Merge branch '15.0.beta3' of https://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3
This commit is contained in:
@@ -14,7 +14,9 @@ function loadAllUsers()
|
||||
var moduleID = $('#module').val();
|
||||
var productID = $('#product').val();
|
||||
setAssignedTo(moduleID, productID);
|
||||
$('#assignedTo').empty().append($(data).find('option')).trigger('chosen:updated').trigger('chosen:activate');
|
||||
$('#assignedTo').replaceWith(data);
|
||||
$('#assignedTo_chosen').remove();
|
||||
$('#assignedTo').chosen();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1178,6 +1178,10 @@ class executionModel extends model
|
||||
{
|
||||
$link = helper::createLink($module, $method, "productID=0&branch=0&extra=executionID=%s");
|
||||
}
|
||||
elseif(in_array($module, array('bug', 'case', 'testtask', 'testreport')) and $method == 'view')
|
||||
{
|
||||
$link = helper::createLink('execution', $module, "executionID=%s");
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = helper::createLink($module, $method, "executionID=%s");
|
||||
|
||||
@@ -63,7 +63,7 @@ class file extends control
|
||||
die(json_encode(array('error' => 1, 'message' => $this->lang->file->errorFileUpload)));
|
||||
}
|
||||
}
|
||||
if(@helper::saveFile($file['tmpname'], $this->file->savePath . $this->file->getSaveName($file['pathname'])))
|
||||
if(@move_uploaded_file($file['tmpname'], $this->file->savePath . $this->file->getSaveName($file['pathname'])))
|
||||
{
|
||||
/* Compress image for jpg and bmp. */
|
||||
$file = $this->file->compressImage($file);
|
||||
|
||||
+28
-3
@@ -262,7 +262,7 @@ class fileModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!helper::saveFile($file['tmpname'], $tmpFileChunkPath)) return false;
|
||||
if(!move_uploaded_file($file['tmpname'], $tmpFileChunkPath)) return false;
|
||||
}
|
||||
|
||||
if($file['chunk'] == ($file['chunks'] - 1))
|
||||
@@ -278,7 +278,7 @@ class fileModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!helper::saveFile($file['tmpname'], $file['realpath'])) return false;
|
||||
if(!move_uploaded_file($file['tmpname'], $file['realpath'])) return false;
|
||||
|
||||
$uploadFile['extension'] = $file['extension'];
|
||||
$uploadFile['pathname'] = $file['pathname'];
|
||||
@@ -471,7 +471,7 @@ class fileModel extends model
|
||||
$pathName = $filePath->pathname;
|
||||
$realPathName = $this->savePath . $this->getRealPathName($pathName);
|
||||
if(!is_dir(dirname($realPathName))) mkdir(dirname($realPathName));
|
||||
helper::saveFile($file['tmpname'], $realPathName);
|
||||
move_uploaded_file($file['tmpname'], $realPathName);
|
||||
|
||||
$file['pathname'] = $pathName;
|
||||
$file = $this->compressImage($file);
|
||||
@@ -966,4 +966,29 @@ class fileModel extends model
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image size.
|
||||
*
|
||||
* @access public
|
||||
* @param object $file
|
||||
* @return array
|
||||
*/
|
||||
public function getImageSize($file)
|
||||
{
|
||||
if($this->config->file->storageType == 'fs')
|
||||
{
|
||||
return getimagesize($file->realPath);
|
||||
}
|
||||
else if($this->config->file->storageType == 's3')
|
||||
{
|
||||
$this->app->loadClass('ossclient', true);
|
||||
|
||||
$config = $this->config->file;
|
||||
$ossClient = new ossclient($config->accessKeyId, $config->accessKeySecret, $config->endpoint, $config->bucket);
|
||||
$info = $ossClient->getImageInfo($file->pathname);
|
||||
|
||||
return array($info->ImageWidth->value, $info->ImageHeight->value, 'img');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ $sessionString .= session_name() . '=' . session_id();
|
||||
$imageWidth = 0;
|
||||
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false)
|
||||
{
|
||||
$imageSize = getimagesize($file->realPath);
|
||||
$imageSize = $this->file->getImageSize($file);
|
||||
$imageWidth = $imageSize ? $imageSize[0] : 0;
|
||||
}
|
||||
|
||||
|
||||
+12
-11
@@ -252,22 +252,23 @@ class group extends control
|
||||
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
|
||||
die(js::locate($this->createLink('group', 'browse'), 'parent'));
|
||||
}
|
||||
$group = $this->group->getById($groupID);
|
||||
$groupUsers = $this->group->getUserPairs($groupID);
|
||||
$allUsers = $this->loadModel('dept')->getDeptUserPairs($deptID);
|
||||
$otherUsers = array_diff_assoc($allUsers, $groupUsers);
|
||||
$group = $this->group->getById($groupID);
|
||||
$groupUsers = $this->group->getUserPairs($groupID);
|
||||
$allUsers = $this->loadModel('dept')->getDeptUserPairs($deptID);
|
||||
$otherUsers = array_diff_assoc($allUsers, $groupUsers);
|
||||
$outsideUsers = $this->user->getPairs('outside|noclosed|noletter|noempty');
|
||||
|
||||
$title = $this->lang->company->common . $this->lang->colon . $group->name . $this->lang->colon . $this->lang->group->manageMember;
|
||||
$position[] = $group->name;
|
||||
$position[] = $this->lang->group->manageMember;
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->group = $group;
|
||||
$this->view->deptTree = $this->loadModel('dept')->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createGroupManageMemberLink'), $groupID);
|
||||
$this->view->groupUsers = $groupUsers;
|
||||
$this->view->otherUsers = $otherUsers;
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->group = $group;
|
||||
$this->view->deptTree = $this->loadModel('dept')->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createGroupManageMemberLink'), $groupID);
|
||||
$this->view->groupUsers = $groupUsers;
|
||||
$this->view->otherUsers = $otherUsers;
|
||||
$this->view->outsideUsers = array_diff_assoc($outsideUsers, $groupUsers);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
<tr>
|
||||
<th class='w-140px'>
|
||||
<div class="checkbox-primary checkbox-inline checkbox-right check-all">
|
||||
<input type='checkbox' id='allOutSideChecker'>
|
||||
<label class='text-right' for='allOutSideChecker'><?php echo $lang->group->outside;?></label>
|
||||
<input type='checkbox' id='allOtherChecker'>
|
||||
<label class='text-right' for='allOtherChecker'><?php echo $lang->group->outside;?></label>
|
||||
</div>
|
||||
</th>
|
||||
<td id='other' class='pv-10px'><?php $i = 1;?>
|
||||
@@ -58,6 +58,19 @@
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-140px'>
|
||||
<div class="checkbox-primary checkbox-inline checkbox-right check-all">
|
||||
<input type='checkbox' id='allOutSideChecker'>
|
||||
<label class='text-right' for='allOutSideChecker'><?php echo $lang->user->outside;?></label>
|
||||
</div>
|
||||
</th>
|
||||
<td id='outside' class='pv-10px'><?php $i = 1;?>
|
||||
<?php foreach($outsideUsers as $account => $realname):?>
|
||||
<div class='group-item'><?php echo html::checkbox('members', array($account => $realname), '');?></div>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='text-center form-actions' colspan='2'>
|
||||
<?php
|
||||
|
||||
@@ -1601,7 +1601,8 @@ class productModel extends model
|
||||
}
|
||||
elseif($module == 'testtask')
|
||||
{
|
||||
$link = helper::createLink($module, 'browse', "productID=%s" . ($branch ? "&branch=%s" : '&branch=0') . "&extra=$extra");
|
||||
$extra = $method != 'browse' ? '' : "&extra=$extra";
|
||||
$link = helper::createLink($module, 'browse', "productID=%s" . ($branch ? "&branch=%s" : '&branch=0') . $extra);
|
||||
}
|
||||
elseif($module == 'bug' && $method == 'view')
|
||||
{
|
||||
|
||||
@@ -815,6 +815,8 @@ class projectModel extends model
|
||||
$this->dao->replace(TABLE_USERGROUP)->data($groupPriv)->exec();
|
||||
}
|
||||
|
||||
if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project');
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
}
|
||||
|
||||
+20
-13
@@ -1769,20 +1769,27 @@ class repoModel extends model
|
||||
return $buildedURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitlab projects.
|
||||
*
|
||||
* @param string $host
|
||||
* @param string $token
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getGitlabProjects($host, $token)
|
||||
{
|
||||
/**
|
||||
* Get gitlab projects.
|
||||
*
|
||||
* @param string $host
|
||||
* @param string $token
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getGitlabProjects($host, $token)
|
||||
{
|
||||
$host = rtrim($host, '/');
|
||||
$host .= '/api/v4/projects';
|
||||
|
||||
$projects = file_get_contents($host . "?private_token=$token");
|
||||
return json_decode($projects);
|
||||
}
|
||||
$allResults = array();
|
||||
for($page = 1; true; $page ++)
|
||||
{
|
||||
$results = json_decode(file_get_contents($host . "?private_token=$token&page={$page}&per_page=100"));
|
||||
if(empty($results)) break;
|
||||
$allResults = $allResults + $results;
|
||||
}
|
||||
|
||||
return $allResults;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class upgrade extends control
|
||||
|
||||
if(!$this->upgrade->isError())
|
||||
{
|
||||
if(!$this->config->systemMode && !isset($this->config->qcVersion)) $this->locate(inlink('to15Guide', "fromVersion=$fromVersion"));
|
||||
if(!$this->config->systemMode && !isset($this->config->qcVersion) && strpos($fromVersion, 'max') === false) $this->locate(inlink('to15Guide', "fromVersion=$fromVersion"));
|
||||
$this->locate(inlink('afterExec', "fromVersion=$fromVersion"));
|
||||
}
|
||||
|
||||
|
||||
@@ -4199,6 +4199,7 @@ class upgradeModel extends model
|
||||
$program->openedDate = helper::now();
|
||||
$program->openedVersion = $this->config->version;
|
||||
$program->acl = 'open';
|
||||
$program->days = $this->computeDaysDelta($program->begin, $program->end);
|
||||
|
||||
$this->app->loadLang('program');
|
||||
$this->app->loadLang('project');
|
||||
@@ -4274,6 +4275,7 @@ class upgradeModel extends model
|
||||
$project->status = $data->projectStatus;
|
||||
$project->begin = $data->begin;
|
||||
$project->end = isset($data->end) ? $data->end : LONG_TIME;
|
||||
$project->days = $this->computeDaysDelta($project->begin, $project->end);
|
||||
$project->PM = $data->PM;
|
||||
$project->auth = 'extend';
|
||||
$project->openedBy = $account;
|
||||
@@ -4324,6 +4326,32 @@ class upgradeModel extends model
|
||||
return array($programID, $projectID, $lineID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute delta of two days.
|
||||
*
|
||||
* @param string begin
|
||||
* @param string end
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function computeDaysDelta($begin, $end)
|
||||
{
|
||||
if($end == LONG_TIME) return 0;
|
||||
|
||||
$delta = helper::diffDate($end, $begin);
|
||||
$week = date('w', strtotime($begin));
|
||||
$weekend = 0;
|
||||
for($i = 0; $i < $delta; $i++)
|
||||
{
|
||||
$week = $week % 7;
|
||||
if($week == 0 or $week == 6) $weekend ++;
|
||||
|
||||
$week++;
|
||||
}
|
||||
|
||||
return $delta - $weekend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace program or project id for product and project linked objects.
|
||||
*
|
||||
@@ -4397,8 +4425,11 @@ class upgradeModel extends model
|
||||
$this->dao->replace(TABLE_PROJECTCASE)->data($projectCase)->exec();
|
||||
}
|
||||
|
||||
/* Compute sprint path and grade. */
|
||||
$sprints = $this->dao->select('id, type, acl')->from(TABLE_PROJECT)->where('id')->in($sprintIdList)->fetchAll();
|
||||
/* Compute sprint path, grade and the minimum start date and end date of the project. */
|
||||
$project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
|
||||
$sprints = $this->dao->select('id, type, acl, begin, end')->from(TABLE_PROJECT)->where('id')->in($sprintIdList)->fetchAll();
|
||||
$minBeginDate = $project->begin;
|
||||
$maxEndData = $project->end;
|
||||
foreach($sprints as $sprint)
|
||||
{
|
||||
$data = new stdclass();
|
||||
@@ -4411,6 +4442,9 @@ class upgradeModel extends model
|
||||
$data->lifetime = empty($sprint->lifetime) ? $sprint->type : $sprint->lifetime;
|
||||
|
||||
$this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($sprint->id)->exec();
|
||||
|
||||
$minBeginDate = ($sprint->begin < $minBeginDate) ? $sprint->begin : $minBeginDate;
|
||||
$maxEndData = $sprint->end > $maxEndData ? $sprint->end : $maxEndData;
|
||||
}
|
||||
|
||||
/* Compute project date and status. */
|
||||
@@ -4429,6 +4463,13 @@ class upgradeModel extends model
|
||||
$data->closedDate = $maxRealEnd;
|
||||
}
|
||||
|
||||
if($minBeginDate != $project->begin or $maxEndData != $project->end)
|
||||
{
|
||||
$data->begin = $minBeginDate;
|
||||
$data->end = $maxEndData;
|
||||
$data->days = $this->computeDaysDelta($data->begin, $data->end);
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($projectID)->exec();
|
||||
|
||||
/* Set product and project relation. */
|
||||
@@ -4481,8 +4522,10 @@ class upgradeModel extends model
|
||||
$users = $this->dao->select('account')->from(TABLE_USER)->where('deleted')->eq('0')->fetchPairs('account', 'account');
|
||||
|
||||
/* Insert product and sprint team into project team. */
|
||||
$today = helper::today();
|
||||
foreach($teams as $account)
|
||||
$today = helper::today();
|
||||
$project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
|
||||
$projectMember = $this->dao->select('*')->from(TABLE_TEAM)->where('account')->in($teams)->fetchAll('account');
|
||||
foreach($projectMember as $account => $user)
|
||||
{
|
||||
if(empty($account)) continue;
|
||||
if(!isset($users[$account])) continue;
|
||||
@@ -4491,7 +4534,10 @@ class upgradeModel extends model
|
||||
$team->root = $projectID;
|
||||
$team->type = 'project';
|
||||
$team->account = $account;
|
||||
$team->role = $user->role;
|
||||
$team->join = $today;
|
||||
$team->days = $project->days;
|
||||
$team->hours = '7.0';
|
||||
$this->dao->replace(TABLE_TEAM)->data($team)->exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ class userModel extends model
|
||||
* Get user info by ID.
|
||||
*
|
||||
* @param mix $userID
|
||||
* @param string $field id|account
|
||||
* @access public
|
||||
* @return object|bool
|
||||
*/
|
||||
|
||||
+4
-4
@@ -46,8 +46,8 @@ function run($result)
|
||||
/**
|
||||
* Print expect data.
|
||||
*
|
||||
* @param int $key
|
||||
* @param string $delimiter
|
||||
* @param string $key
|
||||
* @param string $delimiter
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -96,6 +96,6 @@ function zdImport($table, $yaml, $count = 10)
|
||||
global $app, $config;
|
||||
$dns = "mysql://{$config->db->user}:{$config->db->password}@{$config->db->host}:{$config->db->port}/{$config->db->name}#utf8";
|
||||
$table = trim($table, '`');
|
||||
$commad = "$config->zdPath -c $yaml -t $table -T -dns $dns --clear -n $count";
|
||||
system($commad);
|
||||
$command = "$config->zdPath -c $yaml -t $table -T -dns $dns --clear -n $count";
|
||||
system($command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user