diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-03-14 15:21:27 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-03-14 15:21:27 +0000 |
commit | 25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6 (patch) | |
tree | 01e08dad83c7671bb8a19b9c40f2f786b033d99e /frontends/php/include/classes | |
parent | f35b829723124ac2c15defd1d5cce44b40b1c8ec (diff) | |
download | zabbix-25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6.tar.gz zabbix-25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6.tar.xz zabbix-25036c9384fcec4d36f4cfc69fe2b86e4ef2c9c6.zip |
- added "Data overview" for screens
- added "Triggers overview" for screens (Eugene)
- added blinking into Trigger overview (Eugene)
- added screen displaying in other screen (Eugene)
- improved Overview table header, vertical text added (Eugene)
- developed "ZABBIX Clock" module for screens (Eugene)
- developed "ZABBIX server info" module for screens (Eugene)
- developed "Triggers info" module for screens (Eugene)
- developed "Host info" module for screens (Eugene)
- improved screens displaying, added item alignment (Eugene)
- improved ZABBIX server report (Eugene)
- improved images configuration (Eugene)
- added onserver image resizing for thumbs by php (Eugene)
- developed acknowledges system (Eugene)
- added icons displaying for maps (Eugene)
- added maps displaying for maps (Eugene)
- improved maps (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2699 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
-rw-r--r-- | frontends/php/include/classes/ccombobox.inc.php | 37 | ||||
-rw-r--r-- | frontends/php/include/classes/cflash.inc.php | 136 | ||||
-rw-r--r-- | frontends/php/include/classes/cflashclock.mod.php | 51 | ||||
-rw-r--r-- | frontends/php/include/classes/cformtable.inc.php | 8 | ||||
-rw-r--r-- | frontends/php/include/classes/chostsinfo.mod.php | 82 | ||||
-rw-r--r-- | frontends/php/include/classes/cimg.inc.php | 13 | ||||
-rw-r--r-- | frontends/php/include/classes/clink.inc.php | 8 | ||||
-rw-r--r-- | frontends/php/include/classes/clistbox.inc.php | 38 | ||||
-rw-r--r-- | frontends/php/include/classes/cmap.inc.php | 96 | ||||
-rw-r--r-- | frontends/php/include/classes/cserverinfo.mod.php | 78 | ||||
-rw-r--r-- | frontends/php/include/classes/ctable.inc.php | 3 | ||||
-rw-r--r-- | frontends/php/include/classes/ctableinfo.inc.php | 10 | ||||
-rw-r--r-- | frontends/php/include/classes/ctag.inc.php | 8 | ||||
-rw-r--r-- | frontends/php/include/classes/ctextarea.inc.php | 4 | ||||
-rw-r--r-- | frontends/php/include/classes/ctriggerinfo.mod.php | 98 | ||||
-rw-r--r-- | frontends/php/include/classes/cvar.inc.php | 8 | ||||
-rw-r--r-- | frontends/php/include/classes/table.inc.php | 2 |
17 files changed, 630 insertions, 50 deletions
diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php index 849f2e5a..69a17636 100644 --- a/frontends/php/include/classes/ccombobox.inc.php +++ b/frontends/php/include/classes/ccombobox.inc.php @@ -22,18 +22,24 @@ class CComboItem extends CTag { /* public */ - function CComboItem($value,$caption=NULL,$selected='no') + function CComboItem($value,$caption=NULL,$selected=NULL, $enabled=NULL) { parent::CTag('option','yes'); $this->tag_body_start = ""; $this->SetCaption($caption); $this->SetValue($value); $this->SetSelected($selected); + $this->SetEnabled($enabled); + } function SetValue($value) { return parent::AddOption('value',$value); } + function GetValue() + { + return parent::GetOption('value'); + } function SetCaption($value=NULL) { if(is_null($value)) @@ -47,7 +53,7 @@ function SetSelected($value='yes') { if(is_null($value)) - return 0; + return $this->DelOption('selected'); elseif((is_string($value) && ($value == 'yes' || $value == "selected" || $value=='on')) || (is_int($value) && $value<>0)) return $this->AddOption('selected','selected'); @@ -111,21 +117,26 @@ } function AddItem($value, $caption, $selected=NULL, $enabled='yes') { - if(is_null($selected)) - { - $selected = 'no'; - if(!is_null($this->value)) - if($this->value==$value) - $selected = 'yes'; - } - // if($enabled=='no') return; /* disable item method 1 */ - $cmbItem = new CComboItem($value,$caption,$selected); + $cmbItem = new CComboItem($value,$caption,$selected,$enabled); + return parent::AddItem($cmbItem); + } - $cmbItem->SetEnable($enabled); /* disable item method 2 */ + function SetSelectedByValue(&$item) + { + if(!is_null($this->value)) + { + $selected = 'no'; + if($item->GetValue() == $this->value) $selected = 'yes'; + $item->SetSelected($selected); + } + } - return parent::AddItem($cmbItem); + function ShowTagItem(&$item) + { + $this->SetSelectedByValue($item); + parent::ShowTagItem($item); } function Show() { diff --git a/frontends/php/include/classes/cflash.inc.php b/frontends/php/include/classes/cflash.inc.php new file mode 100644 index 00000000..fa8886a7 --- /dev/null +++ b/frontends/php/include/classes/cflash.inc.php @@ -0,0 +1,136 @@ +<?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 CFlashEmbed extends CTag + { + function CFlashEmbed($src=NULL, $width = NULL, $height = NULL) + { + parent::CTag("embed"); + $this->AddOption("allowScriptAccess","sameDomain"); + $this->AddOption("type","application/x-shockwave-flash"); + $this->AddOption("pluginspage","http://www.macromedia.com/go/getflashplayer"); + $this->AddOption("align","middle"); + $this->AddOption("quality","high"); + + $this->SetWidth($width); + $this->SetHeight($height); + $this->SetSrc($src); + } + function SetWidth($value) + { + if(is_null($value)) + return $this->DelOption("width"); + if(!is_numeric($value)) + return $this->error("Incorrect value for SetWidth [$value]"); + + $this->AddOption("width",$value); + } + function SetHeight($value) + { + if(is_null($value)) + return $this->DelOption("height"); + if(!is_numeric($value)) + return $this->error("Incorrect value for SetHeight [$value]"); + + $this->AddOption("height",$value); + } + function SetSrc($value) + { + if(is_null($value)) + return $this->DelOption("src"); + if(!is_string($value)) + return $this->error("Incorrect value for SetSrc[$value]"); + + $this->AddOption("src",$value); + } + } + + class CParam extends CTag + { + function CParam($name,$value) + { + parent::CTag("param","no"); + + $this->SetName($name); + $this->SetValue($value); + } + function SetName($value) + { + $this->AddOption("name",$value); + } + function SetValue($value) + { + $this->AddOption("value",$value); + } + } + + class CFlash extends CTag + { + var $timetype; + function CFlash($src=NULL, $width = NULL, $height = NULL) + { + parent::CTag("object",'yes'); + $this->AddOption("classid","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"); + $this->AddOption("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"); + $this->AddOption("align","middle"); + + $this->AddItem(new CParam("allowScriptAccess","sameDomain")); + $this->AddItem(new CParam("quality","high")); + $this->items["src"] = new CParam("movie",$src); + + $this->items["embeded"] = new CFlashEmbed(); + + $this->SetWidth($width); + $this->SetHeight($height); + $this->SetSrc($src); + } + function SetWidth($value) + { + if(is_null($value)) + return $this->DelOption("width"); + if(!is_numeric($value)) + return $this->error("Incorrect value for SetWidth [$value]"); + + $this->AddOption("width",$value); + $this->items["embeded"]->SetWidth($value); + } + function SetHeight($value) + { + if(is_null($value)) + return $this->DelOption("height"); + if(!is_numeric($value)) + return $this->error("Incorrect value for SetHeight [$value]"); + + $this->AddOption("height",$value); + $this->items["embeded"]->SetHeight($value); + } + function SetSrc($value) + { + if(is_null($value)) + return $this->DelOption("src"); + if(!is_string($value)) + return $this->error("Incorrect value for SetSrc[$value]"); + + $this->items["src"]->SetValue($value); + $this->items["embeded"]->SetSrc($value); + } + } +?> diff --git a/frontends/php/include/classes/cflashclock.mod.php b/frontends/php/include/classes/cflashclock.mod.php new file mode 100644 index 00000000..b5e4cdab --- /dev/null +++ b/frontends/php/include/classes/cflashclock.mod.php @@ -0,0 +1,51 @@ +<?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 CFlashClock extends CFlash + { + var $timetype; + var $src; + function CFlashClock($width = 200, $height = 200, $timetype = TIME_TYPE_LOCAL, $url = NULL) + { + if(!is_numeric($width) || $width < 24) $width = 200; + if(!is_numeric($height) || $height< 24) $height = 200; + + $this->src = "images/flash/zbxclock.swf?analog=1&smooth=1"; + if(!is_null($url)) $this->src .= "&url=".urlencode($url); + + parent::CFlash($this->src,$width,$height); + $this->SetTimeType($timetype); + } + function SetTimeType($value) + { + if($value != TIME_TYPE_LOCAL && $value != TIME_TYPE_SERVER) + return $this->error("Incorrect value vor SetTimeType [$value]"); + + $this->timetype = $value; + } + function Show() + { + if($this->timetype == TIME_TYPE_SERVER) + $this->SetSrc($this->src."×tamp=".time()); + parent::Show(); + } + } +?> diff --git a/frontends/php/include/classes/cformtable.inc.php b/frontends/php/include/classes/cformtable.inc.php index e1f4b44b..170dc881 100644 --- a/frontends/php/include/classes/cformtable.inc.php +++ b/frontends/php/include/classes/cformtable.inc.php @@ -39,7 +39,9 @@ $this->SetAlign('center'); $this->SetHelp(); - $this->AddItemToTopRow("<a name=\"form\"></a>"); + $frm_link = new CLink(); + $frm_link->SetName("formtable"); + $this->AddItemToTopRow($frm_link); $this->AddVar("form",get_request("form",1)); $this->AddVar("form_refresh",get_request("form_refresh",0)+1); @@ -51,7 +53,7 @@ { if(is_string($value)) - return parent::SetAction($value."#form"); + return parent::SetAction($value); elseif(is_null($value)) return parent::SetAction($value); else @@ -130,7 +132,7 @@ { parent::ShowTagBody(); - $tbl = new CTable(NULL,'form'); + $tbl = new CTable(NULL,'formtable'); $tbl->SetOddRowClass('form_odd_row'); $tbl->SetEvenRowClass('form_even_row'); $tbl->SetCellSpacing(0); diff --git a/frontends/php/include/classes/chostsinfo.mod.php b/frontends/php/include/classes/chostsinfo.mod.php new file mode 100644 index 00000000..b570f7e2 --- /dev/null +++ b/frontends/php/include/classes/chostsinfo.mod.php @@ -0,0 +1,82 @@ +<?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 CHostsInfo extends CTable + { + var $style; + function CHostsInfo($style = STYLE_HORISONTAL) + { + parent::CTable(NULL,"hosts_info"); + $this->SetOrientation($style); + } + + function SetOrientation($value) + { + if($value != STYLE_HORISONTAL && $value != STYLE_VERTICAL) + return $this->error("Incorrect value for SetOrientation [$value]"); + + $this->style = $value; + } + + function UpdateInfo() + { + $this->CleanItems(); + + $db_host_cnt = DBselect("select count(*) as cnt from hosts where available=".HOST_AVAILABLE_TRUE); + $host_cnt = DBfetch($db_host_cnt); + $avail = $host_cnt["cnt"]; + + $db_host_cnt = DBselect("select count(*) as cnt from hosts where available=".HOST_AVAILABLE_FALSE); + $host_cnt = DBfetch($db_host_cnt); + $notav = $host_cnt["cnt"]; + + $db_host_cnt = DBselect("select count(*) as cnt from hosts where available=".HOST_AVAILABLE_UNKNOWN); + $host_cnt = DBfetch($db_host_cnt); + $uncn = $host_cnt["cnt"]; + + $header = new CCol(S_HOSTS_INFO,"header"); + if($this->style == STYLE_HORISONTAL) + $header->SetColspan(3); + + $this->AddRow($header); + + $avail = new CCol($avail." ".S_AVAILABLE, "avail"); + $notav = new CCol($notav." ".S_NOT_AVAILABLE, "notav"); + $uncn = new CCol($uncn." ".S_UNKNOWN, "uncn"); + + if($this->style == STYLE_HORISONTAL) + { + $this->AddRow(array($avail, $notav, $uncn)); + } + else + { + $this->AddRow($avail); + $this->AddRow($notav); + $this->AddRow($uncn); + } + } + function Show() + { + $this->UpdateInfo(); + parent::Show(); + } + } +?> diff --git a/frontends/php/include/classes/cimg.inc.php b/frontends/php/include/classes/cimg.inc.php index 472a52ab..f7cb42c8 100644 --- a/frontends/php/include/classes/cimg.inc.php +++ b/frontends/php/include/classes/cimg.inc.php @@ -57,6 +57,19 @@ } return $this->AddOption("alt",$value); } + function SetMap($value=NULL) + { + if(is_null($value)) + $this->DeleteOption("usemup"); + + if(!is_string($value)) + { + return $this->error("Incorrect value for SetMap [$value]"); + } + + $value = '#'.ltrim($value,'#'); + return $this->AddOption("usemap",$value); + } function SetWidth($value=NULL){ if(is_null($value)) return $this->DelOption("width"); diff --git a/frontends/php/include/classes/clink.inc.php b/frontends/php/include/classes/clink.inc.php index 118f5063..dd32db42 100644 --- a/frontends/php/include/classes/clink.inc.php +++ b/frontends/php/include/classes/clink.inc.php @@ -22,7 +22,7 @@ class CLink extends CTag { /* public */ - function CLink($item="www.zabbix.com",$url="http://www.zabbix.com",$class=NULL) + function CLink($item=NULL,$url=NULL,$class=NULL) { parent::CTag("a","yes"); @@ -37,7 +37,11 @@ } function SetUrl($value) { - if(!is_string($value)) + if(is_null($value)) + { + return $this->DelOption("href"); + } + elseif(!is_string($value)) { return $this->error("Incorrect value for SetUrl [$value]"); } diff --git a/frontends/php/include/classes/clistbox.inc.php b/frontends/php/include/classes/clistbox.inc.php index a5db8b3d..bec590f7 100644 --- a/frontends/php/include/classes/clistbox.inc.php +++ b/frontends/php/include/classes/clistbox.inc.php @@ -19,26 +19,40 @@ **/ ?> <?php - class CListItem extends CComboItem - { -/* public */ - } - class CListBox extends CComboBox { -/* private */ - var $caption; - /* public */ - function CListBox($name='combobox',$size=5,$action=NULL) + function CListBox($name='combobox',$value=NULL,$size=5,$action=NULL) { parent::CComboBox($name,NULL,$action); - $this->AddOption("size",$size); $this->AddOption("multiple","multiple"); + $this->SetSize($size); + $this->SetValue($value); + } + function SetSize($value) + { + if(is_null($value)) + return $this->DelOption("size"); + if(!is_numeric($value)) + return $this->error("Incorrect value for SetSize [$value]"); + $this->AddOption("size",$value); } - function AddItem($value, $caption, $selected='no', $enabled='yes') + function SetSelectedByValue(&$item) { - return parent::AddItem($value, $caption, $selected, $enabled); + if(!is_null($this->value)) + { + if(is_array($this->value)) + { + $selected = 'no'; + if(in_array($item->GetValue(),$this->value)) $selected = 'yes'; + return $item->SetSelected($selected); + } + else + { + return parent::SetSelectedByValue($item); + } + } + return false; } } ?> diff --git a/frontends/php/include/classes/cmap.inc.php b/frontends/php/include/classes/cmap.inc.php new file mode 100644 index 00000000..662b4936 --- /dev/null +++ b/frontends/php/include/classes/cmap.inc.php @@ -0,0 +1,96 @@ +<?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 CMap extends CTag + { +/* public */ + function CMap($name="") + { + parent::CTag("map","yes"); + $this->SetName($name); + } + function AddRectArea($x1,$y1,$x2,$y2,$href,$alt) + { + return $this->AddArea(array($x1,$y1,$x2,$y2),$href,$alt,'rect'); + } + function AddArea($coords,$href,$alt,$shape) + { + return $this->AddItem(new CArea($coords,$href,$alt,$shape)); + } + function AddItem($value) + { + if(!is_a($value,'carea')) + return $this->error("Incorrect value for AddItem [$value]"); + + return parent::AddItem($value); + } + } + + class CArea extends CTag + { + function CArea($coords,$href,$alt,$shape) + { + parent::CTag("area","no"); + $this->SetCoords($coords); + $this->SetShape($shape); + $this->SetHref($href); + $this->SetAlt($alt); + } + function SetCoords($value) + { + if(!is_array($value)) + return $this->error("Incorrect value for SetCoords [$value]"); + if(count($value)<3) + return $this->error("Incorrect values count for SetCoords [".count($value)."]"); + + $str_val = ""; + foreach($value as $val) + { + if(!is_numeric($val)) + return $this->error("Incorrect value for SetCoords [$val]"); + + $str_val .= $val.","; + } + $this->AddOption("coords",trim($str_val,',')); + } + function SetShape($value) + { + if(!is_string($value)) + return $this->error("Incorrect value for SetShape [$value]"); + + $this->AddOption("shape",$value); + } + function SetHref($value) + { + if(!is_string($value)) + return $this->error("Incorrect value for SetHref [$value]"); + + $this->AddOption("href",$value); + } + function SetAlt($value) + { + if(!is_string($value)) + return $this->error("Incorrect value for SetAlt [$value]"); + + $this->AddOption("alt",$value); + } + } +?> diff --git a/frontends/php/include/classes/cserverinfo.mod.php b/frontends/php/include/classes/cserverinfo.mod.php new file mode 100644 index 00000000..7aae9a3f --- /dev/null +++ b/frontends/php/include/classes/cserverinfo.mod.php @@ -0,0 +1,78 @@ +<?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 CServerInfo extends CTable + { + function CServerInfo() + { + parent::CTable(NULL,"server_info"); + } + + function UpdateInfo() + { + global $USER_DETAILS; + global $_SERVER; + + $this->CleanItems(); + + $status = get_status(); + + if($status["zabbix_server"] == S_YES) + $server = new CSpan(S_RUNNING,"off"); + else + $server = new CSpan(S_NOT_RUNNING,"on"); + + $header = new CCol("ZABBIX ".S_SERVER_INFO,"header"); + $this->AddRow($header); + $this->AddRow("Updated: ".date("r",time())); + $this->AddRow(new CCol(array("Refreshed every: ".$USER_DETAILS["refresh"]." sec ", + "(",new CLink("refresh now","http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"],"action"),")"))); + $this->AddRow(S_NUMBER_OF_USERS_SHORT.": ".$status["users_count"]."(".$status["users_online"].")"); + $this->AddRow(new CCol(array("Logged in as ", new CLink($USER_DETAILS["alias"],"profile.php","action")))); + $this->AddRow(new CCol(array(new CLink("ZABBIX server","http://www.zabbix.com","action")," is ",$server)),"status"); + $this->AddRow(S_VALUES_STORED.": ".$status["history_count"]); + $this->AddRow(S_TRENDS_STORED.": ".$status["trends_count"]); + $this->AddRow(new CCol(array(S_NUMBER_OF_HOSTS_SHORT.": ".$status["hosts_count"]."(", + new CSpan($status["hosts_count_monitored"],"off"),"/", + new CSpan($status["hosts_count_not_monitored"],"on"),"/", + new CSpan($status["hosts_count_template"],"unknown"),"/", + $status["hosts_count_deleted"].")"))); + $this->AddRow(new CCol(array(S_NUMBER_OF_ITEMS_SHORT.": ".$status["items_count"]."(", + new CSpan($status["items_count_monitored"],"off"),"/", + new CSpan($status["items_count_disabled"],"on"),"/", + new CSpan($status["items_count_not_supported"],"unknown"), + ")[".$status["items_count_trapper"]."]"))); + $this->AddRow(new CCol(array(S_NUMBER_OF_TRIGGERS_SHORT.": ". $status["triggers_count"]. + "(".$status["triggers_count_enabled"]."/".$status["triggers_count_disabled"].")"."[", + new CSpan($status["triggers_count_on"],"on"),"/", + new CSpan($status["triggers_count_unknown"],"unknown"),"/", + new CSpan($status["triggers_count_off"],"off"),"]" + ))); + $this->AddRow(S_NUMBER_OF_ALARMS.": ".$status["alarms_count"]); + $this->AddRow(S_NUMBER_OF_ALERTS.": ".$status["alerts_count"]); + } + function Show() + { + $this->UpdateInfo(); + parent::Show(); + } + } +?> diff --git a/frontends/php/include/classes/ctable.inc.php b/frontends/php/include/classes/ctable.inc.php index eccdff4b..e82e5429 100644 --- a/frontends/php/include/classes/ctable.inc.php +++ b/frontends/php/include/classes/ctable.inc.php @@ -41,7 +41,6 @@ if(!is_int($value) && !is_numeric($value)) { return $this->error("Incorrect value for SetRowSpan [$value]"); - return 1; } return $this->AddOption("rowspan",strval($value)); } @@ -217,7 +216,7 @@ if(count($this->items)==0) { if(isset($this->message)) - $this->AddRow(new CCol($this->message,'table_message'),$this->evenRowClass); + $this->AddRow(new CCol($this->message,'message'),$this->evenRowClass); } parent::ShowTagBody(); diff --git a/frontends/php/include/classes/ctableinfo.inc.php b/frontends/php/include/classes/ctableinfo.inc.php index 36f58ee7..5819ddc9 100644 --- a/frontends/php/include/classes/ctableinfo.inc.php +++ b/frontends/php/include/classes/ctableinfo.inc.php @@ -22,20 +22,20 @@ class CTableInfo extends CTable { /* public */ - function CTableInfo($message='...',$class='tborder') + function CTableInfo($message='...',$class='tableinfo') { parent::CTable($message,$class); - $this->SetOddRowClass('table_odd_row'); - $this->SetEvenRowClass('table_even_row'); + $this->SetOddRowClass('odd_row'); + $this->SetEvenRowClass('even_row'); $this->SetCellSpacing(1); $this->SetCellPadding(3); $this->SetHeader(); } - function SetHeader($value=NULL,$class='table_header') + function SetHeader($value=NULL,$class='header') { parent::SetHeader($value,$class); } - function SetFooter($value=NULL,$class='table_header') + function SetFooter($value=NULL,$class='footer') { parent::SetFooter($value,$class); } diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php index 83d44c7f..8a115bde 100644 --- a/frontends/php/include/classes/ctag.inc.php +++ b/frontends/php/include/classes/ctag.inc.php @@ -125,6 +125,10 @@ $this->options[$name] = htmlspecialchars(strval($value)); return 0; } + function CleanItems() + { + $this->items = array(); + } function AddItem($value) { if(is_null($value)) @@ -180,7 +184,7 @@ print ($this->tag_end); } } - function SetEnable($value='yes') + function SetEnabled($value='yes') { if(is_null($value)) return 0; @@ -192,7 +196,7 @@ ($value == 'no' || $value == 'disabled' || $value=='off') || $value=='0') || (is_int($value) && $value==0)) return $this->AddOption('disabled','disabled'); - return $this->error("Incorrect value for SetEnable [$value]"); + return $this->error("Incorrect value for SetEnabled [$value]"); } function error($value) { diff --git a/frontends/php/include/classes/ctextarea.inc.php b/frontends/php/include/classes/ctextarea.inc.php index 08277878..e9e75530 100644 --- a/frontends/php/include/classes/ctextarea.inc.php +++ b/frontends/php/include/classes/ctextarea.inc.php @@ -83,7 +83,7 @@ } function SetRows($value) { - if(!is_int($value)) + if(!is_numeric($value)) { return $this->error("Incorrect value for SetRows [$value]"); } @@ -92,7 +92,7 @@ } function SetCols($value) { - if(!is_int($value)) + if(!is_numeric($value)) { return $this->error("Incorrect value for SetCols [$value]"); } diff --git a/frontends/php/include/classes/ctriggerinfo.mod.php b/frontends/php/include/classes/ctriggerinfo.mod.php new file mode 100644 index 00000000..7c1f9d76 --- /dev/null +++ b/frontends/php/include/classes/ctriggerinfo.mod.php @@ -0,0 +1,98 @@ +<?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 CTriggersInfo extends CTable + { + var $style; + function CTriggersInfo($style = STYLE_HORISONTAL) + { + parent::CTable(NULL,"triggers_info"); + $this->SetOrientation($style); + } + + function SetOrientation($value) + { + if($value != STYLE_HORISONTAL && $value != STYLE_VERTICAL) + return $this->error("Incorrect value for SetOrientation [$value]"); + + $this->style = $value; + } + + function UpdateInfo() + { + $this->CleanItems(); + + $uncn = $info = $warn = $avg = $high = $dis = 0; + + $db_priority = DBselect("select t.priority,count(*) as cnt from triggers t,hosts h,items i,functions f where t.value=1 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and t.triggerid=f.triggerid and i.status=0 group by priority"); + + while($row=DBfetch($db_priority)) + { + switch($row["priority"]) + { + case 0: $uncn =$row["cnt"]; break; + case 1: $info =$row["cnt"]; break; + case 2: $warn =$row["cnt"]; break; + case 3: $avg =$row["cnt"]; break; + case 4: $high =$row["cnt"]; break; + case 5: $dis =$row["cnt"]; break; + } + } + + $db_ok_cnt = DBselect("select count(*) as cnt from triggers t,hosts h,items i,functions f where t.value=0 and t.status=0 and f.itemid=i.itemid and h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and t.triggerid=f.triggerid and i.status=0"); + $ok_cnt = DBfetch($db_ok_cnt); + + $header = new CCol(S_TRIGGERS_INFO,"header"); + if($this->style == STYLE_HORISONTAL) + $header->SetColspan(7); + $this->AddRow($header); + + $trok = new CCol($ok_cnt["cnt"]." ".S_OK, "trok"); + $uncn = new CCol($uncn." ".S_NOT_CLASSIFIED, "uncn"); + $info = new CCol($info." ".S_INFORMATION, "info"); + $warn = new CCol($warn." ".S_WARNING, "warn"); + $avg = new CCol($avg." ".S_AVERAGE, "avg"); + $high = new CCol($high." ".S_HIGH, "high"); + $dis = new CCol($dis." ".S_DISASTER, "dis"); + + + if($this->style == STYLE_HORISONTAL) + { + $this->AddRow(array($trok, $uncn, $info, $warn, $avg, $high, $dis)); + } + else + { + $this->AddRow($trok); + $this->AddRow($uncn); + $this->AddRow($info); + $this->AddRow($warn); + $this->AddRow($avg); + $this->AddRow($high); + $this->AddRow($dis); + } + } + function Show() + { + $this->UpdateInfo(); + parent::Show(); + } + } +?> diff --git a/frontends/php/include/classes/cvar.inc.php b/frontends/php/include/classes/cvar.inc.php index b089f181..fc823ce8 100644 --- a/frontends/php/include/classes/cvar.inc.php +++ b/frontends/php/include/classes/cvar.inc.php @@ -29,14 +29,6 @@ $this->SetName($name); $this->SetValue($value); } - function SetName($value) - { - if(!is_string($value)) - { - return $this->error("Incorrect value for SetName [$value]"); - } - return $this->AddOption("name",$value); - } function SetValue($value) { return $this->AddOption("value",$value); diff --git a/frontends/php/include/classes/table.inc.php b/frontends/php/include/classes/table.inc.php index c35802fd..b698e831 100644 --- a/frontends/php/include/classes/table.inc.php +++ b/frontends/php/include/classes/table.inc.php @@ -56,7 +56,7 @@ } // Private - function showHeader($class="tborder") + function showHeader($class="tableinfo") { echo "<table class=\"$class\" border=0 width=\"100%\" bgcolor='#AAAAAA' cellspacing=1 cellpadding=3>"; echo "\n"; |