From c27422f2a8f77664230dc050b948b6dee24bc08c Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 23 Mar 2008 14:20:23 +0000 Subject: [PATCH] redesigned adding of fields --- lam/templates/pdfedit/pdfpage.php | 159 ++++++++++-------------------- 1 file changed, 54 insertions(+), 105 deletions(-) diff --git a/lam/templates/pdfedit/pdfpage.php b/lam/templates/pdfedit/pdfpage.php index a96a7cf6..e466c57a 100644 --- a/lam/templates/pdfedit/pdfpage.php +++ b/lam/templates/pdfedit/pdfpage.php @@ -142,36 +142,23 @@ elseif(isset($_GET['add_section'])) { array_splice($_SESSION['currentPDFStructure'],$_GET['add_section_position'],0,$entry); } // Add a new value field -elseif(isset($_GET['add_field'])) { - // Get available modules - $modules = explode(',',$_GET['modules']); - $fields = array(); - // Search each module for selected values - foreach($modules as $module) { - if(isset($_GET[$module])) { - foreach($_GET[$module] as $field) { - // Create ne value entry - $fields[] = array('tag' => 'ENTRY','type' => 'complete','level' => '3','attributes' => array('NAME' => $module . '_' . $field)); - } - } +elseif(isset($_GET['add_new_field'])) { + $field = array('tag' => 'ENTRY','type' => 'complete','level' => '3','attributes' => array('NAME' => $_GET['new_field'])); + $pos = 0; + // Find begin section to insert into + while($pos < $_GET['add_field_position']) { + next($_SESSION['currentPDFStructure']); + $pos++; } - if(count($fields) > 0) { - $pos = 0; - // Find begin section to insert into - while($pos < $_GET['section']) { - next($_SESSION['currentPDFStructure']); - $pos++; - } + $current = next($_SESSION['currentPDFStructure']); + $pos++; + // End of section to insert into + while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') { $current = next($_SESSION['currentPDFStructure']); $pos++; - // End of section to insert into - while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') { - $current = next($_SESSION['currentPDFStructure']); - $pos++; - } - // Insert new entry before closing section tag - array_splice($_SESSION['currentPDFStructure'],$pos,0,$fields); } + // Insert new entry before closing section tag + array_splice($_SESSION['currentPDFStructure'],$pos,0,array($field)); } // Change section headline elseif(isset($_GET['change'])) { @@ -414,28 +401,29 @@ echo $_SESSION['header'];


- +
' . _('Beginning') . "\n"; $nonTextSections = ''; // Print every entry in the current structure foreach($_SESSION['currentPDFStructure'] as $key => $entry) { // Create the up/down/remove links - $links = "\n" . - "\n" . - "\n"; + "\""\n\n" . + ""; // We have a new section to start if($entry['tag'] == "SECTION" && $entry['type'] == "open") { $name = $entry['attributes']['NAME']; @@ -448,10 +436,7 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) { $nonTextSections .= '\n"; ?> - - - @@ -508,9 +493,7 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) { $sections .= '\n"; ?> - - - - - - + + + + @@ -539,8 +525,6 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) { $name = $entry['attributes']['NAME']; ?> - - - - - @@ -717,7 +666,7 @@ foreach($_SESSION['availablePDFFields'] as $module => $fields) {
- +
\n\n" . "\""\n\n\n" . "\""\n\n\n" . - "\""\n
- - + $entry) { $sections .= '\n"; ?>
+
- + @@ -518,16 +501,19 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
- - - + +
+ + + +

- @@ -561,60 +545,6 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {

 

- - -
- - - - - $fields) { - ?> - - - - - - - - - - - -
- -
- - -
-
-
-
-
@@ -705,11 +635,30 @@ foreach($_SESSION['availablePDFFields'] as $module => $fields) {
+ : - - + + +