diff --git a/e107_admin/image.php b/e107_admin/image.php index 5959d0233..8341b2627 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -9,8 +9,8 @@ * Image Administration Area * * $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $ - * $Revision: 1.16 $ - * $Date: 2008-12-12 09:55:33 $ + * $Revision: 1.17 $ + * $Date: 2008-12-12 22:39:17 $ * $Author: secretr $ * */ @@ -27,6 +27,8 @@ require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."userclass_class.php"); require_once(e_HANDLER."message_handler.php"); $rs = new form; +$frm = new e_form(); //new form handler + $emessage = &eMessage::getInstance(); /* @@ -245,7 +247,7 @@ if (isset($_POST['show_avatars'])) $users = IMALAN_21." | "; $row = array('user_id' => ''); $image_pre = ''; - $disabled = ''; + $disabled = false; if ($sql->db_Select("user", "*", "user_image='-upload-".$tp->toDB($image_name)."' OR user_sess='".$tp->toDB($image_name)."'")) { $row = $sql->db_Fetch(); @@ -263,7 +265,7 @@ if (isset($_POST['show_avatars'])) //Friendly UI - click text to select a form element $img_src = ''.IMALAN_70.''; - $disabled = ' disabled="disabled"'; + $disabled = true; } else { @@ -289,14 +291,12 @@ if (isset($_POST['show_avatars']))
{$users}
{$img_src}
- + ".$frm->checkbox('multiaction[]', "{$row['user_id']}#{$image_pre}{$image_name}", false, array('id' => false, 'disabled' => $disabled))."
- "; - $count++; } @@ -304,11 +304,11 @@ if (isset($_POST['show_avatars']))
- - - - - + ".$frm->admin_button('check_all', IMALAN_59, 'action')." + ".$frm->admin_button('uncheck_all', IMALAN_60, 'action')." + ".$frm->admin_button('submit_show_delete_multi', IMALAN_58, 'delete')." + ".$frm->admin_button('submit_show_deleteall', IMALAN_25, 'delete')." + ".$frm->admin_button('submit_cancel_show', IMALAN_68, 'cancel')."
@@ -447,9 +447,9 @@ if (isset($_POST['check_avatar_sizes']))
- - - + ".$frm->admin_button('check_all', IMALAN_59, 'action')." + ".$frm->admin_button('uncheck_all', IMALAN_60, 'action')." + ".$frm->admin_button('submit_avdelete_multi', IMALAN_58, 'delete')."
@@ -543,7 +543,7 @@ $text = "
- + ".$frm->checkbox('image_post', 1, $pref['image_post'])."
".IMALAN_2."
@@ -563,10 +563,10 @@ $text = " ".IMALAN_12." - + ".$frm->select_open('image_post_disabled_method')." + ".$frm->option(IMALAN_14, '0', ($pref['image_post_disabled_method'] == "0"))." + ".$frm->option(IMALAN_15, '1', ($pref['image_post_disabled_method'] == "1"))." + ".$frm->select_close()."
".IMALAN_13."
@@ -574,11 +574,11 @@ $text = " ".IMALAN_3."
".IMALAN_54." {$gd_version}
- + ".$frm->select_open('resize_method')." + ".$frm->option('gd1', 'gd1', ($pref['resize_method'] == "gd1"))." + ".$frm->option('gd2', 'gd2', ($pref['resize_method'] == "gd2"))." + ".$frm->option('ImageMagick', 'ImageMagick', ($pref['resize_method'] == "ImageMagick"))." + ".$frm->select_close()."
".IMALAN_4."
@@ -586,7 +586,7 @@ $text = " ".IMALAN_5."
{$IM_NOTE}
- + ".$frm->text('im_path', $pref['im_path'])."
".IMALAN_6."
@@ -596,7 +596,7 @@ $text = "
- + ".$frm->checkbox('enable_png_image_fix', 1, ($pref['enable_png_image_fix']))."
".IMALAN_35."
@@ -605,20 +605,20 @@ $text = " ".IMALAN_16." - + ".$frm->admin_button('show_avatars', IMALAN_17)." ".IMALAN_36." - + ".$frm->admin_button('check_avatar_sizes', IMALAN_17)."
- + ".$frm->admin_button('update_options', IMALAN_8, 'update')."
"; diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 4084045fc..659c6b874 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -9,8 +9,8 @@ * Form Handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ - * $Revision: 1.4 $ - * $Date: 2008-12-12 16:36:45 $ + * $Revision: 1.5 $ + * $Date: 2008-12-12 22:39:17 $ * $Author: secretr $ * */ @@ -38,10 +38,18 @@ if (!defined('e107_INIT')) { exit; } * * - size => (int) size attribute value (used when needed) * default: 40 + * + * - title (string) title attribute + * default: empty string (omitted) * * - readonly => (bool) readonly attribute * default: false - * + * + * - selected => (bool) selected attribute (used when needed) + * default: false + * + * checked => (bool) checked attribute (used when needed) + * default: false * - disabled => (bool) disabled attribute * default: false * @@ -66,24 +74,113 @@ class e_form function text($name, $value, $maxlength = 200, $options = array()) { $options = $this->format_options('text', $name, $options); - return "get_attributes($options)." />"; + return "get_attributes($options)." />"; } + function file($name, $options = array()) + { + $options = $this->format_options('text', $name, $options); + return "get_attributes($options)." />"; + } + + function password($name, $maxlength = 50, $options = array()) { $options = $this->format_options('text', $name, $options); - return "get_attributes($options)." />"; + return "get_attributes($options)." />"; } - //------------------ Work in progress START ---------------------------> - function textarea($name, $value, $rows, $cols, $options = array()) + + function textarea($name, $value, $rows = 15, $cols = 40, $options = array()) { - //TODO - Add title to option array + $options = $this->format_options('textarea', $name, $options); + return ""; + } + + function checkbox($name, $value, $checked = false, $options = array()) + { + $options['checked'] = $checked; //comes as separate argument just for convenience + $options = $this->format_options('checkbox', $name, $options); + return "get_attributes($options)." />"; + + } + + function radio($name, $value, $checked = false, $options = array()) + { + $options['checked'] = $checked; //comes as separate argument just for convenience + $options = $this->format_options('radio', $name, $options); + return "get_attributes($options)." />"; + + } + + function label($text, $for_id, $name = '') + { + if($name) $for_id = $this->_format_id($for_id, $name); + return ""; } + function select_open($name, $options = array()) + { + $options = $this->format_options('select', $name, $options); + return ""; + } + function hidden($name, $value, $options = array()) + { + $options = $this->format_options('hidden', $name, $options); + return "get_attributes($options)." />"; + } + + function submit($name, $value, $options = array()) + { + $options = $this->format_options('submit', $name, $options); + return "get_attributes($options)." />"; + } + + function submit_image($name, $value, $image, $options = array()) + { + $options = $this->format_options('submit', $name, $options); + return "get_attributes($options)." />"; + } + + function admin_button($name, $value, $action = '', $label = '', $options = array()) + { + $options['class'] = $action; //additional classes not allowed + $btype = 'submit'; + if($action == 'action') $btype = 'button'; + $options = $this->format_options('admin_button', $name, $options); + if(empty($label)) $label = $value; + + return " + + "; + } + function get_attributes($options) { $ret = ''; @@ -103,16 +200,29 @@ class e_form case 'size': if($optval) $ret .= " size='{$optval}'"; break; + + case 'title': + if($optval) $ret .= " title='{$optval}'"; + break; case 'tabindex': if($optval === false || !$this->_tabindex_enabled) break; - $ret .= " tabindex='".($optval ? $optval : $this->_tabindex_counter++)."'"; + $this->_tabindex_counter++; + $ret .= " tabindex='".($optval ? $optval : $this->_tabindex_counter)."'"; break; case 'readonly': if($optval) $ret .= " readonly='readonly'"; break; + case 'selected': + if($optval) $ret .= " selected='selected'"; + break; + + case 'checked': + if($optval) $ret .= " checked='checked'"; + break; + case 'disabled': if($optval) $ret .= " disabled='disabled'"; break; @@ -174,11 +284,15 @@ class e_form if(isset($this->_cached_attributes[$type])) return $this->_cached_attributes[$type]; $def_options = array( + 'id' => '', 'class' => '', + 'title' => '', 'size' => '', 'readonly' => false, + 'selected' => false, + 'checked' => false, 'disabled' => false, - 'tabindex' => $this->_tab_counter, + 'tabindex' => 0, 'other' => '' ); @@ -189,34 +303,42 @@ class e_form case 'text': $def_options['class'] = 'tbox input-text'; + unset($def_options['selected'], $def_options['checked']); break; case 'textarea': $def_options['class'] = 'tbox textarea'; + unset($def_options['selected'], $def_options['checked'], $def_options['size']); break; case 'select': $def_options['class'] = 'tbox select'; + unset($def_options['checked'], $def_options['checked']); + break; + + case 'option': + $def_options = array('class' => '', 'selected' => false, 'other' => ''); break; case 'radio': $def_options['class'] = 'radio'; + unset($def_options['size'], $def_options['selected']); break; case 'checkbox': $def_options['class'] = 'checkbox'; + unset($def_options['size'], $def_options['selected']); break; case 'submit': $def_options['class'] = 'button'; + unset($def_options['checked'], $def_options['selected'], $def_options['readonly']); break; case 'admin_button': + unset($def_options['checked'], $def_options['selected'], $def_options['readonly']); break; - case 'option': - $def_options = array('class' => '', 'other' => ''); - break; } $this->_cached_attributes[$type] = $def_options; diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index dc5210b34..30f73b0a5 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $ -| $Revision: 1.22 $ -| $Date: 2008-12-07 16:37:37 $ -| $Author: e107steved $ +| $Revision: 1.23 $ +| $Date: 2008-12-12 22:39:17 $ +| $Author: secretr $ +----------------------------------------------------------------------------+ */ @@ -280,7 +280,7 @@ class user_class } // Only return the select box if we've ended up with some options - if ($text) $text = "\n"; + if ($text) $text = "\n"; return $text; } @@ -388,7 +388,7 @@ class user_class { $c = (in_array($k,$curArray)) ? " checked='checked'" : ""; if ($showdescription) $v .= " (".$this->uc_get_classdescription($k).")"; - $ret .= "
\n"; + $ret .= "
\n"; } } @@ -399,7 +399,7 @@ class user_class foreach($tmpl as $lang) { $c = (in_array($lang, $curArray)) ? " checked='checked' " : ""; - $ret .= "
"; + $ret .= "
"; } } return $ret; @@ -501,7 +501,7 @@ class user_class // $style = " style='text-indent:".(12*$nest_level)."px'"; $style = " style='text-indent:".(1.2*$nest_level)."em'"; } - return "
".$this->class_tree[$classnum]['userclass_name']."
\n"; + return "
".$this->class_tree[$classnum]['userclass_name']."
\n"; } @@ -519,7 +519,7 @@ class user_class { $style = " style='text-indent:".(1.2*$nest_level)."em'"; } - return "
".$this->class_tree[$classnum]['userclass_name'].' ('.$this->class_tree[$classnum]['userclass_description'].")
\n"; + return "
".$this->class_tree[$classnum]['userclass_name'].' ('.$this->class_tree[$classnum]['userclass_description'].")
\n"; }