productplan->noPlan;?>
-
+
createLink('productplan', 'create', "productID=$product->id&branch=$branch"), " " . $lang->productplan->create, '', "class='btn btn-info'");?>
From 6db0f8b4704bd2b42898857141e463eb6602e93b Mon Sep 17 00:00:00 2001
From: hufangzhou <746775970@qq.com>
Date: Tue, 13 Apr 2021 14:34:13 +0800
Subject: [PATCH 06/51] * Adjust the doc view width under the different
resolutions.
---
module/doc/css/objectlibs.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/module/doc/css/objectlibs.css b/module/doc/css/objectlibs.css
index 93588e4764..743a6d66a0 100644
--- a/module/doc/css/objectlibs.css
+++ b/module/doc/css/objectlibs.css
@@ -15,8 +15,8 @@
.main-col .doc-title .version .dropdown-menu a:hover {color: #ffffff;}
.main-col .doc-title .actions a {margin-right: 8px;}
.main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;}
-#sidebar {width: 265px;}
-#sidebar>.cell {width: 265px;}
+#sidebar {width: 275px;}
+#sidebar>.cell {width: 100%;}
#sidebar>.sidebar-toggle {left: 3px; right: auto;}
.hide-sidebar #sidebar>.cell {left: -270px;}
.hide-sidebar #sidebar>.sidebar-toggle>.icon:before {content: "\e314";}
From eb9cfcf41bd110ed7b681e9aed61816fe8bceed8 Mon Sep 17 00:00:00 2001
From: leiyong <1549684884@qq.com>
Date: Tue, 13 Apr 2021 07:34:25 +0000
Subject: [PATCH 07/51] * Adjust session.
---
module/action/model.php | 3 ++-
module/bug/view/view.html.php | 2 +-
module/project/control.php | 12 ++++++++----
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/module/action/model.php b/module/action/model.php
index cef27805e4..e002345d95 100755
--- a/module/action/model.php
+++ b/module/action/model.php
@@ -177,11 +177,12 @@ class actionModel extends model
}
/* Only process these object types. */
- if(strpos(',story,productplan,release,task,build,bug,case,testtask,doc,', ",{$objectType},") !== false)
+ if(strpos(',story,productplan,release,task,build,bug,case,testtask,doc,issue,risk,', ",{$objectType},") !== false)
{
if(!isset($this->config->objectTables[$objectType])) return $emptyRecord;
/* Set fields to fetch. */
+ $fields = '*';
if(strpos('story, productplan, case', $objectType) !== false) $fields = 'product';
if(strpos('build, bug, testtask, doc', $objectType) !== false) $fields = 'product, project, execution';
if($objectType == 'release') $fields = 'product, build';
diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php
index e9e1a34d46..ee07990a30 100644
--- a/module/bug/view/view.html.php
+++ b/module/bug/view/view.html.php
@@ -13,7 +13,7 @@
-session->bugList != false ? $app->session->bugList : inlink('browse', "productID=$bug->product");?>
+session->bugList ? $app->session->bugList : inlink('browse', "productID=$bug->product");?>
diff --git a/module/project/control.php b/module/project/control.php
index 37aa2cd229..f425d0f461 100644
--- a/module/project/control.php
+++ b/module/project/control.php
@@ -286,7 +286,7 @@ class project extends control
if($model == 'waterfall')
{
$productID = $this->loadModel('product')->getProductIDByProject($projectID, true);
- $this->session->set('programPlanList', $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=lists", '', '', $projectID), 'project');
+ $this->session->set('projectPlanList', $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=lists", '', '', $projectID), 'project');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('programplan', 'create', "projectID=$projectID", '', '', $projectID)));
}
@@ -606,14 +606,18 @@ class project extends control
$this->session->set('productPlanList', $uri, 'product');
$this->session->set('releaseList', $uri, 'product');
$this->session->set('storyList', $uri, 'product');
- $this->session->set('projectList', $uri, 'project');
- $this->session->set('executionList', $uri, 'execution');
$this->session->set('taskList', $uri, 'execution');
$this->session->set('buildList', $uri, 'execution');
$this->session->set('bugList', $uri, 'qa');
$this->session->set('caseList', $uri, 'qa');
$this->session->set('testtaskList', $uri, 'qa');
+ if($this->config->maxVersion)
+ {
+ $this->session->set('riskList', $uri, 'project');
+ $this->session->set('issueList', $uri, 'project');
+ }
+
/* Append id for secend sort. */
$orderBy = $direction == 'next' ? 'date_desc' : 'date_asc';
$sort = $this->loadModel('common')->appendOrder($orderBy);
@@ -712,7 +716,7 @@ class project extends control
$this->loadModel('product');
/* Save session. */
- $this->session->set('bugList', $this->app->getURI(true), 'qa');
+ $this->session->set('bugList', $this->app->getURI(true), 'project');
$this->project->setMenu($projectID);
$project = $this->project->getByID($projectID);
From 42bda4073530120eb2f4586fa177ab5b40d0c97c Mon Sep 17 00:00:00 2001
From: qiyu-xie
Date: Tue, 13 Apr 2021 15:40:57 +0800
Subject: [PATCH 08/51] * Fix bug#11075.
---
module/task/css/edit.zh-cn.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/module/task/css/edit.zh-cn.css b/module/task/css/edit.zh-cn.css
index 9672ee2c84..d0b9f1d97a 100644
--- a/module/task/css/edit.zh-cn.css
+++ b/module/task/css/edit.zh-cn.css
@@ -1,2 +1,2 @@
-.thWidth {width: 80px !important;}
+.thWidth {width: 93px !important;}
.lifeThWidth {width: 80px !important;}
From 1ccb76c4871641b5bc84bfa980e65014afae5e62 Mon Sep 17 00:00:00 2001
From: holan20180123 <56391770@qq.com>
Date: Tue, 13 Apr 2021 16:18:46 +0800
Subject: [PATCH 09/51] * Fix product doc lib acl error.
---
module/project/model.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/module/project/model.php b/module/project/model.php
index 5e374b0b97..cf8c762820 100644
--- a/module/project/model.php
+++ b/module/project/model.php
@@ -820,7 +820,7 @@ class projectModel extends model
$lib->name = $this->lang->doclib->main['product'];
$lib->type = 'product';
$lib->main = '1';
- $lib->acl = $product->acl;
+ $lib->acl = 'default';
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
}
From a1ee0caa3f7ac913434b4dc83b7a8d6ac6c14954 Mon Sep 17 00:00:00 2001
From: Yagami <976204163@qq.com>
Date: Tue, 13 Apr 2021 16:31:23 +0800
Subject: [PATCH 10/51] * Adjust doc code.
---
module/common/lang/menu.php | 6 +-
module/doc/control.php | 205 ++--------------------------
module/doc/js/browse.js | 24 ----
module/doc/model.php | 126 ++---------------
module/doc/view/browse.html.php | 77 +----------
module/doc/view/content.html.php | 2 +
module/doc/view/showfiles.html.php | 209 -----------------------------
module/group/lang/resource.php | 14 +-
8 files changed, 34 insertions(+), 629 deletions(-)
delete mode 100644 module/doc/js/browse.js
delete mode 100644 module/doc/view/showfiles.html.php
diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php
index 4b2a111d0f..7e96993882 100644
--- a/module/common/lang/menu.php
+++ b/module/common/lang/menu.php
@@ -330,9 +330,9 @@ $lang->devops->menuOrder[25] = 'rules';
/* Doc menu.*/
$lang->doc->menu = new stdclass();
$lang->doc->menu->dashboard = array('link' => "{$lang->dashboard}|doc|index");
-$lang->doc->menu->recent = array('link' => "{$lang->doc->recent}|doc|browse|libID=0&browseTyp=byediteddate", 'alias' => 'recent');
-$lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|libID=0&browseTyp=openedbyme", 'alias' => 'my');
-$lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|libID=0&browseTyp=collectedbyme", 'alias' => 'collect');
+$lang->doc->menu->recent = array('link' => "{$lang->doc->recent}|doc|browse|browseTyp=byediteddate", 'alias' => 'recent');
+$lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|browseTyp=openedbyme", 'alias' => 'my');
+$lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|browseTyp=collectedbyme", 'alias' => 'collect');
$lang->doc->menu->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product", 'alias' => 'product');
if($config->systemMode == 'new') $lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project", 'alias' => 'project');
if($config->systemMode == 'classic') $lang->doc->menu->execution = array('link' => "{$lang->doc->execution}|doc|objectLibs|type=execution", 'alias' => 'execution');
diff --git a/module/doc/control.php b/module/doc/control.php
index cd0337040a..c1fc4f5226 100644
--- a/module/doc/control.php
+++ b/module/doc/control.php
@@ -26,10 +26,6 @@ class doc extends control
$this->loadModel('product');
$this->loadModel('project');
$this->loadModel('execution');
- $this->from = $this->cookie->from ? $this->cookie->from : 'doc';
- $this->productID = $this->cookie->product ? $this->cookie->product : '0';
- $this->projectID = isset($_GET['project']) ? $_GET['project'] : 0;
- if($this->from == 'doc') $this->session->set('project', '');
}
/**
@@ -40,9 +36,6 @@ class doc extends control
*/
public function index()
{
- $this->from = 'doc';
- setcookie('from', 'doc', $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
-
$this->session->set('docList', $this->app->getURI(true), 'doc');
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 5, 1);
@@ -53,9 +46,9 @@ class doc extends control
$this->view->title = $this->lang->doc->common . $this->lang->colon . $this->lang->doc->index;
$this->view->position[] = $this->lang->doc->index;
- $this->view->latestEditedDocs = $this->doc->getDocsByBrowseType(0, 'byediteddate', 0, 0, 'editedDate_desc, id_desc', $pager);
- $this->view->myDocs = $this->doc->getDocsByBrowseType(0, 'openedbyme', 0, 0, 'addedDate_desc', $pager);
- $this->view->collectedDocs = $this->doc->getDocsByBrowseType(0, 'collectedbyme', 0, 0, 'addedDate_desc', $pager);
+ $this->view->latestEditedDocs = $this->doc->getDocsByBrowseType('byediteddate', 0, 0, 'editedDate_desc, id_desc', $pager);
+ $this->view->myDocs = $this->doc->getDocsByBrowseType('openedbyme', 0, 0, 'addedDate_desc', $pager);
+ $this->view->collectedDocs = $this->doc->getDocsByBrowseType('collectedbyme', 0, 0, 'addedDate_desc', $pager);
$this->view->statisticInfo = $this->doc->getStatisticInfo();
$this->view->users = $this->user->getPairs('noletter');
@@ -69,20 +62,15 @@ class doc extends control
* @param string $browseType
* @param int $param
* @param string $orderBy
- * @param string $from doc|project|product
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
- public function browse($libID = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $from = 'doc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
+ public function browse($browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->session->set('docList', $this->app->getURI(true), 'doc');
-
- $this->from = $from;
- setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
-
$this->loadModel('search');
/* Set browseType.*/
@@ -90,38 +78,8 @@ class doc extends control
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
- $type = '';
- $productID = 0;
- $executionID = 0;
- if($libID)
- {
- $lib = $this->doc->getLibByID($libID);
- $type = $lib->type;
- $productID = $lib->product;
- $executionID = $lib->execution;
-
- if($type != 'product' and $type != 'execution') $from = 'doc';
- }
-
- $this->libs = $this->doc->getLibs($type, '', $libID);
-
- /* According the from, set menus. */
- if($from == 'product')
- {
- $this->product->setMenu($productID);
- }
- elseif($from == 'project')
- {
- $this->project->setMenu($lib->project);
- }
- else
- {
- $menuType = (!$type && (in_array($browseType, array_keys($this->lang->doc->fastMenuList)) || $browseType == 'bysearch')) ? $browseType : $type;
- }
-
/* Set header and position. */
- $this->view->title = $this->lang->doc->common . ($libID ? $this->lang->colon . $this->libs[$libID] : '');
- $this->view->position[] = $libID ? $this->libs[$libID] : '';
+ $this->view->title = $this->lang->doc->common;
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -130,33 +88,8 @@ class doc extends control
/* Append id for secend sort. */
$sort = $this->loadModel('common')->appendOrder($orderBy);
- /* Build the search form. */
- $actionURL = $this->createLink('doc', 'browse', "lib=$libID&browseType=bySearch&queryID=myQueryID&orderBy=$orderBy");
- $this->doc->buildSearchForm($libID, $this->libs, $queryID, $actionURL, $type);
-
- $title = '';
- $module = $moduleID ? $this->tree->getByID($moduleID) : '';
- if($module) $title = $module->name;
- if($libID) $title = html::a(helper::createLink('doc', 'browse', "libID=$libID"), $this->libs[$libID], '');
- if(in_array($browseType, array_keys($this->lang->doc->fastMenuList))) $title = $this->lang->doc->fastMenuList[$browseType];
- if($browseType == 'bysearch') $title = $this->lang->doc->search;
- if($param != 0) $title = $this->doc->buildCrumbTitle($libID, $param, $title);
- if($browseType == 'fastsearch')
- {
- if($this->post->searchDoc) $this->session->set('searchDoc', $this->post->searchDoc);
- $title = '"' . $this->session->searchDoc . '" ' . $this->lang->doc->searchResult;
- }
- else
- {
- $this->session->set('searchDoc', '');
- }
-
- $libs = array();
if($browseType == 'collectedbyme')
{
- $libs = $this->doc->getAllLibsByType('collector');
- $this->view->itemCounts = $this->doc->statLibCounts(array_keys($libs));
-
$this->app->rawMethod = 'collect';
}
elseif($browseType == 'openedbyme')
@@ -168,33 +101,13 @@ class doc extends control
$this->app->rawMethod = 'recent';
}
- $attachLibs = array();
- if(!empty($lib) and (!empty($lib->product) or !empty($lib->execution)) and $browseType != 'bymodule')
- {
- $count = $this->dao->select('count(*) as count')->from(TABLE_DOCLIB)->where('execution')->eq($lib->execution)->andWhere('product')->eq($lib->product)->fetch('count');
- if($count == 1 and $type and isset($lib->$type))
- {
- $objectLibs = $this->doc->getLibsByObject($type, $lib->$type);
- if(isset($objectLibs['execution'])) $attachLibs['execution'] = $objectLibs['execution'];
- if(isset($objectLibs['files'])) $attachLibs['files'] = $objectLibs['files'];
- }
- }
-
- $this->view->breadTitle = $title;
- $this->view->libID = $libID;
$this->view->moduleID = $moduleID;
- $this->view->modules = $this->doc->getDocMenu($libID, $moduleID, '`order`', $browseType);
- $this->view->docs = $this->doc->getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager);
- $this->view->attachLibs = $attachLibs;
+ $this->view->docs = $this->doc->getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager);
$this->view->users = $this->user->getPairs('noletter');
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->param = $param;
- $this->view->type = $type;
- $this->view->from = $from;
$this->view->pager = $pager;
- $this->view->libs = $libs;
- $this->view->currentLib = $libID ? $lib : '';
$this->display();
}
@@ -390,20 +303,6 @@ class doc extends control
$lib = $this->doc->getLibByID($libID);
$type = $lib->type;
- /* According the from, set menus. */
- if($this->from == 'product')
- {
- $this->product->setMenu($lib->product);
-
- $this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
- }
- elseif($this->from == 'project')
- {
- $this->project->setMenu($lib->project);
-
- $this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
- }
-
$this->view->title = $lib->name . $this->lang->colon . $this->lang->doc->create;
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $lib->name);
$this->view->position[] = $this->lang->doc->create;
@@ -411,7 +310,7 @@ class doc extends control
$unclosed = strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'unclosedProject' : '';
$this->view->libID = $libID;
- $this->view->libs = $this->doc->getLibs($type = 'all', $extra = "withObject,$unclosed", $libID);
+ $this->view->libs = $this->doc->getLibs($type = 'all', $extra = "withObject,$unclosed", $libID, $objectID);
$this->view->libName = $this->dao->findByID($libID)->from(TABLE_DOCLIB)->fetch('name');
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
$this->view->moduleID = $moduleID ? (int)$moduleID : (int)$this->cookie->lastDocModule;
@@ -522,7 +421,7 @@ class doc extends control
$this->view->doc = $doc;
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
$this->view->type = $type;
- $this->view->libs = $this->doc->getLibs('all', $extra = 'withObject|noBook', $libID);
+ $this->view->libs = $this->doc->getLibs('all', $extra = 'withObject|noBook', $libID, $objectID);
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted', $doc->users);
$this->display();
@@ -576,16 +475,6 @@ class doc extends control
$lib = $this->doc->getLibByID($doc->lib);
$type = $lib->type;
- /* According the from, set menus. */
- if($this->from == 'product')
- {
- $this->product->setMenu($lib->product);
- }
- elseif($this->from == 'project')
- {
- $this->project->setMenu($lib->project);
- }
-
$this->view->title = "DOC #$doc->id $doc->title - " . $lib->name;
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $lib->name);
$this->view->position[] = $this->lang->doc->view;
@@ -873,84 +762,6 @@ class doc extends control
$this->display();
}
- /**
- * Show files for product or execution.
- *
- * @param string $type
- * @param int $objectID
- * @param string $from product|project|doc
- * @param string $viewType
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function showFiles($type, $objectID, $from = 'doc', $viewType = '', $orderBy = 't1.id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $uri = $this->app->getURI(true);
- $this->app->session->set('taskList', $uri, 'execution');
- $this->app->session->set('storyList', $uri, 'product');
- $this->app->session->set('docList', $uri, 'doc');
-
- if(empty($viewType)) $viewType = !empty($_COOKIE['docFilesViewType']) ? $this->cookie->docFilesViewType : 'card';
- setcookie('docFilesViewType', $viewType, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
-
- $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
- $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
-
- /* According the from, set menus. */
- if($this->from == 'product')
- {
- $this->product->setMenu($lib->product);
- }
- elseif($this->from == 'project')
- {
- $this->project->setMenu($objectID);
- }
- else
- {
- $crumb = html::a(inlink('allLibs', "type=$type"), $type == 'product' ? $this->lang->productCommon : $this->lang->executionCommon) . $this->lang->doc->separator;
- if($this->productID and $type == 'execution') $crumb = $this->doc->getProductCrumb($this->productID, $objectID);
- $crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name);
- $crumb .= $this->lang->doc->separator . ' ' . $this->lang->doclib->files;
-
- $productID = 0;
- $executionID = 0;
- if($type == 'product')
- {
- $productID = $objectID;
- if(!$this->product->checkPriv($objectID)) $this->accessDenied();
- }
-
- if($type == 'execution')
- {
- $executionID = $objectID;
- if(!$this->execution->checkPriv($objectID)) $this->accessDenied();
- }
- }
-
- /* Load pager. */
- $this->app->loadClass('pager', $static = true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
-
- $this->view->title = $object->name;
- $this->view->position[] = $object->name;
-
- $this->view->type = $type;
- $this->view->object = $object;
- $this->view->files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager);
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->pager = $pager;
- $this->view->viewType = $viewType;
- $this->view->orderBy = $orderBy;
- $this->view->objectID = $objectID;
- $this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable.
-
- $this->display();
- }
-
/**
* Show accessDenied response.
*
diff --git a/module/doc/js/browse.js b/module/doc/js/browse.js
deleted file mode 100644
index f5427fdb6b..0000000000
--- a/module/doc/js/browse.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Browse by module. */
-function browseByModule()
-{
- $('.divider').removeClass('hidden');
- $('#bymoduleTab').addClass('active');
- $('#allTab').removeClass('active');
-}
-
-function browseBySearch()
-{
- $('.divider').addClass('hidden');
- $('#bymoduleTab').removeClass('active');
- $('#allTab').addClass('active');
-}
-
-$(function()
-{
- if(browseType == 'bysearch') return;
- if(browseType == 'byediteddate' || browseType == 'openedbyme' || browseType == 'collectedbyme')
- {
- $('#pageActions ul.dropdown-menu').css('left', '0px');
- }
- $('#' + browseType + 'Tab').addClass('active');
-});
diff --git a/module/doc/model.php b/module/doc/model.php
index 0635317772..e0f2aa7f2a 100644
--- a/module/doc/model.php
+++ b/module/doc/model.php
@@ -31,43 +31,23 @@ class docModel extends model
* @param string $type
* @param string $extra
* @param string $appendLibs
+ * @param int $projectID
* @access public
* @return array
*/
- public function getLibs($type = '', $extra = '', $appendLibs = '')
+ public function getLibs($type = '', $extra = '', $appendLibs = '', $objectID = 0)
{
- $projectID = $this->session->project;
- if($type == 'product' or $type == 'project')
+ if($type == 'product' or $type == 'project' or $type == 'execution')
{
- $idList = array();
- if($type == 'product') $idList = $this->loadModel('product')->getProductIDByProject($projectID, false);
- if($type == 'execution')
- {
- $status = strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'undone' : 'all';
- $idList = $this->loadModel('execution')->getIdList($projectID, $status);
- }
-
- $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
- ->where($type)->in($idList)
+ ->where($type)->eq($objectID)
->andWhere('deleted')->eq('0')
->query();
}
elseif($type == 'all')
{
- /* If extra have unclosedProject then ignore unclosed project libs. */
- $status = (strpos($extra, 'unclosedProject') !== false) ? 'undone' : 'all';
- $executionIdList = $this->loadModel('execution')->getIdList($projectID, $status);
- $productIdList = $this->loadModel('product')->getProductIDByProject($projectID, false);
-
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
->where('deleted')->eq(0)
- ->andWhere()
- ->markLeft(1)
- ->where('`type`')->eq('custom')
- ->orWhere('execution')->in($executionIdList)
- ->orWhere('product')->in($productIdList)
- ->markRight(1)
->orderBy('id_desc')
->query();
}
@@ -79,11 +59,9 @@ class docModel extends model
->orderBy('`order`, id desc')->query();
}
- if(strpos($extra, 'withObject') !== false)
- {
- $products = $this->loadModel('product')->getProductPairsByProject($projectID);
- $executions = $this->loadModel('execution')->getPairs($projectID, 'all', 'noclosed');
- }
+ $products = $this->loadModel('product')->getPairs();
+ $projects = $this->loadModel('project')->getPairsByProgram();
+ $executions = $this->loadModel('execution')->getPairs();
$libPairs = array();
while($lib = $stmt->fetch())
@@ -93,6 +71,7 @@ class docModel extends model
if(strpos($extra, 'withObject') !== false)
{
if($lib->product != 0) $lib->name = zget($products, $lib->product, '') . '/' . $lib->name;
+ if($lib->project != 0) $lib->name = zget($projects, $lib->project, '') . '/' . $lib->name;
if($lib->execution != 0) $lib->name = zget($executions, $lib->execution, '') . '/' . $lib->name;
}
@@ -211,7 +190,6 @@ class docModel extends model
/**
* Get docs by browse type.
*
- * @param string $libID
* @param string $browseType
* @param int $queryID
* @param int $moduleID
@@ -220,10 +198,10 @@ class docModel extends model
* @access public
* @return array
*/
- public function getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager)
+ public function getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager)
{
$allLibs = array_keys($this->getLibs('all'));
- $docIdList = $this->getPrivDocs($libID, $moduleID);
+ $docIdList = $this->getPrivDocs(0, $moduleID);
$files = $this->dao->select('*')->from(TABLE_FILE)
->where('objectType')->eq('doc')
@@ -232,13 +210,12 @@ class docModel extends model
if($browseType == "all")
{
- $docs = $this->getDocs($libID, 0, $sort, $pager);
+ $docs = $this->getDocs(0, 0, $sort, $pager);
}
elseif($browseType == "openedbyme")
{
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
- ->beginIF($libID)->andWhere('lib')->in($libID)->fi()
->andWhere('lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('addedBy')->eq($this->app->user->account)
@@ -256,7 +233,6 @@ class docModel extends model
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere('id')->in(array_keys($docIDList))
- ->beginIF($libID)->andWhere('lib')->in($libID)->fi()
->andWhere('lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->orderBy($sort)
@@ -278,7 +254,6 @@ class docModel extends model
{
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
- ->beginIF($libID)->andWhere('lib')->in($libID)->fi()
->andWhere('lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('collector')->like("%,{$this->app->user->account},%")
@@ -286,83 +261,6 @@ class docModel extends model
->page($pager)
->fetchAll('id');
}
- elseif($browseType == "bymodule")
- {
- $modules = 0;
- if($moduleID)
- {
- $modules = array($moduleID => $moduleID);
- if(strpos($this->config->doc->custom->showLibs, 'children') !== false) $modules = $this->loadModel('tree')->getAllChildId($moduleID);
- }
- $docs = $this->getDocs($libID, $modules, $sort, $pager);
- }
- elseif($browseType == "bygrid")
- {
- $docs = $this->getDocs($libID, 0, $sort, $pager);
- }
- elseif($browseType == "bysearch")
- {
- if($queryID)
- {
- $query = $this->loadModel('search')->getQuery($queryID);
- if($query)
- {
- $this->session->set('docQuery', $query->sql);
- $this->session->set('docForm', $query->form);
- }
- else
- {
- $this->session->set('docQuery', ' 1 = 1');
- }
- }
- else
- {
- if($this->session->docQuery == false) $this->session->set('docQuery', ' 1 = 1');
- }
-
- $libCond = strpos($this->session->docQuery, "`lib` = ") !== false;
- $allLibCond = strpos($this->session->docQuery, "`lib` = 'all'") !== false;
-
- $docQuery = str_replace("`product` = 'all'", '1', $this->session->docQuery); // Search all product.
- $docQuery = str_replace("`execution` = 'all'", '1', $docQuery); // Search all execution.
- $docQuery = str_replace("`lib` = 'all'", '1', $docQuery); // Search all lib.
-
- $docs = $this->dao->select('*')->from(TABLE_DOC)->where($docQuery)
- ->beginIF(!$libCond and $libID != 0)->andWhere("lib")->eq($libID)->fi()
- ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
- ->andWhere('deleted')->eq(0)
- ->fetchAll('id');
- foreach($docs as $docID => $doc)
- {
- if(!$this->checkPrivDoc($doc)) unset($docs[$docID]);
- }
- $docs = $this->dao->select('*')->from(TABLE_DOC)
- ->where('id')->in(array_keys($docs))
- ->andWhere('lib')->in($allLibs)
- ->orderBy($sort)
- ->page($pager)
- ->fetchAll('id');
- }
- elseif($browseType == 'fastsearch')
- {
- if($this->session->searchDoc == false) return array();
- $docIdList = $this->getPrivDocs($libID, $moduleID);
- $docs = $this->dao->select('t1.*')->from(TABLE_DOC)->alias('t1')
- ->leftJoin(TABLE_DOCCONTENT)->alias('t2')->on('t2.doc = t1.id')
- ->where('t1.deleted')->eq(0)
- ->beginIF(!empty($docIdList))->andWhere('t1.id')->in($docIdList)->fi()
- ->andWhere('t1.title', true)->like("%{$this->session->searchDoc}%")
- ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
- ->orWhere('t2.content')->like("%{$this->session->searchDoc}%")->markRight(1)
- ->andWhere('t1.lib')->in($allLibs)
- ->orderBy($sort)
- ->page($pager)
- ->fetchAll('id');
- foreach($docs as $doc) $doc->title = str_replace($this->session->searchDoc, "{$this->session->searchDoc}", $doc->title);
- }
-
- $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'doc', false);
- if(!$docs) return array();
$docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc');
foreach($docs as $index => $doc)
@@ -743,7 +641,7 @@ class docModel extends model
->orderBy($orderBy)
->fetchAll('id');
- $docCounts= $this->dao->select("module, count(id) as docCount")->from(TABLE_DOC)
+ $docCounts = $this->dao->select("module, count(id) as docCount")->from(TABLE_DOC)
->where('module')->in(array_keys($modules))
->andWhere('deleted')->eq(0)
->groupBy('module')
diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php
index 96457575b2..cd56fe5bc5 100644
--- a/module/doc/view/browse.html.php
+++ b/module/doc/view/browse.html.php
@@ -15,27 +15,14 @@
doc->confirmDelete)?>
-
-from != 'doc') js::set('type', 'doc');?>
-
-app->user->feedback) && !$this->cookie->feedbackView && $this->from == 'doc') ? true : false;?>
-
+
-
-
-
-
doc->noSearchedDoc;?>
-
-
+
-
doc->noDoc;?>
-
- createLink('doc', 'create', "libID={$libID}&moduleID=$moduleID&type=&from={$lang->navGroup->doc}"), " " . $lang->doc->create, '', "class='btn btn-info'");?>
-
-
+
doc->noEditedDoc;?>
doc->noOpenedDoc;?>
@@ -58,60 +45,6 @@