use new meta HTML classes and new buttons
This commit is contained in:
parent
ad239cc7bd
commit
4c1b10fe24
|
@ -52,7 +52,7 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
|
|||
}
|
||||
|
||||
// check if admin has submited delete operation
|
||||
if ($_POST['submit']) {
|
||||
if (isset($_POST['submit'])) {
|
||||
// delete profile
|
||||
if (!delAccountProfile($_POST['del'], $_POST['type'])) {
|
||||
metaRefresh('profilemain.php?deleteScope=' . $_POST['type'] . '&deleteFailed=' . $_POST['del']);
|
||||
|
@ -65,23 +65,38 @@ if ($_POST['submit']) {
|
|||
}
|
||||
|
||||
// check if admin has aborted delete operation
|
||||
if ($_POST['abort']) {
|
||||
if (isset($_POST['abort'])) {
|
||||
metaRefresh('profilemain.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
// print standard header
|
||||
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'];
|
||||
echo ("<p align=\"center\"><big>" . _("Do you really want to delete this profile?") . " <b>");
|
||||
echo ($_GET['del'] . "</b></big><br></p>\n");
|
||||
echo ("<form action=\"profiledelete.php\" method=\"post\">\n");
|
||||
echo ("<p align=\"center\">\n");
|
||||
echo ("<input type=\"submit\" name=\"submit\" value=\"" . _("Ok") . "\">\n");
|
||||
echo ("<input type=\"submit\" name=\"abort\" value=\"" . _("Cancel") . "\">\n");
|
||||
echo ("<input type=\"hidden\" name=\"type\" value=\"$type\">");
|
||||
echo ("<input type=\"hidden\" name=\"del\" value=\"" . $_GET['del'] . "\">");
|
||||
echo ("</p></form>\n");
|
||||
|
||||
$container = new htmlTable();
|
||||
$container->addElement(new htmlOutputText(_("Do you really want to delete this profile?")), true);
|
||||
$container->addElement(new htmlSpacer(null, '10px'), true);
|
||||
|
||||
$subContainer = new htmlTable();
|
||||
$subContainer->addElement(new htmlOutputText(_("Profile name") . ': '));
|
||||
$subContainer->addElement(new htmlOutputText($_GET['del']), true);
|
||||
$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';
|
||||
|
|
|
@ -93,89 +93,75 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
|||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||
$profileList = getAccountProfiles($profileClasses[$i]['scope']);
|
||||
natcasesort($profileList);
|
||||
$profiles = "";
|
||||
foreach ($profileList as $p) {
|
||||
$profiles = $profiles . "<option>" . $p . "</option>\n";
|
||||
}
|
||||
$profileClasses[$i]['profiles'] = $profiles;
|
||||
$profileClasses[$i]['profiles'] = $profileList;
|
||||
}
|
||||
|
||||
include '../main_header.php';
|
||||
|
||||
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 "<div class=\"userlist-bright smallPaddingContent\">\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
|
||||
echo "<fieldset class=\"useredit\">\n";
|
||||
echo "<legend>\n";
|
||||
echo "<b>" . _('Create a new profile') . "</b>\n";
|
||||
echo "</legend>\n";
|
||||
echo "<br><table border=0>\n";
|
||||
echo "<tr><td>\n";
|
||||
echo "<select class=\"user\" name=\"createProfile\">\n";
|
||||
$sortedTypes = array();
|
||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||
$sortedTypes[$profileClasses[$i]['scope']] = $profileClasses[$i]['title'];
|
||||
}
|
||||
natcasesort($sortedTypes);
|
||||
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";
|
||||
$container->addElement(new htmlSubTitle(_('Create a new profile')), true);
|
||||
$sortedTypes = array();
|
||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||
$sortedTypes[$profileClasses[$i]['title']] = $profileClasses[$i]['scope'];
|
||||
}
|
||||
natcasesort($sortedTypes);
|
||||
$newProfileSelect = new htmlSelect('createProfile', $sortedTypes);
|
||||
$newProfileSelect->setHasDescriptiveElements(true);
|
||||
$container->addElement($newProfileSelect);
|
||||
$container->addElement(new htmlButton('createProfileButton', _('Create')), true);
|
||||
|
||||
$container->addElement(new htmlSpacer(null, '10px'), true);
|
||||
|
||||
// existing profiles
|
||||
echo "<fieldset class=\"useredit\">\n";
|
||||
echo "<legend>\n";
|
||||
echo "<b>" . _('Manage existing profiles') . "</b>\n";
|
||||
echo "</legend>\n";
|
||||
echo "<br><table border=0>\n";
|
||||
$container->addElement(new htmlSubTitle(_('Manage existing profiles')), true);
|
||||
$existingContainer = new htmlTable();
|
||||
$existingContainer->colspan = 5;
|
||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||
if ($i > 0) {
|
||||
echo "<tr><td colspan=3> </td></tr>\n";
|
||||
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
||||
}
|
||||
echo "<tr>\n";
|
||||
echo "<td>";
|
||||
echo "<img alt=\"" . $profileClasses[$i]['title'] . "\" src=\"../../graphics/" . $profileClasses[$i]['scope'] . ".png\"> \n";
|
||||
echo $profileClasses[$i]['title'];
|
||||
echo "</td>\n";
|
||||
echo "<td> ";
|
||||
echo "<select class=\"user\" style=\"width: 20em;\" name=\"profile_" . $profileClasses[$i]['scope'] . "\">\n";
|
||||
echo $profileClasses[$i]['profiles'];
|
||||
echo "</select>\n";
|
||||
echo "</td>\n";
|
||||
echo "<td> ";
|
||||
echo "<input type=\"image\" src=\"../../graphics/edit.png\" name=\"editProfile_" . $profileClasses[$i]['scope'] . "\" " .
|
||||
"alt=\"" . _('Edit') . "\" title=\"" . _('Edit') . "\">";
|
||||
echo " ";
|
||||
echo "<input type=\"image\" src=\"../../graphics/delete.png\" name=\"deleteProfile_" . $profileClasses[$i]['scope'] . "\" " .
|
||||
"alt=\"" . _('Delete') . "\" title=\"" . _('Delete') . "\">";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
$existingContainer->addElement(new htmlImage('../../graphics/' . $profileClasses[$i]['scope']));
|
||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||
$existingContainer->addElement(new htmlOutputText($profileClasses[$i]['title']));
|
||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||
$existingContainer->addElement(new htmlSelect('profile_' . $profileClasses[$i]['scope'], $profileClasses[$i]['profiles']));
|
||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||
$editButton = new htmlButton('editProfile_' . $profileClasses[$i]['scope'], 'edit.png', true);
|
||||
$editButton->setTitle(_('Edit'));
|
||||
$existingContainer->addElement($editButton);
|
||||
$deleteButton = new htmlButton('deleteProfile_' . $profileClasses[$i]['scope'], 'delete.png', true);
|
||||
$deleteButton->setTitle(_('Delete'));
|
||||
$existingContainer->addElement($deleteButton);
|
||||
$existingContainer->addNewLine();
|
||||
}
|
||||
echo "</table>\n";
|
||||
echo "</fieldset>\n";
|
||||
echo "<br>\n";
|
||||
$container->addElement($existingContainer);
|
||||
|
||||
// generate content
|
||||
$tabindex = 1;
|
||||
parseHtml(null, $container, array(), false, $tabindex, 'user');
|
||||
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
include '../main_footer.php';
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue