From 3f218959330313ec943ffe2335bc5ad2ae0c9ce8 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Fri, 18 Oct 2024 09:24:24 +0800 Subject: [PATCH] * [bug#56248,done,1h,0h] Project dropdown compatible with old pages. --- module/index/config.php | 1 + module/project/control.php | 42 +++ module/project/model.php | 7 +- .../project/view/ajaxgetolddropmenu.html.php | 248 ++++++++++++++++++ 4 files changed, 296 insertions(+), 2 deletions(-) create mode 100644 module/project/view/ajaxgetolddropmenu.html.php diff --git a/module/index/config.php b/module/index/config.php index bb5ad0c27e..5e0ece6c9b 100644 --- a/module/index/config.php +++ b/module/index/config.php @@ -38,3 +38,4 @@ $config->index->oldPages[] = 'weekly-index'; $config->index->oldPages[] = 'kanban-importticket'; $config->index->oldPages[] = 'message-ajaxgetdropmenuforold'; $config->index->oldPages[] = 'product-ajaxgetolddropmenu'; +$config->index->oldPages[] = 'project-ajaxgetolddropmenu'; diff --git a/module/project/control.php b/module/project/control.php index 392c29b640..139345bad8 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -127,6 +127,48 @@ class project extends control $this->display(); } + /** + * 旧页面:设置1.5级项目下拉菜单。 + * Ajax get project drop menu. + * + * @param int $projectID + * @param string $module + * @param string $method + * @access public + * @return void + */ + public function ajaxGetOldDropMenu(int $projectID, string $module, string $method, string $extra = '') + { + /* Set cookie for show all project. */ + $_COOKIE['showClosed'] = 1; + + /* Query user's project and program. */ + $projects = $this->project->getListByCurrentUser(); + $involvedProjects = $this->project->getInvolvedListByCurrentUser(); + $programs = $this->loadModel('program')->getPairs(true); + + /* Generate project tree. */ + $orderedProjects = array(); + foreach($projects as $project) + { + $project->parent = $this->program->getTopByID($project->parent); + $project->parent = isset($programs[$project->parent]) ? $project->parent : $project->id; + + $orderedProjects[$project->parent][] = $project; + } + + $this->view->link = $this->project->getProjectLink($module, $method, $projectID, $extra); // Create the link from module,method. + $this->view->projectID = $projectID; + $this->view->module = $module; + $this->view->method = $method; + $this->view->programs = $programs; + + $this->view->projects = $orderedProjects; + $this->view->involvedProjects = $involvedProjects; + + $this->display(); + } + /** * 移除项目团队成员时进行提示。 * Ajax prompts when removing project team members. diff --git a/module/project/model.php b/module/project/model.php index 7b3081d063..afc3f57c84 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -2647,8 +2647,11 @@ class projectModel extends model return $output; } - $dropMenuLink = helper::createLink('project', 'ajaxGetDropMenu', "objectID=$projectID&module=$currentModule&method=$currentMethod"); - $output = "