diff --git a/e107_admin/image.php b/e107_admin/image.php index 504d94fb9..63c6402af 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -375,7 +375,7 @@ class media_admin_ui extends e_admin_ui 'watermark_activate' => array('title'=> 'Watermark Activation', 'type' => 'text', 'data' => 'str', 'help'=>'All images with a width or height greater than this value will be given a watermark during resizing.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'watermark_text' => array('title'=> 'Watermark Text', 'type' => 'text', 'data' => 'str', 'help'=>'Optional Watermark Text'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'watermark_font' => array('title'=> 'Watermark Font', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Optional Watermark Font. Upload more .ttf fonts to the /fonts folder in your theme directory.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), - 'watermark_size' => array('title'=> 'Watermark Size', 'type' => 'text', 'data' => 'int', 'help'=>'Optional Watermark Font'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), + 'watermark_size' => array('title'=> 'Watermark Size', 'type' => 'text', 'data' => 'int', 'help'=>'Size of the font in pts'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'watermark_pos' => array('title'=> 'Watermark Position', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Watermark Position'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'watermark_opacity' => array('title'=> 'Watermark Opacity', 'type' => 'text', 'data' => 'int', 'help'=>'Enter a number between 1 and 100'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), diff --git a/e107_admin/users.php b/e107_admin/users.php index 04a86ead1..ecef38fcf 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -684,20 +684,20 @@ class users_admin_ui extends e_admin_ui 'user_login' => array('title' => LAN_USER_03, 'type' => 'text', 'width' => 'auto'), // Real name (no real vetting) 'user_customtitle' => array('title' => LAN_USER_04, 'type' => 'text', 'width' => 'auto'), // No real vetting // 'user_password' => array('title' => LAN_USER_05, 'type' => 'text', 'width' => 'auto'), //TODO add md5 option to form handler? - 'user_sess' => array('title' => 'session', 'type' => 'text', 'width' => 'auto'), // Photo + 'user_sess' => array('title' => 'Session', 'type' => 'text', 'width' => 'auto'), // Photo 'user_image' => array('title' => LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar 'user_email' => array('title' => LAN_USER_08, 'type' => 'text', 'width' => 'auto'), 'user_hideemail' => array('title' => LAN_USER_10, 'type' => 'boolean', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), - 'user_xup' => array('title' => 'Xup', 'type' => 'text', 'width' => 'auto'), - 'user_class' => array('title' => LAN_USER_12, 'type' => 'userclass' , 'filter'=>true, 'batch'=>true), - 'user_join' => array('title' => LAN_USER_14, 'type' => 'datestamp', 'width' => 'auto'), + 'user_xup' => array('title' => 'Xup', 'type' => 'text', 'width' => 'auto'), + 'user_class' => array('title' => LAN_USER_12, 'type' => 'method' , 'data' =>'text', 'filter'=>true, 'batch'=>true), + 'user_join' => array('title' => LAN_USER_14, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'), 'user_lastvisit' => array('title' => LAN_USER_15, 'type' => 'datestamp', 'width' => 'auto'), 'user_currentvisit' => array('title' => LAN_USER_16, 'type' => 'datestamp', 'width' => 'auto'), - 'user_comments' => array('title' => LAN_USER_17, 'type' => 'integer', 'width' => 'auto','thclass'=>'right','class'=>'right'), + 'user_comments' => array('title' => LAN_USER_17, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), 'user_lastpost' => array('title' => 'Last Post', 'type' => 'datestamp', 'width' => 'auto'), 'user_ip' => array('title' => LAN_USER_18, 'type' => 'ip', 'width' => 'auto'), // 'user_prefs' => array('title' => LAN_USER_20, 'type' => 'text', 'width' => 'auto'), - 'user_visits' => array('title' => LAN_USER_21, 'type' => 'integer', 'width' => 'auto','thclass'=>'right','class'=>'right'), + 'user_visits' => array('title' => LAN_USER_21, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), 'user_admin' => array('title' => LAN_USER_22, 'type' => 'boolean', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), 'user_perms' => array('title' => LAN_USER_23, 'type' => 'method', 'width' => 'auto'), 'user_pwchange' => array('title' => LAN_USER_24, 'type'=>'datestamp' , 'width' => 'auto'), @@ -724,7 +724,7 @@ class users_admin_ui extends e_admin_ui $field = "user_".$row['user_extended_struct_name']; $title = ucfirst(str_replace("user_","",$field)); $label = $tp->toHtml($row['user_extended_struct_text'],false,'defs'); - $this->fields[$field] = array('title' => $label,'width' => 'auto','type'=>'text'); + $this->fields[$field] = array('title' => $label,'width' => 'auto','type'=>'text', 'noedit'=>true); } } @@ -1060,7 +1060,36 @@ class users_admin_form_ui extends e_admin_form_ui } return vartrue($bo[$curval],' '); // ($curval == 1) ? ADMIN_TRUE_ICON : ''; - } + } + + + function user_class($curval,$mode) + { + if($mode == 'write') + { + $frm = e107::getForm(); + return $frm->uc_select('user_class[]', $curval, 'admin,classes', 'description=1&multiple=1'); + } + + $e_userclass = new user_class; + $list = $e_userclass->uc_required_class_list("classes"); + + if($mode == 'filter') + { + return $list; + } + + //FIXME userclasses are NOT be saved since they are an array. + //FIXME TODO - option to append userclass to existing value. + if($mode == 'batch') + { + $list['#delete'] = "(clear userclass)"; // special + return $list; + } + + return $list[$curval]; + + } function user_status($curval,$mode) diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 98da919d8..3cb939c96 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -2743,6 +2743,10 @@ class e_admin_controller_ui extends e_admin_controller break; } break; + + case 'append': + //TODO - append value to existing field value. eg. userclasses. + break; default: $field = $trigger[0]; @@ -2827,6 +2831,7 @@ class e_admin_controller_ui extends e_admin_controller protected function convertToData(&$data) { $model = new e_model($data); + foreach ($this->getFields() as $key => $attributes) { $value = vartrue($attributes['dataPath']) ? $model->getData($attributes['dataPath']) : $model->get($key); @@ -2853,7 +2858,7 @@ class e_admin_controller_ui extends e_admin_controller case 'ip': // TODO - ask Steve if this check is required //if(strpos($value, '.') !== FALSE) { - $value = trim($value) ? e107::getInstance()->ipEncode($value) : ''; + $value = trim($value) ? e107::getIPHandler()->ipEncode($value) : ''; } break; @@ -2867,6 +2872,7 @@ class e_admin_controller_ui extends e_admin_controller $value = implode(',', $value); } break; + } if(vartrue($attributes['dataPath'])) { @@ -3634,7 +3640,24 @@ class e_admin_ui extends e_admin_controller_ui */ protected function handleListBatch($selected, $field, $value) { - $cnt = $this->getTreeModel()->update($field, "'".$value."'", $selected, $value, false); + // special exceptions + + if($value == '#delete') // see admin->users + { + $val = "''"; + $value = "(empty)"; + } + elseif($value == "#null") + { + $val = null; + $value = "(empty)"; + } + else + { + $val = "'".$value."'"; + } + + $cnt = $this->getTreeModel()->update($field, $val, $selected, $value, false); if($cnt) { $vttl = $this->getUI()->renderValue($field, $value, $this->getFieldAttr($field));