Qual: Clean code of box management

This commit is contained in:
Laurent Destailleur
2013-04-23 16:18:26 +02:00
parent 203d4e3ca8
commit 854b9df96d
13 changed files with 250 additions and 68 deletions

View File

@@ -886,7 +886,9 @@ class FormOther
foreach($boxactivated as $box)
{
if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user
$arrayboxtoactivatelabel[$box->id]=$langs->transnoentitiesnoconv($box->boxlabel); // We keep only boxes not shown for user, to show into combo list
$label=$langs->transnoentitiesnoconv($box->boxlabel);
if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')';
$arrayboxtoactivatelabel[$box->id]=$label; // We keep only boxes not shown for user, to show into combo list
}
$form=new Form($db);
@@ -897,7 +899,7 @@ class FormOther
if (! empty($conf->use_javascript_ajax))
{
print '<script type="text/javascript" language="javascript">
// To update list of activated boxes
function updateBoxOrder(closing) {
var left_list = cleanSerialize(jQuery("#left").sortable("serialize"));
@@ -920,7 +922,7 @@ class FormOther
});
}
}
jQuery(document).ready(function() {
jQuery("#boxcombo").change(function() {
var boxid=jQuery("#boxcombo").val();
@@ -937,7 +939,7 @@ class FormOther
});';
if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();';
print '
jQuery("#left, #right").sortable({
/* placeholder: \'ui-state-highlight\', */
handle: \'.boxhandle\',
@@ -958,9 +960,9 @@ class FormOther
// TODO Add id, label into combo list
updateBoxOrder(1);
});
});'."\n";
print '</script>'."\n";
}