dialog for delete confirmation
This commit is contained in:
parent
c9f8b3d6cd
commit
8def4a53ff
|
@ -4,7 +4,7 @@ $Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2006 Michael Duergner
|
Copyright (C) 2003 - 2006 Michael Duergner
|
||||||
2005 - 2010 Roland Gruber
|
2005 - 2011 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -75,6 +75,23 @@ for ($i = 0; $i < sizeof($scopes); $i++) {
|
||||||
}
|
}
|
||||||
natcasesort($sortedScopes);
|
natcasesort($sortedScopes);
|
||||||
|
|
||||||
|
$container = new htmlTable();
|
||||||
|
$container->addElement(new htmlTitle(_('PDF editor')), true);
|
||||||
|
|
||||||
|
if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) {
|
||||||
|
// delete structure
|
||||||
|
if (deletePDFStructureDefinition($_POST['profileDeleteType'], $_POST['profileDeleteName'])) {
|
||||||
|
$message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
||||||
|
$message->colspan = 10;
|
||||||
|
$container->addElement($message, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
||||||
|
$message->colspan = 10;
|
||||||
|
$container->addElement($message, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get list of account types
|
// get list of account types
|
||||||
$availableScopes = '';
|
$availableScopes = '';
|
||||||
$templateClasses = array();
|
$templateClasses = array();
|
||||||
|
@ -97,38 +114,17 @@ for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if a profile should be deleted
|
|
||||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
|
||||||
if (isset($_POST['deleteTemplate_' . $templateClasses[$i]['scope']]) || isset($_POST['deleteTemplate_' . $templateClasses[$i]['scope'] . '_x'])) {
|
|
||||||
metaRefresh('pdfdelete.php?type=' . $templateClasses[$i]['scope'] . '&delete=' . $_POST['template_' . $templateClasses[$i]['scope']]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$container = new htmlTable();
|
|
||||||
|
|
||||||
include '../main_header.php';
|
include '../main_header.php';
|
||||||
?>
|
?>
|
||||||
<div class="userlist-bright smallPaddingContent">
|
<div class="userlist-bright smallPaddingContent">
|
||||||
<form action="pdfmain.php" method="post">
|
<form action="pdfmain.php" method="post">
|
||||||
<?php
|
<?php
|
||||||
$container->addElement(new htmlTitle(_('PDF editor')), true);
|
|
||||||
|
|
||||||
if (isset($_GET['savedSuccessfully'])) {
|
if (isset($_GET['savedSuccessfully'])) {
|
||||||
$message = new htmlStatusMessage("INFO", _("PDF structure was successfully saved."), htmlspecialchars($_GET['savedSuccessfully']));
|
$message = new htmlStatusMessage("INFO", _("PDF structure was successfully saved."), htmlspecialchars($_GET['savedSuccessfully']));
|
||||||
$message->colspan = 10;
|
$message->colspan = 10;
|
||||||
$container->addElement($message, true);
|
$container->addElement($message, true);
|
||||||
}
|
}
|
||||||
if (isset($_GET['deleteFailed'])) {
|
|
||||||
$message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_GET['deleteFailed']));
|
|
||||||
$message->colspan = 10;
|
|
||||||
$container->addElement($message, true);
|
|
||||||
}
|
|
||||||
if (isset($_GET['deleteSucceeded'])) {
|
|
||||||
$message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_GET['deleteSucceeded']));
|
|
||||||
$message->colspan = 10;
|
|
||||||
$container->addElement($message, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// new template
|
// new template
|
||||||
$container->addElement(new htmlSubTitle(_('Create a new PDF structure')), true);
|
$container->addElement(new htmlSubTitle(_('Create a new PDF structure')), true);
|
||||||
|
@ -157,9 +153,10 @@ include '../main_header.php';
|
||||||
$exEditButton = new htmlButton('editTemplate_' . $templateClasses[$i]['scope'], 'edit.png', true);
|
$exEditButton = new htmlButton('editTemplate_' . $templateClasses[$i]['scope'], 'edit.png', true);
|
||||||
$exEditButton->setTitle(_('Edit'));
|
$exEditButton->setTitle(_('Edit'));
|
||||||
$existingContainer->addElement($exEditButton);
|
$existingContainer->addElement($exEditButton);
|
||||||
$exDelButton = new htmlButton('deleteTemplate_' . $templateClasses[$i]['scope'], 'delete.png', true);
|
$deleteLink = new htmlLink(null, '#', '../../graphics/delete.png');
|
||||||
$exDelButton->setTitle(_('Delete'));
|
$deleteLink->setTitle(_('Delete'));
|
||||||
$existingContainer->addElement($exDelButton, true);
|
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['scope'] . "', '" . 'template_' . $templateClasses[$i]['scope'] . "');");
|
||||||
|
$existingContainer->addElement($deleteLink, true);
|
||||||
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
||||||
}
|
}
|
||||||
$container->addElement($existingContainer, true);
|
$container->addElement($existingContainer, true);
|
||||||
|
@ -170,5 +167,15 @@ include '../main_header.php';
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
include '../main_footer.php';
|
// form for delete action
|
||||||
|
echo '<div id="deleteProfileDialog" class="hidden"><form id="deleteProfileForm" action="pdfmain.php" method="post">';
|
||||||
|
echo _("Do you really want to delete this PDF structure?");
|
||||||
|
echo '<br><br><div class="nowrap">';
|
||||||
|
echo _("Structure name") . ': <div id="deleteText" style="display: inline;"></div></div>';
|
||||||
|
echo '<input id="profileDeleteType" type="hidden" name="profileDeleteType" value="">';
|
||||||
|
echo '<input id="profileDeleteName" type="hidden" name="profileDeleteName" value="">';
|
||||||
|
echo '<input type="hidden" name="deleteProfile" value="true">';
|
||||||
|
echo '</form></div>';
|
||||||
|
|
||||||
|
include '../main_footer.php';
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2010 Roland Gruber
|
Copyright (C) 2003 - 2011 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -80,12 +80,25 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if a profile should be deleted
|
|
||||||
for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
include '../main_header.php';
|
||||||
if (isset($_POST['deleteProfile_' . $profileClasses[$i]['scope']]) || isset($_POST['deleteProfile_' . $profileClasses[$i]['scope'] . '_x'])) {
|
echo "<div class=\"userlist-bright smallPaddingContent\">\n";
|
||||||
metaRefresh("profiledelete.php?type=" . $profileClasses[$i]['scope'] .
|
echo "<form action=\"profilemain.php\" method=\"post\">\n";
|
||||||
"&del=" . $_POST['profile_' . $profileClasses[$i]['scope']]);
|
|
||||||
exit;
|
$container = new htmlTable();
|
||||||
|
$container->addElement(new htmlTitle(_("Profile editor")), true);
|
||||||
|
|
||||||
|
if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) {
|
||||||
|
// delete profile
|
||||||
|
if (delAccountProfile($_POST['profileDeleteName'], $_POST['profileDeleteType'])) {
|
||||||
|
$message = new htmlStatusMessage('INFO', _('Deleted profile.'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
||||||
|
$message->colspan = 10;
|
||||||
|
$container->addElement($message, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message = new htmlStatusMessage('ERROR', _('Unable to delete profile!'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
||||||
|
$message->colspan = 10;
|
||||||
|
$container->addElement($message, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,28 +109,11 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||||
$profileClasses[$i]['profiles'] = $profileList;
|
$profileClasses[$i]['profiles'] = $profileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
include '../main_header.php';
|
|
||||||
echo "<div class=\"userlist-bright smallPaddingContent\">\n";
|
|
||||||
echo "<form action=\"profilemain.php\" method=\"post\">\n";
|
|
||||||
|
|
||||||
$container = new htmlTable();
|
|
||||||
$container->addElement(new htmlTitle(_("Profile editor")), true);
|
|
||||||
|
|
||||||
if (isset($_GET['savedSuccessfully'])) {
|
if (isset($_GET['savedSuccessfully'])) {
|
||||||
$message = new htmlStatusMessage("INFO", _("Profile was saved."), htmlspecialchars($_GET['savedSuccessfully']));
|
$message = new htmlStatusMessage("INFO", _("Profile was saved."), htmlspecialchars($_GET['savedSuccessfully']));
|
||||||
$message->colspan = 10;
|
$message->colspan = 10;
|
||||||
$container->addElement($message, true);
|
$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
|
||||||
$container->addElement(new htmlSubTitle(_('Create a new profile')), true);
|
$container->addElement(new htmlSubTitle(_('Create a new profile')), true);
|
||||||
|
@ -156,9 +152,10 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||||
$editButton = new htmlButton('editProfile_' . $profileClasses[$i]['scope'], 'edit.png', true);
|
$editButton = new htmlButton('editProfile_' . $profileClasses[$i]['scope'], 'edit.png', true);
|
||||||
$editButton->setTitle(_('Edit'));
|
$editButton->setTitle(_('Edit'));
|
||||||
$existingContainer->addElement($editButton);
|
$existingContainer->addElement($editButton);
|
||||||
$deleteButton = new htmlButton('deleteProfile_' . $profileClasses[$i]['scope'], 'delete.png', true);
|
$deleteLink = new htmlLink(null, '#', '../../graphics/delete.png');
|
||||||
$deleteButton->setTitle(_('Delete'));
|
$deleteLink->setTitle(_('Delete'));
|
||||||
$existingContainer->addElement($deleteButton);
|
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $profileClasses[$i]['scope'] . "', '" . 'profile_' . $profileClasses[$i]['scope'] . "');");
|
||||||
|
$existingContainer->addElement($deleteLink);
|
||||||
$existingContainer->addNewLine();
|
$existingContainer->addNewLine();
|
||||||
}
|
}
|
||||||
$container->addElement($existingContainer);
|
$container->addElement($existingContainer);
|
||||||
|
@ -169,6 +166,17 @@ parseHtml(null, $container, array(), false, $tabindex, 'user');
|
||||||
|
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
|
// form for delete action
|
||||||
|
echo '<div id="deleteProfileDialog" class="hidden"><form id="deleteProfileForm" action="profilemain.php" method="post">';
|
||||||
|
echo _("Do you really want to delete this profile?");
|
||||||
|
echo '<br><br><div class="nowrap">';
|
||||||
|
echo _("Profile name") . ': <div id="deleteText" style="display: inline;"></div></div>';
|
||||||
|
echo '<input id="profileDeleteType" type="hidden" name="profileDeleteType" value="">';
|
||||||
|
echo '<input id="profileDeleteName" type="hidden" name="profileDeleteName" value="">';
|
||||||
|
echo '<input type="hidden" name="deleteProfile" value="true">';
|
||||||
|
echo '</form></div>';
|
||||||
|
|
||||||
include '../main_footer.php';
|
include '../main_footer.php';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue