From 3cb7a7f16be016f2d563762379222fdea5767986 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 28 Apr 2009 07:36:01 +0000 Subject: Added icon module, and made the news module use it. Also made the ImageComboBox use it if supplied as the values parameter. --- utils/forms.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'utils/forms.php') diff --git a/utils/forms.php b/utils/forms.php index d946c34..a450463 100644 --- a/utils/forms.php +++ b/utils/forms.php @@ -209,7 +209,12 @@ class ImageComboBox { public function render($indent = "") { - $width = 100; + $selheight = 64; + $height = $selheight * 0.8; + + if(get_class($this->values) == "Icons") $numicons = sizeof($this->values->icons); + else $numicons = sizeof($this->values); + $str = $indent . "
\n"; $str .= $indent . "
".$this->label."
\n"; $str .= $indent . "
\n"; @@ -220,18 +225,24 @@ class ImageComboBox { $str .= $indent . " var container = document.getElementById('icons');\n"; $str .= $indent . " var icons = document.getElementsByName('icon');\n"; $str .= $indent . " for(i = 0; i < icons.length; i++) {\n"; - $str .= $indent . " if(icons[i].src == value) icons[i].width = ".$width.";\n"; - $str .= $indent . " else icons[i].width = ".($width - 10).";\n"; + $str .= $indent . " if(icons[i].alt == value) icons[i].height = ".$selheight.";\n"; + $str .= $indent . " else icons[i].height = ".$height.";\n"; // $str .= $indent . " if(icons[i].src == value) icons[i].style.border = '10px blue';\n"; // $str .= $indent . " else { icons[i].style.border = '0px' }\n"; $str .= $indent . " }\n"; $str .= $indent . " }\n"; $str .= $indent . " \n"; - $str .= $indent . "
\n"; - $str .= $indent . "
values)."px;\">\n"; + $str .= $indent . "
\n"; + $str .= $indent . "
\n"; $str .= $indent . " name."\" name=\"vars[".$this->name."]\" type=\"hidden\" value=\"\"/>\n"; - foreach($this->values as $k => $v) { - $str .= $indent . " \n"; + if(get_class($this->values) == "Icons") { + foreach($this->values->icons as $icon) { + $str .= $indent . " \"".$icon-file."\" src=\"".$icon->prefix.$icon->file."\" onclick=\"setSelection('".$icon->file."')\"/>\n"; + } + } else { + foreach($this->values as $k => $v) { + $str .= $indent . " \"".$v."\"\n"; + } } $str .= $indent . "
\n"; // box $str .= $indent . "
\n"; // overflow -- cgit v1.2.3