diff options
| author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-06-27 14:14:38 +0000 |
|---|---|---|
| committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-06-27 14:14:38 +0000 |
| commit | 715d45c30750b2f32d186f0f5fa879212e1736cf (patch) | |
| tree | 362bb175086938f7d91c0fb0deb16df99f2ee432 /frontends/php/include/classes | |
| parent | a88e4ef120a13064f2bf09238abfd7a1ea952a1a (diff) | |
- changed properties of text files in SVN repository (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@4371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
| -rw-r--r-- | frontends/php/include/classes/cpumenu.inc.php | 134 | ||||
| -rw-r--r-- | frontends/php/include/classes/ctree.inc.php | 500 |
2 files changed, 317 insertions, 317 deletions
diff --git a/frontends/php/include/classes/cpumenu.inc.php b/frontends/php/include/classes/cpumenu.inc.php index ef583ea6..a4acf1d5 100644 --- a/frontends/php/include/classes/cpumenu.inc.php +++ b/frontends/php/include/classes/cpumenu.inc.php @@ -1,67 +1,67 @@ -<?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();
- /*********************** ITEM ARRAY ***********************
- ITEM: array(name, url, param, css, submenu1, submenu2, ... , submenuN)
-
- name: text
- url: text (url for href perameter)
- param: array(tw => t_val, sb => s_val)
- tw: target parameter
- t_val: one of '_blank', '_parent', '_self', '_top'
- sb: text for statusbar)
- s_val: text
- css: array(outer => cssarray, inner => cssarray)
- outer -> style for outer div element
- inner -> style for inner link element with text
- cssarray -> array(normal, mouseover, mousedown)
- submen1-N: list of subitems
- **********************************************************/
- $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);
- echo '<script language="JavaScript" type="text/javascript" src="js/menu.js"></script>';
- }
- }
-?>
+<?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(); + /*********************** ITEM ARRAY *********************** + ITEM: array(name, url, param, css, submenu1, submenu2, ... , submenuN) + + name: text + url: text (url for href perameter) + param: array(tw => t_val, sb => s_val) + tw: target parameter + t_val: one of '_blank', '_parent', '_self', '_top' + sb: text for statusbar) + s_val: text + css: array(outer => cssarray, inner => cssarray) + outer -> style for outer div element + inner -> style for inner link element with text + cssarray -> array(normal, mouseover, mousedown) + submen1-N: list of subitems + **********************************************************/ + $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); + echo '<script language="JavaScript" type="text/javascript" src="js/menu.js"></script>'; + } + } +?> diff --git a/frontends/php/include/classes/ctree.inc.php b/frontends/php/include/classes/ctree.inc.php index 9b2412be..7ab2f89f 100644 --- a/frontends/php/include/classes/ctree.inc.php +++ b/frontends/php/include/classes/ctree.inc.php @@ -1,251 +1,251 @@ -<?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.
-**/
-
-class CTree{
-
-/*public*/
-var $tree='';
-var $fields='';
-var $treename='';
-
-/*private*/
-var $size=0;
-var $maxlevel=0;
-
-
-/*public*/
-function CTree($value=array(),$fields=array()){
-// parent::CTable();
- $this->tree = $value;
- $this->fields = $fields;
- $this->treename = $this->fields['caption'];
-
- $this->size = count($value);
- unset($value);
- unset($fields);
-
- if(!$this->CheckTree()){
- $this->Destroy();
- return false;
- } else {
- $this->CountDepth();
- }
-}
-
-function GetTree(){
- return $this->tree;
-}
-
-/*private*/
-function MakeHeaders(){
- $c=0;
- $tr = new CRow();
- $tr->AddItem($this->fields['caption']);
- $tr->SetClass('treeheader');
- unset($this->fields['caption']);
- foreach($this->fields as $id => $caption){
- $tr->AddItem($caption);
- $fields[$c] = $id;
- $c++;
- }
- $this->fields = $fields;
-return $tr;
-}
-
-function SimpleHTML(){
- $table = new CTableInfo('','tabletree');
-
- $table->SetCellSpacing(0);
- $table->SetCellPadding(0);
-
- $table->oddRowClass = 'odd_row';
- $table->evenRowClass = 'even_row';
- $table->headerClass = 'header';
- $table->footerClass = 'footer';
-
- $table->AddOption('border','0');
- $table->AddRow($this->MakeHeaders());
-// $table->AddRow();
- foreach($this->tree as $id => $rows){
- $table->AddRow($this->MakeSHTMLRow($id));
- }
-return $table->ToString();
-}
-
-
-function MakeSHTMLRow($id){
- $table = new CTable();
- $table->SetCellSpacing(0);
- $table->SetCellPadding(0);
- $table->AddOption('width','200');
-
- $tr = $this->MakeSImgStr($id);
-
- $td = new CCol($this->tree[$id]['caption']);
- $td->SetAlign('left');
-
-
- $tr->AddItem($td);
- $table->AddRow($tr);
-
- $tr = new CRow();
- $tr->AddItem($table);
- $tr->AddOption('id',$id);
-// $tr->AddOption('ntype',$this->tree[$id]['childs']);
- $tr->AddOption('style',($this->tree[$id]['parentid'] != '0')?('display: none;'):(''));
-
- foreach($this->fields as $key => $value){
-// $tr->AddItem(' ');
- $td = new CCol($this->tree[$id][$value]);
-// $td->SetAlign('left');
- $tr->AddItem($td);
- }
-return $tr;
-}
-
-function MakeSImgStr($id){
- $tr = new CRow();
- $tr->AddOption('height',18);
- $count=(isset($this->tree[$id]['nodeimg']))?(strlen($this->tree[$id]['nodeimg'])):(0);
- for($i=0; $i<$count; $i++){
- switch($this->tree[$id]['nodeimg'][$i]){
- case 'O':
- $img= new CImg('images/general/tree/O.gif','o','22','18');
- break;
- case 'I':
- $img= new CImg('images/general/tree/I.gif','i','22','18');
- break;
- case 'L':
- if($this->tree[$id]['nodetype'] == 2){
- $img= new CImg('images/general/tree/Yc.gif','y','22','18');
- $img->AddOption('OnClick','javascript: tree.closeSNodeX('.$id.',this);');
- $img->AddOption('id',$id.'I');
- $img->SetClass('imgnode');
-
- } else {
- $img= new CImg('images/general/tree/L.gif','l','22','18');
- }
- break;
- case 'T':
- if($this->tree[$id]['nodetype'] == 2){
- $img= new CImg('images/general/tree/Xc.gif','x','22','18');
- $img->AddOption('OnClick','javascript: tree.closeSNodeX('.$id.',this);');
- $img->AddOption('id',$id.'I');
- $img->SetClass('imgnode');
- } else {
- $img= new CImg('images/general/tree/T.gif','t','22','18');
- }
- break;
- }
- $td = new CCol($img,'tdtree');
- $tr->AddItem($td);
- }
-// echo $txt.' '.$this->tree[$id]['Name'].'<br />';
-return $tr;
-}
-
-function CountDepth(){
- foreach($this->tree as $id => $rows){
-
- if($id == '0'){
- continue;
- }
- $parentid = $this->tree[$id]['parentid'];
-
- $this->tree[$id]['nodeimg'] = $this->GetImg($id,(isset($this->tree[$parentid]['nodeimg']))?($this->tree[$parentid]['nodeimg']):(''));
- //$this->tree[$parentid]['childs'] = ($this->tree[$parentid]['childs']+$this->tree[$id]['childs']+1);
-
- $this->tree[$parentid]['nodetype'] = 2;
-
- $this->tree[$id]['Level'] = (isset($this->tree[$parentid]['Level']))?($this->tree[$parentid]['Level']+1):(1);
-
- ($this->maxlevel>$this->tree[$id]['Level'])?(''):($this->maxlevel = $this->tree[$id]['Level']);
- }
-
-}
-
-
-function CreateJS(){
-global $page;
- $js = '
- <script src="js/tree.js" type="text/javascript"></script>
- <script src="js/cookies.js" type="text/javascript"></script>
- <script type="text/javascript">
- var treenode = new Array(0);
- var tree_name = "tree_'.$this->getUserAlias().'_'.$page["file"].'";
- ';
-
- foreach($this->tree as $id => $rows){
- $parentid = $rows['parentid'];
- $this->tree[$parentid]['nodelist'].=$id.'.';
- }
-
- foreach($this->tree as $id => $rows){
- if($rows['nodetype'] == '2'){
- $js .= 'treenode['.$id.'] = { status: \'close\', nodelist : \''.$rows['nodelist'].'\', parentid : \''.$rows['parentid'].'\'};';
- }
- }
-return $js.'window.onload = function(){tree.init()};
-</script>';
-}
-
-function GetImg($id,$img){
- $img=str_replace('T','I',$img);
- $img=str_replace('L','O',$img);
- $ch = 'L';
-
- $childs = $this->tree[$this->tree[$id]['parentid']]['childnodes'];
- $childs_last = count($this->tree[$this->tree[$id]['parentid']]['childnodes'])-1;
-
- if(isset($childs[$childs_last]) && ($childs[$childs_last] != $id)){
- $ch='T';
- }
- $img.=$ch;
-return $img;
-}
-
-function CheckTree(){
- if(!is_array($this->tree)){
- return false;
- }
- foreach($this->tree as $id => $cell){
- $this->tree[$id]['nodetype'] = 0;
-
- $parentid=$cell['parentid'];
- $this->tree[$parentid]['childnodes'][] = $id;
-
- $this->tree[$id]['nodelist'] = '';
-// echo $id.BR;
- }
-
-return true;
-}
-
-function Destroy(){
- unset($this->tree);
-}
-
-function getUserAlias(){
-global $USER_DETAILS;
-return $USER_DETAILS["alias"];
-}
-}
-
+<?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. +**/ + +class CTree{ + +/*public*/ +var $tree=''; +var $fields=''; +var $treename=''; + +/*private*/ +var $size=0; +var $maxlevel=0; + + +/*public*/ +function CTree($value=array(),$fields=array()){ +// parent::CTable(); + $this->tree = $value; + $this->fields = $fields; + $this->treename = $this->fields['caption']; + + $this->size = count($value); + unset($value); + unset($fields); + + if(!$this->CheckTree()){ + $this->Destroy(); + return false; + } else { + $this->CountDepth(); + } +} + +function GetTree(){ + return $this->tree; +} + +/*private*/ +function MakeHeaders(){ + $c=0; + $tr = new CRow(); + $tr->AddItem($this->fields['caption']); + $tr->SetClass('treeheader'); + unset($this->fields['caption']); + foreach($this->fields as $id => $caption){ + $tr->AddItem($caption); + $fields[$c] = $id; + $c++; + } + $this->fields = $fields; +return $tr; +} + +function SimpleHTML(){ + $table = new CTableInfo('','tabletree'); + + $table->SetCellSpacing(0); + $table->SetCellPadding(0); + + $table->oddRowClass = 'odd_row'; + $table->evenRowClass = 'even_row'; + $table->headerClass = 'header'; + $table->footerClass = 'footer'; + + $table->AddOption('border','0'); + $table->AddRow($this->MakeHeaders()); +// $table->AddRow(); + foreach($this->tree as $id => $rows){ + $table->AddRow($this->MakeSHTMLRow($id)); + } +return $table->ToString(); +} + + +function MakeSHTMLRow($id){ + $table = new CTable(); + $table->SetCellSpacing(0); + $table->SetCellPadding(0); + $table->AddOption('width','200'); + + $tr = $this->MakeSImgStr($id); + + $td = new CCol($this->tree[$id]['caption']); + $td->SetAlign('left'); + + + $tr->AddItem($td); + $table->AddRow($tr); + + $tr = new CRow(); + $tr->AddItem($table); + $tr->AddOption('id',$id); +// $tr->AddOption('ntype',$this->tree[$id]['childs']); + $tr->AddOption('style',($this->tree[$id]['parentid'] != '0')?('display: none;'):('')); + + foreach($this->fields as $key => $value){ +// $tr->AddItem(' '); + $td = new CCol($this->tree[$id][$value]); +// $td->SetAlign('left'); + $tr->AddItem($td); + } +return $tr; +} + +function MakeSImgStr($id){ + $tr = new CRow(); + $tr->AddOption('height',18); + $count=(isset($this->tree[$id]['nodeimg']))?(strlen($this->tree[$id]['nodeimg'])):(0); + for($i=0; $i<$count; $i++){ + switch($this->tree[$id]['nodeimg'][$i]){ + case 'O': + $img= new CImg('images/general/tree/O.gif','o','22','18'); + break; + case 'I': + $img= new CImg('images/general/tree/I.gif','i','22','18'); + break; + case 'L': + if($this->tree[$id]['nodetype'] == 2){ + $img= new CImg('images/general/tree/Yc.gif','y','22','18'); + $img->AddOption('OnClick','javascript: tree.closeSNodeX('.$id.',this);'); + $img->AddOption('id',$id.'I'); + $img->SetClass('imgnode'); + + } else { + $img= new CImg('images/general/tree/L.gif','l','22','18'); + } + break; + case 'T': + if($this->tree[$id]['nodetype'] == 2){ + $img= new CImg('images/general/tree/Xc.gif','x','22','18'); + $img->AddOption('OnClick','javascript: tree.closeSNodeX('.$id.',this);'); + $img->AddOption('id',$id.'I'); + $img->SetClass('imgnode'); + } else { + $img= new CImg('images/general/tree/T.gif','t','22','18'); + } + break; + } + $td = new CCol($img,'tdtree'); + $tr->AddItem($td); + } +// echo $txt.' '.$this->tree[$id]['Name'].'<br />'; +return $tr; +} + +function CountDepth(){ + foreach($this->tree as $id => $rows){ + + if($id == '0'){ + continue; + } + $parentid = $this->tree[$id]['parentid']; + + $this->tree[$id]['nodeimg'] = $this->GetImg($id,(isset($this->tree[$parentid]['nodeimg']))?($this->tree[$parentid]['nodeimg']):('')); + //$this->tree[$parentid]['childs'] = ($this->tree[$parentid]['childs']+$this->tree[$id]['childs']+1); + + $this->tree[$parentid]['nodetype'] = 2; + + $this->tree[$id]['Level'] = (isset($this->tree[$parentid]['Level']))?($this->tree[$parentid]['Level']+1):(1); + + ($this->maxlevel>$this->tree[$id]['Level'])?(''):($this->maxlevel = $this->tree[$id]['Level']); + } + +} + + +function CreateJS(){ +global $page; + $js = ' + <script src="js/tree.js" type="text/javascript"></script> + <script src="js/cookies.js" type="text/javascript"></script> + <script type="text/javascript"> + var treenode = new Array(0); + var tree_name = "tree_'.$this->getUserAlias().'_'.$page["file"].'"; + '; + + foreach($this->tree as $id => $rows){ + $parentid = $rows['parentid']; + $this->tree[$parentid]['nodelist'].=$id.'.'; + } + + foreach($this->tree as $id => $rows){ + if($rows['nodetype'] == '2'){ + $js .= 'treenode['.$id.'] = { status: \'close\', nodelist : \''.$rows['nodelist'].'\', parentid : \''.$rows['parentid'].'\'};'; + } + } +return $js.'window.onload = function(){tree.init()}; +</script>'; +} + +function GetImg($id,$img){ + $img=str_replace('T','I',$img); + $img=str_replace('L','O',$img); + $ch = 'L'; + + $childs = $this->tree[$this->tree[$id]['parentid']]['childnodes']; + $childs_last = count($this->tree[$this->tree[$id]['parentid']]['childnodes'])-1; + + if(isset($childs[$childs_last]) && ($childs[$childs_last] != $id)){ + $ch='T'; + } + $img.=$ch; +return $img; +} + +function CheckTree(){ + if(!is_array($this->tree)){ + return false; + } + foreach($this->tree as $id => $cell){ + $this->tree[$id]['nodetype'] = 0; + + $parentid=$cell['parentid']; + $this->tree[$parentid]['childnodes'][] = $id; + + $this->tree[$id]['nodelist'] = ''; +// echo $id.BR; + } + +return true; +} + +function Destroy(){ + unset($this->tree); +} + +function getUserAlias(){ +global $USER_DETAILS; +return $USER_DETAILS["alias"]; +} +} + ?>
\ No newline at end of file |
