Delete fiscal year buttons prepared for final js confirmation dialog.
[fa-stable.git] / js / inserts.js
index 1026fbf623276bfec5a80ef8cb6d0e0235890a38..a6d08dd952c70fe8e264c81a6f9828d1f8f2b340 100644 (file)
@@ -14,21 +14,6 @@ var _hotkeys = {
        'focus': -1             // currently selected indeks of document.links
 };
 
-function debug(msg) {
-    box = document.getElementById('msgbox')
-       box.innerHTML= box.innerHTML+'<br>'+msg
-}
-
-function progbar() {
-       box = document.getElementById('msgbox');
-    box.innerHTML= "<center><table width='98%' border='1' cellpadding=3 "
-       +"bordercolor='#007700' style='border-collapse: collapse'>"
-       +"<tr><td align='center' bgcolor='#ccffcc' >"
-               +"<img src='"+user.theme+"images/progressbar.gif' alt='"
-               +user.loadtxt+"' /></td></tr></table></center><br>";
-       box.style.display = 'block';
-}
-
 function save_focus(e) {
   _focus = e.name||e.id;
   var h = document.getElementById('hints');
@@ -200,17 +185,36 @@ var inserts = {
            e.style.display = 'block';
        },
 //     '.ajaxsubmit,.editbutton,.navibutton': // much slower on IE7
-       'button.ajaxsubmit,input.ajaxsubmit,input.editbutton,button.navibutton': 
+       'button.ajaxsubmit,input.ajaxsubmit,input.editbutton,button.editbutton,button.navibutton': 
        function(e) {
-           e.onclick = function() {
-                       if (this.getAttribute('aspect') == 'process')
-                               progbar();
-                   save_focus(this);
-                       JsHttpRequest.request(this);
-                       return false;
-           }
+                   e.onclick = function() {
+                           save_focus(e);
+                                       if (e.getAttribute('aspect') == 'process')
+                                               JsHttpRequest.request(this, null, 30000);
+                                       else
+                                               JsHttpRequest.request(this);
+                               return false;
+                   }
+       },
+/*     'button': function(e) {
+               if (e.name) {
+                       var func = _validate[e.name];
+                       var old = e.onclick;
+                       if(func) {
+                               if (typeof old != 'function') {
+                                       e.onclick = func;
+                               } else {
+                                       e.onclick = function() {
+                                               if(func()) 
+                                                       { old(); return true;}
+                                               else
+                                                       return false;
+                                       }
+                               }
+                       }
+               }
        },
-    '.amount': function(e) {
+*/    '.amount': function(e) {
                if(e.onblur==undefined) {
                  e.onblur = function() {
                        var dec = this.getAttribute("dec");
@@ -296,11 +300,11 @@ var inserts = {
                }
 
        },
-*/     '#msgbox': function(e) {
+*//*   '#msgbox': function(e) {
        // this is to avoid changing div height after ajax update in IE7
          e.style.display = e.innerHTML.length ? 'block' : 'none';
        }
-/* TODO
+*//* TODO
        'a.date_picker':  function(e) {
            // this un-hides data picker for js enabled browsers
            e.href = date_picker(this.getAttribute('rel'));
@@ -378,14 +382,17 @@ function setHotKeys() {
                                _hotkeys.alt = false;
                                if (_hotkeys.focus>=0) {
                                        var link = document.links[_hotkeys.focus];
-                                       if (link.target=='_blank') {
-//                                             window.open(link.href,'','toolbar=no,scrollbar=no,resizable=yes,menubar=no,width=900,height=500');
-                                               openWindow(link.href,'_blank');
-                                       } else
-                                               window.location = link.href;
+                                       if(link.onclick) 
+                                               link.onclick();
+                                       else
+                                               if (link.target=='_blank') {
+                                                       window.open(link.href,'','toolbar=no,scrollbar=no,resizable=yes,menubar=no,width=900,height=500');
+                                                       openWindow(link.href,'_blank');
+                                               } else
+                                                       window.location = link.href;
                                }
-                       } 
                        return stopEv(ev);
+                       } 
                }
                return true;
        }