[0005209] Reports: fixed broken reports after session timeout.
[fa-stable.git] / js / inserts.js
index dacb82898e200975d79a700a51177aa9fb6d7854..d0722250769dcb4d3cb25be45586979d34f77f23 100644 (file)
@@ -29,6 +29,12 @@ function validate(e) {
        return true;
 }
 
+function set_fullmode() {
+       document.getElementById('ui_mode').value = 1;
+       document.loginform.submit();
+       return true;
+}
+
 function save_focus(e) {
   _focus = e.name||e.id;
   var h = document.getElementById('hints');
@@ -133,8 +139,6 @@ function _set_combo_select(e) {
                e.setAttribute('_last', e.selectedIndex);
                e.onblur = function() {
                    var box = document.getElementsByName(this.getAttribute('rel'))[0];
-//                     if(string_contains(this.className, 'combo'))
-//                         _update_box(this);
                        if ((this.selectedIndex != this.getAttribute('_last'))
                                ||((string_contains(this.className, 'combo') || string_contains(this.className, 'combo3')) && _update_box(this))
                                )
@@ -310,10 +314,12 @@ var inserts = {
                e.onclick = function(){
                        if (validate(e)) {
                                setTimeout(function() { var asp = e.getAttribute('aspect');
-                                       set_mark((asp && ((asp.indexOf('process') !== -1) || (asp.indexOf('nonajax') !== -1))) ? 'progressbar.gif' : 'ajax-loader.gif');
+                                       if (asp && asp.indexOf('download') === -1 && asp.indexOf('popup') === -1)
+                                               set_mark((asp && ((asp.indexOf('process') !== -1) || (asp.indexOf('nonajax') !== -1))) ? 'progressbar.gif' : 'ajax-loader.gif');
                                }, 100);
                                return true;
                        }
+                       return false;
                },
                e.onkeydown = function(ev) {    // block unintentional page escape with 'history back' key pressed on buttons
                        ev = ev||window.event;
@@ -340,11 +346,18 @@ var inserts = {
                                return false;
                        }
        },
-    '.amount': function(e) {
-               if(e.onblur==undefined) {
+       '.amount': function(e) {
+               if (e.onblur == undefined) {
+                 e.setAttribute('_last_val', e.value);
                  e.onblur = function() {
                        var dec = this.getAttribute("dec");
-                       price_format(this.name, get_amount(this.name), dec);
+                       var val = this.getAttribute('_last_val');
+                       if (val != get_amount(this.name)) {
+                               this.setAttribute('_last_val', get_amount(this.name));
+                               price_format(this.name, get_amount(this.name), dec);
+                               if (e.className.match(/\bactive\b/))
+                                       JsHttpRequest.request('_'+this.name+'_changed', this.form);
+                       }
                  };
                }
        },
@@ -463,11 +476,9 @@ var inserts = {
            var ulist=ul.getElementsByTagName("li");
            for (var x=0; x<ulist.length; x++){ //loop through each LI e
                var tab=ulist[x].getElementsByTagName("button")[0];
-//             if(tab.onclick==undefined) {
-// ?  var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
                    var url = tab.form.action
                    tab.onclick=function(){
-                   if (!_hotkeys.alt && !tab.disabled)
+                   if (!_hotkeys.alt && !this.disabled)
                                _expand(this);
                        return false;
                    }
@@ -481,24 +492,7 @@ var inserts = {
                        };
                }
        }
-/*     'tr.editrow': function(e) {
-                       e.onkeydown = function(ev) {
-                       ev = ev||window.event;
-                       key = ev.keyCode||ev.which;
-                       if(key == 13) {
-                         // Find & click additem/update button
-
-                       } else  if(key == 27) {
-                         return false;
-                       }
-               }
-
-       },
-*//*   '#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'));