use new meta HTML classes and new buttons

This commit is contained in:
Roland Gruber 2010-10-16 17:52:08 +00:00
parent ad239cc7bd
commit 4c1b10fe24
2 changed files with 82 additions and 81 deletions

View File

@ -52,7 +52,7 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
} }
// check if admin has submited delete operation // check if admin has submited delete operation
if ($_POST['submit']) { if (isset($_POST['submit'])) {
// delete profile // delete profile
if (!delAccountProfile($_POST['del'], $_POST['type'])) { if (!delAccountProfile($_POST['del'], $_POST['type'])) {
metaRefresh('profilemain.php?deleteScope=' . $_POST['type'] . '&deleteFailed=' . $_POST['del']); metaRefresh('profilemain.php?deleteScope=' . $_POST['type'] . '&deleteFailed=' . $_POST['del']);
@ -65,23 +65,38 @@ if ($_POST['submit']) {
} }
// check if admin has aborted delete operation // check if admin has aborted delete operation
if ($_POST['abort']) { if (isset($_POST['abort'])) {
metaRefresh('profilemain.php'); metaRefresh('profilemain.php');
exit; exit;
} }
// print standard header // print standard header
include '../main_header.php'; include '../main_header.php';
echo ("<p><br></p>\n"); echo "<div class=\"userlist-bright smallPaddingContent\">\n";
echo "<form action=\"profiledelete.php\" method=\"post\">\n";
$type = $_GET['type']; $type = $_GET['type'];
echo ("<p align=\"center\"><big>" . _("Do you really want to delete this profile?") . " <b>");
echo ($_GET['del'] . "</b></big><br></p>\n"); $container = new htmlTable();
echo ("<form action=\"profiledelete.php\" method=\"post\">\n"); $container->addElement(new htmlOutputText(_("Do you really want to delete this profile?")), true);
echo ("<p align=\"center\">\n"); $container->addElement(new htmlSpacer(null, '10px'), true);
echo ("<input type=\"submit\" name=\"submit\" value=\"" . _("Ok") . "\">\n");
echo ("<input type=\"submit\" name=\"abort\" value=\"" . _("Cancel") . "\">\n"); $subContainer = new htmlTable();
echo ("<input type=\"hidden\" name=\"type\" value=\"$type\">"); $subContainer->addElement(new htmlOutputText(_("Profile name") . ': '));
echo ("<input type=\"hidden\" name=\"del\" value=\"" . $_GET['del'] . "\">"); $subContainer->addElement(new htmlOutputText($_GET['del']), true);
echo ("</p></form>\n"); $container->addElement($subContainer, true);
$container->addElement(new htmlSpacer(null, '10px'), true);
$buttonContainer = new htmlTable();
$buttonContainer->addElement(new htmlButton('submit', _("Ok")));
$buttonContainer->addElement(new htmlButton('abort', _("Cancel")));
$buttonContainer->addElement(new htmlHiddenInput('type', $type));
$buttonContainer->addElement(new htmlHiddenInput('del', $_GET['del']));
$container->addElement($buttonContainer);
$tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo "</form>\n";
echo "</div>";
include '../main_footer.php'; include '../main_footer.php';

View File

@ -93,89 +93,75 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
for ($i = 0; $i < sizeof($profileClasses); $i++) { for ($i = 0; $i < sizeof($profileClasses); $i++) {
$profileList = getAccountProfiles($profileClasses[$i]['scope']); $profileList = getAccountProfiles($profileClasses[$i]['scope']);
natcasesort($profileList); natcasesort($profileList);
$profiles = ""; $profileClasses[$i]['profiles'] = $profileList;
foreach ($profileList as $p) {
$profiles = $profiles . "<option>" . $p . "</option>\n";
}
$profileClasses[$i]['profiles'] = $profiles;
} }
include '../main_header.php'; include '../main_header.php';
echo "<div class=\"userlist-bright smallPaddingContent\">\n";
echo "<h1>" . _('Profile editor') . "</h1>\n";
if (isset($_GET['savedSuccessfully'])) {
StatusMessage("INFO", _("Profile was saved."), htmlspecialchars($_GET['savedSuccessfully']));
}
if (isset($_GET['deleteFailed'])) {
StatusMessage('ERROR', _('Unable to delete profile!'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_GET['deleteFailed']));
}
if (isset($_GET['deleteSucceeded'])) {
StatusMessage('INFO', _('Deleted profile.'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_GET['deleteSucceeded']));
}
echo "<br>\n";
echo "<form action=\"profilemain.php\" method=\"post\">\n"; echo "<form action=\"profilemain.php\" method=\"post\">\n";
$container = new htmlTable();
if (isset($_GET['savedSuccessfully'])) {
$message = new htmlStatusMessage("INFO", _("Profile was saved."), htmlspecialchars($_GET['savedSuccessfully']));
$message->colspan = 10;
$container->addElement($message, true);
}
if (isset($_GET['deleteFailed'])) {
$message = new htmlStatusMessage('ERROR', _('Unable to delete profile!'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_GET['deleteFailed']));
$message->colspan = 10;
$container->addElement($message, true);
}
if (isset($_GET['deleteSucceeded'])) {
$message = new htmlStatusMessage('INFO', _('Deleted profile.'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_GET['deleteSucceeded']));
$message->colspan = 10;
$container->addElement($message, true);
}
// new profile // new profile
echo "<fieldset class=\"useredit\">\n"; $container->addElement(new htmlSubTitle(_('Create a new profile')), true);
echo "<legend>\n"; $sortedTypes = array();
echo "<b>" . _('Create a new profile') . "</b>\n"; for ($i = 0; $i < sizeof($profileClasses); $i++) {
echo "</legend>\n"; $sortedTypes[$profileClasses[$i]['title']] = $profileClasses[$i]['scope'];
echo "<br><table border=0>\n"; }
echo "<tr><td>\n"; natcasesort($sortedTypes);
echo "<select class=\"user\" name=\"createProfile\">\n"; $newProfileSelect = new htmlSelect('createProfile', $sortedTypes);
$sortedTypes = array(); $newProfileSelect->setHasDescriptiveElements(true);
for ($i = 0; $i < sizeof($profileClasses); $i++) { $container->addElement($newProfileSelect);
$sortedTypes[$profileClasses[$i]['scope']] = $profileClasses[$i]['title']; $container->addElement(new htmlButton('createProfileButton', _('Create')), true);
}
natcasesort($sortedTypes); $container->addElement(new htmlSpacer(null, '10px'), true);
foreach ($sortedTypes as $key => $value) {
echo "<option value=\"" . $key . "\">" . $value . "</option>\n";
}
echo "</select>\n";
echo "</td>\n";
echo "<td>\n";
echo "<input type=\"submit\" name=\"createProfileButton\" value=\"" . _('Create') . "\">";
echo "</td></tr>\n";
echo "</table>\n";
echo "</fieldset>\n";
echo "<br>\n";
// existing profiles // existing profiles
echo "<fieldset class=\"useredit\">\n"; $container->addElement(new htmlSubTitle(_('Manage existing profiles')), true);
echo "<legend>\n"; $existingContainer = new htmlTable();
echo "<b>" . _('Manage existing profiles') . "</b>\n"; $existingContainer->colspan = 5;
echo "</legend>\n";
echo "<br><table border=0>\n";
for ($i = 0; $i < sizeof($profileClasses); $i++) { for ($i = 0; $i < sizeof($profileClasses); $i++) {
if ($i > 0) { if ($i > 0) {
echo "<tr><td colspan=3>&nbsp;</td></tr>\n"; $existingContainer->addElement(new htmlSpacer(null, '10px'), true);
} }
echo "<tr>\n"; $existingContainer->addElement(new htmlImage('../../graphics/' . $profileClasses[$i]['scope']));
echo "<td>"; $existingContainer->addElement(new htmlSpacer('3px', null));
echo "<img alt=\"" . $profileClasses[$i]['title'] . "\" src=\"../../graphics/" . $profileClasses[$i]['scope'] . ".png\">&nbsp;\n"; $existingContainer->addElement(new htmlOutputText($profileClasses[$i]['title']));
echo $profileClasses[$i]['title']; $existingContainer->addElement(new htmlSpacer('3px', null));
echo "</td>\n"; $existingContainer->addElement(new htmlSelect('profile_' . $profileClasses[$i]['scope'], $profileClasses[$i]['profiles']));
echo "<td>&nbsp;"; $existingContainer->addElement(new htmlSpacer('3px', null));
echo "<select class=\"user\" style=\"width: 20em;\" name=\"profile_" . $profileClasses[$i]['scope'] . "\">\n"; $editButton = new htmlButton('editProfile_' . $profileClasses[$i]['scope'], 'edit.png', true);
echo $profileClasses[$i]['profiles']; $editButton->setTitle(_('Edit'));
echo "</select>\n"; $existingContainer->addElement($editButton);
echo "</td>\n"; $deleteButton = new htmlButton('deleteProfile_' . $profileClasses[$i]['scope'], 'delete.png', true);
echo "<td>&nbsp;"; $deleteButton->setTitle(_('Delete'));
echo "<input type=\"image\" src=\"../../graphics/edit.png\" name=\"editProfile_" . $profileClasses[$i]['scope'] . "\" " . $existingContainer->addElement($deleteButton);
"alt=\"" . _('Edit') . "\" title=\"" . _('Edit') . "\">"; $existingContainer->addNewLine();
echo "&nbsp;";
echo "<input type=\"image\" src=\"../../graphics/delete.png\" name=\"deleteProfile_" . $profileClasses[$i]['scope'] . "\" " .
"alt=\"" . _('Delete') . "\" title=\"" . _('Delete') . "\">";
echo "</td>\n";
echo "</tr>\n";
} }
echo "</table>\n"; $container->addElement($existingContainer);
echo "</fieldset>\n";
echo "<br>\n"; // generate content
$tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo "</form>\n"; echo "</form>\n";
echo "</div>\n";
include '../main_footer.php'; include '../main_footer.php';
?> ?>