X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_input.inc;h=9ae512b5910ed2111eef9d4fef0f1fdcecdf99fc;hb=063c5f22068dbbd6adccacaf5bd0f66b2eda8e4f;hp=391cd7fc5a4e0952b10ee5878ce842478e23f39e;hpb=872e4d4be9935e50cb58b1408bbe9ae2300ec8ca;p=fa-stable.git
diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc
index 391cd7fc..9ae512b5 100644
--- a/includes/ui/ui_input.inc
+++ b/includes/ui/ui_input.inc
@@ -37,6 +37,7 @@ function find_submit($prefix, $numeric=true)
}
return $numeric ? -1 : null;
}
+
//------------------------------------------------------------------------------
//
// Helper function for simple db table editor pages
@@ -112,7 +113,7 @@ function hidden($name, $value=null, $echo=true)
'selector' - ditto with closing current popup editor window
'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL
'process' - displays progress bar during call; optional icon
-
+ 'nonajax' - ditto, non-ajax submit
$atype can contain also multiply type selectors separated by space,
however make sense only combination of 'process' and one of defualt/selector/cancel
*/
@@ -141,6 +142,9 @@ function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=fal
case 'cancel':
if ($icon===false) $icon=ICON_ESCAPE; break;
+
+ case 'nonajax':
+ $atype = false;
}
}
}
@@ -247,17 +251,24 @@ function submit_return($name, $value, $title=false)
}
}
-function submit_js_confirm($name, $msg) {
- add_js_source(
- "_validate.$name=function(){ return confirm('"
- . strtr($msg, array("\n"=>'\\n')) . "');};");
-};
+function submit_js_confirm($name, $msg, $set = true) {
+ global $Ajax;
+ $js = "_validate.$name=".($set ? "function(){ return confirm('"
+ . strtr($msg, array("\n"=>'\\n')) . "');};"
+ : 'null;');
+ if (in_ajax()) {
+ $Ajax->addScript(true, $js);
+ } else
+ add_js_source($js);
+}
//-----------------------------------------------------------------------------------
function set_icon($icon, $title=false)
{
global $path_to_root;
- return "\n";
+ if (basename($icon) === $icon) // standard icons does not contain path separator
+ $icon = "$path_to_root/themes/".user_theme()."/images/$icon";
+ return "\n";
}
function button($name, $value, $title=false, $icon=false, $aspect='')
@@ -273,16 +284,18 @@ function button($name, $value, $title=false, $icon=false, $aspect='')
{
if ($value == _("Delete")) // Helper during implementation
$icon = ICON_DELETE;
- return "