finished tabs and added end page
This commit is contained in:
parent
cf36d01de1
commit
dfbc7f77cb
|
@ -77,9 +77,9 @@ if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthentica
|
||||||
$_SESSION['conf_isAuthenticated'] = $conf->getName();
|
$_SESSION['conf_isAuthenticated'] = $conf->getName();
|
||||||
|
|
||||||
// check if button was pressed and if we have to save the setting or go back to login
|
// 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
|
// go to final page
|
||||||
if (isset($_POST['submitconf'])){
|
if (isset($_POST['saveSettings'])){
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
// go to modules page
|
// go to modules page
|
||||||
|
@ -93,7 +93,7 @@ if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmo
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// back to login
|
// back to login
|
||||||
else if (isset($_POST['back'])){
|
else if (isset($_POST['cancelSettings'])){
|
||||||
metaRefresh("../login.php");
|
metaRefresh("../login.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -149,14 +149,19 @@ echo "<tr valign=\"top\"><td style=\"border-bottom: 1px solid;padding:0px;\" col
|
||||||
// show tabs
|
// show tabs
|
||||||
echo "<table width=\"100%\" border=0 style=\"border-collapse: collapse;\">";
|
echo "<table width=\"100%\" border=0 style=\"border-collapse: collapse;\">";
|
||||||
echo "<tr>\n";
|
echo "<tr>\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 = ' ';
|
$buttonSpace = ' ';
|
||||||
// general settings
|
// general settings
|
||||||
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
||||||
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
||||||
echo "<tr><td class=\"settingsActiveTab\" onclick=\"document.getElementsByName('generalSettingsButton')[0].click();\"";
|
echo "<tr><td class=\"settingsActiveTab\" onclick=\"document.getElementsByName('generalSettingsButton')[0].click();\"";
|
||||||
echo " align=\"center\">\n";
|
echo " align=\"center\">\n";
|
||||||
$buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;';
|
$buttonStyle = 'background-image: url(../../graphics/bigTools.png);width:' . $buttonWidth . 'em;';
|
||||||
echo "<input style=\"" . $buttonStyle . "\" name=\"generalSettingsButton\" type=\"submit\" value=\"" . $buttonSpace . _('General settings') . "\"";
|
echo "<input style=\"" . $buttonStyle . "\" name=\"generalSettingsButton\" type=\"submit\" value=\"" . $buttonSpace . _('General settings') . "\"";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
echo "</td></tr></table>\n";
|
echo "</td></tr></table>\n";
|
||||||
|
@ -164,24 +169,45 @@ echo "<tr>\n";
|
||||||
// account types
|
// account types
|
||||||
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
||||||
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
||||||
echo "<tr><td onclick=\"document.getElementsByName('accountTypesButton')[0].click();\"";
|
echo "<tr><td onclick=\"document.getElementsByName('edittypes')[0].click();\"";
|
||||||
echo " align=\"center\">\n";
|
echo " align=\"center\">\n";
|
||||||
$buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;';
|
$buttonStyle = 'background-image: url(../../graphics/gear.png);width:' . $buttonWidth . 'em;';
|
||||||
echo "<input style=\"" . $buttonStyle . "\" name=\"accountTypesButton\" type=\"submit\" value=\"" . $buttonSpace . _('Account types') . "\"";
|
echo "<input style=\"" . $buttonStyle . "\" name=\"edittypes\" type=\"submit\" value=\"" . $buttonSpace . _('Account types') . "\"";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
echo "</td></tr></table>\n";
|
echo "</td></tr></table>\n";
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
// module selection
|
// module selection
|
||||||
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
||||||
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
||||||
echo "<tr><td onclick=\"document.getElementsByName('modulesButton')[0].click();\"";
|
echo "<tr><td onclick=\"document.getElementsByName('editmodules')[0].click();\"";
|
||||||
echo " align=\"center\">\n";
|
echo " align=\"center\">\n";
|
||||||
$buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;';
|
$buttonStyle = 'background-image: url(../../graphics/modules.png);width:' . $buttonWidth . 'em;';
|
||||||
echo "<input style=\"" . $buttonStyle . "\" name=\"modulesButton\" type=\"submit\" value=\"" . $buttonSpace . _('Modules') . "\"";
|
echo "<input style=\"" . $buttonStyle . "\" name=\"editmodules\" type=\"submit\" value=\"" . $buttonSpace . _('Modules') . "\"";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
echo "</td></tr></table>\n";
|
echo "</td></tr></table>\n";
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo "<td width=\"100%\"> </td></tr></table>\n";
|
echo "<td width=\"100%\"> </td>";
|
||||||
|
// save button
|
||||||
|
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
||||||
|
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
||||||
|
echo "<tr><td onclick=\"document.getElementsByName('saveSettings')[0].click();\"";
|
||||||
|
echo " align=\"center\">\n";
|
||||||
|
$buttonStyle = 'background-image: url(../../graphics/pass.png);width:' . $buttonWidth . 'em;';
|
||||||
|
echo "<input style=\"" . $buttonStyle . "\" name=\"saveSettings\" type=\"submit\" value=\"" . $buttonSpace . _('Save') . "\"";
|
||||||
|
echo ">\n";
|
||||||
|
echo "</td></tr></table>\n";
|
||||||
|
echo '</td>';
|
||||||
|
// cancel button
|
||||||
|
echo "<td width=\"$buttonWidth\" style=\"padding-bottom:0px;padding-right:5px;padding-left:5px;padding-top:10px;\">\n";
|
||||||
|
echo "<table class=\"settingsTab\" width=\"100%\">\n";
|
||||||
|
echo "<tr><td onclick=\"document.getElementsByName('cancelSettings')[0].click();\"";
|
||||||
|
echo " align=\"center\">\n";
|
||||||
|
$buttonStyle = 'background-image: url(../../graphics/fail.png);width:' . $buttonWidth . 'em;';
|
||||||
|
echo "<input style=\"" . $buttonStyle . "\" name=\"cancelSettings\" type=\"submit\" value=\"" . $buttonSpace . _('Cancel') . "\"";
|
||||||
|
echo ">\n";
|
||||||
|
echo "</td></tr></table>\n";
|
||||||
|
echo '</td>';
|
||||||
|
echo "</tr></table>\n";
|
||||||
// end tabs
|
// end tabs
|
||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
|
@ -287,28 +313,9 @@ echo ("</fieldset>");
|
||||||
|
|
||||||
echo ("<br>");
|
echo ("<br>");
|
||||||
|
|
||||||
echo ("<fieldset><legend><img align=\"middle\" src=\"../../graphics/modules.png\" alt=\"modules.png\"> <b>" . _("Account types and modules") . "</b></legend><br>\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 "<b>" . getTypeAlias($types[$i]) . ": </b>" . implode(", ", $moduleNames) . "<br>\n";
|
|
||||||
}
|
|
||||||
echo "<br>\n";
|
|
||||||
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"edittypes\" value=\"" . _("Edit account types") . "\"> ";
|
|
||||||
$tabindex++;
|
|
||||||
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"editmodules\" value=\"" . _("Edit modules") . "\"> ";
|
|
||||||
printHelpLink(getHelp('', '217'), '217');
|
|
||||||
$tabindex++;
|
|
||||||
|
|
||||||
echo ("</fieldset>");
|
|
||||||
|
|
||||||
echo ("<br>");
|
|
||||||
|
|
||||||
|
|
||||||
// module settings
|
// module settings
|
||||||
|
$types = $conf->get_ActiveTypes();
|
||||||
|
|
||||||
// get list of scopes of modules
|
// get list of scopes of modules
|
||||||
$scopes = array();
|
$scopes = array();
|
||||||
|
@ -524,27 +531,9 @@ echo ("<tr><td align=\"right\"><font color=\"red\"><b>".
|
||||||
$tabindex++;
|
$tabindex++;
|
||||||
echo ("</table>\n");
|
echo ("</table>\n");
|
||||||
echo ("</fieldset>\n");
|
echo ("</fieldset>\n");
|
||||||
echo ("<p> </p>\n");
|
|
||||||
|
|
||||||
|
|
||||||
// buttons
|
|
||||||
echo ("<table border=0>\n");
|
|
||||||
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td align=\"left\"><pre>";
|
|
||||||
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"submitconf\" value=\"" . _("Ok") . "\">";
|
|
||||||
$tabindex++;
|
|
||||||
echo " ";
|
|
||||||
echo "<input tabindex=\"$tabindex\" type=\"submit\" name=\"back\" value=\"" . _("Cancel") . "\"\n";
|
|
||||||
$tabindex++;
|
|
||||||
|
|
||||||
echo ("></pre></td></tr>\n");
|
|
||||||
|
|
||||||
echo ("</table>\n");
|
|
||||||
|
|
||||||
echo ("<p> </p>");
|
|
||||||
|
|
||||||
echo ("<p>* = ". _("required") . "</p>");
|
echo ("<p>* = ". _("required") . "</p>");
|
||||||
|
echo ("<p> </p>\n");
|
||||||
|
|
||||||
echo '</td></tr></table>';
|
echo '</td></tr></table>';
|
||||||
echo ("</form>\n");
|
echo ("</form>\n");
|
||||||
|
@ -668,31 +657,15 @@ function saveSettings() {
|
||||||
}
|
}
|
||||||
// check options
|
// check options
|
||||||
$errors = array_merge($errors, checkConfigOptions($scopes, $options));
|
$errors = array_merge($errors, checkConfigOptions($scopes, $options));
|
||||||
|
$conf->set_moduleSettings($options);
|
||||||
// print error messages if any
|
// print error messages if any
|
||||||
if (sizeof($errors) > 0) {
|
if (sizeof($errors) > 0) {
|
||||||
$_SESSION['conf_errors'] = $errors;
|
$_SESSION['conf_errors'] = $errors;
|
||||||
$conf->set_moduleSettings($options);
|
|
||||||
}
|
}
|
||||||
// save settings if no errors occured
|
// save settings if no errors occured
|
||||||
else {
|
else {
|
||||||
// page head
|
metaRefresh("confsave.php");
|
||||||
echo $_SESSION['header'];
|
exit;
|
||||||
echo "<title>" . _("LDAP Account Manager Configuration") . "</title>\n";
|
|
||||||
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
|
|
||||||
echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"../../graphics/favicon.ico\">\n";
|
|
||||||
echo "</head><body>\n";
|
|
||||||
echo ("<p align=\"center\"><a href=\"http://lam.sourceforge.net\" target=\"new_window\">".
|
|
||||||
"<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>");
|
|
||||||
$conf->set_moduleSettings($options);
|
|
||||||
$conf->save();
|
|
||||||
echo ("<br><br><br><br><br><a href=\"../login.php\" target=\"_top\">" . _("Back to Login") . "</a>");
|
|
||||||
echo("</body></html>");
|
|
||||||
// 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
||||||
|
Copyright (C) 2009 Roland Gruber
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End page of configuration.
|
||||||
|
*
|
||||||
|
* @package configuration
|
||||||
|
* @author Roland Gruber
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** Access to config functions */
|
||||||
|
include_once("../../lib/config.inc");
|
||||||
|
|
||||||
|
/** access to module settings */
|
||||||
|
include_once("../../lib/modules.inc");
|
||||||
|
|
||||||
|
// start session
|
||||||
|
if (strtolower(session_module_name()) == 'files') {
|
||||||
|
session_save_path("../../sess");
|
||||||
|
}
|
||||||
|
@session_start();
|
||||||
|
|
||||||
|
setlanguage();
|
||||||
|
|
||||||
|
// get password
|
||||||
|
if (isset($_POST['passwd'])) $passwd = $_POST['passwd'];
|
||||||
|
|
||||||
|
// check if password was entered
|
||||||
|
// if not: load login page
|
||||||
|
if (!isset($passwd) && !isset($_SESSION['conf_isAuthenticated'])) {
|
||||||
|
$_SESSION['conf_message'] = _("No password was entered!");
|
||||||
|
/** go back to login if password is empty */
|
||||||
|
require('conflogin.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_SESSION['conf_config']) && isset($_POST['filename'])) {
|
||||||
|
$_SESSION['conf_config'] = new LAMConfig($_POST['filename']);
|
||||||
|
}
|
||||||
|
$conf = &$_SESSION['conf_config'];
|
||||||
|
|
||||||
|
// check if password is valid
|
||||||
|
// if not: load login page
|
||||||
|
if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthenticated'] === $conf->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 "<title>" . _("LDAP Account Manager Configuration") . "</title>\n";
|
||||||
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
|
||||||
|
echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"../../graphics/favicon.ico\">\n";
|
||||||
|
echo "</head><body>\n";
|
||||||
|
echo ("<p align=\"center\"><a href=\"http://lam.sourceforge.net\" target=\"new_window\">".
|
||||||
|
"<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>");
|
||||||
|
$conf->save();
|
||||||
|
echo ("<br><br><br><br><br><a href=\"../login.php\" target=\"_top\">" . _("Back to Login") . "</a>");
|
||||||
|
echo("</body></html>");
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue