summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/classes
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-08 10:37:07 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-08 10:37:07 +0000
commita15f9f40b7eea4a9d2ba16b6ba6a134b45a7f2b9 (patch)
tree494d49a190027ff516b47429041adfdd1c3b9dd8 /frontends/php/include/classes
parent88200af1f657d31aa8ac69e35a12ff5a1bae6e70 (diff)
downloadzabbix-a15f9f40b7eea4a9d2ba16b6ba6a134b45a7f2b9.tar.gz
zabbix-a15f9f40b7eea4a9d2ba16b6ba6a134b45a7f2b9.tar.xz
zabbix-a15f9f40b7eea4a9d2ba16b6ba6a134b45a7f2b9.zip
- [DEV-149] improved host-group-template editing (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5686 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
-rw-r--r--frontends/php/include/classes/ccombobox.inc.php35
1 files changed, 26 insertions, 9 deletions
diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php
index fd98b43b..522a9d03 100644
--- a/frontends/php/include/classes/ccombobox.inc.php
+++ b/frontends/php/include/classes/ccombobox.inc.php
@@ -50,7 +50,7 @@
}
function SetSelected($value='yes')
{
- if((is_string($value) && ($value == 'yes' || $value == "selected" || $value=='on'))
+ if((is_string($value) && ($value == 'yes' || $value == 'selected' || $value=='on'))
|| (is_int($value) && $value<>0))
return $this->options['selected'] = 'selected';
@@ -157,9 +157,11 @@
}
class CTweenBox{
- function ctweenbox(&$form,$name,$size){
+ function ctweenbox(&$form,$name,$value=null,$size=10){
$this->form = &$form;
- $this->name = $name;
+ $this->name = $name;
+
+ $this->value = $value;
$this->id_l = $this->name.'_left';
$this->id_r = $this->name.'_right';
@@ -171,13 +173,23 @@
// $this->rbox->AddOption('style','width: 140px;');
}
- function AddItem($expr, $value, $caption, $selected=NULL, $enabled='yes'){
- if($expr){
- $this->lbox->AddItem($value,$caption,$selected,$enabled);
+ function AddItem($value, $caption, $selected=null, $enabled='yes'){
+ if(is_null($selected)){
+ if(is_array($this->value)) {
+ if(str_in_array($value,$this->value))
+ $selected = 1;
+ }
+ else if(strcmp($value,$this->value) == 0){
+ $selected = 1;
+ }
+ }
+
+ if((is_int($selected) && $selected!=0) || (is_string($selected) && ($selected == 'yes' || $selected == 'selected' || $selected=='on'))){
+ $this->lbox->AddItem($value,$caption,null,$enabled);
$this->form->AddVar($this->name.'['.$value.']',$value);
}
else{
- $this->rbox->AddItem($value,$caption,$selected,$enabled);
+ $this->rbox->AddItem($value,$caption,null,$enabled);
}
}
@@ -191,7 +203,7 @@
}
}
- function Get($caption_l=null,$caption_r=null){
+ function Get($caption_l=S_IN,$caption_r=S_OTHER){
$grp_tab = new CTable();
$grp_tab->SetCellSpacing(0);
$grp_tab->SetCellPadding(0);
@@ -212,9 +224,14 @@
return $grp_tab;
}
- function Show($caption_l=null,$caption_r=null){
+ function Show($caption_l=S_IN,$caption_r=S_OTHER){
$tab = $this->Get($caption_l,$caption_r);
$tab->Show();
}
+
+ function toString(){
+ $tab = $this->Get();
+ return $tab->toString();
+ }
}
?> \ No newline at end of file