Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms
This commit is contained in:
@@ -39,14 +39,11 @@ $(function()
|
||||
{
|
||||
setTimeout(function()
|
||||
{
|
||||
var checkedProduct = true;
|
||||
$("[id^='productIDList']").each(function()
|
||||
{
|
||||
if(!$(this).prop('checked')) checkedProduct = false;
|
||||
})
|
||||
var allCount = $("[id^='productIDList']").length;
|
||||
var checkedCount = $("[id^='productIDList']:checked").length;
|
||||
|
||||
if(checkedProduct) $('.check-all').addClass('checked');
|
||||
if(!checkedProduct) $('.check-all').removeClass('checked');
|
||||
if(allCount == checkedCount) $('.check-all').addClass('checked');
|
||||
if(allCount != checkedCount) $('.check-all').removeClass('checked');
|
||||
}, 100)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -416,7 +416,6 @@ class project extends control
|
||||
->where('t1.project')->eq($projectID)
|
||||
->andWhere('t2.plan')->in(array_keys($oldPlans))
|
||||
->fetchAll('story');
|
||||
$diffResult = array_diff($oldPlans, $_POST['plans']);
|
||||
|
||||
$changes = $this->project->update($projectID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
@@ -428,6 +427,7 @@ class project extends control
|
||||
}
|
||||
|
||||
/* Link the plan stories. */
|
||||
$diffResult = array_diff($oldPlans, $_POST['plans']);
|
||||
if(!empty($_POST['plans']) and !empty($diffResult))
|
||||
{
|
||||
$this->loadModel('productplan')->linkProject($projectID, $_POST['plans'], $oldPlanStories);
|
||||
@@ -471,6 +471,7 @@ class project extends control
|
||||
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
|
||||
$this->view->project = $project;
|
||||
$this->view->programList = $this->program->getParentPairs();
|
||||
$this->view->program = $this->program->getByID($project->parent);
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->allProducts = array('0' => '') + $allProducts;
|
||||
$this->view->productPlans = $productPlans;
|
||||
@@ -519,14 +520,23 @@ class project extends control
|
||||
$projectIdList = $this->post->projectIdList ? $this->post->projectIdList : die(js::locate($this->session->projectList, 'parent'));
|
||||
$projects = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchAll('id');
|
||||
|
||||
foreach($projects as $project) $appendPMUsers[$project->PM] = $project->PM;
|
||||
/* Get program list. */
|
||||
$programs = $this->loadModel('program')->getParentPairs();
|
||||
$unauthorizedIDList = array();
|
||||
foreach($projects as $project)
|
||||
{
|
||||
if(!isset($programs[$project->parent]) and !in_array($project->parent, $unauthorizedIDList)) $unauthorizedIDList[] = $project->parent;
|
||||
$appendPMUsers[$project->PM] = $project->PM;
|
||||
}
|
||||
$unauthorizedPrograms = $this->program->getPairsByList($unauthorizedIDList);
|
||||
|
||||
$this->view->title = $this->lang->project->batchEdit;
|
||||
$this->view->position[] = $this->lang->project->batchEdit;
|
||||
|
||||
$this->view->projects = $projects;
|
||||
$this->view->programList = $this->loadModel('program')->getParentPairs();
|
||||
$this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $appendPMUsers);
|
||||
$this->view->projects = $projects;
|
||||
$this->view->programs = $programs;
|
||||
$this->view->unauthorizedPrograms = $unauthorizedPrograms;
|
||||
$this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $appendPMUsers);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -976,8 +976,8 @@ class projectModel extends model
|
||||
$projectName = $data->names[$projectID];
|
||||
|
||||
$projects[$projectID] = new stdClass();
|
||||
if(isset($data->parents[$projectID])) $projects[$projectID]->parent = $data->parents[$projectID];
|
||||
$projects[$projectID]->name = $projectName;
|
||||
$projects[$projectID]->parent = $data->parents[$projectID];
|
||||
$projects[$projectID]->PM = $data->PMs[$projectID];
|
||||
$projects[$projectID]->begin = $data->begins[$projectID];
|
||||
$projects[$projectID]->end = isset($data->ends[$projectID]) ? $data->ends[$projectID] : LONG_TIME;
|
||||
|
||||
@@ -37,7 +37,11 @@
|
||||
<?php $aclList = $project->parent ? $lang->program->subAcls : $lang->project->acls;?>
|
||||
<tr>
|
||||
<td><?php echo sprintf('%03d', $projectID) . html::hidden("projectIdList[$projectID]", $projectID);?></td>
|
||||
<td><?php echo html::select("parents[$projectID]", $programList, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}'");?></td>
|
||||
<?php if(isset($unauthorizedPrograms[$project->parent])):?>
|
||||
<td><?php echo html::select("parents[$projectID]", $unauthorizedPrograms, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}' disabled");?></td>
|
||||
<?php else:?>
|
||||
<td><?php echo html::select("parents[$projectID]", $programs, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}'");?></td>
|
||||
<?php endif;?>
|
||||
<td title='<?php echo $project->name;?>'><?php echo html::input("names[$projectID]", $project->name, "class='form-control'");?></td>
|
||||
<td><?php echo html::select("PMs[$projectID]", $PMUsers, $project->PM, "class='form-control chosen'");?></td>
|
||||
<td>
|
||||
|
||||
@@ -32,7 +32,16 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->program->parent;?></th>
|
||||
<td><?php echo html::select('parent', $programList, $project->parent, "class='form-control chosen'");?></td>
|
||||
<?php
|
||||
$attr = '';
|
||||
if(!isset($programList[$project->parent]))
|
||||
{
|
||||
echo html::hidden('parent', $project->parent);
|
||||
$attr = 'disabled';
|
||||
$programList = array($project->parent => $program->name);
|
||||
}
|
||||
?>
|
||||
<td><?php echo html::select('parent', $programList, $project->parent, "class='form-control chosen' $attr");?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
+13
-18
@@ -129,12 +129,11 @@ class repo extends control
|
||||
|
||||
$this->app->loadLang('action');
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
|
||||
$this->view->position[] = $this->lang->repo->create;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $this->loadModel('product')->getProductPairsByProject($objectID);
|
||||
$this->view->gitlabHosts = $this->loadModel('gitlab')->getPairs();
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
|
||||
$this->view->position[] = $this->lang->repo->create;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $this->loadModel('product')->getProductPairsByProject($objectID);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -177,16 +176,15 @@ class repo extends control
|
||||
$this->view->projects = $options;
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->edit;
|
||||
$repo->repoType = $repo->id . '-' . $repo->SCM;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $objectID ? $this->loadModel('product')->getProductPairsByProject($objectID) : $this->loadModel('product')->getPairs();
|
||||
$this->view->gitlabHosts = $this->loadModel('gitlab')->getPairs();
|
||||
$repo->repoType = $repo->id . '-' . $repo->SCM;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $objectID ? $this->loadModel('product')->getProductPairsByProject($objectID) : $this->loadModel('product')->getPairs();
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->edit;
|
||||
$this->view->position[] = html::a(inlink('maintain'), $this->lang->repo->common);
|
||||
$this->view->position[] = $this->lang->repo->edit;
|
||||
|
||||
@@ -209,9 +207,6 @@ class repo extends control
|
||||
die(js::confirm($this->lang->repo->notice->delete, $this->repo->createLink('delete', "repoID=$repoID&objectID=$objectID&confirm=yes")));
|
||||
}
|
||||
|
||||
/* Delete project relation for gitlab type. */
|
||||
$this->loadModel('gitlab')->deleteProjectRelation($repoID);
|
||||
|
||||
$relationID = $this->dao->select('id')->from(TABLE_RELATION)->where('extra')->eq($repoID)->fetch();
|
||||
if($relationID)
|
||||
{
|
||||
|
||||
@@ -126,7 +126,6 @@ $lang->repo->encodingList['gbk'] = 'GBK';
|
||||
$lang->repo->scmList['Git'] = '本地 Git';
|
||||
$lang->repo->scmList['Gitlab'] = 'Gitlab';
|
||||
$lang->repo->scmList['Subversion'] = 'Subversion';
|
||||
$lang->repo->scmList['Gitlab'] = 'Gitlab';
|
||||
|
||||
$lang->repo->gitlabHost = 'GitLab Server';
|
||||
$lang->repo->gitlabToken = 'GitLab Token';
|
||||
|
||||
+7
-20
@@ -153,8 +153,6 @@ class repoModel extends model
|
||||
if(!$hasPriv) unset($repos[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
if($repo->SCM == 'Gitlab') $repo = $this->processGitlab($repo);
|
||||
}
|
||||
|
||||
return $repos;
|
||||
@@ -198,16 +196,15 @@ class repoModel extends model
|
||||
if(!$this->checkConnection()) return false;
|
||||
|
||||
$data = fixer::input('post')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', '')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'path', $this->post->gitlabProject)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject)
|
||||
->skipSpecial('path,client,account,password')
|
||||
->setDefault('product', '')
|
||||
->join('product', ',')
|
||||
->get();
|
||||
|
||||
/* see this file in 1783G: processGitlab::$repo->path */
|
||||
if($this->post->SCM == 'Gitlab') $data->path = $this->post->gitlabProject;
|
||||
if($this->post->SCM == 'Gitlab') $data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
|
||||
|
||||
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
|
||||
|
||||
@@ -229,14 +226,8 @@ class repoModel extends model
|
||||
->exec();
|
||||
|
||||
if(!dao::isError()) $this->rmClientVersionFile();
|
||||
$repoID = $this->dao->lastInsertID();
|
||||
|
||||
$this->loadModel('gitlab');
|
||||
if($this->post->SCM == 'Gitlab')
|
||||
{
|
||||
$this->gitlab->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
|
||||
}
|
||||
return $repoID;
|
||||
return $this->dao->lastInsertID();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,9 +242,9 @@ class repoModel extends model
|
||||
$repo = $this->getRepoByID($id);
|
||||
|
||||
$data = fixer::input('post')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', '')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'path', $this->post->gitlabProject)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject)
|
||||
->setDefault('client', 'svn')
|
||||
->setDefault('prefix', $repo->prefix)
|
||||
->setDefault('product', '')
|
||||
@@ -261,6 +252,7 @@ class repoModel extends model
|
||||
->join('product', ',')
|
||||
->get();
|
||||
|
||||
if($this->post->SCM == 'Gitlab') $data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
|
||||
if($data->path != $repo->path) $data->synced = 0;
|
||||
|
||||
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
|
||||
@@ -281,7 +273,6 @@ class repoModel extends model
|
||||
if($data->client != $repo->client and !$this->checkClient()) return false;
|
||||
if(!$this->checkConnection()) return false;
|
||||
|
||||
|
||||
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
|
||||
$this->dao->update(TABLE_REPO)->data($data, $skip = 'gitlabHost,gitlabToken,gitlabProject')
|
||||
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
|
||||
@@ -292,15 +283,12 @@ class repoModel extends model
|
||||
|
||||
$this->rmClientVersionFile();
|
||||
|
||||
$this->loadModel('gitlab');
|
||||
if($repo->SCM == 'Gitlab') $this->gitlab->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
|
||||
if($repo->path != $data->path)
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($id)->exec();
|
||||
$this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($id)->exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -384,7 +372,6 @@ class repoModel extends model
|
||||
if(!$repo) return false;
|
||||
|
||||
if($repo->encrypt == 'base64') $repo->password = base64_decode($repo->password);
|
||||
if($repo->SCM == 'Gitlab') $reps = $this->processGitlab($repo);
|
||||
$repo->acl = json_decode($repo->acl);
|
||||
return $repo;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class='text' title='<?php if(strtolower($repo->SCM) == "gitlab") echo $lang->repo->pathTipsForGitlab; else echo $repo->path; ?>'><?php echo $repo->path; ?></td>
|
||||
<td class='text' title='<?php echo $repo->path; ?>'><?php echo $repo->path; ?></td>
|
||||
<td class='text-left c-actions'>
|
||||
<?php
|
||||
common::printIcon('repo', 'edit', "repoID=$repo->id&objectID=$objectID", '', 'list', 'edit');
|
||||
|
||||
@@ -935,7 +935,7 @@ class taskModel extends model
|
||||
foreach($teams as $member) $this->dao->insert(TABLE_TEAM)->data($member)->autoCheck()->exec();
|
||||
|
||||
/* Assign the left hours to zero who will be skipped. */
|
||||
$skipMembers = $this->loadModel('execution')->getTeamSkip($oldTask->team, $oldTask->assignedTo, $task->assignedTo);
|
||||
$skipMembers = $this->loadModel('execution')->getTeamSkip($oldTask->team, $oldTask->assignedTo, isset($task->assignedTo) ? $task->assignedTo : $oldTask->assignedTo);
|
||||
foreach($skipMembers as $account => $team) $this->dao->update(TABLE_TEAM)->set('left')->eq(0)->where('root')->eq($taskID)->andWhere('type')->eq('task')->andWhere('account')->eq($account)->exec();
|
||||
|
||||
$task = $this->computeHours4Multiple($oldTask, $task, array(), $autoStatus = false);
|
||||
|
||||
Reference in New Issue
Block a user