mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 10:52:37 +01:00
Debug v23
This commit is contained in:
@@ -782,10 +782,11 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
|
||||
* @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on the same page for the same field.
|
||||
* @param int $forcenojs Force the component to work as link post (without javascript) instead of ajax call
|
||||
* @param string $moreparam When $forcenojs=1 then we can add more parameters to the backtopage URL. String must url encoded. Example: 'abc=def&fgh=ijk'
|
||||
* @param int $readonly Use 1 if button not allowed.
|
||||
* @return string html for button on/off
|
||||
* @see ajax_constantonoff() to update that value of a constant
|
||||
*/
|
||||
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '', $forcenojs = 0, $moreparam = '')
|
||||
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '', $forcenojs = 0, $moreparam = '', $readonly = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -795,7 +796,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
|
||||
|
||||
$out = '';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax) && empty($forcenojs)) {
|
||||
if (!empty($conf->use_javascript_ajax) && empty($forcenojs) && empty($readonly)) {
|
||||
$out .= '<script>
|
||||
$(function() {
|
||||
var input = '.json_encode($input).';
|
||||
@@ -889,8 +890,16 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
|
||||
}
|
||||
|
||||
if (empty($conf->use_javascript_ajax) || $forcenojs) {
|
||||
$out .= '<a id="set_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'" href="'.DOL_URL_ROOT.'/core/ajax/objectonoff.php?action=set&token='.newToken().'&id='.((int) $object->id).'&element='.urlencode($object->element).'&field='.urlencode($field).'&value=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.($moreparam ? '&'.$moreparam : '')).'">'.img_picto($langs->trans($text_off), $switchoff, '', 0, 0, 0, '', $cssswitchoff).'</a>';
|
||||
$out .= '<a id="del_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'" href="'.DOL_URL_ROOT.'/core/ajax/objectonoff.php?action=set&token='.newToken().'&id='.((int) $object->id).'&element='.urlencode($object->element).'&field='.urlencode($field).'&value=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.($moreparam ? '&'.$moreparam : '')).'">'.img_picto($langs->trans($text_on), $switchon, '', 0, 0, 0, '', $cssswitchon).'</a>';
|
||||
$url = DOL_URL_ROOT.'/core/ajax/objectonoff.php?action=set&token='.newToken().'&id='.((int) $object->id).'&element='.urlencode($object->element).'&field='.urlencode($field).'&value=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.($moreparam ? '&'.$moreparam : ''));
|
||||
if ($readonly) {
|
||||
$url ='#';
|
||||
}
|
||||
$out .= '<a id="set_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'" href="'.$url.'">'.img_picto($langs->trans($text_off), $switchoff, '', 0, 0, 0, '', $cssswitchoff).'</a>';
|
||||
$url = DOL_URL_ROOT.'/core/ajax/objectonoff.php?action=set&token='.newToken().'&id='.((int) $object->id).'&element='.urlencode($object->element).'&field='.urlencode($field).'&value=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.($moreparam ? '&'.$moreparam : ''));
|
||||
if ($readonly) {
|
||||
$url ='#';
|
||||
}
|
||||
$out .= '<a id="del_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'" href="'.$url.'">'.img_picto($langs->trans($text_on), $switchon, '', 0, 0, 0, '', $cssswitchon).'</a>';
|
||||
} else {
|
||||
$out .= '<span id="set_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_off), $switchoff, '', 0, 0, 0, '', $cssswitchoff).'</span>';
|
||||
$out .= '<span id="del_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_on), $switchon, '', 0, 0, 0, '', $cssswitchon).'</span>';
|
||||
|
||||
@@ -3168,6 +3168,13 @@ if (!GETPOST('hide_websitemenu')) {
|
||||
}
|
||||
|
||||
|
||||
$disabled = '';
|
||||
$morecss = '';
|
||||
if (!$user->hasRight('website', 'write')) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
$morecss = 'opacitymedium cursordefault';
|
||||
}
|
||||
|
||||
//var_dump($objectpage);exit;
|
||||
print '<div class="centpercent websitebar'.(GETPOST('dol_openinpopup', 'aZ09') ? ' hiddenforpopup' : '').'">'."\n";
|
||||
|
||||
@@ -3245,16 +3252,12 @@ if (!GETPOST('hide_websitemenu')) {
|
||||
//print '<div class="inline-block marginrightonly">';
|
||||
//print ajax_object_onoff($object, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle inline-block', 'statuswebsite');
|
||||
//print '</div>';
|
||||
$disabled = '';
|
||||
if (!$user->hasRight('website', 'write')) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
}
|
||||
if ($website->status == $website::STATUS_DRAFT) {
|
||||
$text_off = 'Offline';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setwebsiteonline&token='.newToken().'&website='.urlencode($website->ref).'&websitepage='.((int) $websitepage->id).'"'.$disabled.'>'.img_picto($langs->trans($text_off), 'switch_off', '', 0, 0, 0, '', ($user->hasRight('website', 'write') ? '' : 'opacitymedium cursordefault')).'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setwebsiteonline&token='.newToken().'&website='.urlencode($website->ref).'&websitepage='.((int) $websitepage->id).'"'.$disabled.'>'.img_picto($langs->trans($text_off), 'switch_off', '', 0, 0, 0, '', $morecss).'</a>';
|
||||
} else {
|
||||
$text_off = 'Online';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setwebsiteoffline&token='.newToken().'&website='.urlencode($website->ref).'&websitepage='.((int) $websitepage->id).'"'.$disabled.'>'.img_picto($langs->trans($text_off), 'switch_on', '', 0, 0, 0, '', ($user->hasRight('website', 'write') ? '' : 'opacitymedium cursordefault')).'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setwebsiteoffline&token='.newToken().'&website='.urlencode($website->ref).'&websitepage='.((int) $websitepage->id).'"'.$disabled.'>'.img_picto($langs->trans($text_off), 'switch_on', '', 0, 0, 0, '', $morecss).'</a>';
|
||||
}
|
||||
print '</span>';
|
||||
}
|
||||
@@ -3262,7 +3265,7 @@ if (!GETPOST('hide_websitemenu')) {
|
||||
// Refresh / Reload web site (for non javascript browsers)
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<span class="websiteselection">';
|
||||
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshsite" value="'.$langs->trans("Load").'">';
|
||||
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshsite" value="'.$langs->trans("Load").'"'.$disabled.'>';
|
||||
print '</span>';
|
||||
}
|
||||
|
||||
@@ -3511,13 +3514,13 @@ if (!GETPOST('hide_websitemenu')) {
|
||||
if ($object->status == $object::STATUS_DRAFT) { // website is off, we do not allow to change status of page
|
||||
$text_off = 'SetWebsiteOnlineBefore';
|
||||
if ($websitepage->status == $websitepage::STATUS_DRAFT) { // page is off
|
||||
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
|
||||
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_off', '', 0, 0, 0, '', $morecss).'</span>';
|
||||
} else {
|
||||
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_on').'</span>';
|
||||
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_on', '', 0, 0, 0, '', $morecss).'</span>';
|
||||
}
|
||||
} else {
|
||||
if ($objectpage->type_container != 'setup') { // we do not allow to change status of setup pages
|
||||
print ajax_object_onoff($websitepage, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle inline-block'.(empty($websitepage->id) ? ' opacitymedium disabled' : ''), 'statuswebsitepage', 1, 'website='.urlencode($website->ref).'&pageid='.((int) $websitepage->id));
|
||||
print ajax_object_onoff($websitepage, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle inline-block'.((empty($websitepage->id) || !$user->hasRight('website', 'write')) ? ' opacitymedium disabled' : ''), 'statuswebsitepage', 1, 'website='.urlencode($website->ref).'&pageid='.((int) $websitepage->id), $user->hasRight('website', 'write') ? 0 : 1);
|
||||
}
|
||||
}
|
||||
//print '</div>';
|
||||
|
||||
Reference in New Issue
Block a user