1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Correct inline editing of userclasses in Admin -> Users and re-ordered userclasses in Admin -> Userclasses. autocomplete nowswitched off in usersettings.php

This commit is contained in:
Cameron 2015-05-15 13:07:26 -07:00
parent fc4f9dc712
commit 2b436ded30
5 changed files with 37 additions and 17 deletions

View File

@ -78,7 +78,8 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
protected $perPage = 10;
protected $batchDelete = true;
protected $batchCopy = false; // no way to generate the non-incrementing primary key at the moment
protected $listOrder = 'userclass_id DESC';
// protected $listOrder = 'userclass_id DESC'; //XXX Make more intuitive.
protected $listOrder = "CASE WHEN userclass_id = 250 THEN 1 WHEN userclass_id =254 THEN 2 WHEN userclass_id = 253 THEN 3 WHEN userclass_id < 250 THEN 4 END, userclass_id DESC ";
// protected $sortField = 'somefield_order';
// protected $orderStep = 10;
// protected $tabs = array('Tabl 1','Tab 2'); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable.

View File

@ -246,7 +246,7 @@ class users_admin_ui extends e_admin_ui
'user_email' => array('title' => LAN_EMAIL, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'str', 'width' => 'auto'),
'user_hideemail' => array('title' => LAN_USER_10, 'tab'=>0, 'type' => 'boolean', 'data'=>'int', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'),
'user_xup' => array('title' => 'Xup', 'tab'=>0, 'noedit'=>true, 'type' => 'text', 'data'=>'str', 'width' => 'auto'),
'user_class' => array('title' => LAN_USER_12, 'tab'=>0, 'type' => 'userclasses' , 'data'=>'str', 'inline'=>true, 'writeParms' => 'classlist=classes', 'filter'=>true, 'batch'=>true),
'user_class' => array('title' => LAN_USER_12, 'tab'=>0, 'type' => 'userclasses' , 'data'=>'str', 'inline'=>true, 'writeParms' => 'classlist=classes,new', 'readParms'=>'classlist=classes,new&defaultLabel=--', 'filter'=>true, 'batch'=>true),
'user_join' => array('title' => LAN_USER_14, 'tab'=>0, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'),
'user_lastvisit' => array('title' => LAN_USER_15, 'tab'=>0, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'),
'user_currentvisit' => array('title' => LAN_USER_16, 'tab'=>0, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'),

View File

@ -3354,24 +3354,35 @@ class e_form
break;
case 'userclasses':
// return $value;
$classes = explode(',', $value);
$uv = array();
foreach ($classes as $cid)
{
$uv[] = $this->_uc->uc_get_classname($cid);
if(!empty($parms['defaultLabel']) && $cid === '')
{
$uv[] = $parms['defaultLabel'];
continue;
}
$uv[] = $this->_uc->getName($cid);
}
$dispvalue = implode(vartrue($parms['separator'],"<br />"), $uv);
// Inline Editing.
if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
{
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$optlist = $parm['xxxxx']; // XXX TODO - add param for choice of class list options below.
$array = e107::getUserClass()->uc_required_class_list('nobody,admin,main,public,classes'); //XXX Ugly looking (non-standard) function naming - TODO discuss name change.
$source = str_replace('"',"'",json_encode($array, JSON_FORCE_OBJECT));
$uc_options = vartrue($parms['classlist'], 'public,guest, nobody,member,admin,main,classes'); // defaults to 'public,guest,nobody,member,classes' (userclass handler)
$array = e107::getUserClass()->uc_required_class_list($uc_options); //XXX Ugly looking (non-standard) function naming - TODO discuss name change.
//$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$mode = $tp->filter(vartrue($_GET['mode'], ''),'w');
$source = str_replace('"',"'",json_encode($array, JSON_FORCE_OBJECT));
//NOTE Leading ',' required on $value; so it picks up existing value.
$value = "<a class='e-tip e-editable editable-click' data-placement='bottom' data-value=',".$value."' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='checklist' data-pk='".$id."' data-url='".e_SELF."?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$dispvalue."</a>";
}
@ -3379,8 +3390,8 @@ class e_form
{
$value = $dispvalue;
}
unset($parms['classlist']);
break;
@ -3968,6 +3979,7 @@ class e_form
case 'userclasses':
$uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,admin,main,classes'); // defaults to 'public,guest,nobody,member,classes' (userclass handler)
unset($parms['classlist']);
// $method = ($attributes['type'] == 'userclass') ? 'uc_select' : 'uc_select';
if(vartrue($attributes['type']) == 'userclasses'){ $parms['multiple'] = true; }
$ret = vartrue($parms['pre']).$this->uc_select($key, $value, $uc_options, vartrue($parms, array())). vartrue($parms['post']);

View File

@ -8,7 +8,7 @@
*/
if(empty($_POST['content']))
if(empty($_POST['content']) && empty($_GET['debug']))
{
header('Content-Length: 0');
exit;
@ -41,8 +41,13 @@ class e107TinyMceParser
if(!empty($_GET['debug']) && getperms('0'))
{
$debug = true; // For future use.
// $_POST['content'] = '';
// $_POST['mode'] = $_GET['mode'];
$text = <<<TEMPL
[html][code]Something goes here [b]bold print[/b][/code][/html]
TEMPL;
$_POST['content'] = $text;
$_POST['mode'] = 'tohtml';
}
else
{
@ -62,6 +67,8 @@ class e107TinyMceParser
if($debug == true)
{
print_a($html);
echo "<hr />";
echo $html;
}
elseif($this->gzipCompression == true)
{

View File

@ -763,7 +763,7 @@ if (vartrue($_POST))
//require_once (e_HANDLER."form_handler.php");
//$rs = new form;
$text = '<form method="post" action="'.$usersettings_form_action.'" id="dataform" class="form-horizontal" role="form" enctype="multipart/form-data">';
$text = '<form method="post" action="'.$usersettings_form_action.'" id="dataform" class="form-horizontal" role="form" enctype="multipart/form-data" autocomplete="off">';
//$text = (is_numeric($_uid) ? $rs->form_open("post", e_SELF."?".e_QUERY, "dataform", "", " class='form-horizontal' role='form' enctype='multipart/form-data'") : $rs->form_open("post", e_SELF, "dataform", "", " class='form-horizontal' role='form' enctype='multipart/form-data'"));