diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-11 11:21:34 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-11 11:21:34 +0000 |
| commit | 419b228afeba243106a8757543cde23bbdd03189 (patch) | |
| tree | 331a7c47e32f2ca254ca261e6bf650b596c54383 /frontends/php/js | |
| parent | 9b1c6e98efe2a2a793b959df384db1a337a212ff (diff) | |
| download | zabbix-419b228afeba243106a8757543cde23bbdd03189.tar.gz zabbix-419b228afeba243106a8757543cde23bbdd03189.tar.xz zabbix-419b228afeba243106a8757543cde23bbdd03189.zip | |
- Zabbix1.5.b commit (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5468 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/js')
| -rw-r--r-- | frontends/php/js/common.js | 132 | ||||
| -rw-r--r-- | frontends/php/js/dashboard.js | 3 | ||||
| -rw-r--r-- | frontends/php/js/sbinit.js | 6 |
3 files changed, 86 insertions, 55 deletions
diff --git a/frontends/php/js/common.js b/frontends/php/js/common.js index a1c6b7f7..63c8cd1d 100644 --- a/frontends/php/js/common.js +++ b/frontends/php/js/common.js @@ -106,44 +106,8 @@ function close_window() return false; } -function add_variable(o_el, s_name, x_value, s_formname, o_document) -{ - var form; - - if(!o_document) o_document = document; - - if(s_formname) - { - if( !(form = o_document.forms[s_formname]) ) - throw "Missed form with name '"+s_formname+"'."; - } - else if(o_el) - { - - if( !(form = o_el.form) ) - throw "Missed form in 'o_el' object"; - } - else - { - if( !(form = this.form) ) - throw "Missed form in 'this' object"; - } - - var o_variable = o_document.createElement('input'); - - if( !o_variable ) throw "Can't create element"; - - o_variable.type = 'hidden'; - o_variable.name = s_name; - o_variable.value = x_value; - - form.appendChild(o_variable); - - return true; -} - function add2favorites(favobj,favid){ - if(typeof(Ajax) == 'undefined'){ + if('undefined' == typeof(Ajax)){ throw("Prototype.js lib is required!"); return false; } @@ -179,7 +143,7 @@ function add2favorites(favobj,favid){ function rm4favorites(favobj,favid,menu_rowid){ // alert(favobj+','+favid+','+menu_rowid); - if(typeof(Ajax) == 'undefined'){ + if('undefined' == typeof(Ajax)){ throw("Prototype.js lib is required!"); return false; } @@ -251,27 +215,62 @@ function get_cursor_position(e) function Redirect(url) { window.location = url; return false; -} +} -function create_var(form_name, var_name, var_val, submit) -{ - var frmForm = document.forms[form_name]; +function add_variable(o_el, s_name, x_value, s_formname, o_document){ + var form; + + if(!o_document) o_document = document; + + if(s_formname){ + if( !(form = o_document.forms[s_formname]) ) + throw "Missed form with name '"+s_formname+"'."; + } + else if(o_el){ + if( !(form = o_el.form) ) + throw "Missed form in 'o_el' object"; + } + else{ + if( !(form = this.form) ) + throw "Missed form in 'this' object"; + } + + var o_variable = o_document.createElement('input'); + + if( !o_variable ) throw "Can't create element"; + + o_variable.type = 'hidden'; + o_variable.name = s_name; + o_variable.value = x_value; - if(!frmForm) return false; + form.appendChild(o_variable); + +return true; +} - var objVar = document.createElement('input'); +function create_var(form_name, var_name, var_val, subm){ + var frmForm = document.forms[form_name]; + if(!frmForm) return false; - if(!objVar) return false; + var objVar = document.getElementsByName(var_name); + objVar=(objVar.length>0)?objVar[0]:null; + + if(is_null(objVar)){ + objVar = document.createElement('input'); + if(!objVar) return false; - objVar.setAttribute('type', 'hidden'); - objVar.setAttribute('name', var_name); - objVar.setAttribute('value', var_val); + frmForm.appendChild(objVar); + + objVar.setAttribute('type', 'hidden'); + objVar.setAttribute('name', var_name); + } + + objVar.value = var_val; - frmForm.appendChild(objVar); - if(submit) + if(subm) frmForm.submit(); - return false; +return false; } function Confirm(msg){ @@ -398,6 +397,37 @@ function deselectAll(){ /************************************************************************************/ /* Pages stuff */ /************************************************************************************/ +function change_filter_state(icon, divid){ + if((typeof(icon) == 'undefined') || (typeof(divid) == 'undefined')) throw "Function [change_filter_state()] awaits exactly 2 arguments."; + + if('undefined' == typeof(Ajax)){ + throw("Prototype.js lib is required!"); + return false; + } + + deselectAll(); + var filter_state = ShowHide(divid); + switchElementsClass(icon,"filteropened","filterclosed"); + + if(false === filter_state) return false; + + var params = { + 'favobj': 'filter', + 'favid': divid, + 'state': filter_state + } + + var uri = new url(location.href); + + new Ajax.Request(uri.getPath()+"?output=ajax", + { + 'method': 'post', + 'parameters':params, + 'onSuccess': function(resp){ },//alert(resp.responseText); + 'onFailure': function(){ document.location = uri.getPath()+'?'+Object.toQueryString(params); } + } + ); +} function GetSelectedText(obj){ if(IE){ diff --git a/frontends/php/js/dashboard.js b/frontends/php/js/dashboard.js index 7ee78bfa..ad7e0df8 100644 --- a/frontends/php/js/dashboard.js +++ b/frontends/php/js/dashboard.js @@ -33,7 +33,7 @@ function change_hat_state(icon, divid){ deselectAll(); var hat_state = ShowHide(divid); switchElementsClass(icon,"arrowup","arrowdown"); - + if(false === hat_state) return false; var params = { @@ -46,6 +46,7 @@ function change_hat_state(icon, divid){ { 'method': 'post', 'parameters': params, + 'onSuccess': function(resp){ },//alert(resp.responseText); 'onFailure': function(){ document.location = 'dashboard.php?'+Object.toQueryString(params);} } ); diff --git a/frontends/php/js/sbinit.js b/frontends/php/js/sbinit.js index b69b5caa..3231978a 100644 --- a/frontends/php/js/sbinit.js +++ b/frontends/php/js/sbinit.js @@ -45,8 +45,8 @@ function showgraphmenu(obj_id){ scrl.style.top = pos.top+"px"; scrl.style.left = 1+"px"; - G_MENU.gm_gmenu.style.top = (pos.top-108)+"px" // 110 = G_MENU height - G_MENU.gm_gmenu.style.left = 1+"px" + G_MENU.gm_gmenu.style.top = (pos.top-108)+"px"; // 110 = G_MENU height + G_MENU.gm_gmenu.style.left = 1+"px"; SCROLL_BAR.onchange = function(){ if(is_null(_PE_SB)){ @@ -173,7 +173,7 @@ function graph_zoom_init(graph_id,stime,period,width,height){ } function sboxload(){ - var date = datetoarray(parseInt(this.stime)); // this becomes related to the object who ones that function!! + var date = datetoarray(parseInt(this.stime)); // `this` becomes related to the object who ownes that function!! //SDI(this.sbox_id); var stime = ''+date[2]+date[1]+date[0]+date[3]+date[4]; |
