From 66b0edbdb696021c2aba7ac9752ecb2e930cc434 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 29 Mar 2005 16:10:30 +0000 Subject: [PATCH] added scope to parseHtml() and fixed loading of old values --- lam/lib/modules.inc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index f1713955..41aa847b 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -535,9 +535,10 @@ function doUploadPostActions($scope, $data, $ids, $failed) { * @param boolean $restricted If true then no buttons will be displayed * @param integer $tabindex Start value of tabulator index for input fields * @param integer $tabindexLink Start value of tabulator index for links +* @param string $scope Account type * @return array List of input field names and their type (name => type) */ -function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindexLink) { +function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindexLink, $scope) { $ret = array(); if (is_array($input)) { echo "\n"; @@ -569,14 +570,14 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex // checkbox if ($type == "checkbox") { if (isset($values[$input[$i][$j]['name']])) { - if ($values[$input[$i][$j]['name']] == "true") $output .= ' checked'; + if ($values[$input[$i][$j]['name']][0] == "true") $output .= ' checked'; } elseif ($input[$i][$j]['checked']) $output .= ' checked'; } // other input element else { if (isset($values[$input[$i][$j]['name']])) { - $output .= ' value="' . $values[$input[$i][$j]['name']] . '"'; + $output .= ' value="' . $values[$input[$i][$j]['name']][0] . '"'; } elseif ($input[$i][$j]['value']!='') $output .= ' value="' . $input[$i][$j]['value'] . '"'; } @@ -594,7 +595,7 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex case 'fieldset': echo "
\n"; if ($input[$i][$j]['legend']!='') echo "" . $input[$i][$j]['legend'] . "\n"; - parseHtml($module, $input[$i][$j]['value'], $values, $restricted, $tabindex, $tabindexLink); + parseHtml($module, $input[$i][$j]['value'], $values, $restricted, $tabindex, $tabindexLink, $scope); echo "
\n"; break; // selection @@ -641,11 +642,11 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex break; // sub table case 'table': - parseHtml($module, $input[$i][$j]['value'], $values, $restricted, $tabindex, $tabindexLink); + parseHtml($module, $input[$i][$j]['value'], $values, $restricted, $tabindex, $tabindexLink, $scope); break; // help link case 'help': - echo "" . _('Help') . "\n"; + echo "" . _('Help') . "\n"; $tabindexLink++; break; // status message @@ -917,7 +918,7 @@ class accountContainer { else $return = call_user_func(array($this->module[$this->order[$this->current_page]], 'display_html_'.$this->subpage), $post); $y = 5000; $z = 10000; - parseHtml($this->order[$this->current_page], $return, array(), false, $y, $z); + parseHtml($this->order[$this->current_page], $return, array(), false, $y, $z, $this->type); // Display rest of html-page echo "\n"; echo "
\n";