* code for task #48840.
This commit is contained in:
@@ -32,6 +32,7 @@ $config->methodVar = 'f'; // 请求类型为GET:模块
|
||||
$config->viewVar = 't'; // 请求类型为GET:视图变量名。 requestType=GET: the view var name.
|
||||
$config->sessionVar = 'zentaosid'; // 请求类型为GET:session变量名。 requestType=GET: the session var name.
|
||||
$config->views = ',html,json,mhtml,xhtml,'; // 支持的视图类型。 Supported view formats.
|
||||
$config->visions = ',rnd,lite,'; // 支持的界面类型。 Supported vision formats.
|
||||
|
||||
/* 支持的主题和语言。Supported thems and languages. */
|
||||
$config->themes['default'] = 'default';
|
||||
|
||||
@@ -319,7 +319,7 @@ $lang->exportTypeList['all'] = '全部记录';
|
||||
$lang->exportTypeList['selected'] = '选中记录';
|
||||
|
||||
$lang->visionList = array();
|
||||
$lang->visionList['rnd'] = '研发界面';
|
||||
$lang->visionList['rnd'] = '研发综合界面';
|
||||
$lang->visionList['lite'] = '迅捷界面';
|
||||
|
||||
$lang->createObjects['todo'] = '待办';
|
||||
|
||||
@@ -3,8 +3,8 @@ $config->user = new stdclass();
|
||||
$config->user->create = new stdclass();
|
||||
$config->user->edit = new stdclass();
|
||||
|
||||
$config->user->create->requiredFields = 'account,realname,password,password1,password2';
|
||||
$config->user->edit->requiredFields = 'account,realname';
|
||||
$config->user->create->requiredFields = 'account,realname,visions,password,password1,password2';
|
||||
$config->user->edit->requiredFields = 'account,realname,visions';
|
||||
|
||||
$config->user->availableBatchCreateFields = 'dept,email,gender,commiter,join,skype,qq,dingding,weixin,mobile,slack,whatsapp,phone,address,zipcode';
|
||||
$config->user->availableBatchEditFields = 'dept,email,commiter,skype,qq,dingding,weixin,mobile,slack,whatsapp,phone,address,zipcode';
|
||||
|
||||
@@ -2,6 +2,7 @@ th.required:after {position: relative; right: 10px;}
|
||||
td .passwordBox {border-left-width: 0px!important;}
|
||||
|
||||
.c-id {width: 40px;}
|
||||
.c-dept {width: 150px;}
|
||||
.c-dept {width: 120px;}
|
||||
.c-realname {width: 130px;}
|
||||
.c-visions {width: 130px;}
|
||||
.c-role, .c-group, .c-commiter, .c-join, .c-contact {width: 120px;}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
.accountThWidth {width: 200px !important;}
|
||||
.accountThWidth {width: 120px !important;}
|
||||
.genderThWidth {width: 140px !important;}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
.accountThWidth {width: 180px !important;}
|
||||
.accountThWidth {width: 120px !important;}
|
||||
.genderThWidth {width: 100px !important;}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
.accountThWidth {width: 180px !important;}
|
||||
.accountThWidth {width: 120px !important;}
|
||||
.genderThWidth {width: 100px !important;}
|
||||
|
||||
1
module/user/css/create.css
Normal file
1
module/user/css/create.css
Normal file
@@ -0,0 +1 @@
|
||||
.checkbox-primary {display:inline-block; padding-right:10px;}
|
||||
@@ -42,6 +42,7 @@ $lang->user->address = '通讯地址';
|
||||
$lang->user->zipcode = '邮编';
|
||||
$lang->user->join = '入职日期';
|
||||
$lang->user->visits = '访问次数';
|
||||
$lang->user->visions = '版本类型';
|
||||
$lang->user->ip = '最后IP';
|
||||
$lang->user->last = '最后登录';
|
||||
$lang->user->ranzhi = 'ZDOO帐号';
|
||||
|
||||
@@ -295,9 +295,11 @@ class userModel extends model
|
||||
->setDefault('join', '0000-00-00')
|
||||
->setDefault('type', 'inside')
|
||||
->setDefault('company', 0)
|
||||
->setDefault('visions', '')
|
||||
->setIF($this->post->password1 != false, 'password', substr($this->post->password1, 0, 32))
|
||||
->setIF($this->post->password1 == false, 'password', '')
|
||||
->setIF($this->post->email != false, 'email', trim($this->post->email))
|
||||
->join('visions', ',')
|
||||
->remove('new, group, password1, password2, verifyPassword, passwordStrength')
|
||||
->get();
|
||||
|
||||
@@ -385,7 +387,8 @@ class userModel extends model
|
||||
if($users->email[$i] and !validater::checkEmail($users->email[$i])) die(js::error(sprintf($this->lang->user->error->mail, $i + 1)));
|
||||
$users->password[$i] = (isset($prev['password']) and $users->ditto[$i] == 'on' and !$this->post->password[$i]) ? $prev['password'] : $this->post->password[$i];
|
||||
if(!validater::checkReg($users->password[$i], '|(.){6,}|')) die(js::error(sprintf($this->lang->user->error->password, $i + 1)));
|
||||
$role = $users->role[$i] == 'ditto' ? (isset($prev['role']) ? $prev['role'] : '') : $users->role[$i];
|
||||
$role = $users->role[$i] == 'ditto' ? (isset($prev['role']) ? $prev['role'] : '') : $users->role[$i];
|
||||
$visions = in_array('ditto', $users->visions[$i]) ? (isset($prev['visions']) ? $prev['visions'] : array()) : $users->visions[$i];
|
||||
|
||||
/* Check weak and common weak password. */
|
||||
if(isset($this->config->safe->mode) and $this->computePasswordStrength($users->password[$i]) < $this->config->safe->mode) die(js::error(sprintf($this->lang->user->error->weakPassword, $i + 1)));
|
||||
@@ -417,6 +420,7 @@ class userModel extends model
|
||||
$data[$i]->phone = $users->phone[$i];
|
||||
$data[$i]->address = $users->address[$i];
|
||||
$data[$i]->zipcode = $users->zipcode[$i];
|
||||
$data[$i]->visions = join(',', $visions);
|
||||
|
||||
/* Check required fields. */
|
||||
foreach(explode(',', $this->config->user->create->requiredFields) as $field)
|
||||
@@ -447,6 +451,7 @@ class userModel extends model
|
||||
$prev['dept'] = $data[$i]->dept;
|
||||
$prev['role'] = $data[$i]->role;
|
||||
$prev['group'] = $data[$i]->group;
|
||||
$prev['visions'] = $users->visions[$i];
|
||||
$prev['password'] = $users->password[$i];
|
||||
}
|
||||
}
|
||||
@@ -502,8 +507,10 @@ class userModel extends model
|
||||
$user = fixer::input('post')
|
||||
->setDefault('join', '0000-00-00')
|
||||
->setDefault('company', 0)
|
||||
->setDefault('visions', '')
|
||||
->setIF($this->post->password1 != false, 'password', substr($this->post->password1, 0, 32))
|
||||
->setIF($this->post->email != false, 'email', trim($this->post->email))
|
||||
->join('visions', ',')
|
||||
->remove('new, password1, password2, groups,verifyPassword, passwordStrength')
|
||||
->get();
|
||||
|
||||
@@ -545,6 +552,7 @@ class userModel extends model
|
||||
->checkIF($this->post->mobile != '', 'mobile', 'mobile')
|
||||
->where('id')->eq((int)$userID)
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
/* If account changed, update the privilege. */
|
||||
if($this->post->account != $oldUser->account)
|
||||
@@ -647,6 +655,7 @@ class userModel extends model
|
||||
$users[$id]['phone'] = $data->phone[$id];
|
||||
$users[$id]['address'] = $data->address[$id];
|
||||
$users[$id]['zipcode'] = $data->zipcode[$id];
|
||||
$users[$id]['visions'] = !empty($data->visions[$id]) ? join(',', $data->visions[$id]) : '';
|
||||
$users[$id]['dept'] = $data->dept[$id] == 'ditto' ? (isset($prev['dept']) ? $prev['dept'] : 0) : $data->dept[$id];
|
||||
$users[$id]['role'] = $data->role[$id] == 'ditto' ? (isset($prev['role']) ? $prev['role'] : 0) : $data->role[$id];
|
||||
|
||||
@@ -2649,4 +2658,21 @@ class userModel extends model
|
||||
}
|
||||
return $userDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vision list.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getVisionList()
|
||||
{
|
||||
$visionList = $this->lang->visionList;
|
||||
foreach($visionList as $visionKey => $visionName)
|
||||
{
|
||||
if(strpos($this->config->visions, ",{$visionKey},") === false) unset($visionList[$visionKey]);
|
||||
}
|
||||
|
||||
return $visionList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<th class='c-dept<?php echo zget($visibleFields, 'dept', ' hidden') . zget($requiredFields, 'dept', '', ' required');?>'> <?php echo $lang->user->dept;?></th>
|
||||
<th class='accountThWidth required'><?php echo $lang->user->account;?></th>
|
||||
<th class='c-realname required'><?php echo $lang->user->realname;?></th>
|
||||
<th class='c-visions required'><?php echo $lang->user->visions;?></th>
|
||||
<th class='c-role<?php echo zget($requiredFields, 'role', '', ' required')?>'><?php echo $lang->user->role;?></th>
|
||||
<th class='c-group'><?php echo $lang->user->group;?></th>
|
||||
<th class='<?php echo zget($visibleFields, 'email', "$minWidth hidden", $minWidth) . zget($requiredFields, 'email', '', ' required')?>'><?php echo $lang->user->email;?></th>
|
||||
@@ -71,13 +72,15 @@
|
||||
<tbody>
|
||||
<?php $depts = $depts + array('ditto' => $lang->user->ditto)?>
|
||||
<?php $lang->user->roleList = $lang->user->roleList + array('ditto' => $lang->user->ditto)?>
|
||||
<?php $groupList = $groupList + array('ditto' => $lang->user->ditto)?>
|
||||
<?php $groupList = $groupList + array('ditto' => $lang->user->ditto);?>
|
||||
<?php $visionList = $this->user->getVisionList() + array('ditto' => $lang->user->ditto);?>
|
||||
<?php for($i = 0; $i < $config->user->batchCreate; $i++):?>
|
||||
<tr class='text-center'>
|
||||
<td><?php echo $i+1;?></td>
|
||||
<td><?php echo $i + 1;?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'dept', ' hidden')?>' style='overflow:visible'><?php echo html::select("dept[$i]", $depts, $i > 0 ? 'ditto' : $deptID, "class='form-control chosen'");?></td>
|
||||
<td><?php echo html::input("account[$i]", '', "class='form-control account_$i' onchange='changeEmail($i)'");?></td>
|
||||
<td><?php echo html::input("realname[$i]", '', "class='form-control'");?></td>
|
||||
<td class='text-left'><?php echo html::select("visions[$i][]", $visionList, $i > 0 ? 'ditto' : '', "class='form-control chosen' multiple");?></td>
|
||||
<td><?php echo html::select("role[$i]", $lang->user->roleList, $i > 0 ? 'ditto' : '', "class='form-control' onchange='changeGroup(this.value, $i)'");?></td>
|
||||
<td class='text-left' style='overflow:visible'><?php echo html::select("group[$i]", $groupList, $i > 0 ? 'ditto' : '', "class='form-control chosen'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'email', "class='hidden'")?>><?php echo html::input("email[$i]", '', "class='form-control email_$i' onchange='setDefaultEmail($i)'");?></td>
|
||||
|
||||
@@ -44,10 +44,11 @@
|
||||
<table class="table table-form">
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
<th class='w-30px'><?php echo $lang->idAB;?></th>
|
||||
<th class='w-30px'><?php echo $lang->idAB;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'dept', ' hidden')?>'> <?php echo $lang->user->dept;?></th>
|
||||
<th class='<?php echo $minWidth?> required'><?php echo $lang->user->account;?></th>
|
||||
<th class='<?php echo $minWidth?> required'><?php echo $lang->user->realname;?></th>
|
||||
<th class='w-130px'><?php echo $lang->user->visions;?></th>
|
||||
<th class='w-120px'><?php echo $lang->user->role;?></th>
|
||||
<th class='w-120px'><?php echo $lang->user->type;?></th>
|
||||
<th class='<?php echo $minWidth . zget($visibleFields, 'commiter', ' hidden')?>'><?php echo $lang->user->commiter;?></th>
|
||||
@@ -71,8 +72,8 @@
|
||||
<?php $first = true;?>
|
||||
<?php foreach($users as $user):?>
|
||||
<?php
|
||||
$dept = ($first and empty($user->dept)) ? 0 : (empty($user->dept) ? 'ditto' : $user->dept);
|
||||
$role = ($first and empty($user->role)) ? 0 : (empty($user->role) ? 'ditto' : $user->role);
|
||||
$dept = ($first and empty($user->dept)) ? 0 : (empty($user->dept) ? 'ditto' : $user->dept);
|
||||
$role = ($first and empty($user->role)) ? 0 : (empty($user->role) ? 'ditto' : $user->role);
|
||||
$type = empty($user->type) ? 'inside' : $user->type;
|
||||
$first = false;
|
||||
?>
|
||||
@@ -81,6 +82,8 @@
|
||||
<td class='text-left<?php echo zget($visibleFields, 'dept', ' hidden')?>' style='overflow:visible'><?php echo html::select("dept[$user->id]", $depts, $dept, "class='form-control chosen'");?></td>
|
||||
<td><?php echo html::input("account[$user->id]", $user->account, "class='form-control'");?></td>
|
||||
<td><?php echo html::input("realname[$user->id]", $user->realname, "class='form-control'");?></td>
|
||||
<?php $visionList = $this->user->getVisionList();?>
|
||||
<td class='text-left'><?php echo html::select("visions[$user->id][]", $visionList, $user->visions, "class='form-control chosen' multiple");?></td>
|
||||
<td><?php echo html::select("role[$user->id]", $lang->user->roleList, $role, "class='form-control'");?></td>
|
||||
<td><?php echo html::select("type[$user->id]", $lang->user->typeList, $type, "class='form-control'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'commiter', 'hidden')?>'><?php echo html::input("commiter[$user->id]", $user->commiter, "class='form-control'");?></td>
|
||||
|
||||
@@ -60,6 +60,11 @@
|
||||
<th><?php echo $lang->user->password2;?></th>
|
||||
<td><?php echo html::password('password2', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->visions;?></th>
|
||||
<?php $visionList = $this->user->getVisionList();?>
|
||||
<td><?php echo html::checkbox('visions', $visionList, key($visionList), "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->realname;?></th>
|
||||
<td><?php echo html::input('realname', '', "class='form-control'");?></td>
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->user->commiter;?></th>
|
||||
<td><?php echo html::input('commiter', $user->commiter, "class='form-control'");?></td>
|
||||
<th><?php echo $lang->user->visions;?></th>
|
||||
<?php $visionList = $this->user->getVisionList();?>
|
||||
<td><?php echo html::select('visions[]', $visionList, $user->visions, "class='form-control chosen' multiple");?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table align='center' class='table table-form'>
|
||||
|
||||
Reference in New Issue
Block a user