diff options
-rwxr-xr-x | usr/local/www/pkg.php | 4 | ||||
-rwxr-xr-x | usr/local/www/pkg_edit.php | 82 | ||||
-rwxr-xr-x | usr/local/www/pkg_mgr_install.php | 5 |
3 files changed, 63 insertions, 28 deletions
diff --git a/usr/local/www/pkg.php b/usr/local/www/pkg.php index 1b9e147..2532261 100755 --- a/usr/local/www/pkg.php +++ b/usr/local/www/pkg.php @@ -45,6 +45,10 @@ if($xml == "") { $pkg = parse_xml_config_pkg("/usr/local/pkg/" . $xml, "packagegui"); } +if($pkg['donotsave'] <> "") { + header("Location: pkg_edit.php?xml=" . $xml); +} + $package_name = $pkg['menu']['name']; $section = $pkg['menu']['section']; $config_path = $pkg['configpath']; diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index 1d3ed5a..c7d1b01 100755 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -53,7 +53,7 @@ if($xml == "") { $package_name = $pkg['menu']['name']; $section = $pkg['menu']['section']; $config_path = $pkg['configpath']; -$title = $section . ": Edit " . $package_name; +$title = $section . ": " . $package_name; $id = $_GET['id']; if (isset($_POST['id'])) @@ -73,10 +73,31 @@ if ($_POST) { write_config(); } else { if($pkg['custom_add_php_command']) { - eval($pkg['custom_add_php_command']); + if($pkg['donotsave'] <> "") { + ?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title><?=gentitle_pkg($title);?></title> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<link href="gui.css" rel="stylesheet" type="text/css"> +</head> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php +include("fbegin.inc"); +?> +<p class="pgtitle"><?=$title?></p> + <?php + } + if($pkg['preoutput']) echo "<pre>"; + eval($pkg['custom_add_php_command']); + if($pkg['preoutput']) echo "</pre>"; } } + if($pkg['donotsave'] <> "") exit; + // store values in xml configration file. if (!$input_errors) { $pkgarr = array(); @@ -120,45 +141,54 @@ $config = $config_tmp; <input type="hidden" name="xml" value="<?= $xml ?>"> <?php if ($savemsg) print_info_box($savemsg); ?> + <br> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <?php $cols = 0; - foreach ($pkg['fields']['field'] as $pkg) { ?> + $savevalue = "Save"; + if($pkg['savetext'] <> "") $savevalue = $pkg['savetext']; + foreach ($pkg['fields']['field'] as $pkga) { ?> </tr> <tr valign="top"> <td width="22%" class="vncellreq"> - <?= $pkg['fielddescr'] ?> + <?= $pkga['fielddescr'] ?> </td> <td class="vtable"> <?php - if($pkg['type'] == "input") { + + if($pkga['type'] == "input") { // XXX: TODO: set $value - if($pkg['size']) $size = " size='" . $pkg['size'] . "' "; - echo "<input " . $size . " name='" . $pkg['fieldname'] . "' value='" . $value . "'>\n"; - echo "<br>" . $pkg['description'] . "\n"; - } else if($pkg['type'] == "password") { - echo "<input type='password' " . $size . " name='" . $pkg['fieldname'] . "' value='" . $value . "'>\n"; - echo "<br>" . $pkg['description'] . "\n"; - } else if($pkg['type'] == "select") { + if($pkga['size']) $size = " size='" . $pkga['size'] . "' "; + echo "<input " . $size . " name='" . $pkga['fieldname'] . "' value='" . $value . "'>\n"; + echo "<br>" . $pkga['description'] . "\n"; + } else if($pkga['type'] == "password") { + echo "<input type='password' " . $size . " name='" . $pkga['fieldname'] . "' value='" . $value . "'>\n"; + echo "<br>" . $pkga['description'] . "\n"; + } else if($pkga['type'] == "select") { // XXX: TODO: set $selected - if($pkg['size']) $size = " size='" . $pkg['size'] . "' "; - if($pkg['multiple'] == "yes") $multiple = "MULTIPLE "; - echo "<select " . $multiple . $size . "id='" . $pkg['fieldname'] . "' name='" . $pkg['fieldname'] . "'>\n"; - foreach ($pkg['options']['option'] as $opt) { + if($pkga['size']) $size = " size='" . $pkga['size'] . "' "; + if($pkga['multiple'] == "yes") $multiple = "MULTIPLE "; + echo "<select " . $multiple . $size . "id='" . $pkga['fieldname'] . "' name='" . $pkga['fieldname'] . "'>\n"; + foreach ($pkga['options']['option'] as $opt) { echo "\t<option name='" . $opt['name'] . "' value='" . $opt['value'] . "'>" . $opt['name'] . "</option>\n"; } echo "</select>\n"; - echo "<br>" . $pkg['description'] . "\n"; - } else if($pkg['type'] == "checkbox") { - echo "<input type='checkbox' name='" . $pkg['fieldname'] . "' value='" . $value . "'>\n"; - echo "<br>" . $pkg['description'] . "\n"; - } else if($pkg['type'] == "textarea") { - if($pkg['rows']) $rows = " rows='" . $pkg['rows'] . "' "; - if($pkg['cols']) $cols = " cols='" . $pkg['cols'] . "' "; - echo "<textarea " . $rows . $cols . " name='" . $pkg['fieldname'] . "'>" . $value . "</textarea>\n"; - echo "<br>" . $pkg['description'] . "\n"; + echo "<br>" . $pkga['description'] . "\n"; + } else if($pkga['type'] == "checkbox") { + echo "<input type='checkbox' name='" . $pkga['fieldname'] . "' value='" . $value . "'>\n"; + echo "<br>" . $pkga['description'] . "\n"; + } else if($pkga['type'] == "textarea") { + if($pkga['rows']) $rows = " rows='" . $pkga['rows'] . "' "; + if($pkga['cols']) $cols = " cols='" . $pkga['cols'] . "' "; + echo "<textarea " . $rows . $cols . " name='" . $pkga['fieldname'] . "'>" . $value . "</textarea>\n"; + echo "<br>" . $pkga['description'] . "\n"; + } else if($pkga['type'] == "radio") { + echo "<input type='radio' name='" . $pkga['fieldname'] . "' value='" . $value . "'>"; } + + if($pkga['typehint']) echo " " . $pkga['typehint']; ?> </td> </tr> @@ -169,7 +199,7 @@ $config = $config_tmp; <tr> <td width="22%" valign="top"> </td> <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="Save"> + <input name="Submit" type="submit" class="formbtn" value="<?= $savevalue ?>"> <?php if (isset($id) && $a_pkg[$id]): ?> <input name="id" type="hidden" value="<?=$id;?>"> <?php endif; ?> diff --git a/usr/local/www/pkg_mgr_install.php b/usr/local/www/pkg_mgr_install.php index d4e8d7e..688809c 100755 --- a/usr/local/www/pkg_mgr_install.php +++ b/usr/local/www/pkg_mgr_install.php @@ -228,6 +228,7 @@ mwexec("mkdir /usr/local/www/ext/Interfaces >/dev/null 2>&1"); mwexec("mkdir /usr/local/www/ext/Firewall >/dev/null 2>&1"); mwexec("mkdir /usr/local/www/ext/VPN >/dev/null 2>&1"); mwexec("mkdir /usr/local/www/ext/Status >/dev/null 2>&1"); +mwexec("mkdir /usr/local/www/ext/Diagnostics >/dev/null 2>&1"); update_progress_bar($pb_percent); $pb_percent += 10; @@ -338,7 +339,7 @@ if(file_exists("/usr/local/pkg/" . $pkgent['name'] . ".xml")) { // install menu item into the ext folder fwrite($fd_log, "Adding menu option to " . $package_conf['menu']['section'] . "/" . $package_conf['menu']['name'] . "\n"); $fd = fopen("/usr/local/www/ext/" . $package_conf['menu']['section'] . "/" . $package_conf['menu']['name'] , "w"); - fwrite($fd, "/usr/local/www/pkg.php?xml=" . $package_conf['name'] . ".xml\n"); + fwrite($fd, "/pkg.php?xml=" . $package_conf['name'] . ".xml\n"); fclose($fd); } else { update_output_window("WARNING! /usr/local/pkg/" . $pkgent['name'] . ".xml" . " does not exist!\n"); @@ -385,7 +386,7 @@ while(!feof($fd_log)) { } fclose($fd_log); $log = ereg_replace("\n", "\\n", $tmp); -echo "\n<script language=\"JavaScript\">this.document.forms[0].output.value = \"" . $log . "\";</script>"; +//echo "\n<script language=\"JavaScript\">this.document.forms[0].output.value = \"" . $log . "\";</script>"; update_progress_bar(100); |