From 7dd81df0580a7c0d9562d669685aa7be4d42bc78 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sat, 14 Sep 2024 09:55:39 +0800 Subject: [PATCH] * [bug#55190] Get repos and commits in tutorial. --- module/design/config/dtable.php | 2 +- module/repo/model.php | 4 ++ .../config/waterfallProjectManage.php | 12 +++--- module/tutorial/lang/de.php | 3 +- module/tutorial/lang/en.php | 3 +- module/tutorial/lang/fr.php | 3 +- module/tutorial/lang/zh-cn.php | 3 +- module/tutorial/model.php | 37 ++++++++++++++++++- 8 files changed, 51 insertions(+), 16 deletions(-) diff --git a/module/design/config/dtable.php b/module/design/config/dtable.php index cc6e3b32bf..7228028166 100644 --- a/module/design/config/dtable.php +++ b/module/design/config/dtable.php @@ -43,7 +43,7 @@ $app->loadLang('repo'); $config->design->linkcommit->dtable->fieldList['revision']['title'] = $lang->repo->revisionA; $config->design->linkcommit->dtable->fieldList['revision']['type'] = 'title'; -$config->design->linkcommit->dtable->fieldList['revision']['link'] = helper::createLink('repo', 'revision', 'repoID=%s&objectID=%s&revision={revision}'); +$config->design->linkcommit->dtable->fieldList['revision']['link'] = common::isTutorialMode() ? '' : helper::createLink('repo', 'revision', 'repoID=%s&objectID=%s&revision={revision}'); $config->design->linkcommit->dtable->fieldList['revision']['sortType'] = false; $config->design->linkcommit->dtable->fieldList['revision']['checkbox'] = true; diff --git a/module/repo/model.php b/module/repo/model.php index 9d355fa8bd..6ad4e16423 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -552,6 +552,8 @@ class repoModel extends model */ public function getRepoPairs(string $type, int $projectID = 0, bool $showScm = true): array { + if(common::isTutorialMode()) return $this->loadModel('tutorial')->getRepoPairs(); + $repos = $this->dao->select('*')->from(TABLE_REPO) ->where('deleted')->eq(0) ->fetchAll(); @@ -840,6 +842,8 @@ class repoModel extends model */ public function getCommits(object $repo, string $entry, string $revision = 'HEAD', string $type = 'dir', object|null $pager = null, string $begin = '', string $end = '', object|string|null $query = null): array { + if(common::isTutorialMode()) return $this->loadModel('tutorial')->getCommits(); + if(!isset($repo->id)) return array(); if(in_array($repo->SCM, $this->config->repo->notSyncSCM)) return $this->loadModel('gitlab')->getCommits($repo, $entry, $pager, $begin, $end, $query); diff --git a/module/tutorial/config/waterfallProjectManage.php b/module/tutorial/config/waterfallProjectManage.php index 2f275940c6..f77b64bd21 100644 --- a/module/tutorial/config/waterfallProjectManage.php +++ b/module/tutorial/config/waterfallProjectManage.php @@ -711,7 +711,7 @@ if(in_array($config->edition, array('max', 'ipd'))) 'type' => 'click', 'target' => 'a.design-create-btn', 'page' => 'design-browse', - 'url' => array('design', 'browse', 'projectID=2'), + 'url' => array('design', 'browse', 'projectID=2&productID=1'), 'title' => $lang->tutorial->waterfallProjectManage->design->step2->name, 'desc' => $lang->tutorial->waterfallProjectManage->design->step2->desc ); @@ -747,14 +747,16 @@ if(in_array($config->edition, array('max', 'ipd'))) ); $waterfallProjectManage->advance->tasks['design']['steps'][] = array( - 'type' => 'form', - 'page' => 'repo-create', + 'type' => 'selectRow', + 'target' => '#table-design-linkcommit .dtable-body', + 'page' => 'design-view', 'title' => $lang->tutorial->waterfallProjectManage->design->step7->name ); $waterfallProjectManage->advance->tasks['design']['steps'][] = array( - 'type' => 'saveForm', - 'page' => 'repo-create', + 'type' => 'click', + 'target' => '#table-design-linkcommit div.dtable-footer nav.toolbar button', + 'page' => 'design-view', 'title' => $lang->tutorial->waterfallProjectManage->design->step8->name, 'desc' => $lang->tutorial->waterfallProjectManage->design->step8->desc ); diff --git a/module/tutorial/lang/de.php b/module/tutorial/lang/de.php index 938685c481..2fcace7281 100644 --- a/module/tutorial/lang/de.php +++ b/module/tutorial/lang/de.php @@ -869,8 +869,7 @@ $lang->tutorial->waterfallProjectManage->design->step6->name = 'Click to Link Co $lang->tutorial->waterfallProjectManage->design->step6->desc = 'You can associate submissions here.'; $lang->tutorial->waterfallProjectManage->design->step7 = new stdClass(); -$lang->tutorial->waterfallProjectManage->design->step7->name = 'Fill out the form'; -$lang->tutorial->waterfallProjectManage->design->step7->desc = 'Empty'; +$lang->tutorial->waterfallProjectManage->design->step7->name = 'Select Commit'; $lang->tutorial->waterfallProjectManage->design->step8 = new stdClass(); $lang->tutorial->waterfallProjectManage->design->step8->name = 'Save the form'; diff --git a/module/tutorial/lang/en.php b/module/tutorial/lang/en.php index f0c0b672e3..19318aec8d 100644 --- a/module/tutorial/lang/en.php +++ b/module/tutorial/lang/en.php @@ -869,8 +869,7 @@ $lang->tutorial->waterfallProjectManage->design->step6->name = 'Click to Link Co $lang->tutorial->waterfallProjectManage->design->step6->desc = 'You can associate submissions here.'; $lang->tutorial->waterfallProjectManage->design->step7 = new stdClass(); -$lang->tutorial->waterfallProjectManage->design->step7->name = 'Fill out the form'; -$lang->tutorial->waterfallProjectManage->design->step7->desc = 'Empty'; +$lang->tutorial->waterfallProjectManage->design->step7->name = 'Select Commit'; $lang->tutorial->waterfallProjectManage->design->step8 = new stdClass(); $lang->tutorial->waterfallProjectManage->design->step8->name = 'Save the form'; diff --git a/module/tutorial/lang/fr.php b/module/tutorial/lang/fr.php index 826a5a8b94..0b02722d36 100644 --- a/module/tutorial/lang/fr.php +++ b/module/tutorial/lang/fr.php @@ -869,8 +869,7 @@ $lang->tutorial->waterfallProjectManage->design->step6->name = 'Click to Link Co $lang->tutorial->waterfallProjectManage->design->step6->desc = 'You can associate submissions here.'; $lang->tutorial->waterfallProjectManage->design->step7 = new stdClass(); -$lang->tutorial->waterfallProjectManage->design->step7->name = 'Fill out the form'; -$lang->tutorial->waterfallProjectManage->design->step7->desc = 'Empty'; +$lang->tutorial->waterfallProjectManage->design->step7->name = 'Select Commit'; $lang->tutorial->waterfallProjectManage->design->step8 = new stdClass(); $lang->tutorial->waterfallProjectManage->design->step8->name = 'Save the form'; diff --git a/module/tutorial/lang/zh-cn.php b/module/tutorial/lang/zh-cn.php index 72d9264871..5a9ea1e2ad 100644 --- a/module/tutorial/lang/zh-cn.php +++ b/module/tutorial/lang/zh-cn.php @@ -869,8 +869,7 @@ $lang->tutorial->waterfallProjectManage->design->step6->name = '点击关联提 $lang->tutorial->waterfallProjectManage->design->step6->desc = '您可以在这里关联提交'; $lang->tutorial->waterfallProjectManage->design->step7 = new stdClass(); -$lang->tutorial->waterfallProjectManage->design->step7->name = '填写表单'; -$lang->tutorial->waterfallProjectManage->design->step7->desc = '空'; +$lang->tutorial->waterfallProjectManage->design->step7->name = '选择提交'; $lang->tutorial->waterfallProjectManage->design->step8 = new stdClass(); $lang->tutorial->waterfallProjectManage->design->step8->name = '保存表单'; diff --git a/module/tutorial/model.php b/module/tutorial/model.php index 164dc03f0a..485071f472 100644 --- a/module/tutorial/model.php +++ b/module/tutorial/model.php @@ -1522,8 +1522,8 @@ class tutorialModel extends model $design->execution = 0; $design->name = 'Test Design'; $design->status = ''; - $design->createdBy = ''; - $design->createdDate = ''; + $design->createdBy = $this->app->user->account; + $design->createdDate = helper::now(); $design->editedBy = ''; $design->editedDate = ''; $design->assignedTo = ''; @@ -2485,4 +2485,37 @@ class tutorialModel extends model $charter = $this->getCharter(); return array($charter->id => $charter); } + + /** + * 获取新手模式代码库键值对。 + * Get repo pairs. + * + * @access public + * @return array + */ + public function getRepoPairs(): array + { + return array(1 => '[git] Test repo'); + } + + /** + * 获取新手模式提交记录。 + * Get git commits. + * + * @access public + * @return array + */ + public function getCommits(): array + { + $commit = new stdClass(); + $commit->id = 1; + $commit->repo = 1; + $commit->revision = 'bedeaaf39ef7084b9a455b9d9dba71e2db357201'; + $commit->commit = 1; + $commit->comment = 'Git comment.'; + $commit->committer = $this->app->user->account; + $commit->time = helper::now(); + $commit->originalComment = 'Git comment.'; + return array($commit->revision => $commit); + } }