summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authordeva <deva>2009-04-18 15:53:00 +0000
committerdeva <deva>2009-04-18 15:53:00 +0000
commit2ef60376a100dfca219a2d455a3ff9fbe2210301 (patch)
treea221145c18dcd3c54189a83b604538656586b4d8 /utils
parent8df91ac2dd8c40eeb7892a88ee52752c99e6fd0d (diff)
Added imagecombobox and fileupload widgets.
Diffstat (limited to 'utils')
-rw-r--r--utils/forms.php42
1 files changed, 39 insertions, 3 deletions
diff --git a/utils/forms.php b/utils/forms.php
index c7971dc..d5216f2 100644
--- a/utils/forms.php
+++ b/utils/forms.php
@@ -1,10 +1,12 @@
<?php
-function beginform($action)
+function beginform($action, $hasfile = false)
{
global $m, $s;
?>
-<form method="post" action="?page=admin&amp;m=<?php echo $m; ?>&amp;s=<?php echo $s; ?>&amp;a=<?php echo $action; ?>">
+<form method="post"
+<?php if($hasfile) { ?> enctype="multipart/form-data"
+<?php } ?> action="?page=admin&amp;m=<?php echo $m; ?>&amp;s=<?php echo $s; ?>&amp;a=<?php echo $action; ?>">
<?php
}
@@ -35,6 +37,16 @@ function lineedit($label, $name, $value = "")
<?php
}
+function fileupload($label, $name, $accept = "*")
+{
+?>
+ <div class="input">
+ <div class="label"><?php echo $label; ?></div>
+ <div class="widget"><input type="file" name="<?php echo $name; ?>" accept="<?php echo $accept;?>"/></div>
+ </div>
+<?php
+}
+
function hidden($values)
{
foreach($values as $key => $value) {
@@ -49,7 +61,7 @@ function textedit($label, $name, $value = "")
?>
<div class="input">
<div class="label"><?php echo $label; ?></div>
- <div class="widget"><textarea name="<?php echo "vars[".$name."]"; ?>"><?php echo $value; ?></textarea></div>
+ <div class="widget"><textarea class="textedit" name="<?php echo "vars[".$name."]"; ?>"><?php echo $value; ?></textarea></div>
</div>
<?php
}
@@ -108,4 +120,28 @@ function combobox($label, $name, $value, $values)
</div>
<?php
}
+
+function imagecombobox($label, $name, $value, $values)
+{
+?>
+ <div class="input">
+ <div class="label"><?php echo $label; ?></div>
+ <div class="widget">
+ <select name="<?php echo "vars[".$name."]"; ?>">
+<?php
+
+ foreach($values as $k => $v) {
+?>
+ <optgroup style="background-image: url(<?php echo $v;?>); height: 100px; width: 100px;"/>
+ <option value="<?php echo $k; ?>"<?php if($v == $value) echo " selected";?>><?php echo $k;?></option>
+ </optgroup>
+<?php
+ }
+?>
+ </select>
+ </div>
+ </div>
+<?php
+}
+
?>