diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-03-16 11:39:29 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-03-16 11:39:29 +0000 |
commit | df2d967e519775ef67c7e004199fe52caea58f1d (patch) | |
tree | 1a78d3641a7f4874fa950bde06ad4c185d18efe7 /frontends/php/include/classes | |
parent | 7aa815c71fb9382e11d5886e91fa36dfae80339d (diff) | |
download | zabbix-df2d967e519775ef67c7e004199fe52caea58f1d.tar.gz zabbix-df2d967e519775ef67c7e004199fe52caea58f1d.tar.xz zabbix-df2d967e519775ef67c7e004199fe52caea58f1d.zip |
- developed PopUp menu for overview (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3892 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
-rw-r--r-- | frontends/php/include/classes/ccolor.inc.php | 2 | ||||
-rw-r--r-- | frontends/php/include/classes/ccombobox.inc.php | 4 | ||||
-rw-r--r-- | frontends/php/include/classes/cpumenu.inc.php | 53 | ||||
-rw-r--r-- | frontends/php/include/classes/ctag.inc.php | 15 | ||||
-rw-r--r-- | frontends/php/include/classes/ctextbox.inc.php | 8 |
5 files changed, 72 insertions, 10 deletions
diff --git a/frontends/php/include/classes/ccolor.inc.php b/frontends/php/include/classes/ccolor.inc.php index 2e9d6ca9..3ebc2c28 100644 --- a/frontends/php/include/classes/ccolor.inc.php +++ b/frontends/php/include/classes/ccolor.inc.php @@ -209,7 +209,7 @@ else if (document.getElementById) $txt = new CTextBox($name,$value,7); $txt->AddOption('id', $name); - $txt->AddOption('onChange', 'set_color_by_name(\''.$name.'\',this.value)'); + $txt->AddAction('onChange', 'set_color_by_name(\''.$name.'\',this.value)'); $txt->AddOption('style', 'margin: 0px'); $this->AddItem(array($txt, $lbl)); diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php index d05020d7..79d50f3d 100644 --- a/frontends/php/include/classes/ccombobox.inc.php +++ b/frontends/php/include/classes/ccombobox.inc.php @@ -177,8 +177,8 @@ inseret_javascript_for_editable_combobox(); parent::CComboBox($name,$value,$action); - parent::AddOption('onfocus','CEditableComboBoxInit(this);'); - parent::AddOption('onchange','CEditableComboBoxOnChange(this,'.$size.');'); + parent::AddAction('onfocus','CEditableComboBoxInit(this);'); + parent::AddAction('onchange','CEditableComboBoxOnChange(this,'.$size.');'); } function AddItem($value, $caption='', $selected=NULL, $enabled='yes') diff --git a/frontends/php/include/classes/cpumenu.inc.php b/frontends/php/include/classes/cpumenu.inc.php new file mode 100644 index 00000000..1b697941 --- /dev/null +++ b/frontends/php/include/classes/cpumenu.inc.php @@ -0,0 +1,53 @@ +<?php +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ +?> +<?php + class CPUMenu + { +/* private */ + /* + var $items = array(); + var $width; + */ +/* public */ + function CPUMenu($items=array(), $width=null) + { + $this->InsertJavaScript(); + $this->items = $items; + $this->width = $width; + } + + function GetOnActionJS() + { + if(count($this->items) <= 0) return NULL; + + return 'return show_popup_menu(event,'.zbx_jsvalue($this->items).','.zbx_jsvalue($this->width).');'; + } + + function InsertJavaScript() + { + if(defined('CPUMENU_INSERTJAVASCRIPT_INSERTED')) return; + define('CPUMENU_INSERTJAVASCRIPT_INSERTED', 1); +?> +<script language="JavaScript" type="text/javascript" src="js/menu.js"></script> +<?php + } + } +?> diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php index 2b462617..df7d91ae 100644 --- a/frontends/php/include/classes/ctag.inc.php +++ b/frontends/php/include/classes/ctag.inc.php @@ -228,13 +228,21 @@ $code = "show_hint(this,event,'".$text."');"; } - $this->AddOption('onMouseOver', $code); - $this->AddOption('onMouseMove', $code); + $this->AddAction('onMouseOver', $code); + $this->AddAction('onMouseMove', $code); } function OnClick($handle_code) { - $this->AddOption('onClick', $handle_code); + $this->AddAction('onClick', $handle_code); + } + + function AddAction($name, $value) + { + if(isset($value)) + $this->options[$name] = str_replace("\n", '', strval($value)); + else + unset($this->options[$name]); } function AddOption($name, $value) @@ -244,6 +252,7 @@ else unset($this->options[$name]); } + function SetEnabled($value='yes') { if((is_string($value) && ($value == 'yes' || $value == 'enabled' || $value=='on') || $value=='1') diff --git a/frontends/php/include/classes/ctextbox.inc.php b/frontends/php/include/classes/ctextbox.inc.php index c1bd3134..a261f7dc 100644 --- a/frontends/php/include/classes/ctextbox.inc.php +++ b/frontends/php/include/classes/ctextbox.inc.php @@ -70,10 +70,10 @@ parent::CTextBox($name,$value,$size,$readonly); $this->AddOption('MaxLength', $size); $this->AddOption('Style', 'text-align: right;'); - $this->AddOption('OnKeyPress', + $this->AddAction('OnKeyPress', ' var c = (window.event) ? event.keyCode : event.which;'. ' if(event.ctrlKey || c <= 31 || (c >= 48 && c <= 57)) return true; else return false; '); - $this->AddOption('OnChange', + $this->AddAction('OnChange', ($allowempty ? ' if(this.value.length==0 || this.value==null) this.value = \'\'; else ' : ''). ' if(isNaN(parseInt(this.value))) this.value = 0; '. ' else this.value = parseInt(this.value);' @@ -101,10 +101,10 @@ if($i != 3) { $this->ip_parts[$i]->tag_end = ''; - $this->ip_parts[$i]->AddOption('OnKeyDown', + $this->ip_parts[$i]->AddAction('OnKeyDown', ' this.maxlength = this.getAttribute("maxlength"); '. ' this.oldlength = this.value.length; '); - $this->ip_parts[$i]->AddOption('OnKeyUp', + $this->ip_parts[$i]->AddAction('OnKeyUp', ' if(this.oldlength != this.value.length && this.value.length == this.maxlength) {'. ' var el = this.form.elements["'.$name.'['.($i+1).']'.'"];'. ' if(el) { el.focus(); el.select(); }}'); |