* Merge module-design 18.4-18.8 to Merge184.
This commit is contained in:
+19
-14
@@ -297,8 +297,18 @@ class design extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkCommit(int $designID = 0, int $repoID = 0, string $begin = '', string $end = '', int $recPerPage = 50, int $pageID = 1)
|
||||
public function linkCommit(int $designID = 0, int $repoID = 0, string $begin = '', string $end = '', int $recTotal = 0, int $recPerPage = 50, int $pageID = 1)
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->design->linkCommit($designID, $repoID);
|
||||
|
||||
$result['result'] = 'success';
|
||||
$result['message'] = $this->lang->saveSuccess;
|
||||
$result['locate'] = 'parent';
|
||||
return $this->send($result);
|
||||
}
|
||||
|
||||
$design = $this->design->getById($designID);
|
||||
$this->commonAction($design->project, (int)$design->product, $designID);
|
||||
|
||||
@@ -314,11 +324,7 @@ class design extends control
|
||||
$repo = $this->loadModel('repo')->getByID($repoID);
|
||||
$revisions = $this->design->getCommits($repo,$begin, date('Y-m-d 23:59:59', strtotime($end)));
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$this->design->linkCommit($designID, $repoID);
|
||||
return $this->sendSuccess(array('closeModal' => true, 'load' => true));
|
||||
}
|
||||
$this->session->set('designRevisions', $revisions);
|
||||
|
||||
/* Linked submission. */
|
||||
$linkedRevisions = array();
|
||||
@@ -382,14 +388,13 @@ class design extends control
|
||||
*/
|
||||
public function viewCommit(int $designID = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
|
||||
{
|
||||
$design = $this->design->getByID($designID);
|
||||
$this->commonAction($design->project, (int)$design->product, $designID);
|
||||
$design = $this->design->getCommit($designID, $pager);
|
||||
$this->commonAction($design->project, $design->product, $designID);
|
||||
|
||||
/* Init pager. */
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = pager::init(0, $recPerPage, $pageID);
|
||||
$pager = pager::init(0, $recPerPage, $pageID);
|
||||
|
||||
$design = $this->design->getCommit($designID, $pager);
|
||||
$this->config->design->viewcommit->dtable->fieldList['actions']['list']['unlinkCommit']['url'] = sprintf($this->config->design->viewcommit->actionList['unlinkCommit']['url'], $designID);
|
||||
|
||||
$this->view->title = $this->lang->design->common . $this->lang->colon . $this->lang->design->submission;
|
||||
@@ -404,15 +409,15 @@ class design extends control
|
||||
/**
|
||||
* A version of the repository.
|
||||
*
|
||||
* @param int $repoID
|
||||
* @param int $revisionID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function revision(int $repoID = 0, int $projectID = 0)
|
||||
public function revision(int $revisionID = 0, int $projectID = 0)
|
||||
{
|
||||
$repo = $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('id')->eq($repoID)->fetch();
|
||||
$this->locate(helper::createLink('repo', 'revision', "repoID={$repo->repo}&objectID={$projectID}&revistion={$repo->revision}"));
|
||||
$revision = $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('id')->eq($revisionID)->fetch();
|
||||
$this->locate(helper::createLink('repo', 'revision', "repoID=$revision->repo&objectID=$projectID&revistion=$revision->revision"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+32
-9
@@ -179,10 +179,31 @@ class designModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkCommit($designID = 0, $repoID = 0)
|
||||
public function linkCommit(int $designID = 0, int $repoID = 0)
|
||||
{
|
||||
$repo = $this->loadModel('repo')->getByID($repoID);
|
||||
$revisions = $_POST['revision'];
|
||||
|
||||
if($repo->SCM == 'Gitlab')
|
||||
{
|
||||
$logs = array();
|
||||
foreach($this->session->designRevisions as $key => $commit)
|
||||
{
|
||||
if(in_array($commit->revision, $revisions))
|
||||
{
|
||||
$log = new stdclass();
|
||||
$log->committer = $commit->committer_name;
|
||||
$log->revision = $commit->id;
|
||||
$log->comment = $commit->message;
|
||||
$log->time = date('Y-m-d H:i:s', strtotime($commit->created_at));
|
||||
|
||||
$logs[] = $log;
|
||||
}
|
||||
}
|
||||
$this->repo->saveCommit($repoID, array('commits' => $logs), 0);
|
||||
$revisions = $this->dao->select('id')->from(TABLE_REPOHISTORY)->where('revision')->in($revisions)->andWhere('repo')->eq($repoID)->fetchPairs('id');
|
||||
}
|
||||
|
||||
foreach($revisions as $revision)
|
||||
{
|
||||
$data = new stdclass();
|
||||
@@ -256,7 +277,7 @@ class designModel extends model
|
||||
|
||||
$design->commit = '';
|
||||
$relations = $this->loadModel('common')->getRelations('design', $designID, 'commit');
|
||||
foreach($relations as $relation) $design->commit .= html::a(helper::createLink('design', 'revision', "repoID=$relation->BID&projectID={$design->project}"), "#$relation->BID", '', 'data-app=devops');
|
||||
foreach($relations as $relation) $design->commit .= html::a(helper::createLink('design', 'revision', "revisionID=$relation->BID&projectID={$design->project}"), "#$relation->BID");
|
||||
|
||||
return $this->loadModel('file')->replaceImgURL($design, 'desc');
|
||||
}
|
||||
@@ -438,20 +459,20 @@ class designModel extends model
|
||||
* @param int $projectID
|
||||
* @param int $products
|
||||
* @param int $productID
|
||||
* @param string $currentModule
|
||||
* @param string $currentMethod
|
||||
* @param string $extra
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function setMenu($projectID, $products, $productID = 0)
|
||||
public function setMenu(int $projectID, array $products, int $productID = 0): string
|
||||
{
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
if(!empty($project) and (in_array($project->model, array('waterfall', 'ipd')))) $typeList = 'typeList';
|
||||
if(!empty($project) and $project->model == 'waterfallplus') $typeList = 'plusTypeList';
|
||||
|
||||
/* Show custom design types. */
|
||||
$this->lang->waterfall->menu->design['subMenu'] = new stdclass();
|
||||
$this->lang->waterfall->menu->design['subMenu']->all = array('link' => "{$this->lang->all}|design|browse|projectID=%s&productID=0&browseType=all");
|
||||
$count = 1;
|
||||
foreach(array_filter($this->lang->design->typeList) as $key => $value)
|
||||
foreach(array_filter($this->lang->design->{$typeList}) as $key => $value)
|
||||
{
|
||||
$key = strtolower($key);
|
||||
|
||||
@@ -466,6 +487,8 @@ class designModel extends model
|
||||
$count ++;
|
||||
}
|
||||
|
||||
if($this->app->rawMethod == 'browse') $this->lang->waterfall->menu->design['subMenu']->bysearch = array('link' => '<a href="javascript:;" class="querybox-toggle"><i class="icon-search icon"></i> ' . $this->lang->searchAB . '</a>');
|
||||
|
||||
if(empty($products) || !$productID) return '';
|
||||
|
||||
if($productID)
|
||||
|
||||
Reference in New Issue
Block a user