summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/classes
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-11 13:33:50 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-11 13:33:50 +0000
commitb4b26e48b09f36c8b533412a1b19f1f23a447a9b (patch)
tree065ba2d78e0a647be5e8fe7908c4417dfe4e1015 /frontends/php/include/classes
parent5fbc202c9ec11aac9d0ad9bf2f469a05deda8083 (diff)
- added HTML classes into PHP framework (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2514 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
-rw-r--r--frontends/php/include/classes/cbutton.inc.php82
-rw-r--r--frontends/php/include/classes/ccheckbox.inc.php50
-rw-r--r--frontends/php/include/classes/ccombobox.inc.php144
-rw-r--r--frontends/php/include/classes/cform.inc.php54
-rw-r--r--frontends/php/include/classes/cformtable.inc.php128
-rw-r--r--frontends/php/include/classes/chelp.inc.php31
-rw-r--r--frontends/php/include/classes/cimg.inc.php49
-rw-r--r--frontends/php/include/classes/clink.inc.php41
-rw-r--r--frontends/php/include/classes/cpassbox.inc.php31
-rw-r--r--frontends/php/include/classes/ctable.inc.php247
-rw-r--r--frontends/php/include/classes/ctableinfo.inc.php43
-rw-r--r--frontends/php/include/classes/ctag.inc.php175
-rw-r--r--frontends/php/include/classes/ctextarea.inc.php91
-rw-r--r--frontends/php/include/classes/ctextbox.inc.php95
-rw-r--r--frontends/php/include/classes/cvar.inc.php45
15 files changed, 1306 insertions, 0 deletions
diff --git a/frontends/php/include/classes/cbutton.inc.php b/frontends/php/include/classes/cbutton.inc.php
new file mode 100644
index 00000000..eb6443c7
--- /dev/null
+++ b/frontends/php/include/classes/cbutton.inc.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 CButton extends CTag
+ {
+/* public */
+ function CButton($name="button", $caption="", $action=NULL)
+ {
+ parent::CTag("input","no");
+ $this->tag_body_start = "";
+ $this->AddOption("type","submit");
+ $this->SetClass("button");
+ $this->SetName($name);
+ $this->SetCaption($caption);
+ $this->SetAction($action);
+ }
+ function SetAction($value='submit()', $event='onClick')
+ {
+ if(is_null($value))
+ return 1;
+ if(!is_string($value))
+ return $this->error("Incorrect value for SetAction [$value]");
+ if(!is_string($event))
+ return $this->error("Incorrect event for SetAction [$event]");
+ return $this->AddOption($event,$value);
+ }
+ function SetTitle($value='button title')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetTitle [$value]");
+ }
+ return $this->AddOption("title",$value);
+ }
+ function SetAccessKey($value='B')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetAccessKey [$value]");
+ }
+
+ if($this->GetOption('title')==NULL)
+ $this->SetTitle($this->GetOption('value')." [Alt+$value]");
+
+ return $this->AddOption("accessKey",$value);
+ }
+ function SetName($value='button')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetName [$value]");
+ }
+ return $this->AddOption("name",$value);
+ }
+ function SetCaption($value="")
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetCaption [$value]");
+ }
+ return $this->AddOption("value",$value);
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/ccheckbox.inc.php b/frontends/php/include/classes/ccheckbox.inc.php
new file mode 100644
index 00000000..0da3295e
--- /dev/null
+++ b/frontends/php/include/classes/ccheckbox.inc.php
@@ -0,0 +1,50 @@
+<?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 CCheckBox extends CTag
+ {
+/* public */
+ function CCheckBox($name='checkbox',$value=NULL)
+ {
+ parent::CTag("input","no");
+ $this->tag_body_start = "";
+ $this->AddOption('type','checkbox');
+ $this->SetName($name);
+ $this->SetCaption($value);
+ }
+ function SetName($value='checkbox')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetName [$value]");
+ }
+ return $this->AddOption("name",$value);
+ }
+ function SetCaption($value=NULL)
+ {
+ if(is_null($value))
+ return 0;
+ elseif(is_string($value))
+ return $this->AddItem(nbsp($value));
+ return $this->error("Incorrect value for SetCaption [$value]");
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php
new file mode 100644
index 00000000..33d65256
--- /dev/null
+++ b/frontends/php/include/classes/ccombobox.inc.php
@@ -0,0 +1,144 @@
+<?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 CComboItem extends CTag
+ {
+/* public */
+ function CComboItem($value,$caption=NULL,$selected='no')
+ {
+ parent::CTag('option','yes');
+ $this->tag_body_start = "";
+ $this->SetCaption($caption);
+ $this->SetValue($value);
+ $this->SetSelected($selected);
+ }
+ function SetValue($value)
+ {
+ return parent::AddOption('value',$value);
+ }
+ function SetCaption($value=NULL)
+ {
+ if(is_null($value))
+ return 0;
+ elseif(is_string($value)){
+ parent::AddItem(nbsp($value));
+ return 0;
+ }
+ return $this->error("Incorrect value for SetCaption [$value]");
+ }
+ function SetEnable($value='yes')
+ {
+ if(is_string($value))
+ {
+ if($value == 'yes')
+ return $this->DelOption('disabled');
+ elseif($value == 'no')
+ return $this->AddOption('disabled','disabled');
+ }
+ return $this->error("Incorrect value for SetEnable [$value]");
+ }
+ function SetSelected($value)
+ {
+ if(is_string($value))
+ {
+ if($value == 'yes')
+ return $this->AddOption('selected','selected');
+ elseif($value == 'no')
+ return $this->DelOption('selected');
+ }
+ return $this->error("Incorrect value for SetSelected [$value]");
+ }
+ }
+
+ class CComboBox extends CTag
+ {
+/* private */
+ var $caption;
+ var $value;
+
+/* public */
+ function CComboBox($name='combobox',$value=NULL,$action=NULL)
+ {
+ parent::CTag("select","yes");
+ $this->tag_end = "";
+ $this->SetClass("biginput");
+ $this->SetName($name);
+ $this->SetValue($value);
+ $this->AddOption("size",1);
+ $this->SetAction($action);
+ }
+ function SetAction($value='submit()', $event='onChange')
+ {
+ if(is_null($value))
+ return 1;
+ if(!is_string($value))
+ return $this->error("Incorrect value for SetAction [$value]");
+ if(!is_string($event))
+ return $this->error("Incorrect event for SetAction [$event]");
+ return $this->AddOption($event,$value);
+ }
+ function SetName($value='combobox')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetName [$value]");
+ }
+ return $this->AddOption("name",$value);
+ }
+ function SetCaption($value=NULL)
+ {
+ if(is_null($value))
+ unset($this->caption);
+ elseif(is_string($value))
+ $this->caption = $value;
+ else
+ {
+ return $this->error("Incorrect value for SetCaption [$value]");
+ }
+ return 0;
+ }
+ function SetValue($value=NULL)
+ {
+ $this->value = $value;
+ }
+ function AddItem($value, $caption, $enabled='yes')
+ {
+ $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->SetEnable($enabled); /* disable item method 2 */
+
+ parent::AddItem($cmbItem);
+ }
+ function Show()
+ {
+ if(isset($this->caption))
+ print ($this->caption." ");
+ parent::Show();
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/cform.inc.php b/frontends/php/include/classes/cform.inc.php
new file mode 100644
index 00000000..065185f9
--- /dev/null
+++ b/frontends/php/include/classes/cform.inc.php
@@ -0,0 +1,54 @@
+<?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 CForm extends CTag
+ {
+/* public */
+ function CForm($action=NULL, $method='get')
+ {
+ parent::CTag("form","yes");
+ $this->SetMethod($method);
+ $this->SetAction($action);
+ }
+ function SetMethod($value='post')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetMethod [$value]");
+ }
+ return $this->AddOption("method",$value);
+ }
+ function SetAction($value=NULL)
+ {
+ if(is_null($value))
+ return 1;
+ elseif(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetAction [$value]");
+ }
+ return $this->AddOption("action",$value);
+ }
+ function AddVar($name, $value)
+ {
+ $this->AddItem(new CVar($name, $value));
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/cformtable.inc.php b/frontends/php/include/classes/cformtable.inc.php
new file mode 100644
index 00000000..dbcfdb94
--- /dev/null
+++ b/frontends/php/include/classes/cformtable.inc.php
@@ -0,0 +1,128 @@
+<?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 CFormTable extends CForm
+ {
+/* private */
+ var $align;
+ var $title;
+ var $help;
+/* protected */
+ var $top_items = array();
+ var $center_items = array();
+ var $bottom_items = array();
+/* public */
+ function CFormTable($title=NULL, $action=NULL, $method='get')
+ {
+ parent::CForm($action,$method);
+ $this->SetTitle($title);
+ $this->SetAlign('center');
+ $this->SetHelp();
+
+ $this->bottom_items = new CCol(NULL,'form_row_last');
+ $this->bottom_items->SetColSpan(2);
+ }
+ function SetAlign($value)
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetAlign [$value]");
+ }
+ return $this->align = $value;
+ }
+ function SetTitle($value=NULL)
+ {
+ if(is_null($value))
+ {
+ unset($this->title);
+ return 0;
+ }
+ elseif(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetTitle [$value]");
+ }
+ $this->title = nbsp($value);
+ }
+ function SetHelp($value=NULL)
+ {
+ if(is_null($value))
+ $this->help = new CHelp();
+ elseif(is_a($value,'chelp'))
+ $this->help = $value;
+ elseif(is_string($value))
+ $this->help = new CHelp($value);
+ else
+ {
+ return $this->error("Incorrect value for SetHelp [$value]");
+ }
+ return 0;
+ }
+ function AddVar($name, $value)
+ {
+ $this->AddTopRow(new CVar($name, $value));
+ }
+ function AddTopRow($value)
+ {
+ array_push($this->top_items, $value);
+ }
+ function AddRow($item1, $item2=NULL)
+ {
+ if(is_string($item1))
+ $item1=nbsp($item1);
+
+ $row = new CRow(array(
+ new CCol($item1,'form_row_l'),
+ new CCol($item2,'form_row_r')
+ )
+ );
+ array_push($this->center_items, $row);
+ }
+ function AddBottomRow($value)
+ {
+ $this->bottom_items->AddItem($value);
+ }
+/* protected */
+ function ShowTagBody()
+ {
+ parent::ShowTagBody();
+
+ $tbl = new CTable(NULL,'form');
+ $tbl->SetOddRowClass('form_odd_row');
+ $tbl->SetEvenRowClass('form_even_row');
+ $tbl->SetCellSpacing(0);
+ $tbl->SetCellPadding(1);
+ $tbl->SetAlign($this->align);
+# add center rows
+ foreach($this->center_items as $item)
+ $tbl->AddRow($item);
+# add first row
+ $col = new CCol(NULL,'form_row_first');
+ $col->SetColSpan(2);
+ if(isset($this->help)) $col->AddItem($this->help);
+ if(isset($this->title)) $col->AddItem($this->title);
+ foreach($this->top_items as $item) $col->AddItem($item);
+ $tbl->SetHeader($col);
+# add last row
+ $tbl->SetFooter($this->bottom_items);
+ $tbl->Show();
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/chelp.inc.php b/frontends/php/include/classes/chelp.inc.php
new file mode 100644
index 00000000..79055781
--- /dev/null
+++ b/frontends/php/include/classes/chelp.inc.php
@@ -0,0 +1,31 @@
+<?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 CHelp extends CLink
+ {
+/* public */
+ function CHelp($url="index.php")
+ {
+ parent::CLink(new CImg("images/general/help.gif",'?'), "http://www.zabbix.com/manual/v1.1/$url");
+ $this->AddOption("style","float:right");
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/cimg.inc.php b/frontends/php/include/classes/cimg.inc.php
new file mode 100644
index 00000000..c185337c
--- /dev/null
+++ b/frontends/php/include/classes/cimg.inc.php
@@ -0,0 +1,49 @@
+<?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 CImg extends CTag
+ {
+/* public */
+ function CImg($src,$alt_text)
+ {
+ parent::CTag("img","no");
+ $this->AddOption('border',0);
+ $this->SetAltText($alt_text);
+ $this->SetSrc($src);
+ }
+ function SetSrc($value)
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetSrc [$value]");
+ }
+ return $this->AddOption("src",$value);
+ }
+ function SetAltText($value="picture")
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetText [$value]");
+ }
+ return $this->AddOption("alt",$value);
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/clink.inc.php b/frontends/php/include/classes/clink.inc.php
new file mode 100644
index 00000000..12adc6ef
--- /dev/null
+++ b/frontends/php/include/classes/clink.inc.php
@@ -0,0 +1,41 @@
+<?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 CLink extends CTag
+ {
+/* public */
+ function CLink($item="www.zabbix.com",$url="http://www.zabbix.com",$class=NULL)
+ {
+ parent::CTag("a","yes");
+ $this->SetClass($class);
+ $this->AddItem($item);
+ $this->SetUrl($url);
+ }
+ function SetUrl($value)
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetUrl [$value]");
+ }
+ $this->AddOption("href",$value);
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/cpassbox.inc.php b/frontends/php/include/classes/cpassbox.inc.php
new file mode 100644
index 00000000..2f51a9ee
--- /dev/null
+++ b/frontends/php/include/classes/cpassbox.inc.php
@@ -0,0 +1,31 @@
+<?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 CPassBox extends CTextBox
+ {
+/* public */
+ function CPassBox($name="password",$value="",$size=20,$caption=NULL)
+ {
+ parent::CTextBox($name,$value,$size,$caption);
+ $this->AddOption("type","password");
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/ctable.inc.php b/frontends/php/include/classes/ctable.inc.php
new file mode 100644
index 00000000..bcb1998d
--- /dev/null
+++ b/frontends/php/include/classes/ctable.inc.php
@@ -0,0 +1,247 @@
+<?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 CCol extends CTag
+ {
+/* public */
+ function CCol($item=NULL,$calss=NULL)
+ {
+ parent::CTag("td","yes");
+ $this->AddItem($item);
+ $this->SetClass($calss);
+ }
+ function SetAlign($value)
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetAlign [$value]");
+ }
+ return $this->AddOption("align",$value);
+ }
+ function SetRowSpan($value)
+ {
+ if(!is_int($value))
+ {
+ return $this->error("Incorrect value for SetRowSpan [$value]");
+ return 1;
+ }
+ return $this->AddOption("rowspan",strval($value));
+ }
+ function SetColSpan($value)
+ {
+ if(!is_int($value))
+ {
+ return $this->error("Incorrect value for SetColSpan[$value]");
+ }
+ return $this->AddOption("colspan",strval($value));
+ }
+ }
+
+ class CRow extends CTag
+ {
+/* public */
+ function CRow($item=NULL,$class=NULL)
+ {
+ parent::CTag("tr","yes");
+ $this->AddItem($item);
+ $this->SetClass($class);
+ }
+ function SetAlign($value)
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetAlign [$value]");
+ }
+ return $this->AddOption("align",$value);
+ }
+ function AddItem($item=NULL)
+ {
+ if(is_null($item))
+ return 0;
+ elseif(is_a($item,'ccol'))
+ {
+ return parent::AddItem($item);
+ }
+ elseif(is_array($item))
+ {
+ $ret = 0;
+ foreach($item as $el)
+ {
+ if(is_a($el,'ccol'))
+ {
+ $ret |= parent::AddItem($el);
+ } else {
+ $ret |= parent::AddItem(new CCol($el));
+ }
+ }
+ return $ret;
+ }
+ return parent::AddItem(new CCol($item));
+ }
+ }
+
+ class CTable extends CTag
+ {
+/* protected */
+ var $oddRowClass;
+ var $evenRowClass;
+ var $header;
+ var $footer;
+/* public */
+ function CTable($message=NULL,$class=NULL)
+ {
+ parent::CTag("table","yes");
+ $this->SetClass($class);
+ $this->message = $message;
+ $this->SetOddRowClass();
+ $this->SetEvenRowClass();
+ $this->SetHeader();
+ $this->SetFooter();
+ }
+ function SetHeader($value=NULL,$class=NULL)
+ {
+ if(is_null($value)){
+ $this->header = NULL;
+ }elseif(is_a($value,'crow'))
+ {
+ if(isset($class))
+ $value->SetClass($class);
+ $this->header = $value;
+ }else{
+ $this->header = new CRow($value,$class);
+ }
+ }
+ function SetFooter($value=NULL,$class=NULL)
+ {
+ if(is_null($value)){
+ $this->footer = NULL;
+ }elseif(is_a($value,'ccol'))
+ {
+ if(isset($this->header) && $value->GetOption('colspan')==NULL)
+ $value->SetColSpan(count($this->header->items));
+
+ $this->footer = new CRow($value,$class);
+ }elseif(is_a($value,'crow'))
+ {
+ if(isset($class))
+ $value->SetClass($class);
+ $this->footer = $value;
+ }else{
+ $this->footer = new CRow($value,$class);
+ }
+ }
+ function SetOddRowClass($value=NULL)
+ {
+ if(!is_string($value) && !is_null($value))
+ {
+ return $this->error("Incorrect value for SetOddRowClass [$value]");
+ }
+ $this->oddRowClass = $value;
+ }
+ function SetEvenRowClass($value=NULL)
+ {
+ if(!is_string($value) && !is_null($value))
+ {
+ return $this->error("Incorrect value for SetEvenRowClass [$value]");
+ }
+ $this->evenRowClass = $value;
+ }
+ function SetAlign($value)
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetAlign [$value]");
+ }
+ return $this->AddOption("align",$value);
+ }
+ function SetCellPadding($value)
+ {
+ if(!is_int($value))
+ {
+ return $this->error("Incorrect value for SetCellpadding [$value]");
+ }
+ return $this->AddOption("cellpadding",strval($value));
+ }
+ function SetCellSpacing($value)
+ {
+ if(!is_int($value))
+ {
+ return $this->error("Incorrect value for SetCellSpacing [$value]");
+ }
+ return $this->AddOption("cellspacing",strval($value));
+ }
+ function AddRow($item,$rowClass=NULL)
+ {
+ if(is_null($item)){
+ return 0;
+ }elseif(is_a($item,'ccol'))
+ {
+ if(isset($this->header) && $item->GetOption('colspan')==NULL)
+ $item->SetColSpan(count($this->header->items));
+
+ return $this->AddItem(new CRow($item,$rowClass));
+ }elseif(is_a($item,'crow'))
+ {
+ if(isset($rowClass))
+ $item->SetClass($rowClass);
+
+ return $this->AddItem($item);
+ }else{
+ return $this->AddItem(new CRow($item,$rowClass));
+ }
+ }
+/* protected */
+ function ShowTagBody()
+ {
+ if(is_a($this->header,'crow'))
+ $this->header->Show();
+
+ if(count($this->items)==0)
+ {
+ if(isset($this->message))
+ $this->AddRow(new CCol($this->message,'table_message'),$this->evenRowClass);
+ }
+
+ parent::ShowTagBody();
+
+ if(is_a($this->footer,'crow'))
+ $this->footer->Show();
+ }
+ function AddItem($value)
+ {
+ $cname="crow";
+ if(!is_a($value,$cname))
+ {
+ return $this->error("Incorrect value for AddItem [$value]");
+ }
+
+ if($value->GetOption('class')==NULL)
+ {
+ $value->SetClass(
+ ((count($this->items)+1)%2==1) ?
+ $this->evenRowClass : $this->oddRowClass
+ );
+ }
+
+ return parent::AddItem($value);
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/ctableinfo.inc.php b/frontends/php/include/classes/ctableinfo.inc.php
new file mode 100644
index 00000000..36f58ee7
--- /dev/null
+++ b/frontends/php/include/classes/ctableinfo.inc.php
@@ -0,0 +1,43 @@
+<?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 CTableInfo extends CTable
+ {
+/* public */
+ function CTableInfo($message='...',$class='tborder')
+ {
+ parent::CTable($message,$class);
+ $this->SetOddRowClass('table_odd_row');
+ $this->SetEvenRowClass('table_even_row');
+ $this->SetCellSpacing(1);
+ $this->SetCellPadding(3);
+ $this->SetHeader();
+ }
+ function SetHeader($value=NULL,$class='table_header')
+ {
+ parent::SetHeader($value,$class);
+ }
+ function SetFooter($value=NULL,$class='table_header')
+ {
+ parent::SetFooter($value,$class);
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php
new file mode 100644
index 00000000..50f3f0b9
--- /dev/null
+++ b/frontends/php/include/classes/ctag.inc.php
@@ -0,0 +1,175 @@
+<?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 CTag
+ {
+/* private */
+ var $name;
+ var $options = array();
+ var $paired;
+/* protected */
+ var $items = array();
+
+ var $tag_body_start;
+ var $tag_body_end;
+ var $tag_start;
+ var $tag_end;
+
+/* public */
+ function CTag($name=NULL, $paired='no')
+ {
+ $this->SetTagName($name);
+ $this->SetPaired($paired);
+ $this->tag_start= "";
+ $this->tag_end = "\n";
+ $this->tag_body_start = "\n";
+ $this->tag_body_end = "";
+ }
+ function Show()
+ {
+ $this->ShowTagStart();
+ $this->ShowTagBody();
+ $this->ShowTagEnd();
+ }
+ function SetTagName($value=NULL)
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetTagName [$value]");
+ }
+ $this->name=$value;
+ return 0;
+ }
+ function SetClass($value)
+ {
+ if(is_null($value))
+ return 0;
+
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetClass [$value]");
+ }
+ return $this->AddOption("class",$value);
+ }
+ function SetPaired($value='no')
+ {
+ if($value == 'no') $this->paired=$value;
+ elseif($value == 'yes') $this->paired=$value;
+ else
+ {
+ return $this->error("Incorrect value for SetPaired [$value]");
+ }
+ return 0;
+ }
+ function DelOption($name)
+ {
+ if(!is_string($name))
+ {
+ return $this->error("Incorrect value for DelOption [$value]");
+ }
+ unset($this->options[$name]);
+ return 0;
+ }
+ function &GetOption($name)
+ {
+ $ret = NULL;
+ if(is_string($name))
+ if(isset($this->options[$name]))
+ $ret =& $this->options[$name];
+ return $ret;
+ }
+ function AddOption($name, $value)
+ {
+ if(!is_string($name))
+ {
+ return $this->error("Incorrect name for AddOption [$name]");
+ }
+ if(!is_string($value) && !is_int($value) && !is_float($value))
+ {
+ return $this->error("Incorrect value for AddOption [$value]");
+ }
+
+ $this->options[$name] = strval($value);
+ return 0;
+ }
+ function AddItem($value)
+ {
+ if(is_null($value))
+ {
+ return 1;
+ }
+ elseif(is_array($value))
+ {
+ foreach($value as $item)
+ array_push($this->items,$item);
+ }
+ else
+ {
+ array_push($this->items,$value);
+ }
+ return 0;
+ }
+/* protected */
+ function ShowTagStart()
+ {
+ print ($this->tag_start);
+ print("<".$this->name);
+ foreach($this->options as $key => $value)
+ {
+ print (" $key=\"$value\"");
+ }
+
+ if($this->paired=='yes')
+ print (">");
+ else
+ print ("/>");
+
+ print ($this->tag_body_start);
+ }
+ function ShowTagItem($item)
+ {
+ if(is_null($item)) return;
+ elseif(is_object($item))$item->Show();
+ else print (strval($item));
+ }
+ function ShowTagBody()
+ {
+ foreach($this->items as $item)
+ $this->ShowTagItem($item);
+ }
+ function ShowTagEnd()
+ {
+ print ($this->tag_body_end);
+
+ if($this->paired=='yes')
+ {
+ print ("</".$this->name.">");
+ print ($this->tag_end);
+ }
+ }
+ function error($value)
+ {
+ error("class(".get_class($this).") - ".$value);
+ return 1;
+ }
+
+ }
+?>
diff --git a/frontends/php/include/classes/ctextarea.inc.php b/frontends/php/include/classes/ctextarea.inc.php
new file mode 100644
index 00000000..d1d605e8
--- /dev/null
+++ b/frontends/php/include/classes/ctextarea.inc.php
@@ -0,0 +1,91 @@
+<?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 CTextArea extends CTag
+ {
+/* private */
+ var $caption;
+/* public */
+ function CTextArea($name='textarea',$value="",$cols=77,$rows=7,$caption=NULL)
+ {
+ parent::CTag("textarea","yes");
+ $this->SetClass("biginput");
+ $this->AddOption('wrap','soft');
+ $this->SetName($name);
+ $this->SetCols($cols);
+ $this->SetRows($rows);
+ $this->SetCaption($caption);
+ $this->SetValue($value);
+ }
+ function Show()
+ {
+ if(isset($this->caption))
+ print ($this->caption." ");
+ parent::Show();
+ }
+ function SetName($value='textarea')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetName [$value]");
+ }
+ return $this->AddOption("name",$value);
+ }
+ function SetCaption($value=NULL)
+ {
+ if(is_null($value))
+ unset($this->caption);
+ elseif(is_string($value))
+ $this->caption = $value;
+ else
+ {
+ return $this->error("Incorrect value for SetCaption [$value]");
+ }
+ return 0;
+ }
+ function SetValue($value="")
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetValue [$value]");
+ }
+ return $this->AddItem($value);
+ }
+ function SetRows($value)
+ {
+ if(!is_int($value))
+ {
+ return $this->error("Incorrect value for SetRows [$value]");
+ }
+ return $this->AddOption("rows",strval($value));
+
+ }
+ function SetCols($value)
+ {
+ if(!is_int($value))
+ {
+ return $this->error("Incorrect value for SetCols [$value]");
+ }
+ return $this->AddOption("cols",strval($value));
+
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/ctextbox.inc.php b/frontends/php/include/classes/ctextbox.inc.php
new file mode 100644
index 00000000..0a00de40
--- /dev/null
+++ b/frontends/php/include/classes/ctextbox.inc.php
@@ -0,0 +1,95 @@
+<?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 CTextBox extends CTag
+ {
+/* private */
+ var $caption;
+/* public */
+ function CTextBox($name='textbox',$value="",$size=20,$caption=NULL)
+ {
+ parent::CTag("input","no");
+ $this->SetClass("biginput");
+ $this->SetName($name);
+ $this->SetSize($size);
+ $this->SetCaption($caption);
+ $this->SetValue($value);
+ }
+ function Show()
+ {
+ if(isset($this->caption))
+ print ($this->caption." ");
+ parent::Show();
+ }
+ function SetReadonly($value='yes')
+ {
+ if(is_string($value))
+ {
+ if($value=='no')
+ return $this->DelOption("readonly");
+ elseif($value=='yes')
+ return $this->AddOption("readonly",'readonly');
+ }
+ return $this->error("Incorrect value for SetReadonly [$value]");
+ }
+ function SetName($value='textbox')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetName [$value]");
+ }
+ return $this->AddOption("name",$value);
+ }
+ function SetCaption($value=NULL)
+ {
+ if(is_null($value))
+ unset($this->caption);
+ elseif(is_string($value))
+ $this->caption = $value;
+ else
+ {
+ return $this->error("Incorrect value for SetCaption [$value]");
+ }
+ return 0;
+ }
+ function SetValue($value="")
+ {
+ if(is_int($value))
+ {
+ return $this->AddOption("value",strval($value));
+ }
+ elseif(is_string($value))
+ {
+ return $this->AddOption("value",$value);
+ }
+ return $this->error("Incorrect value for SetValue [$value]");
+ }
+ function SetSize($value)
+ {
+ if(!is_int($value))
+ {
+ return $this->error("Incorrect value for SetSize [$value]");
+ }
+ return $this->AddOption("size",strval($value));
+
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/cvar.inc.php b/frontends/php/include/classes/cvar.inc.php
new file mode 100644
index 00000000..b089f181
--- /dev/null
+++ b/frontends/php/include/classes/cvar.inc.php
@@ -0,0 +1,45 @@
+<?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 CVar extends CTag
+ {
+/* public */
+ function CVar($name="",$value="0")
+ {
+ parent::CTag("input","no");
+ $this->AddOption("type","hidden");
+ $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);
+ }
+ }
+?>