mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix creation of page
This commit is contained in:
parent
87f05067ca
commit
9e86e5ce93
|
|
@ -7993,6 +7993,31 @@ class Form
|
|||
}
|
||||
}
|
||||
|
||||
// Try also magic suggest
|
||||
$out .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n";
|
||||
if (is_array($array) && !empty($array)) {
|
||||
if ($value_as_key) {
|
||||
$array = array_combine($array, $array);
|
||||
}
|
||||
|
||||
if (!empty($array)) {
|
||||
foreach ($array as $key => $value) {
|
||||
$newval = ($translate ? $langs->trans($value) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
|
||||
$out .= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != '')) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
// Add code for jquery to use multiselect
|
||||
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
|
||||
$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
|
||||
|
|
@ -8047,31 +8072,6 @@ class Form
|
|||
$out .= '</script>';
|
||||
}
|
||||
|
||||
// Try also magic suggest
|
||||
$out .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n";
|
||||
if (is_array($array) && !empty($array)) {
|
||||
if ($value_as_key) {
|
||||
$array = array_combine($array, $array);
|
||||
}
|
||||
|
||||
if (!empty($array)) {
|
||||
foreach ($array as $key => $value) {
|
||||
$newval = ($translate ? $langs->trans($value) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
|
||||
$out .= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != '')) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3630,29 +3630,6 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
if ($action == 'createcontainer') {
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
|
||||
}
|
||||
print '<label for="checkboxcreatefromfetching"><span class="opacitymediumxx">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
|
||||
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("URL");
|
||||
print '</td><td>';
|
||||
print info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, 'warning');
|
||||
print '<input class="flat minwidth500" type="text" name="externalurl" value="'.dol_escape_htmltag(GETPOST('externalurl', 'alpha')).'" placeholder="https://externalsite/pagetofetch"> ';
|
||||
print '<br><input class="flat paddingtop" type="checkbox" name="grabimages" value="1" checked="checked"> '.$langs->trans("GrabImagesInto");
|
||||
print ' ';
|
||||
print $langs->trans("ImagesShouldBeSavedInto").' ';
|
||||
$arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage"));
|
||||
print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br>';
|
||||
print '<input class="button" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="radio" name="radiocreatefrom" id="checkboxcreatemanually" value="checkboxcreatemanually"'.(GETPOST('radiocreatefrom') == 'checkboxcreatemanually' ? ' checked' : '').'> ';
|
||||
}
|
||||
|
|
@ -3819,7 +3796,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
if (empty($object->lang) && empty($object->otherlang)) {
|
||||
$onlykeys = null; // We keep full list of languages
|
||||
}
|
||||
print $formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys, 1);
|
||||
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys, 1);
|
||||
$htmltext = $langs->trans("AvailableLanguagesAreDefinedIntoWebsiteProperties");
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</td></tr>';
|
||||
|
|
@ -3907,7 +3884,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
}
|
||||
|
||||
print '<tr><td class="toptd">'.$form->editfieldkey('Categories', 'categories', '', $objectpage, 0).'</td><td>';
|
||||
print img_picto('', 'category', 'class="paddingright"');
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"');
|
||||
print $form->multiselectarray('categories', $cate_arbo, (GETPOSTISSET('categories') ? GETPOST('categories', 'array') : $arrayselected), null, null, 'minwidth200 widthcentpercentminusxx');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
|
@ -3987,12 +3964,38 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
print '<input class="button button-cancel" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
|
||||
}
|
||||
print '<label for="checkboxcreatefromfetching"><span class="opacitymediumxx">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
|
||||
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("URL");
|
||||
print '</td><td>';
|
||||
print info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, 'warning');
|
||||
print '<input class="flat minwidth500" type="text" name="externalurl" value="'.dol_escape_htmltag(GETPOST('externalurl', 'alpha')).'" placeholder="https://externalsite/pagetofetch"> ';
|
||||
print '<br><input class="flat paddingtop" type="checkbox" name="grabimages" value="1" checked="checked"> '.$langs->trans("GrabImagesInto");
|
||||
print ' ';
|
||||
print $langs->trans("ImagesShouldBeSavedInto").' ';
|
||||
$arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage"));
|
||||
print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br>';
|
||||
print '<input class="button" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($action == 'createcontainer') {
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
var disableautofillofalias = 0;
|
||||
var selectedm = \'\';
|
||||
var selectedf = \'\';
|
||||
jQuery("#WEBSITE_TITLE").keyup(function() {
|
||||
if (disableautofillofalias == 0)
|
||||
{
|
||||
|
|
@ -4009,17 +4012,31 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
disableautofillofalias = 1;
|
||||
});
|
||||
|
||||
jQuery("#checkboxcreatefromfetching,#checkboxcreatemanually").change(function() {
|
||||
console.log("we select a method to create a new container"+jQuery("#checkboxcreatefromfetching:checked").val())
|
||||
if (typeof(jQuery("#checkboxcreatefromfetching:checked").val()) != \'undefined\')
|
||||
{
|
||||
jQuery(".tablecheckboxcreatefromfetching").show();
|
||||
jQuery(".tablecheckboxcreatemanually").hide();
|
||||
jQuery("#checkboxcreatefromfetching,#checkboxcreatemanually").click(function() {
|
||||
console.log("we select a method to create a new container "+jQuery("#checkboxcreatefromfetching:checked").val())
|
||||
jQuery(".tablecheckboxcreatefromfetching").hide();
|
||||
jQuery(".tablecheckboxcreatemanually").hide();
|
||||
if (typeof(jQuery("#checkboxcreatefromfetching:checked").val()) != \'undefined\') {
|
||||
console.log("show a");
|
||||
if (selectedf != \'createfromfetching\') {
|
||||
jQuery(".tablecheckboxcreatefromfetching").show();
|
||||
selectedf = \'createfromfetching\';
|
||||
selectedm = \'\';
|
||||
} else {
|
||||
jQuery(".tablecheckboxcreatefromfetching").hide();
|
||||
selectedf = \'\';
|
||||
}
|
||||
}
|
||||
if (typeof(jQuery("#checkboxcreatemanually:checked").val()) != \'undefined\')
|
||||
{
|
||||
jQuery(".tablecheckboxcreatefromfetching").hide();
|
||||
jQuery(".tablecheckboxcreatemanually").show();
|
||||
if (typeof(jQuery("#checkboxcreatemanually:checked").val()) != \'undefined\') {
|
||||
console.log("show b");
|
||||
if (selectedm != \'createmanually\') {
|
||||
jQuery(".tablecheckboxcreatemanually").show();
|
||||
selectedm = \'createmanually\';
|
||||
selectedf = \'\';
|
||||
} else {
|
||||
jQuery(".tablecheckboxcreatemanually").hide();
|
||||
selectedm = \'\';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user