Optional processing progressbar for submit buttons
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 18 Jul 2008 22:54:55 +0000 (22:54 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 18 Jul 2008 22:54:55 +0000 (22:54 +0000)
includes/ui/ui_input.inc
includes/ui/ui_lists.inc
js/inserts.js

index b775ede018e5b8ae68d83ae3f734f3e812043bc3..65ac068fd5acea5f2850e137973a53e05057a085 100644 (file)
@@ -95,9 +95,10 @@ function hidden($name, $value=null, $echo=true)
 //---------------------------------------------------------------------------------
 //     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
-//             null - fallback button not visible in js enabled mode
+//             'process' - ditto with processing indicator in msgbox
 //
 function submit($name, $value, $echo=true, $title=false, $async=false)
 {
@@ -106,7 +107,8 @@ function submit($name, $value, $echo=true, $title=false, $async=false)
        $submit_str = "<input type=\"submit\" class=\""
            .($async ? 'ajaxsubmit' : 'inputsubmit')
                ."\""
-               .($async === null ? (in_ajax() ? " style='display:none;'" : ' fallback="1"' ): '')
+               .($async === null ? (in_ajax() ? " style='display:none;'" : ' aspect="fallback"' ): 
+                       ($async === 'process' ? 'aspect="process"' : '') )
            ." name=\"$name\"  id=\"$name\" value=\"$value\""
            .($title ? " title='$title'" : '')
            .">\n";
index c654fafba709dde4350f74a754a4ce3d5473f8b0..67d95b97219f84953d69e2b0b9f0cd36a45e3c92 100644 (file)
@@ -6,10 +6,10 @@ include_once($path_to_root . "/includes/types.inc");
 include_once($path_to_root . "/includes/current_user.inc");
 
 $_search_button = "<input %s type='submit' class='combo_submit' style='border:0;background:url($path_to_root/themes/"
-       ."%s/images/locate.png) no-repeat;%s' fallback='1' name='%s' value=' ' title='"._("Set filter")."'> ";
+       ."%s/images/locate.png) no-repeat;%s' aspect='fallback' name='%s' value=' ' title='"._("Set filter")."'> ";
 
 $_select_button = "<input %s type='submit' class='combo_select' style='border:0;background:url($path_to_root/themes/"
-       ."%s/images/button_ok.png) no-repeat;%s' fallback='1' name='%s' value=' ' title='"._("Select")."'> ";
+       ."%s/images/button_ok.png) no-repeat;%s' aspect='fallback' name='%s' value=' ' title='"._("Select")."'> ";
 
 $all_items = reserved_words::get_all();
 
index 244792bc12391ac7e78149100cdfc853436fa631..ec1626a0b23388a111905887905c0b66d93eb6b1 100644 (file)
@@ -5,10 +5,13 @@ function debug(msg) {
        box.innerHTML= box.innerHTML+'<br>'+msg
 }
 
-function progbar(container) {
-    container.innerHTML= "<center><img src='"+
-       user.theme+"images/progressbar1.gif' /> "+
-       user.loadtxt+"</center>";
+function progbar() {
+       box = document.getElementById('msgbox');
+    box.innerHTML= "<center><table width='98%' border='1' cellpadding=3 "
+       +"style='border-collapse: collapse' bordercolor='#007700'>"
+       +"<tr><td align='center' bgcolor='#ccffcc' >"
+               +"<img src='"+user.theme+"images/progressbar.gif' alt='"
+               +user.loadtxt+"' /></td></tr></table></center><br>";
 }
 
 function save_focus(e) {
@@ -153,7 +156,7 @@ var inserts = {
                                _set_combo_input(e);
                }
        },
-       'input.combo2,input[fallback]': 
+       'input.combo2,input[aspect="fallback"]': 
        function(e) {
            // this hides search button for js enabled browsers
            e.style.display = 'none';
@@ -161,6 +164,8 @@ var inserts = {
        'input.ajaxsubmit,input.editbutton,input.navibutton': 
        function(e) {
            e.onclick = function() {
+                       if (this.getAttribute('aspect') == 'process')
+                               progbar();
                        JsHttpRequest.request(this);
                        return false;
            }