show profile list when file was saved successfully

This commit is contained in:
Roland Gruber 2010-05-26 17:54:00 +00:00
parent 4fe5a63708
commit e6c6087ab1
2 changed files with 38 additions and 51 deletions

View File

@ -113,6 +113,13 @@ for ($i = 0; $i < sizeof($templateClasses); $i++) {
include '../main_header.php'; include '../main_header.php';
?> ?>
<h1><?php echo _('PDF editor'); ?></h1> <h1><?php echo _('PDF editor'); ?></h1>
<?php
if (isset($_GET['savedSuccessfully'])) {
StatusMessage("INFO", _("PDF structure was successfully saved."), htmlspecialchars($_GET['savedSuccessfully']));
}
?>
<br> <br>
<form action="pdfmain.php" method="post"> <form action="pdfmain.php" method="post">

View File

@ -84,23 +84,21 @@ if ((isset($_GET['headline'])) && ($_GET['headline'] != $_SESSION['currentPageDe
// Check if pdfname is valid, then save current structure to file and go to // Check if pdfname is valid, then save current structure to file and go to
// main pdf structure page // main pdf structure page
$saveErrors = array();
if(isset($_GET['submit'])) { if(isset($_GET['submit'])) {
include '../main_header.php';
if(!isset($_GET['pdfname']) || !preg_match('/[a-zA-Z0-9\-\_]+/',$_GET['pdfname'])) { if(!isset($_GET['pdfname']) || !preg_match('/[a-zA-Z0-9\-\_]+/',$_GET['pdfname'])) {
StatusMessage('ERROR', _('PDF-structure name not valid'), _('The name for that PDF-structure you submitted is not valid. A valid name must constist at least of one of the following characters \'a-z\',\'A-Z\',\'0-9\',\'_\',\'-\',\'.\'.')); $saveErrors[] = array('ERROR', _('PDF structure name not valid'), _('The name for that PDF-structure you submitted is not valid. A valid name must consist of the following characters: \'a-z\',\'A-Z\',\'0-9\',\'_\',\'-\'.'));
} }
else { else {
$return = savePDFStructureDefinitions($_GET['type'],$_GET['pdfname']); $return = savePDFStructureDefinitions($_GET['type'],$_GET['pdfname']);
if($return == 'ok') { if($return == 'ok') {
StatusMessage('INFO', _("PDF structure was successfully saved."), $_GET['pdfname']); metaRefresh('pdfmain.php?savedSuccessfully=' . $_GET['pdfname']);
exit;
} }
elseif($return == 'no perms'){ elseif($return == 'no perms'){
StatusMessage('ERROR', _("Could not save PDF profile, access denied."), $_GET['pdfname']); $saveErrors[] = array('ERROR', _("Could not save PDF structure, access denied."), $_GET['pdfname']);
} }
} }
echo ("<br><a href=\"pdfmain.php\">" . _("Back to PDF Editor") . "</a>");
echo "</body></html>";
exit;
} }
// add a new text field // add a new text field
elseif(isset($_GET['add_text'])) { elseif(isset($_GET['add_text'])) {
@ -388,7 +386,15 @@ foreach($logoFiles as $logoFile) {
// print header // print header
include '../main_header.php'; include '../main_header.php';
// TODO Change enctype of form
// print error messages if any
if (sizeof($saveErrors) > 0) {
for ($i = 0; $i < sizeof($saveErrors); $i++) {
call_user_func_array('StatusMessage', $saveErrors[$i]);
}
echo "<br>\n";
}
?> ?>
<br> <br>
<form action="pdfpage.php" method="post"> <form action="pdfpage.php" method="post">
@ -662,50 +668,24 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
<legend> <legend>
<b><?php echo _("Save"); ?></b> <b><?php echo _("Save"); ?></b>
</legend><BR> </legend><BR>
<table border="0" align="left">
<?php
if(!isset($_GET['pdfname']) || ($_GET['pdfname'] == '')) {
?>
<tr>
<td>
<b><?php echo _("Structure name"); ?>:</b> <b><?php echo _("Structure name"); ?>:</b>
</td> <?php
<td> $structureName = '';
<input type="text" name="pdfname" value="<?php if (isset($_GET['edit'])) echo $_GET['edit'];?>"> if (isset($_GET['edit'])) {
</td> $structureName = $_GET['edit'];
<td> }
else if (isset($_POST['pdfname'])) {
$structureName = $_POST['pdfname'];
}
?>
<input type="text" name="pdfname" value="<?php echo $structureName;?>">
<?php <?php
printHelpLink(getHelp('', '360'), '360'); printHelpLink(getHelp('', '360'), '360');
?> ?>
</td> <br><br>
</tr>
<tr>
<td colspan="3">
&nbsp;
</td>
</tr>
<?php
}
?>
<tr>
<td>
<?php
if(isset($_GET['pdfname'])) {
?>
<input type="hidden" name="pdfname" value="<?php if (isset($_GET['pdfname'])) echo $_GET['pdfname']; ?>">
<?php
}
?>
<input type="submit" name="submit" value="<?php echo _("Save");?>"> <input type="submit" name="submit" value="<?php echo _("Save");?>">
</td>
<td>
<input type="submit" name="abort" value="<?php echo _("Cancel");?>">
</td>
<td>
&nbsp; &nbsp;
</td> <input type="submit" name="abort" value="<?php echo _("Cancel");?>">
</tr>
</table>
</fieldset> </fieldset>
</td> </td>
</tr> </tr>