From dfbc7f77cbee69c0385afe9d96fafb3ccb1fe8a1 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 10 Jul 2009 20:22:59 +0000 Subject: [PATCH] finished tabs and added end page --- lam/templates/config/confmain.php | 111 +++++++++++------------------- lam/templates/config/confsave.php | 97 ++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 69 deletions(-) create mode 100644 lam/templates/config/confsave.php diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php index 1a69f2a9..2e64a370 100644 --- a/lam/templates/config/confmain.php +++ b/lam/templates/config/confmain.php @@ -77,9 +77,9 @@ if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthentica $_SESSION['conf_isAuthenticated'] = $conf->getName(); // check if button was pressed and if we have to save the setting or go back to login -if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmodules']) || isset($_POST['edittypes'])){ +if (isset($_POST['cancelSettings']) || isset($_POST['saveSettings']) || isset($_POST['editmodules']) || isset($_POST['edittypes'])){ // go to final page - if (isset($_POST['submitconf'])){ + if (isset($_POST['saveSettings'])){ saveSettings(); } // go to modules page @@ -93,7 +93,7 @@ if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmo exit; } // back to login - else if (isset($_POST['back'])){ + else if (isset($_POST['cancelSettings'])){ metaRefresh("../login.php"); exit; } @@ -149,14 +149,19 @@ echo ""; echo "\n"; - $buttonWidth = 15; + $buttonWidth = 0; + $buttonTexts = array(_('General settings'), _('Account types'), _('Modules'), _('Save'), _('Cancel')); + for ($b = 0; $b < sizeof($buttonTexts); $b++) { + $tempWidth = round(0.8 * strlen(utf8_decode($buttonTexts[$b]))) + 2; + if ($buttonWidth < $tempWidth) $buttonWidth = $tempWidth; + } $buttonSpace = '       '; // general settings echo "\n"; echo "\n"; echo "
\n"; - $buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;'; + $buttonStyle = 'background-image: url(../../graphics/bigTools.png);width:' . $buttonWidth . 'em;'; echo "\n"; echo "
\n"; @@ -164,24 +169,45 @@ echo "\n"; // account types echo "\n"; echo "\n"; - echo "
\n"; - $buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;'; - echo "\n"; echo "
\n"; echo ''; // module selection echo "\n"; echo "\n"; - echo "
\n"; $buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;'; - echo "\n"; echo "
\n"; echo ''; - echo " \n"; + echo " "; + // save button + echo "\n"; + echo "\n"; + echo "
\n"; + $buttonStyle = 'background-image: url(../../graphics/pass.png);width:' . $buttonWidth . 'em;'; + echo "\n"; + echo "
\n"; + echo ''; + // cancel button + echo "\n"; + echo "\n"; + echo "
\n"; + $buttonStyle = 'background-image: url(../../graphics/fail.png);width:' . $buttonWidth . 'em;'; + echo "\n"; + echo "
\n"; + echo ''; + echo "\n"; // end tabs echo "\n"; @@ -287,28 +313,9 @@ echo (""); echo ("
"); -echo ("
\"modules.png\" " . _("Account types and modules") . "
\n"); - -// Account modules -$types = $conf->get_ActiveTypes(); -for ($i = 0; $i < sizeof($types); $i++) { - $moduleNames = $conf->get_AccountModules($types[$i]); - for ($m = 0; $m < sizeof($moduleNames); $m++) $moduleNames[$m] = getModuleAlias($moduleNames[$m], $types[$i]); - echo "" . getTypeAlias($types[$i]) . ": " . implode(", ", $moduleNames) . "
\n"; -} -echo "
\n"; -echo "  "; -$tabindex++; -echo "  "; -printHelpLink(getHelp('', '217'), '217'); -$tabindex++; - -echo ("
"); - -echo ("
"); - // module settings +$types = $conf->get_ActiveTypes(); // get list of scopes of modules $scopes = array(); @@ -524,27 +531,9 @@ echo ("". $tabindex++; echo ("\n"); echo ("\n"); -echo ("

 

\n"); - - -// buttons -echo ("\n"); - -echo ""; -echo "\n"); - -echo ("
";
-	echo "";
-	$tabindex++;
-	echo " ";
-	echo "
\n"); - -echo ("

 

"); echo ("

* = ". _("required") . "

"); +echo ("

 

\n"); echo ''; echo ("\n"); @@ -668,31 +657,15 @@ function saveSettings() { } // check options $errors = array_merge($errors, checkConfigOptions($scopes, $options)); + $conf->set_moduleSettings($options); // print error messages if any if (sizeof($errors) > 0) { $_SESSION['conf_errors'] = $errors; - $conf->set_moduleSettings($options); } // save settings if no errors occured else { - // page head - echo $_SESSION['header']; - echo "" . _("LDAP Account Manager Configuration") . "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo ("

". - "\"LDAP




"); - $conf->set_moduleSettings($options); - $conf->save(); - echo ("




" . _("Back to Login") . ""); - echo(""); - // remove settings from session - $sessionKeys = array_keys($_SESSION); - for ($i = 0; $i < sizeof($sessionKeys); $i++) { - if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]); - } - exit(); + metaRefresh("confsave.php"); + exit; } } diff --git a/lam/templates/config/confsave.php b/lam/templates/config/confsave.php new file mode 100644 index 00000000..348a0dee --- /dev/null +++ b/lam/templates/config/confsave.php @@ -0,0 +1,97 @@ +getName())) && !$conf->check_Passwd($passwd)) { + $sessionKeys = array_keys($_SESSION); + for ($i = 0; $i < sizeof($sessionKeys); $i++) { + if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]); + } + $_SESSION['conf_message'] = _("The password is invalid! Please try again."); + /** go back to login if password is invalid */ + require('conflogin.php'); + exit; +} +$_SESSION['conf_isAuthenticated'] = $conf->getName(); + + +// page head +echo $_SESSION['header']; +echo "" . _("LDAP Account Manager Configuration") . "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo ("

". + "\"LDAP




"); +$conf->save(); +echo ("




" . _("Back to Login") . ""); +echo(""); +// remove settings from session +$sessionKeys = array_keys($_SESSION); +for ($i = 0; $i < sizeof($sessionKeys); $i++) { + if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]); +} +exit(); + +?> \ No newline at end of file