summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/classes
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-13 15:51:21 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-13 15:51:21 +0000
commite9057de8be3f2273d6251b7d0a6095cf978f27f1 (patch)
treed629cc30cf6b96e12032846be3b08add7b0a8237 /frontends/php/include/classes
parent2934d33bae581c7c54502ce02364f10c3b7d7a45 (diff)
- Frontend improvements. (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2523 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
-rw-r--r--frontends/php/include/classes/ccheckbox.inc.php17
-rw-r--r--frontends/php/include/classes/ccombobox.inc.php37
-rw-r--r--frontends/php/include/classes/cfile.inc.php50
-rw-r--r--frontends/php/include/classes/cform.inc.php12
-rw-r--r--frontends/php/include/classes/cformtable.inc.php6
-rw-r--r--frontends/php/include/classes/clistbox.inc.php44
-rw-r--r--frontends/php/include/classes/ctag.inc.php2
7 files changed, 140 insertions, 28 deletions
diff --git a/frontends/php/include/classes/ccheckbox.inc.php b/frontends/php/include/classes/ccheckbox.inc.php
index 5f492dd0..78be0b90 100644
--- a/frontends/php/include/classes/ccheckbox.inc.php
+++ b/frontends/php/include/classes/ccheckbox.inc.php
@@ -22,7 +22,7 @@
class CCheckBox extends CTag
{
/* public */
- function CCheckBox($name='checkbox',$value=NULL,$checked="no")
+ function CCheckBox($name='checkbox',$value=NULL,$checked="no",$action=NULL)
{
parent::CTag("input","no");
$this->tag_body_start = "";
@@ -30,6 +30,7 @@
$this->SetName($name);
$this->SetCaption($value);
$this->SetChecked($checked);
+ $this->SetAction($action);
}
function SetName($value='checkbox')
{
@@ -49,11 +50,21 @@
}
function SetChecked($value="yes")
{
- if($value=="yes")
+ if($value=="yes" || $value=="checked" || $value=="on")
return $this->AddOption("checked","checked");
- elseif($value=="no")
+ elseif($value=="no" || $value=="unchecked" || $value=="off" || $value==NULL)
return $this->DelOption("checked");
return $this->error("Incorrect value for SetChacked [$value]");
}
+ 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);
+ }
}
?>
diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php
index 33d65256..bd093772 100644
--- a/frontends/php/include/classes/ccombobox.inc.php
+++ b/frontends/php/include/classes/ccombobox.inc.php
@@ -46,24 +46,18 @@
}
function SetEnable($value='yes')
{
- if(is_string($value))
- {
- if($value == 'yes')
- return $this->DelOption('disabled');
- elseif($value == 'no')
- return $this->AddOption('disabled','disabled');
- }
+ if($value == 'yes' || $value == 'enabled' || $value=='on')
+ return $this->DelOption('disabled');
+ elseif($value == 'no' || $value == 'disabled' || $value=='off' || $value == NULL)
+ return $this->AddOption('disabled','disabled');
return $this->error("Incorrect value for SetEnable [$value]");
}
- function SetSelected($value)
+ function SetSelected($value='yes')
{
- if(is_string($value))
- {
- if($value == 'yes')
- return $this->AddOption('selected','selected');
- elseif($value == 'no')
- return $this->DelOption('selected');
- }
+ if($value == 'yes' || $value == "selected" || $value=='on')
+ return $this->AddOption('selected','selected');
+ elseif($value == 'no' || $value=='off' || $value == NULL)
+ return $this->DelOption('selected');
return $this->error("Incorrect value for SetSelected [$value]");
}
}
@@ -119,12 +113,15 @@
{
$this->value = $value;
}
- function AddItem($value, $caption, $enabled='yes')
+ function AddItem($value, $caption, $selected=NULL, $enabled='yes')
{
- $selected = 'no';
- if(!is_null($this->value))
- if($this->value==$value)
- $selected = '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 */
diff --git a/frontends/php/include/classes/cfile.inc.php b/frontends/php/include/classes/cfile.inc.php
new file mode 100644
index 00000000..bea8d910
--- /dev/null
+++ b/frontends/php/include/classes/cfile.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 CFile extends CTag
+ {
+/* public */
+ function CFile ($name='file',$value="")
+ {
+ parent::CTag("input","no");
+ $this->SetClass("biginput");
+ $this->AddOption("type","file");
+ $this->SetName($name);
+ $this->SetFile($value);
+ }
+ function SetName($value='textarea')
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetName [$value]");
+ }
+ return $this->AddOption("name",$value);
+ }
+ function SetFile($value="")
+ {
+ if(!is_string($value))
+ {
+ return $this->error("Incorrect value for SetFile [$value]");
+ }
+ return $this->AddOption("value",$value);
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/cform.inc.php b/frontends/php/include/classes/cform.inc.php
index 065185f9..3dee3109 100644
--- a/frontends/php/include/classes/cform.inc.php
+++ b/frontends/php/include/classes/cform.inc.php
@@ -22,11 +22,12 @@
class CForm extends CTag
{
/* public */
- function CForm($action=NULL, $method='get')
+ function CForm($action=NULL, $method='get', $enctype=NULL)
{
parent::CTag("form","yes");
$this->SetMethod($method);
$this->SetAction($action);
+ $this->SetEnctype($enctype);
}
function SetMethod($value='post')
{
@@ -46,6 +47,15 @@
}
return $this->AddOption("action",$value);
}
+ function SetEnctype($value=NULL)
+ {
+ if(is_null($value)){
+ return $this->DelOption("enctype");
+ }elseif(!is_string($value)){
+ return $this->error("Incorrect value for SetEnctype [$value]");
+ }
+ return $this->AddOption("enctype",$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
index 61139b2b..6fb0c32c 100644
--- a/frontends/php/include/classes/cformtable.inc.php
+++ b/frontends/php/include/classes/cformtable.inc.php
@@ -30,9 +30,9 @@
var $center_items = array();
var $bottom_items = array();
/* public */
- function CFormTable($title=NULL, $action=NULL, $method='get')
+ function CFormTable($title=NULL, $action=NULL, $method='get', $enctype=NULL)
{
- parent::CForm($action,$method);
+ parent::CForm($action,$method,$enctype);
$this->SetTitle($title);
$this->SetAlign('center');
$this->SetHelp();
@@ -96,7 +96,7 @@
);
array_push($this->center_items, $row);
}
- function AddSpanRow($value, $class="form_row_last")
+ function AddSpanRow($value, $class=NULL)
{
$col = new CCol($value,$class);
$col->SetColSpan(2);
diff --git a/frontends/php/include/classes/clistbox.inc.php b/frontends/php/include/classes/clistbox.inc.php
new file mode 100644
index 00000000..1fca2426
--- /dev/null
+++ b/frontends/php/include/classes/clistbox.inc.php
@@ -0,0 +1,44 @@
+<?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 CListItem extends CComboItem
+ {
+/* public */
+ }
+
+ class CListBox extends CComboBox
+ {
+/* private */
+ var $caption;
+
+/* public */
+ function CListBox($name='combobox',$size=5,$action=NULL)
+ {
+ parent::CComboBox($name,NULL,$action);
+ $this->AddOption("size",$size);
+ $this->AddOption("multiple","multiple");
+ }
+ function AddItem($value, $caption, $selected='no', $enabled='yes')
+ {
+ parent::AddItem($value, $caption, $selected, $enabled);
+ }
+ }
+?>
diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php
index 50f3f0b9..7d4519fc 100644
--- a/frontends/php/include/classes/ctag.inc.php
+++ b/frontends/php/include/classes/ctag.inc.php
@@ -144,7 +144,7 @@
print ($this->tag_body_start);
}
- function ShowTagItem($item)
+ function ShowTagItem(&$item)
{
if(is_null($item)) return;
elseif(is_object($item))$item->Show();