Cleaner HTML code
This commit is contained in:
parent
3baf8a6c00
commit
a6378ab0bb
@ -364,7 +364,8 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
|
||||
|
||||
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
|
||||
|
||||
$out= '<script type="text/javascript">
|
||||
$out= "\n<!-- Ajax code to switch constant ".$code." -->".'
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var input = '.json_encode($input).';
|
||||
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
|
||||
@ -376,11 +377,8 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
|
||||
// Set constant
|
||||
$("#set_" + code).click(function() {
|
||||
if (input.alert && input.alert.set) {
|
||||
// Posibility to force label of buttons
|
||||
if (input.alert.set.yesButton)
|
||||
yesButton = input.alert.set.yesButton;
|
||||
if (input.alert.set.noButton)
|
||||
noButton = input.alert.set.noButton;
|
||||
if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
|
||||
if (input.alert.set.noButton) noButton = input.alert.set.noButton;
|
||||
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
|
||||
} else {
|
||||
setConstant(url, code, input, entity);
|
||||
@ -390,22 +388,20 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
|
||||
// Del constant
|
||||
$("#del_" + code).click(function() {
|
||||
if (input.alert && input.alert.del) {
|
||||
// Posibility to force label of buttons
|
||||
if (input.alert.del.yesButton)
|
||||
yesButton = input.alert.del.yesButton;
|
||||
if (input.alert.del.noButton)
|
||||
noButton = input.alert.del.noButton;
|
||||
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
|
||||
if (input.alert.del.noButton) noButton = input.alert.del.noButton;
|
||||
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton);
|
||||
} else {
|
||||
delConstant(url, code, input, entity);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
</script>'."\n";
|
||||
|
||||
$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
|
||||
$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>';
|
||||
$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>';
|
||||
$out.="\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user