diff --git a/lam/templates/pdfedit/pdfpage.php b/lam/templates/pdfedit/pdfpage.php index 53117943..5ca0dcf1 100644 --- a/lam/templates/pdfedit/pdfpage.php +++ b/lam/templates/pdfedit/pdfpage.php @@ -23,6 +23,14 @@ $Id$ */ +/** +* Displays the main page of the PDF editor where the user can select the displayed entries. +* +* @author Michael Dürgner +* @author Roland Gruber +* @package PDF +*/ + include_once('../../lib/pdfstruct.inc'); include_once('../../lib/ldap.inc'); include_once('../../lib/config.inc'); @@ -49,6 +57,7 @@ if(isset($_POST['type'])) { } } + // Abort and go back to main pdf structure page if(isset($_GET['abort'])) { metarefresh('pdfmain.php'); @@ -69,16 +78,16 @@ elseif(isset($_GET['submit'])) { // Add a new section or static text elseif(isset($_GET['add'])) { // Check if name for new section is specified when needed - if($_GET['add_type'] == 'section' && $_GET['section_type'] == 'text' && (!isset($_GET['section_text']) || $_GET['section_text'] == '')) { + 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 - elseif($_GET['add_type'] == 'text' && (!isset($_GET['text_text']) || $_GET['text_text'] == '')) { + elseif($_GET['section_type'] == 'textbox' && (!isset($_GET['text_text']) || $_GET['text_text'] == '')) { StatusMessage('ERROR',_('No static text specified'),_('The static text must contain at least one character.')); } else { // Add a new section - if($_GET['add_type'] == 'section') { + if(($_GET['section_type'] == 'item') || ($_GET['section_type'] == 'text')) { $attributes = array(); // Add a new section with user headline if($_GET['section_type'] == 'text') { @@ -91,7 +100,7 @@ elseif(isset($_GET['add'])) { $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['add_type'] == 'text') { + elseif($_GET['section_type'] == 'textbox') { $entry = array(array('tag' => 'TEXT','type' => 'complete','level' => '2','value' => $_GET['text_text'])); } // Insert new field in structure @@ -300,71 +309,24 @@ elseif(isset($_GET['down'])) { $_SESSION['currentPDFStructure'][$_GET['down'] + 1] = $tmp; } } -// TODO implement page handling -elseif(isset($_POST['page'])) { - if($_POST['logoFile'] != 'printLogo.jpg' && $_POST['logoFile'] != $_SESSION['currentPageDefinitions']['filename']) { - $_SESSION['currentPageDefinitions']['filename'] = $_POST['logoFile']; - } - if($_POST['logo-width'] != '50' && $_POST['logo-width'] != $_SESSION['currentPageDefinitions']['logo-width']) { - if($_POST['logo-width'] <= 50 && $_POST['logo-width'] > 0) { - $_SESSION['currentPageDefinitions']['logo-width'] = $_POST['logo-width']; - } - } - if($_POST['logo-height'] != '20' && $_POST['logo-height'] != $_SESSION['currentPageDefinitions']['logo-height']) { - if($_POST['logo-height'] <= 20 && $_POST['logo-height'] > 0) { - $_SESSION['currentPageDefinitions']['logo-height'] = $_POST['logo-height']; - } - } - if(isset($_POST['logo-max']) && !isset($_SESSION['currentPageDefinitions']['logo-max'])) { - $_SESSION['currentPageDefinitions']['logo-max'] = true; - } - if($_POST['headline'] != 'LDAP Account Manager' && $_POST['headline'] != $_SESSION['currentPageDefinitions']['headline']) { - $_SESSION['currentPageDefinitions']['headline'] = str_replace('<','',str_replace('>','',$_POST['headline'])); - } - if($_POST['margin-top'] != '10.0' && $_SESSION['currentPageDefinitions']['margin-top'] != $_POST['margin-top']) { - $_SESSION['currentPageDefinitions']['margin-top'] = $_POST['margin-top']; - } - if($_POST['margin-bottom'] != '20.0' && $_SESSION['currentPageDefinitions']['margin-bottom'] != $_POST['margin-bottom']) { - $_SESSION['currentPageDefinitions']['margin-bottom'] = $_POST['margin-bottom']; - } - if($_POST['margin-left'] != '10.0' && $_SESSION['currentPageDefinitions']['margin-left'] != $_POST['margin-left']) { - $_SESSION['currentPageDefinitions']['margin-left'] = $_POST['margin-left']; - } - if($_POST['margin-right'] != '10.0' && $_SESSION['currentPageDefinitions']['margin-right'] != $_POST['margin-right']) { - $_SESSION['currentPageDefinitions']['margin-right'] = $_POST['margin-right']; - } - if(isset($_POST['defaults'])) { - foreach($_POST['defaults'] as $default) { - switch($default) { - case 'logoFile': - unset($_SESSION['currentPageDefinitions']['filename']); - break; - case 'logoSize': - unset($_SESSION['currentPageDefinitions']['logo-width']); - unset($_SESSION['currentPageDefinitions']['logo-height']); - unset($_SESSION['currentPageDefinitions']['logo-max']); - break; - case 'headline': - unset($_SESSION['currentPageDefinitions']['headline']); - break; - case 'margin-top': - unset($_SESSION['currentPageDefinitions']['margin-top']); - break; - case 'margin-bottom': - unset($_SESSION['currentPageDefinitions']['margin-bottom']); - break; - case 'margin-left': - unset($_SESSION['currentPageDefinitions']['margin-left']); - break; - case 'margin-right': - unset($_SESSION['currentPageDefinitions']['margin-right']); - break; - default: - break; - } - } - if(count($_SESSION['currentPageDefinitions']['margin']) == 0) { - unset($_SESSION['currentPageDefinitions']['margin']); + +if ((isset($_GET['headline'])) && ($_GET['logoFile'] != $_SESSION['currentPageDefinitions']['filename'])) { + $_SESSION['currentPageDefinitions']['filename'] = $_GET['logoFile']; +} +if ((isset($_GET['headline'])) && ($_GET['headline'] != $_SESSION['currentPageDefinitions']['headline'])) { + $_SESSION['currentPageDefinitions']['headline'] = str_replace('<','',str_replace('>','',$_GET['headline'])); +} +if(isset($_POST['defaults'])) { + foreach($_POST['defaults'] as $default) { + switch($default) { + case 'logoFile': + unset($_SESSION['currentPageDefinitions']['filename']); + break; + case 'headline': + unset($_SESSION['currentPageDefinitions']['headline']); + break; + default: + break; } } } @@ -400,7 +362,7 @@ foreach($_SESSION['availablePDFFields'] as $module => $values) { $modules[] = $module; foreach($values as $attribute) { $section_items_array[] = $module . '_' . $attribute; - $section_items .= "\t\t\t\t\t\t\t\t\t\t\t\t\n"; + $section_items .= "\n"; } } $modules = join(',',$modules); @@ -408,7 +370,7 @@ $modules = join(',',$modules); $logoFiles = getAvailableLogos(); $logos = '\n"; foreach($logoFiles as $logoFile) { - $logos .= "\t\t\t\t\t\t\t\t\t\t\t\n"; + $logos .= "\n"; } // print header @@ -421,75 +383,14 @@ echo $_SESSION['header'];
- +
- - \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n"; + $links = "\n" . + "\n" . + "\n" . + "\n" . + "\n"; // We have a new section to start if($entry['tag'] == "SECTION" && $entry['type'] == "open") { $name = $entry['attributes']['NAME']; @@ -694,46 +569,73 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) { // Print save and abort buttons ?>
+
- - - - - - - - - - - - - +
- : - - - - - - -
- -

