From 9292091fcf5fbca450cd22c42590f083883d1b53 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 9 Apr 2011 10:04:56 +0000 Subject: [PATCH] use dialog for list settings --- lam/lib/lists.inc | 37 +++++++++++-------------------- lam/templates/lib/500_lam.js | 42 ++++++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index 5e4e6e69..c0cfc1fd 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -141,10 +141,6 @@ class lamList { * Prints the HTML code to display the list view. */ public function showPage() { - if (isset($_GET['openConfig'])) { - $this->listPrintConfigurationPage(); - return; - } // do POST actions $postFragment = $this->listDoPost(); // get some parameters @@ -164,6 +160,8 @@ class lamList { } // insert HTML fragment from listDoPost echo $postFragment; + // config dialog + $this->listPrintConfigurationPage(); // show form echo "
"; echo "
\n"; @@ -383,9 +381,9 @@ class lamList { else { $classes = ' ' . $this->type . 'list-dark'; } - echo("type . "')\"\n" . - " onMouseOut=\"list_out(this, '" . $rowID . "', '" . $this->type . "')\"\n" . - " onClick=\"list_click(this, '" . $rowID . "', '" . $this->type . "')\"\n" . + echo("type . "&DN=" . rawurlencode($info[$i]['dn']) . "'\">\n"); echo " type . "')\"" . " type=\"checkbox\" name=\"" . $rowID . "\">\n"; @@ -715,7 +713,7 @@ class lamList { echo "\n"; $this->listShowOUSelection(); echo ""; - echo ' '; + echo ' '; echo '' . _('Change settings') . ''; echo ''; echo "\n"; @@ -875,33 +873,22 @@ class lamList { * Prints the list configuration page. */ protected function listPrintConfigurationPage() { - $this->listPrintHeader(); - - echo "
\n"; - echo "
\n"; - echo "
type . "&norefresh=true\" method=\"post\">\n"; - echo "type . "list-bright\" width=\"100%\">\n"; - echo "type . "list-bright\">
\n"; + echo "
\n"; + echo "type . "&norefresh=true\" method=\"post\">\n"; + echo '
'; $tabindex = 0; $configContainer = new htmlTable(); - $configContainer->addElement(new htmlSubTitle(_('Change list settings')), true); for ($i = 0; $i < sizeof($this->configOptions); $i++) { $configContainer->mergeTableElements($this->configOptions[$i]->getMetaHTML()); } - - $configContainer->addElement(new htmlSpacer(null, '10px'), true); - - $buttonContainer = new htmlTable(); - $buttonContainer->addElement(new htmlButton('saveConfigOptions', _('Ok'))); - $buttonContainer->addElement(new htmlButton('cancelConfigOptions', _('Cancel'))); - $buttonContainer->colspan = 2; - $configContainer->addElement($buttonContainer); + $configContainer->addElement(new htmlHiddenInput('saveConfigOptions', 'ok')); parseHtml('', $configContainer, array(), false, $tabindex, $this->type); echo "
\n"; - $this->listPrintFooter(); + echo ''; + echo "
\n"; } /** diff --git a/lam/templates/lib/500_lam.js b/lam/templates/lib/500_lam.js index 2def4a33..2949c3f7 100644 --- a/lam/templates/lib/500_lam.js +++ b/lam/templates/lib/500_lam.js @@ -21,16 +21,30 @@ $Id$ */ - -function list_over(list, box, scope) { +/** + * Used to highlight the row under the mouse cursor. + * + * @param list table row + */ +function list_over(list) { jQuery(list).addClass('highlight'); } -function list_out(list, box, scope) { +/** + * Used to unhighlight a row if the mouse cursor leaves it. + * + * @param list table row + */ +function list_out(list) { jQuery(list).removeClass('highlight'); } -function list_click(list, box, scope) { +/** + * Called when user clicks on a table row. This toggles the checkbox in the row. + * + * @param box checkbox name + */ +function list_click(box) { cbox = document.getElementsByName(box)[0]; if (cbox.checked == true) { cbox.checked = false; @@ -67,6 +81,26 @@ function listResizeITabContentDiv() { myDivScroll.style.height = scrollHeight + "px"; }; +/** + * Shows the dialog to change the list settings. + * + * @param title dialog title + * @param okText text for Ok button + * @param cancelText text for Cancel button + */ +function listShowSettingsDialog(title, okText, cancelText) { + var buttonList = {}; + buttonList[cancelText] = function() { jQuery(this).dialog("close"); }; + buttonList[okText] = function() { document.forms["settingsDialogForm"].submit(); }; + jQuery('#settingsDialog').dialog({ + modal: true, + title: title, + dialogClass: 'defaultBackground', + buttons: buttonList, + width: 'auto' + }); +} + function SubmitForm(id, e) { if (e.keyCode == 13) { document.getElementsByName(id)[0].click();