use dialog for list settings

This commit is contained in:
Roland Gruber 2011-04-09 10:04:56 +00:00
parent 1ab2670c10
commit 9292091fcf
2 changed files with 50 additions and 29 deletions

View File

@ -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 "<div class=\"ui-tabs-panel ui-widget-content ui-corner-bottom\">";
echo "<div id=\"listTabContentArea\">\n";
@ -383,9 +381,9 @@ class lamList {
else {
$classes = ' ' . $this->type . 'list-dark';
}
echo("<tr class=\"$classes\" onMouseOver=\"list_over(this, '" . $rowID . "', '" . $this->type . "')\"\n" .
" onMouseOut=\"list_out(this, '" . $rowID . "', '" . $this->type . "')\"\n" .
" onClick=\"list_click(this, '" . $rowID . "', '" . $this->type . "')\"\n" .
echo("<tr class=\"$classes\" onMouseOver=\"list_over(this)\"\n" .
" onMouseOut=\"list_out(this)\"\n" .
" onClick=\"list_click('" . $rowID . "')\"\n" .
" onDblClick=\"top.location.href='../account/edit.php?type=" . $this->type . "&amp;DN=" . rawurlencode($info[$i]['dn']) . "'\">\n");
echo " <td align=\"center\"><input class=\"accountBoxUnchecked\" onClick=\"list_click(this, '" . $rowID . "', '" . $this->type . "')\"" .
" type=\"checkbox\" name=\"" . $rowID . "\"></td>\n";
@ -715,7 +713,7 @@ class lamList {
echo "<td align=\"right\">\n";
$this->listShowOUSelection();
echo "<input class=\"smallImageButton\" style=\"background-image: url(../../graphics/refresh.png);\" type=\"submit\" value=\" \" name=\"refresh\" title=\"" . _("Refresh") . "\">";
echo '&nbsp;<a href="list.php?type=' . $this->type . '&amp;openConfig=1">';
echo '&nbsp;<a href="#" onclick="listShowSettingsDialog(\'' . _('Change list settings') . '\', \'' . _('Ok') . '\', \'' . _('Cancel') . '\');">';
echo '<img height=16 width=16 src="../../graphics/tools.png" alt="' . _('Change settings') . '" title="' . _('Change settings') . '">';
echo '</a>';
echo "</td>\n";
@ -875,33 +873,22 @@ class lamList {
* Prints the list configuration page.
*/
protected function listPrintConfigurationPage() {
$this->listPrintHeader();
echo "<div>\n";
echo "<div>\n";
echo "<form action=\"list.php?type=" . $this->type . "&amp;norefresh=true\" method=\"post\">\n";
echo "<table class=\"" . $this->type . "list-bright\" width=\"100%\">\n";
echo "<tr class=\"" . $this->type . "list-bright\"><td>\n";
echo "<div id=\"settingsDialog\" style=\"display: none;\">\n";
echo "<form id=\"settingsDialogForm\" action=\"list.php?type=" . $this->type . "&amp;norefresh=true\" method=\"post\">\n";
echo '<table width="100%"><tr><td>';
$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 "</td></tr></table>\n";
$this->listPrintFooter();
echo '</form>';
echo "</div>\n";
}
/**

View File

@ -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();