X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=b27f5fde11ae787a486fc4fa73ecce2556dca591;hb=9478a0cdeaf9201d2f3947e11e58d90354050025;hp=3817bc9f2606f817b1d12513d6af34b208f803cd;hpb=b1c79afd0a78ec37ff813f1305e9e0804be78ef3;p=fa-stable.git
diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc
index 3817bc9f..b27f5fde 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
//
@@ -42,11 +47,12 @@ function simple_page_mode($numeric_id = true)
$default = $numeric_id ? -1 : '';
$selected_id = get_post('selected_id', $default);
- foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET') as $m) {
+ foreach (array('ADD_ITEM', 'UPDATE_ITEM', 'RESET', 'CLONE') as $m) {
if (isset($_POST[$m])) {
$Ajax->activate('_page_body');
- if ($m == 'RESET')
+ if ($m == 'RESET' || $m == 'CLONE')
$selected_id = $default;
+ unset($_POST['_focus']);
$Mode = $m; return;
}
}
@@ -69,9 +75,9 @@ function simple_page_mode($numeric_id = true)
//
// Read numeric value from user formatted input
//
-function input_num($postname=null, $dflt=null)
+function input_num($postname=null, $dflt=0)
{
- if (!isset($_POST[$postname]))
+ if (!isset($_POST[$postname]) || $_POST[$postname] == "")
return $dflt;
return user_numeric($_POST[$postname]);
@@ -93,21 +99,52 @@ function hidden($name, $value=null, $echo=true)
else
return $ret;
}
-
-function submit($name, $value, $echo=true, $title=false, $async=false, $icon=false)
+/*
+ Universal submit form button.
+ $atype - type of submit:
+ Normal submit:
+ false - normal button; optional icon
+ null - button visible only in fallback mode; optional icon
+ Ajax submit:
+ true - standard button; optional icon
+ 'process' - displays progress bar during call; optional icon
+ 'default' - default form submit on Ctrl-Enter press; dflt ICON_OK icon
+ 'selector' - ditto with closing current popup editor window
+ 'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL
+*/
+function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=false)
{
global $path_to_root;
-
- default_focus($name);
+
+ $aspect='';
+ if (!is_bool($atype)) // necessary: switch uses '=='
+ switch($atype) {
+ case 'process':
+ $aspect = " aspect='process'"; break;
+ case 'selector':
+ $aspect = " aspect='selector' rel = '$value'";
+ $value = _("Select");
+ if ($icon===false) $icon=ICON_SUBMIT; break;
+ case 'default':
+ $aspect = " aspect='default'";
+ if ($icon===false) $icon=ICON_SUBMIT; break;
+ case 'cancel':
+ $aspect = " aspect='cancel'";
+ if ($icon===false) $icon=ICON_ESCAPE; break;
+ case null:
+ $aspect = fallback_mode() ?
+ " aspect='fallback'" : " style='display:none;'"; break;
+ }
+
$submit_str = "\n";
if ($echo)
echo $submit_str;
@@ -117,9 +154,9 @@ function submit($name, $value, $echo=true, $title=false, $async=false, $icon=fal
function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
{
- echo "