X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=1b73f1a40397d848dca2c422dbc123c4637e6a96;hb=a8c6e7e820741388aca1e6c42aed7f899b38c188;hp=6caa0abb3121e1f2911d1e991ead1566a860d71b;hpb=412b79dc32855f813d03a8a6dd9debd45bb308f5;p=fa-stable.git
diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc
index 6caa0abb..1b73f1a4 100644
--- a/includes/ui/ui_input.inc
+++ b/includes/ui/ui_input.inc
@@ -1,9 +1,14 @@
.
+***********************************************************************/
//
// Sets local POST value and adds Value to ajax posting if needed
//
@@ -32,24 +37,61 @@ function find_submit($prefix, $numeric=true)
}
return $numeric ? -1 : null;
}
+//------------------------------------------------------------------------------
+//
+// Helper function for simple db table editor pages
+//
+function simple_page_mode($numeric_id = true)
+{
+ global $Ajax, $Mode, $selected_id;
+
+ $default = $numeric_id ? -1 : '';
+ $selected_id = get_post('selected_id', $default);
+ foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET', 'CLONE') as $m) {
+ if (isset($_POST[$m])) {
+ $Ajax->activate('_page_body');
+ if ($m == 'RESET' || $m == 'CLONE')
+ $selected_id = $default;
+ unset($_POST['_focus']);
+ $Mode = $m; return;
+ }
+ }
+ foreach (array('Edit', 'Delete') as $m) {
+ foreach ($_POST as $p => $pvar) {
+ if (strpos($p, $m) === 0) {
+// $selected_id = strtr(substr($p, strlen($m)), array('%2E'=>'.'));
+ unset($_POST['_focus']); // focus on first form entry
+ $selected_id = quoted_printable_decode(substr($p, strlen($m)));
+ $Ajax->activate('_page_body');
+ $Mode = $m;
+ return;
+ }
+ }
+ }
+ $Mode = '';
+}
//------------------------------------------------------------------------------
//
// Read numeric value from user formatted input
//
-function input_num($postname=null)
+function input_num($postname=null, $dflt=null)
{
- if (!isset($_POST[$postname]))
- return null;
+ if (!isset($_POST[$postname]) || $_POST[$postname] == "")
+ return $dflt;
return user_numeric($_POST[$postname]);
}
//---------------------------------------------------------------------------------
-function hidden($name, $value, $echo=true)
+function hidden($name, $value=null, $echo=true)
{
global $Ajax;
+
+ if ($value === null)
+ $value = get_post($name);
+
$ret = "";
$Ajax->addUpdate($name, $name, $value);
if ($echo)
@@ -57,74 +99,120 @@ function hidden($name, $value, $echo=true)
else
return $ret;
}
-
-//---------------------------------------------------------------------------------
-
-function submit($name, $value, $echo=true, $title=false, $async=false)
-{
- default_focus($name);
- $submit_str = "\n";
+ .">"
+ .($icon ? "" : '')
+ ."$value"
+ ."\n";
if ($echo)
echo $submit_str;
else
return $submit_str;
}
-function submit_center($name, $value, $echo=true, $title=false, $async=false)
+function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
{
echo "