Make setup page of widget easier
This commit is contained in:
parent
522c66915d
commit
949bc9f9bd
@ -175,9 +175,9 @@ if ($action == 'switch') {
|
||||
$newfirst = $objto->box_order;
|
||||
$newsecond = $objfrom->box_order;
|
||||
if ($newfirst == $newsecond) {
|
||||
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
|
||||
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
|
||||
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
|
||||
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
|
||||
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
|
||||
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid);
|
||||
@ -300,14 +300,13 @@ $boxtoadd = InfoBox::listBoxes($db, 'available', -1, null, $actives);
|
||||
// Activated boxes
|
||||
$boxactivated = InfoBox::listBoxes($db, 'activated', -1, null);
|
||||
|
||||
print "<br>\n";
|
||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||
print load_fiche_titre($langs->trans("BoxesAvailable"), '', '');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
||||
print '<input type="hidden" name="action" value="add">'."\n";
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="tagtable liste centpercent">'."\n";
|
||||
|
||||
@ -315,9 +314,12 @@ print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Box").'</td>';
|
||||
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td width="160" class="center">'.$langs->trans("ActivatableOn").'</td>';
|
||||
print "</tr>\n";
|
||||
print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
|
||||
print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||
foreach ($boxtoadd as $box) {
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
|
||||
$logo = $box->boximg;
|
||||
@ -326,8 +328,8 @@ foreach ($boxtoadd as $box) {
|
||||
}
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
print '<tr class="oddeven" style="height:3em !important;">'."\n";
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv($box->boxlabel)).'">'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
|
||||
print img_picto('', 'graph', 'class="paddingleft"');
|
||||
}
|
||||
@ -339,7 +341,7 @@ foreach ($boxtoadd as $box) {
|
||||
}
|
||||
}
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note).'">';
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("WarningUsingThisBoxSlowDown");
|
||||
@ -357,36 +359,21 @@ foreach ($boxtoadd as $box) {
|
||||
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button small smallpaddingimp" value="'.$langs->trans("Activate").'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
if (!count($boxtoadd) && count($boxactivated)) {
|
||||
print '<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans("AllWidgetsWereEnabled").'</span></td></tr>';
|
||||
}
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
print '<div class="right">';
|
||||
print '<input type="submit" class="button"'.(count($boxtoadd) ? '' : ' disabled').' value="'.$langs->trans("Activate").'">';
|
||||
print '</div>'."\n";
|
||||
print '</form>';
|
||||
print "\n".'<!-- End Boxes Available -->'."\n";
|
||||
|
||||
|
||||
//var_dump($boxactivated);
|
||||
print "<br>\n\n";
|
||||
print load_fiche_titre($langs->trans("BoxesActivated"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="tagtable liste">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Box").'</td>';
|
||||
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
|
||||
print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
|
||||
print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$box_order = 1;
|
||||
$foundrupture = 1;
|
||||
foreach ($boxactivated as $key => $box) {
|
||||
@ -397,8 +384,8 @@ foreach ($boxactivated as $key => $box) {
|
||||
}
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
print '<tr class="oddeven" style="height:3em !important;">';
|
||||
print '<td>'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
|
||||
print img_picto('', 'graph', 'class="paddingleft"');
|
||||
}
|
||||
@ -410,14 +397,17 @@ foreach ($boxactivated as $key => $box) {
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$langs->load("errors");
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note == '(WarningUsingThisBoxSlowDown)' ? $langs->trans("WarningUsingThisBoxSlowDown") : $box->note).'">';
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
|
||||
$langs->load("errors");
|
||||
print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
|
||||
} else {
|
||||
print ($box->note ? $box->note : ' ');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->textwithpicto('', $langs->trans("SourceFile").' : '.$box->sourcefile);
|
||||
print '</td>'."\n";
|
||||
print '<td class="center">'.(empty($arrayofhomepages[$box->position]) ? '' : $langs->trans($arrayofhomepages[$box->position])).'</td>';
|
||||
$hasnext = ($key < (count($boxactivated) - 1));
|
||||
$hasprevious = ($key != 0);
|
||||
@ -437,6 +427,8 @@ print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Other parameters
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
class box_shipments extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "lastcustomershipments";
|
||||
public $boximg = "sending";
|
||||
public $boximg = "dolly";
|
||||
public $boxlabel = "BoxLastCustomerShipments";
|
||||
public $depends = array("expedition");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user