diff --git a/lam/templates/pdfedit/pdfdelete.php b/lam/templates/pdfedit/pdfdelete.php index bae51b87..e9bebbb2 100644 --- a/lam/templates/pdfedit/pdfdelete.php +++ b/lam/templates/pdfedit/pdfdelete.php @@ -50,7 +50,7 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) { } // check if admin has submited delete operation -if ($_POST['submit']) { +if (isset($_POST['submit'])) { // delete user profile if(!deletePDFStructureDefinition($_POST['type'],$_POST['delete'])) { metaRefresh('pdfmain.php?deleteScope=' . $_POST['type'] . '&deleteFailed=' . $_POST['delete']); @@ -63,34 +63,44 @@ if ($_POST['submit']) { } // check if admin has aborted delete operation -if ($_POST['abort']) { +if (isset($_POST['abort'])) { metaRefresh('pdfmain.php'); exit; } // print standard header include '../main_header.php'; -echo ("


\n"); +echo "
\n"; +echo "
\n"; // check if right type was given $type = $_GET['type']; -echo ("

" . _("Do you really want to delete this PDF structure?") . ""); -echo "
\n"; -echo "

\n"; -echo "\n"; - echo "\n"; - echo "\n"; -echo "
\n"; - echo "" . _('Account type') . ': ' . getTypeAlias($_GET['type']); - echo "
\n"; - echo "" . _('Name') . ': ' . $_GET['delete'] . "
\n"; - echo "
\n"; -echo "
\n"; -echo ("\n"); -echo ("

\n"); -echo ("\n"); -echo ("\n"); -echo (""); -echo (""); -echo ("

\n"); + +$container = new htmlTable(); + +$container->addElement(new htmlOutputText(_("Do you really want to delete this PDF structure?")), true); +$container->addElement(new htmlSpacer(null, '10px'), true); + +$templateContainer = new htmlTable(); +$templateContainer->addElement(new htmlOutputText(_('Account type'))); +$templateContainer->addElement(new htmlSpacer('10px', null)); +$templateContainer->addElement(new htmlOutputText(getTypeAlias($_GET['type'])), true); +$templateContainer->addElement(new htmlOutputText(_('Name'))); +$templateContainer->addElement(new htmlSpacer('10px', null)); +$templateContainer->addElement(new htmlOutputText($_GET['delete']), true); +$container->addElement($templateContainer, true); +$container->addElement(new htmlSpacer(null, '10px'), true); + +$buttonContainer = new htmlTable(); +$buttonContainer->addElement(new htmlButton('submit', _("Delete"))); +$buttonContainer->addElement(new htmlButton('abort', _("Cancel"))); +$buttonContainer->addElement(new htmlHiddenInput('type', $_GET['type'])); +$buttonContainer->addElement(new htmlHiddenInput('delete', $_GET['delete'])); +$container->addElement($buttonContainer); + +$tabindex = 1; +parseHtml(null, $container, array(), false, $tabindex, 'user'); + +echo "\n"; +echo '
'; include '../main_footer.php'; diff --git a/lam/templates/pdfedit/pdfmain.php b/lam/templates/pdfedit/pdfmain.php index a6e53868..f796a594 100644 --- a/lam/templates/pdfedit/pdfmain.php +++ b/lam/templates/pdfedit/pdfmain.php @@ -83,16 +83,11 @@ foreach ($sortedScopes as $scope => $title) { 'scope' => $scope, 'title' => $title, 'templates' => ""); - $availableScopes .= '\n"; + $availableScopes[$title] = $scope; } // get list of templates for each account type for ($i = 0; $i < sizeof($templateClasses); $i++) { - $templateList = getPDFStructureDefinitions($templateClasses[$i]['scope']); - $templates = ""; - for ($l = 0; $l < sizeof($templateList); $l++) { - $templates = $templates . "\n"; - } - $templateClasses[$i]['templates'] = $templates; + $templateClasses[$i]['templates'] = getPDFStructureDefinitions($templateClasses[$i]['scope']); } // check if a template should be edited @@ -110,81 +105,70 @@ for ($i = 0; $i < sizeof($templateClasses); $i++) { } } +$container = new htmlTable(); + include '../main_header.php'; ?> -

- +
+
addElement(new htmlTitle(_('PDF editor')), true); + if (isset($_GET['savedSuccessfully'])) { - StatusMessage("INFO", _("PDF structure was successfully saved."), htmlspecialchars($_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'])) { - StatusMessage('ERROR', _('Unable to delete PDF structure!'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_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'])) { - StatusMessage('INFO', _('Deleted PDF structure.'), getTypeAlias($_GET['deleteScope']) . ': ' . htmlspecialchars($_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); + $newPDFContainer = new htmlTable(); + $newScopeSelect = new htmlSelect('scope', $availableScopes); + $newScopeSelect->setHasDescriptiveElements(true); + $newScopeSelect->setWidth('15em'); + $newPDFContainer->addElement($newScopeSelect); + $newPDFContainer->addElement(new htmlSpacer('10px', null)); + $newPDFContainer->addElement(new htmlButton('createNewTemplate', _('Create'))); + $container->addElement($newPDFContainer, true); + $container->addElement(new htmlSpacer(null, '10px'), true); -
- - - -
- - - -
- addElement(new htmlSubTitle(_("Manage existing PDF structures")), true); + $existingContainer = new htmlTable(); for ($i = 0; $i < sizeof($templateClasses); $i++) { - if ($i > 0) { - echo "\n"; - } - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + $existingContainer->addElement(new htmlImage('../../graphics/' . $templateClasses[$i]['scope'] . '.png')); + $existingContainer->addElement(new htmlSpacer('3px', null)); + $existingContainer->addElement(new htmlOutputText($templateClasses[$i]['title'])); + $existingContainer->addElement(new htmlSpacer('3px', null)); + $select = new htmlSelect('template_' . $templateClasses[$i]['scope'], $templateClasses[$i]['templates']); + $select->setWidth('15em'); + $existingContainer->addElement($select); + $existingContainer->addElement(new htmlSpacer('3px', null)); + $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); + $existingContainer->addElement(new htmlSpacer(null, '10px'), true); } - ?> -
 
"; - echo "\"" \n"; - echo $templateClasses[$i]['title']; - echo " "; - echo "\n"; - echo " "; - echo ""; - echo " "; - echo ""; - echo "
-
-
+ $container->addElement($existingContainer, true); -
+ $tabindex = 1; + parseHtml(null, $container, array(), false, $tabindex, 'user'); + ?> + +