reordered section adding

This commit is contained in:
Roland Gruber 2008-03-16 14:06:32 +00:00
parent ec12908925
commit da2f2277fa
1 changed files with 58 additions and 55 deletions

View File

@ -107,38 +107,40 @@ if(isset($_GET['submit'])) {
echo "</body></html>"; echo "</body></html>";
exit; exit;
} }
// Add a new section or static text // add a new text field
elseif(isset($_GET['add'])) { elseif(isset($_GET['add_text'])) {
// Check if name for new section is specified when needed
if($_GET['section_type'] == 'text' && (!isset($_GET['section_text']) || $_GET['section_text'] == '')) {
StatusMessage('ERROR',_('No section text specified'),_('The headline for a new section must contain at least one character.'));
}
// Check if text for static text field is specified // Check if text for static text field is specified
elseif($_GET['section_type'] == 'textbox' && (!isset($_GET['text_text']) || $_GET['text_text'] == '')) { if(!isset($_GET['text_text']) || ($_GET['text_text'] == '')) {
StatusMessage('ERROR',_('No static text specified'),_('The static text must contain at least one character.')); StatusMessage('ERROR',_('No static text specified'),_('The static text must contain at least one character.'));
} }
else { else {
// Add a new section
if(($_GET['section_type'] == 'item') || ($_GET['section_type'] == 'text')) {
$attributes = array();
// Add a new section with user headline
if($_GET['section_type'] == 'text') {
$attributes['NAME'] = $_GET['section_text'];
}
// Add a new section with a module value headline
elseif($_GET['section_type'] == 'item') {
$attributes['NAME'] = '_' . $_GET['section_item'];
}
$entry = array(array('tag' => 'SECTION','type' => 'open','level' => '2','attributes' => $attributes),array('tag' => 'SECTION','type' => 'close','level' => '2'));
}
// Add new static text field
elseif($_GET['section_type'] == 'textbox') {
$entry = array(array('tag' => 'TEXT','type' => 'complete','level' => '2','value' => $_GET['text_text'])); $entry = array(array('tag' => 'TEXT','type' => 'complete','level' => '2','value' => $_GET['text_text']));
}
// Insert new field in structure // Insert new field in structure
array_splice($_SESSION['currentPDFStructure'],$_GET['add_position'],0,$entry); array_splice($_SESSION['currentPDFStructure'],$_GET['add_text_position'],0,$entry);
} }
} }
// add a new section with text headline
elseif(isset($_GET['add_sectionText'])) {
// Check if name for new section is specified when needed
if(!isset($_GET['section_text']) || ($_GET['section_text'] == '')) {
StatusMessage('ERROR',_('No section text specified'),_('The headline for a new section must contain at least one character.'));
}
else {
$attributes = array();
$attributes['NAME'] = $_GET['section_text'];
$entry = array(array('tag' => 'SECTION','type' => 'open','level' => '2','attributes' => $attributes),array('tag' => 'SECTION','type' => 'close','level' => '2'));
// Insert new field in structure
array_splice($_SESSION['currentPDFStructure'],$_GET['add_sectionText_position'],0,$entry);
}
}
// Add a new section with item as headline
elseif(isset($_GET['add_section'])) {
$attributes = array();
$attributes['NAME'] = '_' . $_GET['section_item'];
$entry = array(array('tag' => 'SECTION','type' => 'open','level' => '2','attributes' => $attributes),array('tag' => 'SECTION','type' => 'close','level' => '2'));
// Insert new field in structure
array_splice($_SESSION['currentPDFStructure'],$_GET['add_section_position'],0,$entry);
}
// Add a new value field // Add a new value field
elseif(isset($_GET['add_field'])) { elseif(isset($_GET['add_field'])) {
// Get available modules // Get available modules
@ -624,8 +626,8 @@ foreach($_SESSION['availablePDFFields'] as $module => $fields) {
<td colspan="3"> <td colspan="3">
<fieldset class="<?php echo $_GET['type']; ?>edit"> <fieldset class="<?php echo $_GET['type']; ?>edit">
<legend> <legend>
<b><?php echo _('Add section or static text');?></b> <b><?php echo _('New section');?></b>
</legend> </legend><BR>
<table> <table>
<tr> <tr>
<td> <td>
@ -636,21 +638,34 @@ foreach($_SESSION['availablePDFFields'] as $module => $fields) {
<table align="left" width="100%"> <table align="left" width="100%">
<tr> <tr>
<td> <td>
<input type="radio" name="section_type" value="text" checked> <?php echo _("Headline"); ?>: <input type="text" name="section_text">&nbsp;&nbsp;&nbsp;
</td> </td>
<td colspan="2"> <td>
<?php echo _("Name"); ?>: <input type="text" name="section_text"> <B><?php echo _('Position');?>: </B>
<select name="add_sectionText_position">
<?php echo $sections;?>
</select>
</td>
<td>
<input type="submit" name="add_sectionText" value="<?php echo _('Add');?>">
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="radio" name="section_type" value="item"> <?php echo _("Headline"); ?>:
</td>
<td>
<select name="section_item"> <select name="section_item">
<?php echo $section_items;?> <?php echo $section_items;?>
</select>&nbsp;&nbsp;&nbsp;
</td>
<td>
<B><?php echo _('Position');?>: </B>
<select name="add_section_position">
<?php echo $sections;?>
</select> </select>
</td> </td>
<td>
<input type="submit" name="add_section" value="<?php echo _('Add');?>">
</td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
@ -665,39 +680,27 @@ foreach($_SESSION['availablePDFFields'] as $module => $fields) {
<td> <td>
<fieldset class="<?php echo $_GET['type']; ?>edit"> <fieldset class="<?php echo $_GET['type']; ?>edit">
<legend> <legend>
<b><?php echo _("Static text"); ?></b> <b><?php echo _("Text field"); ?></b>
</legend> </legend>
<table width="100%"> <table width="100%">
<tr> <tr>
<td width="10"> <td>
<input type="radio" name="section_type" value="textbox"> <textarea name="text_text" rows="3" cols="40"></textarea>&nbsp;&nbsp;&nbsp;
</td> </td>
<td> <td>
<textarea name="text_text" rows="3" cols="40"></textarea> <B><?php echo _('Position');?>: </B>
<select name="add_text_position">
<?php echo $sections;?>
</select>
</td>
<td>
<input type="submit" name="add_text" value="<?php echo _('Add');?>">
</td> </td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
<tr>
<td>
<B><?php echo _('Position');?>: </B>
<select name="add_position">
<?php echo $sections;?>
</select>
<td>
</tr>
<tr>
<td colspan="2">
<br>
</td>
</tr>
<TR>
<td>
<input type="submit" name="add" value="<?php echo _('Add');?>">
</td>
</TR>
</table> </table>
</fieldset> </fieldset>
</td> </td>