Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms into ta_liyang
This commit is contained in:
@@ -408,8 +408,12 @@ class userEntry extends entry
|
||||
$this->setPost('gender', $gender);
|
||||
|
||||
$password = $this->request('password', zget($_POST, 'password', ''));
|
||||
$this->setPost('password1', md5($password));
|
||||
$this->setPost('password2', md5($password));
|
||||
if($password)
|
||||
{
|
||||
$this->setPost('password1', md5($password));
|
||||
$this->setPost('password2', md5($password));
|
||||
$this->setPost('passwordStrength', 2);
|
||||
}
|
||||
$this->setPost('verifyPassword', md5($this->app->user->password . $this->app->session->rand));
|
||||
|
||||
$control = $this->loadController('user', 'edit');
|
||||
|
||||
@@ -343,7 +343,7 @@ $lang->execution->menu->view = array('link' => "$lang->view|execution|grouptas
|
||||
if($config->edition != 'open') $lang->execution->menu->view = array('link' => "$lang->view|execution|gantt|executionID=%s", 'alias' => 'grouptask,tree,taskeffort,gantt,calendar,relation,maintainrelation');
|
||||
|
||||
$lang->execution->menu->storyGroup = array('link' => "{$lang->common->story}|execution|story|executionID=%s",'class' => 'dropdown dropdown-hover', 'subModule' => 'story', 'alias' => 'batchcreate,storykanban');
|
||||
$lang->execution->menu->story = array('link' => "$lang->SRCommon|execution|story|executionID=%s", 'subModule' => 'story,execution', 'alias' => 'storykanban,linkstory');
|
||||
$lang->execution->menu->story = array('link' => "$lang->SRCommon|execution|story|executionID=%s", 'subModule' => 'story', 'alias' => 'storykanban,linkstory');
|
||||
$lang->execution->menu->qa = array('link' => "{$lang->qa->common}|execution|bug|executionID=%s", 'subModule' => 'bug,testcase,testtask,testreport', 'alias' => 'qa,bug,testcase,testtask,testreport');
|
||||
$lang->execution->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&branchID=&objectID=%s", 'subModule' => 'repo');
|
||||
$lang->execution->menu->doc = array('link' => "{$lang->doc->common}|doc|tableContents|type=execution&objectID=%s", 'subModule' => 'doc');
|
||||
|
||||
@@ -4,3 +4,6 @@ td .passwordBox {border-left-width: 0px!important;}
|
||||
.c-id {width: 40px;}
|
||||
.c-realname, .c-visions {width: 130px;}
|
||||
.c-dept, .c-role, .c-group, .c-commiter, .c-join, .c-contact {width: 120px;}
|
||||
.c-company {width: 210px;}
|
||||
|
||||
.user-type{margin: 8px 0px 0px 8px; float: left;}
|
||||
|
||||
@@ -186,3 +186,55 @@ $(document).on('change', "select[id^='visions']", function()
|
||||
}(n)));
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Show or hide companies based on user type.
|
||||
*
|
||||
* @param type $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function changeType(type)
|
||||
{
|
||||
if(type == 'inside')
|
||||
{
|
||||
$('#companyBox').addClass('hide');
|
||||
$('select[id^=dept], input[id^=join]').closest('td').removeClass('hide');
|
||||
$('select[id^=company]').closest('td').addClass('hide');
|
||||
$('th.c-dept, th.c-join').removeClass('hide');
|
||||
$('th.c-company').addClass('hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#companyBox').removeClass('hide');
|
||||
$('select[id^=dept], input[id^=join]').closest('td').addClass('hide');
|
||||
$('select[id^=company]').closest('td').removeClass('hide');
|
||||
$('th.c-dept, th.c-join').addClass('hide');
|
||||
$('th.c-company').removeClass('hide');
|
||||
}
|
||||
$('#userType').val(type);
|
||||
}
|
||||
|
||||
$(function()
|
||||
{
|
||||
$(":checkbox[name^='new']").change(function()
|
||||
{
|
||||
var companyNode = $(this).prop('checked') ? $(this).closest('span').prevAll('select') : $(this).closest('span').prevAll('input');
|
||||
var companyNodeID = $(companyNode).attr('id');
|
||||
var companyNodeName = $(companyNode).attr('name');
|
||||
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
$(companyNode).replaceWith("<input name='" + companyNodeName + "' id='" + companyNodeID + "' class='form-control'/>");
|
||||
$('#' + companyNodeID + '_chosen').remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
var i = companyNodeID.replace(/[^0-9]/ig, '');
|
||||
var dataHtml = $(companies).attr('id', companyNodeID).attr('name', companyNodeName).prop('outerHTML');
|
||||
$('#' + companyNodeID).replaceWith(dataHtml);
|
||||
if(i == 1) $('#' + companyNodeID).find('option[value="ditto"]').remove();
|
||||
$('#' + companyNodeID).chosen();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
+23
-5
@@ -425,9 +425,19 @@ class userModel extends model
|
||||
}
|
||||
|
||||
$data[$i] = new stdclass();
|
||||
$data[$i]->dept = $users->dept[$i] == 'ditto' ? (isset($prev['dept']) ? $prev['dept'] : 0) : $users->dept[$i];
|
||||
if($users->userType == 'outside')
|
||||
{
|
||||
$data[$i]->company = $users->company[$i] == 'ditto' ? (isset($prev['company']) ? $prev['company'] : 0) : $users->company[$i];
|
||||
$data[$i]->newCompany = isset($users->new[$i]) ? true : false;
|
||||
$data[$i]->type = 'outside';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[$i]->dept = $users->dept[$i] == 'ditto' ? (isset($prev['dept']) ? $prev['dept'] : 0) : $users->dept[$i];
|
||||
$data[$i]->join = empty($users->join[$i]) ? '0000-00-00' : ($users->join[$i]);
|
||||
$data[$i]->type = 'inside';
|
||||
}
|
||||
$data[$i]->account = $users->account[$i];
|
||||
$data[$i]->type = 'inside';
|
||||
$data[$i]->realname = $users->realname[$i];
|
||||
$data[$i]->role = $role;
|
||||
$data[$i]->group = in_array('ditto', isset($users->group[$i]) ? $users->group[$i] : array()) ? (isset($prev['group']) ? $prev['group'] : '') : $users->group[$i];
|
||||
@@ -435,7 +445,6 @@ class userModel extends model
|
||||
$data[$i]->gender = $users->gender[$i];
|
||||
$data[$i]->password = md5(trim($users->password[$i]));
|
||||
$data[$i]->commiter = $users->commiter[$i];
|
||||
$data[$i]->join = empty($users->join[$i]) ? '0000-00-00' : ($users->join[$i]);
|
||||
$data[$i]->skype = $users->skype[$i];
|
||||
$data[$i]->qq = $users->qq[$i];
|
||||
$data[$i]->dingding = $users->dingding[$i];
|
||||
@@ -474,6 +483,7 @@ class userModel extends model
|
||||
}
|
||||
|
||||
$accounts[$i] = $data[$i]->account;
|
||||
$prev['company'] = $data[$i]->company;
|
||||
$prev['dept'] = $data[$i]->dept;
|
||||
$prev['role'] = $data[$i]->role;
|
||||
$prev['group'] = $data[$i]->group;
|
||||
@@ -486,6 +496,16 @@ class userModel extends model
|
||||
$userIDList = array();
|
||||
foreach($data as $user)
|
||||
{
|
||||
if($user->type == 'outside' and $user->newCompany)
|
||||
{
|
||||
$company = new stdClass();
|
||||
$company->name = $user->company;
|
||||
$this->dao->insert(TABLE_COMPANY)->data($company)->exec();
|
||||
|
||||
$user->company = $this->dao->lastInsertID();
|
||||
}
|
||||
unset($user->newCompany);
|
||||
|
||||
if(is_array($user->group))
|
||||
{
|
||||
foreach($user->group as $group)
|
||||
@@ -547,8 +567,6 @@ class userModel extends model
|
||||
->remove('new, password1, password2, groups,verifyPassword, passwordStrength,passwordLength')
|
||||
->get();
|
||||
|
||||
/* Fix bug for api requests using json. */
|
||||
if($this->app->getViewType() == 'json') $this->post->verifyPassword = md5(md5($this->post->verifyPassword) . $this->session->rand);
|
||||
if(empty($_POST['verifyPassword']) or $this->post->verifyPassword != md5($this->app->user->password . $this->session->rand))
|
||||
{
|
||||
dao::$errors['verifyPassword'][] = $this->lang->user->error->verifyPassword;
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::import($jsRoot . 'md5.js');?>
|
||||
<?php js::set('roleGroup', $roleGroup);?>
|
||||
<?php js::set('companies', html::select("company", $companies));?>
|
||||
<div id="mainContent" class="main-content">
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->user->batchCreate;?></h2>
|
||||
<div class="user-type"><?php echo html::radio('type', $lang->user->typeList , 'inside', "onclick='changeType(this.value)'");?></div>
|
||||
<div class="pull-right btn-toolbar">
|
||||
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=user§ion=custom&key=batchCreateFields')?>
|
||||
<?php include '../../common/view/customfield.html.php';?>
|
||||
@@ -42,11 +44,13 @@
|
||||
$showVisionList = count($visionList) > 1;
|
||||
?>
|
||||
<form method='post' class='load-indicator main-form' enctype='multipart/form-data' target='hiddenwin' id="batchCreateForm">
|
||||
<?php echo html::hidden('userType', 'inside');?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-form">
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
<th class='c-id'><?php echo $lang->idAB;?></th>
|
||||
<th class='c-company hide<?php echo zget($requiredFields, 'company', '', ' required');?>'><?php echo $lang->user->company;?></th>
|
||||
<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>
|
||||
@@ -80,6 +84,12 @@
|
||||
<?php for($i = 1; $i <= $config->user->batchCreate; $i++):?>
|
||||
<tr class='text-center'>
|
||||
<td><?php echo $i;?></td>
|
||||
<td class='text-left hide' style='overflow:visible'>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select("company[$i]", $companies, $i > 1 ? 'ditto' : '', "class='form-control chosen'");?>
|
||||
<span class='input-group-addon'><?php echo html::checkBox("new[$i]", $lang->company->create);?></span>
|
||||
</div>
|
||||
</td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'dept', ' hidden')?>' style='overflow:visible'><?php echo html::select("dept[$i]", $depts, $i > 1 ? '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>
|
||||
|
||||
Reference in New Issue
Block a user