From b6e87566be3c42f6aabf6543c0246ec5cacffbf8 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 23 Dec 2004 05:40:30 +0000 Subject: Add suport for pfstat.conf --- usr/local/www/pkg_edit.php | 63 ++++++++++++++++++++++++------------- usr/local/www/row_helper_dynamic.js | 2 +- 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index bbab6c7..459790d 100755 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -99,6 +99,9 @@ include("fbegin.inc"); // donotsave is enabled. lets simply exit. if($pkg['donotsave'] <> "") exit; + $firstfield = ""; + $rows = 0; + // store values in xml configration file. if (!$input_errors) { $pkgarr = array(); @@ -107,10 +110,17 @@ include("fbegin.inc"); // save rowhelper items. for($x=0; $x<99; $x++) { // XXX: this really should be passed from the form. foreach($fields['rowhelper']['rowhelperfield'] as $rowhelperfield) { + if($firstfield == "") { + $firstfield = $rowhelperfield['fieldname']; + } else { + if($firstfield == $rowhelperfield['fieldname']) $rows++; + } $comd = "\$value = \$_POST['" . $rowhelperfield['fieldname'] . $x . "'];"; + //echo($comd . "
"); eval($comd); if($value <> "") { - $comd = "\$pkgarr['rowhelper']['" . $rowhelperfield['fieldname'] . $y . "']['rowhelpervalue'][] = \"" . $value . "\";"; + $comd = "\$pkgarr['row'][" . $x . "]['" . $rowhelperfield['fieldname'] . "'] = \"" . $value . "\";"; + //echo($comd . "
"); eval($comd); } } @@ -185,33 +195,32 @@ $config = $config_tmp; \n"; - echo "
" . $pkga['description'] . "\n"; + if($pkga['size']) $size = " size='" . $pkga['size'] . "' "; + echo "\n"; + echo "
" . $pkga['description'] . "\n"; } else if($pkga['type'] == "password") { - echo "\n"; - echo "
" . $pkga['description'] . "\n"; + echo "\n"; + echo "
" . $pkga['description'] . "\n"; } else if($pkga['type'] == "select") { // XXX: TODO: set $selected if($pkga['size']) $size = " size='" . $pkga['size'] . "' "; if($pkga['multiple'] == "yes") $multiple = "MULTIPLE "; - echo "\n"; foreach ($pkga['options']['option'] as $opt) { echo "\t\n"; } - echo "\n"; - echo "
" . $pkga['description'] . "\n"; + echo "\n"; + echo "
" . $pkga['description'] . "\n"; } else if($pkga['type'] == "checkbox") { - echo "\n"; - echo "
" . $pkga['description'] . "\n"; + echo "\n"; + echo "
" . $pkga['description'] . "\n"; } else if($pkga['type'] == "textarea") { if($pkga['rows']) $rows = " rows='" . $pkga['rows'] . "' "; if($pkga['cols']) $cols = " cols='" . $pkga['cols'] . "' "; - echo "\n"; - echo "
" . $pkga['description'] . "\n"; + echo "\n"; + echo "
" . $pkga['description'] . "\n"; } else if($pkga['type'] == "radio") { - echo ""; + echo ""; } else if($pkga['type'] == "rowhelper") { ?> - - + " . $rowhelper['fielddescr'] . "\n"; + } + echo ""; + echo ""; + echo ""; // XXX: traverse saved fields, add back needed rows. echo ""; @@ -246,15 +260,17 @@ $config = $config_tmp; foreach($pkga['rowhelper']['rowhelperfield'] as $rowhelper) { $temp = ""; $text = ""; + $value = ""; + if($rowhelper['value'] <> "") $value = $rowhelper['value']; echo "\n"; @@ -305,6 +321,9 @@ $config = $config_tmp; } ?> + + +
\n"; if($rowhelper['type'] == "input") { - echo "\n"; + echo "\n"; } else if($rowhelper['type'] == "password") { - echo "\n"; + echo "\n"; } else if($rowhelper['type'] == "textarea") { - echo "\n"; + echo "\n"; } else if($rowhelper['type'] == "select") { - echo "\n"; foreach($rowhelper['options']['option'] as $rowopt) { $text .= ""; echo "\n"; @@ -269,7 +285,7 @@ $config = $config_tmp; echo "\n"; $trc++; } - $rowcounter++; + $rowcounter=0; echo ""; echo ""; echo "
 
  diff --git a/usr/local/www/row_helper_dynamic.js b/usr/local/www/row_helper_dynamic.js index 993e77a..64b34db 100755 --- a/usr/local/www/row_helper_dynamic.js +++ b/usr/local/www/row_helper_dynamic.js @@ -30,7 +30,7 @@ var addRowTo = (function() { } else if(rowtype[i] == 'checkbox') { td.innerHTML=" "; } else if(rowtype[i] == 'input') { - td.innerHTML=" "; + td.innerHTML=" "; } else if(rowtype[i] == 'password') { td.innerHTML=" "; } -- cgit v1.1