X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=inline;f=includes%2Fui%2Fui_input.inc;h=59064f82de031820d3c698b0995031687840cfad;hb=b17df731b4bb055c2fdd568bc4be9e5caa0ee07b;hp=65ac068fd5acea5f2850e137973a53e05057a085;hpb=5ceece3a1a031ad1dbfbcb11d3aabfca97a56f6b;p=fa-stable.git
diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc
index 65ac068f..59064f82 100644
--- a/includes/ui/ui_input.inc
+++ b/includes/ui/ui_input.inc
@@ -1,4 +1,14 @@
.
+***********************************************************************/
function get_post($name, $dflt='')
{
@@ -53,7 +63,9 @@ function simple_page_mode($numeric_id = true)
foreach (array('Edit', 'Delete') as $m) {
foreach ($_POST as $p => $pvar) {
if (strpos($p, $m) === 0) {
- $selected_id = substr($p, strlen($m));
+// $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;
@@ -69,7 +81,7 @@ function simple_page_mode($numeric_id = true)
//
function input_num($postname=null, $dflt=null)
{
- if (!isset($_POST[$postname]))
+ if (!isset($_POST[$postname]) || $_POST[$postname] == "")
return $dflt;
return user_numeric($_POST[$postname]);
@@ -92,50 +104,45 @@ function hidden($name, $value=null, $echo=true)
return $ret;
}
-//---------------------------------------------------------------------------------
-// Submit button.
-// $async parameter can have 3 values:
-// null - fallback button not visible in js enabled mode
-// false - normal submit via form action
-// true - when js is on submition via ajax call
-// 'process' - ditto with processing indicator in msgbox
-//
-function submit($name, $value, $echo=true, $title=false, $async=false)
+function submit($name, $value, $echo=true, $title=false, $async=false, $icon=false)
{
-
+ global $path_to_root;
+
default_focus($name);
- $submit_str = "\n";
+ .">$value"
+ .($icon ? "
" : '')
+ ."\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 "
";
- submit($name, $value, $echo, $title, $async);
+ submit($name, $value, $echo, $title, $async, $icon);
echo "";
}
-function submit_center_first($name, $value, $title=false, $async=false)
+function submit_center_first($name, $value, $title=false, $async=false, $icon=false)
{
echo "";
- submit($name, $value, true, $title, $async);
+ submit($name, $value, true, $title, $async, $icon);
echo " ";
}
-function submit_center_last($name, $value, $title=false, $async=false)
+function submit_center_last($name, $value, $title=false, $async=false, $icon=false)
{
echo " ";
- submit($name, $value, true, $title, $async);
+ submit($name, $value, true, $title, $async, $icon);
echo "";
}
@@ -189,8 +196,15 @@ function submit_row($name, $value, $right=true, $extra="", $title=false, $async=
submit_cells($name, $value, $extra, $title, $async);
echo "\n";
}
-//---------------------------------------------------------------------------------
+function submit_return($name, $value, $title=false, $async=false)
+{
+ if (count($_SESSION['Context'])) {
+ submit($name, $value, true, $title, $async);
+ }
+}
+//---------------------------------------------------------------------------------
+/*
function button($name, $value, $onclick, $title=false)
{
default_focus($name);
@@ -205,7 +219,7 @@ function button_cell($name, $value, $onclick, $title=false)
button($name, $value, $onclick, $title);
echo "\n";
}
-
+*/
//-----------------------------------------------------------------------------------
function check_value($name)
@@ -290,7 +304,7 @@ function percent_cell($label, $bold=false, $id=null)
// 2008-06-15. Changed
function qty_cell($label, $bold=false, $dec=null, $id=null)
{
- if ($dec == null)
+ if (!isset($dec))
$dec = get_qty_dec();
if ($bold)
label_cell("".number_format2($label, $dec)."", "nowrap align=right", $id);
@@ -298,17 +312,17 @@ function qty_cell($label, $bold=false, $dec=null, $id=null)
label_cell(number_format2($label, $dec), "nowrap align=right", $id);
}
-function label_cells($label, $value, $params="", $params2="")
+function label_cells($label, $value, $params="", $params2="", $id='')
{
if ($label != null)
echo "$label | \n";
- echo "$value | \n";
+ label_cell($value, $params2, $id);
}
-function label_row($label, $value, $params="", $params2="", $leftfill=0)
+function label_row($label, $value, $params="", $params2="", $leftfill=0, $id='')
{
echo "";
- label_cells($label, $value, $params, $params2);
+ label_cells($label, $value, $params, $params2, $id);
if ($leftfill!=0)
echo " | ";
echo "
\n";
@@ -390,7 +404,8 @@ function text_row_ex($label, $name, $size, $max=null, $title=null, $value=null,
//-----------------------------------------------------------------------------------
-function date_cells($label, $name, $title = null, $init=null, $inc_days=0, $inc_months=0, $inc_years=0, $params=null)
+function date_cells($label, $name, $title = null, $init=null, $inc_days=0,
+ $inc_months=0, $inc_years=0, $params=null, $submit_on_change=false)
{
global $use_date_picker, $path_to_root;
if (!isset($_POST[$name]) || $_POST[$name] == "")
@@ -419,13 +434,15 @@ function date_cells($label, $name, $title = null, $init=null, $inc_days=0, $inc_
. "
\n";
else
$post_label = "";
- text_cells_ex($label, $name, 9, 12, $_POST[$name], $title, $params, $post_label);
+ text_cells_ex($label, $name, 9, 12, $_POST[$name], $title, $params, $post_label, $submit_on_change);
}
-function date_row($label, $name, $title=null, $init=null, $inc_days=0, $inc_months=0, $inc_years=0, $params=null)
+function date_row($label, $name, $title=null, $init=null, $inc_days=0, $inc_months=0,
+ $inc_years=0, $params=null, $submit_on_change=false)
{
echo "";
- date_cells($label, $name, $title, $init, $inc_days, $inc_months, $inc_years, $params);
+ date_cells($label, $name, $title, $init, $inc_days, $inc_months,
+ $inc_years, $params, $submit_on_change);
echo "
\n";
}
@@ -481,9 +498,10 @@ function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=nu
echo "";
- if ($post_label)
- echo " " . $post_label;
-
+ if ($post_label) {
+ echo " $post_label";
+ $Ajax->addUpdate($name, '_'.$name.'_label', $post_label);
+ }
echo "\n";
$Ajax->addUpdate($name, $name, $_POST[$name]);
$Ajax->addAssign($name, $name, 'dec', $dec);