-

- - - - - - - - - - - - - - - - -
- - - cm -
- - - cm -
- > - - -
-
-

-
- -
- + +
: @@ -502,58 +403,16 @@ echo $_SESSION['header'];
-
- - - - - - - - - - - - - - - - - - - - - - - - -
- : - - - - -
- : - - - - -
- : - - - - -
- : - - - - -
-
+
+ : + + + +
@@ -567,7 +426,7 @@ echo $_SESSION['header'];
+
@@ -578,7 +437,23 @@ $sections = '\n"; // Print every entry in the current structure foreach($_SESSION['currentPDFStructure'] as $key => $entry) { // Create the up/down/remove links - $links = "\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\""\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\""\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\""\n\t\t\t\t\t\t\t\t\t\n" . + "\""\n\n\n" . + "\""\n\n\n" . + "\""\n
+ +

 

+ + + + + + + + +
+ + + + + $fields) { + ?> + + + + + + + + + + + +
+ +
+ + +
+
+
+
+ + + +
- - + +
- - - - - - - - @@ -768,9 +670,6 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) { - + + + + + + + +
- -
- - - - - - - - -
- : - - -
-
-
- - -
-
-
- -
@@ -745,7 +647,7 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
- + :
- -
@@ -779,19 +678,40 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
+ - +
+ : + + +
+
+
+ +
- -

 

+ + + +
@@ -840,54 +760,6 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
- - - - - - - -
- - - - - $fields) { - ?> - - - - - - - - - - - -
- -
- - -
-
-
-
-