Debug website module for multilanguage
This commit is contained in:
parent
c112c807ac
commit
fe93ee4d08
@ -107,9 +107,10 @@ class FormWebsite
|
|||||||
* @param string $selected Selected value
|
* @param string $selected Selected value
|
||||||
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||||
* @param string $moreattrib More attributes on HTML select tag
|
* @param string $moreattrib More attributes on HTML select tag
|
||||||
|
* @param int $addjscombo Add js combo
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
|
public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '', $addjscombo = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user;
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ class FormWebsite
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
print '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer minwidth200" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
||||||
if ($useempty == 1 || ($useempty == 2 && $num > 1))
|
if ($useempty == 1 || ($useempty == 2 && $num > 1))
|
||||||
{
|
{
|
||||||
print '<option value="-1"> </option>';
|
print '<option value="-1"> </option>';
|
||||||
@ -149,6 +150,10 @@ class FormWebsite
|
|||||||
}
|
}
|
||||||
print "</select>";
|
print "</select>";
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||||
|
|
||||||
|
if ($addjscombo) {
|
||||||
|
print ajax_combobox('select'.$htmlname);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans("NoTypeOfPagePleaseEditDictionary");
|
print $langs->trans("NoTypeOfPagePleaseEditDictionary");
|
||||||
}
|
}
|
||||||
@ -165,9 +170,10 @@ class FormWebsite
|
|||||||
* @param string $selected Selected value
|
* @param string $selected Selected value
|
||||||
* @param int $useempty 1=Add an empty value in list
|
* @param int $useempty 1=Add an empty value in list
|
||||||
* @param string $moreattrib More attributes on HTML select tag
|
* @param string $moreattrib More attributes on HTML select tag
|
||||||
|
* @param int $addjscombo Add js combo
|
||||||
* @return string HTML select component with list of type of containers
|
* @return string HTML select component with list of type of containers
|
||||||
*/
|
*/
|
||||||
public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
|
public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '', $addjscombo = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user;
|
||||||
|
|
||||||
@ -190,7 +196,7 @@ class FormWebsite
|
|||||||
}
|
}
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer minwidth200" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
|
||||||
|
|
||||||
if ($useempty == 1 || $useempty == 2)
|
if ($useempty == 1 || $useempty == 2)
|
||||||
{
|
{
|
||||||
@ -210,6 +216,10 @@ class FormWebsite
|
|||||||
}
|
}
|
||||||
$out .= "</select>";
|
$out .= "</select>";
|
||||||
|
|
||||||
|
if ($addjscombo) {
|
||||||
|
$out .= ajax_combobox('select'.$htmlname);
|
||||||
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -252,6 +252,8 @@ ErrorValueLength=Length of field '<b>%s</b>' must be higher than '<b>%s</b>'
|
|||||||
ErrorReservedKeyword=The word '<b>%s</b>' is a reserved keyword
|
ErrorReservedKeyword=The word '<b>%s</b>' is a reserved keyword
|
||||||
ErrorNotAvailableWithThisDistribution=Not available with this distribution
|
ErrorNotAvailableWithThisDistribution=Not available with this distribution
|
||||||
ErrorPublicInterfaceNotEnabled=Public interface was not enabled
|
ErrorPublicInterfaceNotEnabled=Public interface was not enabled
|
||||||
|
ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page
|
||||||
|
ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||||
|
|||||||
@ -100,7 +100,7 @@ EmptyPage=Empty page
|
|||||||
ExternalURLMustStartWithHttp=External URL must start with http:// or https://
|
ExternalURLMustStartWithHttp=External URL must start with http:// or https://
|
||||||
ZipOfWebsitePackageToImport=Upload the Zip file of the website template package
|
ZipOfWebsitePackageToImport=Upload the Zip file of the website template package
|
||||||
ZipOfWebsitePackageToLoad=or Choose an available embedded website template package
|
ZipOfWebsitePackageToLoad=or Choose an available embedded website template package
|
||||||
ShowSubcontainers=Include dynamic content
|
ShowSubcontainers=Show dynamic content
|
||||||
InternalURLOfPage=Internal URL of page
|
InternalURLOfPage=Internal URL of page
|
||||||
ThisPageIsTranslationOf=This page/container is a translation of
|
ThisPageIsTranslationOf=This page/container is a translation of
|
||||||
ThisPageHasTranslationPages=This page/container has translation
|
ThisPageHasTranslationPages=This page/container has translation
|
||||||
|
|||||||
@ -940,6 +940,7 @@ if ($action == 'addcontainer')
|
|||||||
$objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'));
|
$objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml'));
|
||||||
$objectpage->allowed_in_frames = GETPOST('WEBSITE_ALLOWED_IN_FRAMES', 'aZ09');
|
$objectpage->allowed_in_frames = GETPOST('WEBSITE_ALLOWED_IN_FRAMES', 'aZ09');
|
||||||
$objectpage->htmlheader = GETPOST('htmlheader', 'none');
|
$objectpage->htmlheader = GETPOST('htmlheader', 'none');
|
||||||
|
$objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0);
|
||||||
$objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml');
|
$objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml');
|
||||||
$objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS');
|
$objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS');
|
||||||
$objectpage->fk_object = GETPOST('WEBSITE_OBJECTID');
|
$objectpage->fk_object = GETPOST('WEBSITE_OBJECTID');
|
||||||
@ -949,7 +950,7 @@ if ($action == 'addcontainer')
|
|||||||
$sample = GETPOST('sample', 'alpha');
|
$sample = GETPOST('sample', 'alpha');
|
||||||
if (empty($sample)) $sample = 'empty';
|
if (empty($sample)) $sample = 'empty';
|
||||||
|
|
||||||
$pathtosample = DOL_DOCUMENT_ROOT.'/website/samples/page-sample-'.$sample.'.html';
|
$pathtosample = DOL_DOCUMENT_ROOT.'/website/samples/page-sample-'.dol_sanitizeFileName($sample).'.html';
|
||||||
|
|
||||||
// Init content with content into pagetemplate.html, blogposttempltate.html, ...
|
// Init content with content into pagetemplate.html, blogposttempltate.html, ...
|
||||||
$objectpage->content = make_substitutions(@file_get_contents($pathtosample), $substitutionarray);
|
$objectpage->content = make_substitutions(@file_get_contents($pathtosample), $substitutionarray);
|
||||||
@ -978,6 +979,22 @@ if ($action == 'addcontainer')
|
|||||||
$error++;
|
$error++;
|
||||||
$action = 'createcontainer';
|
$action = 'createcontainer';
|
||||||
}
|
}
|
||||||
|
if ($objectpage->fk_page > 0 && empty($objectpage->lang))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorLanguageRequiredIfPageIsTranslationOfAnother"), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
$action = 'createcontainer';
|
||||||
|
}
|
||||||
|
if ($objectpage->fk_page > 0 && !empty($objectpage->lang))
|
||||||
|
{
|
||||||
|
if ($objectpage->lang == $website->lang) {
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother"), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
$action = 'createcontainer';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -3231,14 +3248,16 @@ if ($action == 'createsite')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans('OtherLanguages');
|
$htmltext = $langs->trans("Example").': fr,de,sv,it,pt';
|
||||||
|
print $form->textwithpicto($langs->trans('OtherLanguages'), $htmltext, 1, 'help', '', 0, 2);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="flat minwidth300" name="WEBSITE_OTHERLANG" value="'.dol_escape_htmltag($siteotherlang).'">';
|
print '<input type="text" class="flat minwidth300" name="WEBSITE_OTHERLANG" value="'.dol_escape_htmltag($siteotherlang).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
|
|
||||||
$htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>');
|
$htmltext = $langs->trans("SetHereVirtualHost", '{s1}');
|
||||||
|
$htmltext = str_replace('{s1}', DOL_DATA_ROOT.'/website/<i>websiteref</i>', $htmltext);
|
||||||
$htmltext .= '<br>';
|
$htmltext .= '<br>';
|
||||||
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||||
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), '{s1}');
|
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), '{s1}');
|
||||||
@ -3351,7 +3370,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') // Edit properties of
|
|||||||
print ' ';
|
print ' ';
|
||||||
print $langs->trans("ImagesShouldBeSavedInto").' ';
|
print $langs->trans("ImagesShouldBeSavedInto").' ';
|
||||||
$arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage"));
|
$arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage"));
|
||||||
print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ?GETPOST('grabimagesinto') : 'root');
|
print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<input class="button" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
|
print '<input class="button" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -3433,7 +3452,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') // Edit properties of
|
|||||||
print $langs->trans('WEBSITE_TYPE_CONTAINER');
|
print $langs->trans('WEBSITE_TYPE_CONTAINER');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print img_picto('', 'object_technic', 'class="paddingrightonly"').' ';
|
print img_picto('', 'object_technic', 'class="paddingrightonly"').' ';
|
||||||
$formwebsite->selectTypeOfContainer('WEBSITE_TYPE_CONTAINER', (GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') ?GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') : $type_container));
|
$formwebsite->selectTypeOfContainer('WEBSITE_TYPE_CONTAINER', (GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') ? GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') : $type_container), 0, '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if ($action == 'createcontainer')
|
if ($action == 'createcontainer')
|
||||||
@ -3441,7 +3460,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') // Edit properties of
|
|||||||
print '<tr><td class="titlefield fieldrequired">';
|
print '<tr><td class="titlefield fieldrequired">';
|
||||||
print $langs->trans('WEBSITE_PAGE_EXAMPLE');
|
print $langs->trans('WEBSITE_PAGE_EXAMPLE');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $formwebsite->selectSampleOfContainer('sample', (GETPOSTISSET('sample') ?GETPOST('sample', 'alpha') : 'empty'));
|
print $formwebsite->selectSampleOfContainer('sample', (GETPOSTISSET('sample') ? GETPOST('sample', 'alpha') : 'empty'), 0, '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3561,7 +3580,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') // Edit properties of
|
|||||||
$translationof = $objectpage->fk_page;
|
$translationof = $objectpage->fk_page;
|
||||||
print '<span class="opacitymedium">'.$langs->trans('ThisPageIsTranslationOf').'</span> ';
|
print '<span class="opacitymedium">'.$langs->trans('ThisPageIsTranslationOf').'</span> ';
|
||||||
print $formwebsite->selectContainer($website, 'pageidfortranslation', ($translationof ? $translationof : -1), 1, $action, 'minwidth300', array($objectpage->id));
|
print $formwebsite->selectContainer($website, 'pageidfortranslation', ($translationof ? $translationof : -1), 1, $action, 'minwidth300', array($objectpage->id));
|
||||||
if ($translationof > 0) {
|
if ($translationof > 0 && $sourcepage->lang) {
|
||||||
print $sourcepage->getNomUrl(2).' ('.$sourcepage->lang.')';
|
print $sourcepage->getNomUrl(2).' ('.$sourcepage->lang.')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3596,8 +3615,9 @@ if ($action == 'editmeta' || $action == 'createcontainer') // Edit properties of
|
|||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_WEBSITE_PAGE, '', 'parent', null, null, 1);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_WEBSITE_PAGE, '', 'parent', null, null, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey('Categories', 'categories', '', $objectpage, 0).'</td><td colspan="3">';
|
print '<tr><td class="toptd">'.$form->editfieldkey('Categories', 'categories', '', $objectpage, 0).'</td><td>';
|
||||||
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('categories', $cate_arbo, (GETPOSTISSET('categories') ? GETPOST('categories', 'array') : $arrayselected), null, null, 'quatrevingtpercent widthcentpercentminusx');
|
print img_picto('', 'category', 'class="paddingright"');
|
||||||
|
print $form->multiselectarray('categories', $cate_arbo, (GETPOSTISSET('categories') ? GETPOST('categories', 'array') : $arrayselected), null, null, 'quatrevingtpercent widthcentpercentminusx');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user