diff --git a/lam/templates/pdfedit/pdfmain.php b/lam/templates/pdfedit/pdfmain.php index f796a594..fd97abc0 100644 --- a/lam/templates/pdfedit/pdfmain.php +++ b/lam/templates/pdfedit/pdfmain.php @@ -4,7 +4,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) 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 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); +$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 $availableScopes = ''; $templateClasses = array(); @@ -97,38 +114,17 @@ for ($i = 0; $i < sizeof($templateClasses); $i++) { 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'; ?>
addElement(new htmlTitle(_('PDF editor')), true); - if (isset($_GET['savedSuccessfully'])) { $message = new htmlStatusMessage("INFO", _("PDF structure was successfully saved."), htmlspecialchars($_GET['savedSuccessfully'])); $message->colspan = 10; $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 $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->setTitle(_('Edit')); $existingContainer->addElement($exEditButton); - $exDelButton = new htmlButton('deleteTemplate_' . $templateClasses[$i]['scope'], 'delete.png', true); - $exDelButton->setTitle(_('Delete')); - $existingContainer->addElement($exDelButton, true); + $deleteLink = new htmlLink(null, '#', '../../graphics/delete.png'); + $deleteLink->setTitle(_('Delete')); + $deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['scope'] . "', '" . 'template_' . $templateClasses[$i]['scope'] . "');"); + $existingContainer->addElement($deleteLink, true); $existingContainer->addElement(new htmlSpacer(null, '10px'), true); } $container->addElement($existingContainer, true); @@ -170,5 +167,15 @@ include '../main_header.php';
'; + echo _("Do you really want to delete this PDF structure?"); + echo '

'; + echo _("Structure name") . ':
'; + echo ''; + echo ''; + echo ''; +echo '
'; + +include '../main_footer.php'; ?> diff --git a/lam/templates/profedit/profilemain.php b/lam/templates/profedit/profilemain.php index a73f72b8..e2640122 100644 --- a/lam/templates/profedit/profilemain.php +++ b/lam/templates/profedit/profilemain.php @@ -3,7 +3,7 @@ $Id$ 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 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; } } -// check if a profile should be deleted -for ($i = 0; $i < sizeof($profileClasses); $i++) { - if (isset($_POST['deleteProfile_' . $profileClasses[$i]['scope']]) || isset($_POST['deleteProfile_' . $profileClasses[$i]['scope'] . '_x'])) { - metaRefresh("profiledelete.php?type=" . $profileClasses[$i]['scope'] . - "&del=" . $_POST['profile_' . $profileClasses[$i]['scope']]); - exit; + +include '../main_header.php'; +echo "
\n"; +echo "
\n"; + +$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; } -include '../main_header.php'; -echo "
\n"; -echo "\n"; - -$container = new htmlTable(); -$container->addElement(new htmlTitle(_("Profile editor")), true); - 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 $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->setTitle(_('Edit')); $existingContainer->addElement($editButton); - $deleteButton = new htmlButton('deleteProfile_' . $profileClasses[$i]['scope'], 'delete.png', true); - $deleteButton->setTitle(_('Delete')); - $existingContainer->addElement($deleteButton); + $deleteLink = new htmlLink(null, '#', '../../graphics/delete.png'); + $deleteLink->setTitle(_('Delete')); + $deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $profileClasses[$i]['scope'] . "', '" . 'profile_' . $profileClasses[$i]['scope'] . "');"); + $existingContainer->addElement($deleteLink); $existingContainer->addNewLine(); } $container->addElement($existingContainer); @@ -169,6 +166,17 @@ parseHtml(null, $container, array(), false, $tabindex, 'user'); echo "\n"; echo "
\n"; + +// form for delete action +echo ''; + include '../main_footer.php'; ?>