mirror of
https://github.com/e107inc/e107.git
synced 2025-07-25 00:41:52 +02:00
e_form ready (although need more work and testing), more Administration work
This commit is contained in:
@@ -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 = '<span class="error">'.IMALAN_70.'</span>';
|
||||
$disabled = ' disabled="disabled"';
|
||||
$disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -289,14 +291,12 @@ if (isset($_POST['show_avatars']))
|
||||
<div class='image-users'>{$users}</div>
|
||||
<div class='image-preview'>{$img_src}</div>
|
||||
<div class='image-delete'>
|
||||
<input type='checkbox' class='checkbox' id='image-action-{$count}' name='multiaction[]' value='{$row['user_id']}#{$image_pre}{$image_name}'{$disabled} />
|
||||
".$frm->checkbox('multiaction[]', "{$row['user_id']}#{$image_pre}{$image_name}", false, array('id' => false, 'disabled' => $disabled))."
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
@@ -304,11 +304,11 @@ if (isset($_POST['show_avatars']))
|
||||
<div class='spacer clear'>
|
||||
<div class='buttons-bar'>
|
||||
<input type='hidden' name='show_avatars' value='1' />
|
||||
<button class='action' type='button' name='check_all' value='".IMALAN_59."'><span>".IMALAN_59."</span></button>
|
||||
<button class='action' type='button' name='uncheck_all' value='".IMALAN_60."'><span>".IMALAN_60."</span></button>
|
||||
<button class='delete' type='submit' name='submit_show_delete_multi' value='".IMALAN_58."'><span>".IMALAN_58."</span></button>
|
||||
<button class='delete' type='submit' name='submit_show_deleteall' value='".IMALAN_25."'><span>".IMALAN_25."</span></button>
|
||||
<button class='cancel' type='submit' name='submit_cancel_show' value='".IMALAN_68."'><span>".IMALAN_68."</span></button>
|
||||
".$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')."
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -447,9 +447,9 @@ if (isset($_POST['check_avatar_sizes']))
|
||||
</table>
|
||||
<div class='buttons-bar'>
|
||||
<input type='hidden' name='check_avatar_sizes' value='1' />
|
||||
<button class='action' type='button' name='check_all' value='".IMALAN_59."'><span>".IMALAN_59."</span></button>
|
||||
<button class='action' type='button' name='uncheck_all' value='".IMALAN_60."'><span>".IMALAN_60."</span></button>
|
||||
<button class='delete' type='submit' name='submit_avdelete_multi' value='".IMALAN_58."'><span>".IMALAN_58."</span></button>
|
||||
".$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')."
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -543,7 +543,7 @@ $text = "
|
||||
</td>
|
||||
<td class='control'>
|
||||
<div class='auto-toggle-area autocheck'>
|
||||
<input class='checkbox' type='checkbox' name='image_post' value='1'".($pref['image_post'] ? " checked='checked'" : '')." />
|
||||
".$frm->checkbox('image_post', 1, $pref['image_post'])."
|
||||
<div class='smalltext field-help'>".IMALAN_2."</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -563,10 +563,10 @@ $text = "
|
||||
".IMALAN_12."
|
||||
</td>
|
||||
<td class='control'>
|
||||
<select name='image_post_disabled_method' class='tbox select'>
|
||||
<option value='0'".($pref['image_post_disabled_method'] == "0" ? " selected='selected'" : '').">".IMALAN_14."</option>
|
||||
<option value='1'".($pref['image_post_disabled_method'] == "1" ? " selected='selected'" : "").">".IMALAN_15."</option>
|
||||
</select>
|
||||
".$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()."
|
||||
<div class='smalltext field-help'>".IMALAN_13."</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -574,11 +574,11 @@ $text = "
|
||||
<tr>
|
||||
<td class='label'>".IMALAN_3."<div class='label-note'>".IMALAN_54." {$gd_version}</div></td>
|
||||
<td class='control'>
|
||||
<select name='resize_method' class='tbox'>
|
||||
<option".($pref['resize_method'] == "gd1" ? " selected='selected'" : '').">gd1</option>
|
||||
<option".($pref['resize_method'] == "gd2" ? " selected='selected'" : '').">gd2</option>
|
||||
<option".($pref['resize_method'] == "ImageMagick" ? " selected='selected'" : '').">ImageMagick</option>
|
||||
</select>
|
||||
".$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()."
|
||||
<div class='smalltext field-help'>".IMALAN_4."</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -586,7 +586,7 @@ $text = "
|
||||
<tr>
|
||||
<td class='label'>".IMALAN_5."<div class='label-note'>{$IM_NOTE}</div></td>
|
||||
<td class='control'>
|
||||
<input class='tbox input-text' type='text' name='im_path' size='40' value='{$pref['im_path']}' maxlength='200' />
|
||||
".$frm->text('im_path', $pref['im_path'])."
|
||||
<div class='smalltext field-help'>".IMALAN_6."</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -596,7 +596,7 @@ $text = "
|
||||
</td>
|
||||
<td class='control'>
|
||||
<div class='auto-toggle-area autocheck'>
|
||||
<input type='checkbox' class='checkbox' name='enable_png_image_fix' value='1'".($pref['enable_png_image_fix'] ? " checked='checked'" : '')." />
|
||||
".$frm->checkbox('enable_png_image_fix', 1, ($pref['enable_png_image_fix']))."
|
||||
<div class='smalltext field-help'>".IMALAN_35."</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -605,20 +605,20 @@ $text = "
|
||||
<tr>
|
||||
<td class='label'>".IMALAN_16."</td>
|
||||
<td class='control'>
|
||||
<button class='action' type='submit' name='show_avatars'><span>".IMALAN_17."</span></button>
|
||||
".$frm->admin_button('show_avatars', IMALAN_17)."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='label'>".IMALAN_36."</td>
|
||||
<td class='control'>
|
||||
<button class='action' type='submit' name='check_avatar_sizes'><span>".IMALAN_17."</span></button>
|
||||
".$frm->admin_button('check_avatar_sizes', IMALAN_17)."
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
<button class='update' type='submit' name='update_options' value='".IMALAN_8."'><span>".IMALAN_8."</span></button>
|
||||
".$frm->admin_button('update_options', IMALAN_8, 'update')."
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>";
|
||||
|
@@ -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 "<input type='text' name='{$name}' value='{$value}' maxlength={$maxlength}".$this->get_attributes($options)." />";
|
||||
return "<input type='text' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options)." />";
|
||||
}
|
||||
|
||||
function file($name, $options = array())
|
||||
{
|
||||
$options = $this->format_options('text', $name, $options);
|
||||
return "<input type='text' name='{$name}'".$this->get_attributes($options)." />";
|
||||
}
|
||||
|
||||
|
||||
function password($name, $maxlength = 50, $options = array())
|
||||
{
|
||||
$options = $this->format_options('text', $name, $options);
|
||||
return "<input type='password' name='{$name}' value='' maxlength={$maxlength}".$this->get_attributes($options)." />";
|
||||
return "<input type='password' name='{$name}' value='' maxlength='{$maxlength}'".$this->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 "<textarea name='{$name}' rows='{$rows}' cols='{$cols}'".$this->get_attributes($options).">{$value}</textarea>";
|
||||
}
|
||||
|
||||
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 "<input type='checkbox' name='{$name}' value='{$value}'".$this->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 "<input type='radio' name='{$name}' value='".$value."'".$this->get_attributes($options)." />";
|
||||
|
||||
}
|
||||
|
||||
function label($text, $for_id, $name = '')
|
||||
{
|
||||
if($name) $for_id = $this->_format_id($for_id, $name);
|
||||
return "<label for='{$for_id}'>{$text}</label>";
|
||||
}
|
||||
|
||||
function select_open($name, $options = array())
|
||||
{
|
||||
$options = $this->format_options('select', $name, $options);
|
||||
return "<select name='{$name}'".$this->get_attributes($options).">";
|
||||
}
|
||||
|
||||
function optgroup_open($label, $disabled)
|
||||
{
|
||||
return "<optgroup class='optgroup' label='{$label}'".($disabled ? " disabled='disabled'" : '').">";
|
||||
}
|
||||
|
||||
function option($option_name, $value, $selected = false, $options = array())
|
||||
{
|
||||
if(false === $value) $value = '';
|
||||
$options['selected'] = $selected; //comes as separate argument just for convenience
|
||||
$options = $this->format_options('option', '', $options);
|
||||
return "<option value='{$value}'".$this->get_attributes($options).">{$option_name}</option>";
|
||||
}
|
||||
|
||||
//------------------ Work in progress END --------------------------->
|
||||
function optgroup_close()
|
||||
{
|
||||
return "</optgroup>";
|
||||
}
|
||||
|
||||
function select_close()
|
||||
{
|
||||
return "</select>";
|
||||
}
|
||||
|
||||
function hidden($name, $value, $options = array())
|
||||
{
|
||||
$options = $this->format_options('hidden', $name, $options);
|
||||
return "<input type='hidden' name='{$name}' value='{$value}'".$this->get_attributes($options)." />";
|
||||
}
|
||||
|
||||
function submit($name, $value, $options = array())
|
||||
{
|
||||
$options = $this->format_options('submit', $name, $options);
|
||||
return "<input class='button' type='submit' name='{$name}' value='{$value}'".$this->get_attributes($options)." />";
|
||||
}
|
||||
|
||||
function submit_image($name, $value, $image, $options = array())
|
||||
{
|
||||
$options = $this->format_options('submit', $name, $options);
|
||||
return "<input class='image' type='image' src='{$image}' name='{$name}' value='{$value}'".$this->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 "
|
||||
<button type='{$btype}' name='{$name}' value='{$value}'".$this->get_attributes($options).">
|
||||
<span>{$label}</span>
|
||||
</button>
|
||||
";
|
||||
}
|
||||
|
||||
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;
|
||||
|
@@ -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 = "<select class='tbox' name='{$fieldname}' {$extra_js}>\n".$text."</select>\n";
|
||||
if ($text) $text = "<select class='tbox select' name='{$fieldname}' {$extra_js}>\n".$text."</select>\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 .= "<label><input type='checkbox' name='{$fieldname}[{$k}]' value='{$k}' {$c} /> ".$v."</label><br />\n";
|
||||
$ret .= "<label><input type='checkbox' class='checkbox' name='{$fieldname}[{$k}]' value='{$k}' {$c} /> ".$v."</label><br />\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ class user_class
|
||||
foreach($tmpl as $lang)
|
||||
{
|
||||
$c = (in_array($lang, $curArray)) ? " checked='checked' " : "";
|
||||
$ret .= "<label><input type='checkbox' name='{$fieldname}[{$lang}]' value='1' {$c} /> {$lang}</label><br />";
|
||||
$ret .= "<label><input type='checkbox' class='checkbox' name='{$fieldname}[{$lang}]' value='1' {$c} /> {$lang}</label><br />";
|
||||
}
|
||||
}
|
||||
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 "<div {$style}><input type='checkbox' name='{$treename}[]' id='{$treename}_{$classnum}' value='{$classnum}'{$chk} />".$this->class_tree[$classnum]['userclass_name']."</div>\n";
|
||||
return "<div {$style}><input type='checkbox' class='checkbox' name='{$treename}[]' id='{$treename}_{$classnum}' value='{$classnum}'{$chk} />".$this->class_tree[$classnum]['userclass_name']."</div>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +519,7 @@ class user_class
|
||||
{
|
||||
$style = " style='text-indent:".(1.2*$nest_level)."em'";
|
||||
}
|
||||
return "<div {$style}><input type='checkbox' name='{$treename}[]' id='{$treename}_{$classnum}' value='{$classnum}'{$chk} />".$this->class_tree[$classnum]['userclass_name'].' ('.$this->class_tree[$classnum]['userclass_description'].")</div>\n";
|
||||
return "<div {$style}><input type='checkbox' class='checkbox' name='{$treename}[]' id='{$treename}_{$classnum}' value='{$classnum}'{$chk} />".$this->class_tree[$classnum]['userclass_name'].' ('.$this->class_tree[$classnum]['userclass_description'].")</div>\n";
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user