use meta HTML classes

This commit is contained in:
Roland Gruber 2010-10-18 19:47:07 +00:00
parent 1101e2df47
commit 8e8efef77a
2 changed files with 84 additions and 90 deletions

View File

@ -50,7 +50,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 user profile // delete user profile
if(!deletePDFStructureDefinition($_POST['type'],$_POST['delete'])) { if(!deletePDFStructureDefinition($_POST['type'],$_POST['delete'])) {
metaRefresh('pdfmain.php?deleteScope=' . $_POST['type'] . '&deleteFailed=' . $_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 // check if admin has aborted delete operation
if ($_POST['abort']) { if (isset($_POST['abort'])) {
metaRefresh('pdfmain.php'); metaRefresh('pdfmain.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=\"pdfdelete.php\" method=\"post\">\n";
// check if right type was given // check if right type was given
$type = $_GET['type']; $type = $_GET['type'];
echo ("<p align=\"center\"><big>" . _("Do you really want to delete this PDF structure?") . "</big>");
echo "<br>\n"; $container = new htmlTable();
echo "<br></p>\n";
echo "<table align=\"center\">\n"; $container->addElement(new htmlOutputText(_("Do you really want to delete this PDF structure?")), true);
echo "<tr><td>\n"; $container->addElement(new htmlSpacer(null, '10px'), true);
echo "<b>" . _('Account type') . ': </b>' . getTypeAlias($_GET['type']);
echo "</td></tr>\n"; $templateContainer = new htmlTable();
echo "<tr><td>\n"; $templateContainer->addElement(new htmlOutputText(_('Account type')));
echo "<b>" . _('Name') . ': </b>' . $_GET['delete'] . "<br>\n"; $templateContainer->addElement(new htmlSpacer('10px', null));
echo "</td></tr>\n"; $templateContainer->addElement(new htmlOutputText(getTypeAlias($_GET['type'])), true);
echo "</table>\n"; $templateContainer->addElement(new htmlOutputText(_('Name')));
echo "<br>\n"; $templateContainer->addElement(new htmlSpacer('10px', null));
echo ("<form action=\"pdfdelete.php\" method=\"post\">\n"); $templateContainer->addElement(new htmlOutputText($_GET['delete']), true);
echo ("<p align=\"center\">\n"); $container->addElement($templateContainer, true);
echo ("<input type=\"submit\" name=\"submit\" value=\"" . _("Delete") . "\">\n"); $container->addElement(new htmlSpacer(null, '10px'), true);
echo ("<input type=\"submit\" name=\"abort\" value=\"" . _("Cancel") . "\">\n");
echo ("<input type=\"hidden\" name=\"type\" value=\"" . $_GET['type'] . "\">"); $buttonContainer = new htmlTable();
echo ("<input type=\"hidden\" name=\"delete\" value=\"" . $_GET['delete'] . "\">"); $buttonContainer->addElement(new htmlButton('submit', _("Delete")));
echo ("</p></form>\n"); $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 "</form>\n";
echo '</div>';
include '../main_footer.php'; include '../main_footer.php';

View File

@ -83,16 +83,11 @@ foreach ($sortedScopes as $scope => $title) {
'scope' => $scope, 'scope' => $scope,
'title' => $title, 'title' => $title,
'templates' => ""); 'templates' => "");
$availableScopes .= '<option value="' . $scope . '">' . $title . "</option>\n"; $availableScopes[$title] = $scope;
} }
// get list of templates for each account type // get list of templates for each account type
for ($i = 0; $i < sizeof($templateClasses); $i++) { for ($i = 0; $i < sizeof($templateClasses); $i++) {
$templateList = getPDFStructureDefinitions($templateClasses[$i]['scope']); $templateClasses[$i]['templates'] = getPDFStructureDefinitions($templateClasses[$i]['scope']);
$templates = "";
for ($l = 0; $l < sizeof($templateList); $l++) {
$templates = $templates . "<option>" . $templateList[$l] . "</option>\n";
}
$templateClasses[$i]['templates'] = $templates;
} }
// check if a template should be edited // 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'; include '../main_header.php';
?> ?>
<h1><?php echo _('PDF editor'); ?></h1> <div class="userlist-bright smallPaddingContent">
<form action="pdfmain.php" method="post">
<?php <?php
$container->addElement(new htmlTitle(_('PDF editor')), true);
if (isset($_GET['savedSuccessfully'])) { 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'])) { 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'])) { 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);
} }
?>
<br> // new template
<form action="pdfmain.php" method="post"> $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);
<!-- new template --> // existing templates
<fieldset class="useredit"> $container->addElement(new htmlSubTitle(_("Manage existing PDF structures")), true);
<legend> $existingContainer = new htmlTable();
<b><?php echo _('Create a new PDF structure'); ?></b>
</legend>
<br><table border=0>
<tr><td>
<select class="user" name="scope">
<?php echo $availableScopes; ?>
</select>
</td>
<td>
<input type="submit" name="createNewTemplate" value="<?php echo _('Create'); ?>">
</td></tr>
</table>
</fieldset>
<br>
<!-- existing templates -->
<fieldset class="useredit">
<legend>
<b><?php echo _("Manage existing PDF structures"); ?></b>
</legend>
<br><table border=0>
<?php
for ($i = 0; $i < sizeof($templateClasses); $i++) { for ($i = 0; $i < sizeof($templateClasses); $i++) {
if ($i > 0) { $existingContainer->addElement(new htmlImage('../../graphics/' . $templateClasses[$i]['scope'] . '.png'));
echo "<tr><td colspan=3>&nbsp;</td></tr>\n"; $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 "<tr>\n"; $container->addElement($existingContainer, true);
echo "<td>";
echo "<img alt=\"" . $templateClasses[$i]['title'] . "\" src=\"../../graphics/" . $templateClasses[$i]['scope'] . ".png\">&nbsp;\n";
echo $templateClasses[$i]['title'];
echo "</td>\n";
echo "<td>&nbsp;";
echo "<select class=\"user\" style=\"width: 20em;\" name=\"template_" . $templateClasses[$i]['scope'] . "\">\n";
echo $templateClasses[$i]['templates'];
echo "</select>\n";
echo "</td>\n";
echo "<td>&nbsp;";
echo "<input type=\"image\" src=\"../../graphics/edit.png\" name=\"editTemplate_" . $templateClasses[$i]['scope'] . "\" " .
"alt=\"" . _('Edit') . "\" title=\"" . _('Edit') . "\">";
echo "&nbsp;";
echo "<input type=\"image\" src=\"../../graphics/delete.png\" name=\"deleteTemplate_" . $templateClasses[$i]['scope'] . "\" " .
"alt=\"" . _('Delete') . "\" title=\"" . _('Delete') . "\">";
echo "</td>\n";
echo "</tr>\n";
}
?>
</table>
</fieldset>
<br>
</form> $tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, 'user');
?>
</form>
</div>
<?php <?php
include '../main_footer.php'; include '../main_footer.php';
?> ?>