* Code for task #89927.

This commit is contained in:
tianshujie
2023-04-03 16:12:48 +08:00
parent 85474574ca
commit 978ded6788
11 changed files with 114 additions and 61 deletions
+15 -11
View File
@@ -90,6 +90,8 @@ $filter->doc->browse = new stdclass();
$filter->doc->alllibs = new stdclass();
$filter->doc->objectlibs = new stdclass();
$filter->doc->tablecontents = new stdclass();
$filter->doc->productspace = new stdclass();
$filter->doc->projectspace = new stdclass();
$filter->doc->showfiles = new stdclass();
$filter->doc->default = new stdclass();
$filter->api->default = new stdClass();
@@ -215,17 +217,19 @@ $filter->bug->export->cookie['checkedItem'] = 'reg::checked';
$filter->caselib->create->cookie['lastLibCaseModule'] = 'int';
$filter->doc->create->cookie['lastDocModule'] = 'int';
$filter->doc->browse->cookie['browseType'] = 'reg::browseType';
$filter->doc->alllibs->cookie['browseType'] = 'reg::browseType';
$filter->doc->objectlibs->cookie['browseType'] = 'reg::browseType';
$filter->doc->objectlibs->cookie['preProductID'] = 'int';
$filter->doc->objectlibs->cookie['preBranch'] = 'reg::word';
$filter->doc->default->cookie['from'] = 'code';
$filter->doc->default->cookie['product'] = 'int';
$filter->doc->showfiles->cookie['docFilesViewType'] = 'code';
$filter->doc->tablecontents->cookie['preProductID'] = 'int';
$filter->doc->tablecontents->cookie['preBranch'] = 'reg::word';
$filter->doc->create->cookie['lastDocModule'] = 'int';
$filter->doc->browse->cookie['browseType'] = 'reg::browseType';
$filter->doc->alllibs->cookie['browseType'] = 'reg::browseType';
$filter->doc->objectlibs->cookie['browseType'] = 'reg::browseType';
$filter->doc->objectlibs->cookie['preProductID'] = 'int';
$filter->doc->objectlibs->cookie['preBranch'] = 'reg::word';
$filter->doc->default->cookie['from'] = 'code';
$filter->doc->default->cookie['product'] = 'int';
$filter->doc->showfiles->cookie['docFilesViewType'] = 'code';
$filter->doc->tablecontents->cookie['preProductID'] = 'int';
$filter->doc->tablecontents->cookie['preBranch'] = 'reg::word';
$filter->doc->productspace->cookie['pagerDocTablecontents'] = 'int';
$filter->doc->projectspace->cookie['pagerDocTablecontents'] = 'int';
$filter->api->default->cookie['objectType'] = 'string';
$filter->api->default->cookie['objectID'] = 'int';
+1 -4
View File
@@ -85,10 +85,7 @@ UPDATE `zt_doc` SET `type` = 'text' WHERE `type` = 'url';
UPDATE `zt_doc` SET `acl` = 'private' WHERE `acl` = 'custom';
UPDATE `zt_doc` SET `status` = 'normal' WHERE `status` = '';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'custom' and `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'product' AND `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'execution' AND `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'project' AND `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` IN ('custom', 'book', 'product', 'project, ''execution') AND `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'default' WHERE `type` = 'project' AND `acl` IN ('open', 'private');
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'api' and `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'default' WHERE `type` = 'api' and `acl` = 'open';
+6 -6
View File
@@ -168,7 +168,7 @@ $lang->product->menu->release = array('link' => "{$lang->release->common}|re
$lang->product->menu->roadmap = array('link' => "{$lang->roadmap}|product|roadmap|productID=%s");
$lang->product->menu->requirement = array('link' => "{$lang->URCommon}|product|browse|productID=%s&branch=&browseType=unclosed&param=0&storyType=requirement", 'alias' => 'batchedit', 'subModule' => 'story');
$lang->product->menu->track = array('link' => "{$lang->track}|product|track|productID=%s");
$lang->product->menu->doc = array('link' => "{$lang->doc->common}|doc|tableContents|type=product&objectID=%s", 'subModule' => 'doc');
$lang->product->menu->doc = array('link' => "{$lang->doc->common}|doc|productSpace|objectID=%s", 'subModule' => 'doc');
$lang->product->menu->dynamic = array('link' => "{$lang->dynamic}|product|dynamic|productID=%s");
$lang->product->menu->settings = array('link' => "{$lang->settings}|product|view|productID=%s", 'subModule' => 'tree,branch', 'alias' => 'edit,whitelist,addwhitelist');
@@ -207,7 +207,7 @@ $lang->scrum->menu->execution = array('link' => "$lang->executionCommon|projec
$lang->scrum->menu->storyGroup = array('link' => "{$lang->common->story}|projectstory|story|projectID=%s&product=%s",'class' => 'dropdown dropdown-hover', 'exclude' => 'tree-browse');
$lang->scrum->menu->story = array('link' => "$lang->SRCommon|projectstory|story|projectID=%s", 'subModule' => 'projectstory,tree', 'alias' => 'story,track');
$lang->scrum->menu->projectplan = array('link' => "{$lang->productplan->shortCommon}|projectplan|browse|productID=%s", 'subModule' => 'productplan');
$lang->scrum->menu->doc = array('link' => "{$lang->doc->common}|doc|tableContents|type=project&objectID=%s", 'subModule' => 'doc');
$lang->scrum->menu->doc = array('link' => "{$lang->doc->common}|doc|projectSpace|objectID=%s", 'subModule' => 'doc');
$lang->scrum->menu->qa = array('link' => "{$lang->qa->common}|project|bug|projectID=%s", 'subModule' => 'testcase,testtask,bug,testreport', 'alias' => 'bug,testtask,testcase,testreport', 'exclude' => 'execution-create,execution-batchedit');
$lang->scrum->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&branchID=&objectID=%s", 'subModule' => 'repo');
$lang->scrum->menu->build = array('link' => "{$lang->build->common}|project|build|project=%s", 'subModule' => 'projectbuild');
@@ -260,7 +260,7 @@ $lang->waterfall->menu->storyGroup = array('link' => "{$lang->common->story}|pro
$lang->waterfall->menu->story = array('link' => "$lang->SRCommon|projectstory|story|projectID=%s", 'subModule' => 'projectstory,tree', 'alias' => 'story', 'exclude' => 'projectstory-track');
$lang->waterfall->menu->design = array('link' => "{$lang->design->common}|design|browse|project=%s");
$lang->waterfall->menu->qa = array('link' => "{$lang->qa->common}|project|bug|projectID=%s", 'subModule' => 'testcase,testtask,bug,testreport', 'alias' => 'bug,testtask,testcase,testreport');
$lang->waterfall->menu->doc = array('link' => "{$lang->doc->common}|doc|tableContents|type=project&objectID=%s");
$lang->waterfall->menu->doc = array('link' => "{$lang->doc->common}|doc|projectSpace|objectID=%s");
$lang->waterfall->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&branchID=&objectID=%s", 'subModule' => 'repo');
$lang->waterfall->menu->build = array('link' => "{$lang->build->common}|project|build|project=%s", 'subModule' => 'projectbuild');
$lang->waterfall->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse|project=%s", 'subModule' => 'projectrelease');
@@ -500,10 +500,10 @@ $lang->kanban->menu = new stdclass();
$lang->doc->menu = new stdclass();
$lang->doc->menu->dashboard = array('link' => "{$lang->dashboard}|doc|index");
$lang->doc->menu->my = array('link' => "{$lang->doc->mySpace}|doc|browse|browseTyp=openedbyme", 'alias' => 'my');
$lang->doc->menu->product = array('link' => "{$lang->doc->productSpace}|doc|tableContents|type=product", 'alias' => 'showfiles,product');
$lang->doc->menu->project = array('link' => "{$lang->doc->projectSpace}|doc|tableContents|type=project", 'alias' => 'showfiles,project');
$lang->doc->menu->product = array('link' => "{$lang->doc->productSpace}|doc|productSpace|", 'alias' => 'productspace');
$lang->doc->menu->project = array('link' => "{$lang->doc->projectSpace}|doc|projectSpace|", 'alias' => 'projectspace');
$lang->doc->menu->api = array('link' => "{$lang->doc->apiSpace}|api|index", 'alias' => 'api');
$lang->doc->menu->custom = array('link' => "{$lang->doc->teamSpace}|doc|tableContents|type=custom", 'alias' => 'custom');
$lang->doc->menu->custom = array('link' => "{$lang->doc->teamSpace}|doc|tableContents|type=custom", 'alias' => 'tablecontents');
$lang->doc->dividerMenu = ',product,';
+47 -8
View File
@@ -1274,9 +1274,9 @@ class doc extends control
}
/**
* Show the catalog of the doc library.
* Show team Space.
*
* @param string $type
* @param string $type custom|product|project|execution
* @param int $objectID
* @param int $libID
* @param int $moduleID
@@ -1289,7 +1289,7 @@ class doc extends control
* @access public
* @return void
*/
public function tableContents($type, $objectID = 0, $libID = 0, $moduleID = 0, $browseType = 'all', $orderBy = 'status,id_desc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function tableContents($type = 'custom', $objectID = 0, $libID = 0, $moduleID = 0, $browseType = 'all', $orderBy = 'status,id_desc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->session->set('createProjectLocate', $this->app->getURI(true), 'doc');
@@ -1301,13 +1301,15 @@ class doc extends control
$libTree = $this->doc->getLibTree($libID, $libs, $type, $moduleID, $objectID, $browseType);
$title = ($type == 'book' or $type == 'custom') ? $this->lang->doc->tableContents : $object->name . $this->lang->colon . $this->lang->doc->tableContents;
$title = $type == 'custom' ? $this->lang->doc->tableContents : $object->name . $this->lang->colon . $this->lang->doc->tableContents;
$lib = $this->doc->getLibById($libID);
$libType = isset($lib->type) && $lib->type == 'api' ? 'api' : 'lib';
/* Build the search form. */
$queryID = $browseType == 'bySearch' ? (int)$param : 0;
$actionURL = $this->createLink('doc', 'tableContents', "type=$type&objectID=$objectID&libID=$libID&moduleID=0&browseType=bySearch&orderBy=$orderBy&param=myQueryID");
$params = "objectID=$objectID&libID=$libID&moduleID=0&browseType=bySearch&orderBy=$orderBy&param=myQueryID";
if($this->app->rawMethod == 'tablecontents') $params = "type=$type&" . $params;
$actionURL = $this->createLink('doc', $this->app->rawMethod, $params);
if($libType == 'api')
{
$this->loadModel('api')->buildSearchForm($lib, $queryID, $actionURL, $libs, $type);
@@ -1318,11 +1320,8 @@ class doc extends control
}
/* Load pager. */
$rawMethod = $this->app->rawMethod;
$this->app->rawMethod = 'tableContents';
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->app->rawMethod = $rawMethod;
if($libType == 'api')
{
@@ -1367,6 +1366,46 @@ class doc extends control
$this->display();
}
/**
* Show product space.
*
* @param int $objectID
* @param int $libID
* @param int $moduleID
* @param string $browseType all|draft|bysearch
* @param string $orderBy
* @param int $param
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function productSpace($objectID = 0, $libID = 0, $moduleID = 0, $browseType = 'all', $orderBy = 'status,id_desc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
echo $this->fetch('doc', 'tableContents', "type=product&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$browseType&orderBy=$orderBy&param=$param&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID");
}
/**
* Show project space.
*
* @param int $objectID
* @param int $libID
* @param int $moduleID
* @param string $browseType all|draft|bysearch
* @param string $orderBy
* @param int $param
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function projectSpace($objectID = 0, $libID = 0, $moduleID = 0, $browseType = 'all', $orderBy = 'status,id_desc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
echo $this->fetch('doc', 'tableContents', "type=project&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$browseType&orderBy=$orderBy&param=$param&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID");
}
/**
* Select lib type.
*
+12 -16
View File
@@ -2273,8 +2273,8 @@ class docModel extends model
{
if(!in_array($type, array('product', 'project'))) return '';
$currentModule = $this->app->getModuleName();
$currentMethod = $this->app->getMethodName();
$currentModule = $this->app->rawModule;
$currentMethod = $this->app->rawMethod;
$dropMenuLink = helper::createLink('doc', 'ajaxGetDropMenu', "objectType=$type&objectID=$objectID&module=$currentModule&method=$currentMethod");
$output = "<div class='btn-group selectBox' id='swapper'><button data-toggle='dropdown' type='button' class='btn' id='currentItem' title='{$objectTitle}'><span class='text'>{$objectTitle}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
@@ -2649,27 +2649,18 @@ class docModel extends model
{
$doclib = $this->getLibById($libID);
$type = $doclib->type == 'execution' ? 'project' : $doclib->type;
$objectID = $type == 'custom' or $type == 'book' ? 0 : $doclib->$type;
$objectID = $type == 'custom' ? 0 : $doclib->$type;
}
$objectDropdown = '';
if($type == 'custom')
{
$libs = $this->getLibsByObject('custom', 0, '', $appendLib);
$this->app->rawMethod = 'custom';
$libs = $this->getLibsByObject('custom', 0, '', $appendLib);
if($libID == 0 and !empty($libs)) $libID = reset($libs)->id;
$object = new stdclass();
$object->id = 0;
}
elseif($type == 'book')
{
$libs = $this->getLibsByObject('book', 0, '', $appendLib);
$this->app->rawMethod = 'custom';
if(!empty($libs) and ($libID == 0 or !isset($libs[$libID]))) $libID = reset($libs)->id;
$object = new stdclass();
$object->id = 0;
}
else
{
$objects = $this->getOrderedObjects($type);
@@ -2678,8 +2669,6 @@ class docModel extends model
$libs = $this->getLibsByObject($type, $objectID, '', $appendLib);
if(($libID == 0 or !isset($libs[$libID])) and !empty($libs)) $libID = reset($libs)->id;
if($this->app->tab == 'doc') $this->app->rawMethod = $type == 'execution' ? 'project' : $type;
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
$objectTitle = zget($objects, $objectID, '');
$objectDropdown = $this->select($type, $objectTitle, $objectID);
@@ -2693,7 +2682,14 @@ class docModel extends model
}
$tab = strpos(',doc,product,project,execution,', ",{$this->app->tab},") !== false ? $this->app->tab : 'doc';
if($tab != 'doc' and method_exists($type . 'Model', 'setMenu')) $this->loadModel($type)->setMenu($objectID);
if($tab != 'doc' and method_exists($type . 'Model', 'setMenu'))
{
$this->loadModel($type)->setMenu($objectID);
}
elseif($tab == 'doc' and isset($this->lang->doc->menu->{$type}['alias']))
{
$this->lang->doc->menu->{$type}['alias'] .= ',' . $this->app->rawMethod;
}
return array($libs, $libID, $object, $objectID, $objectDropdown);
}
+2 -1
View File
@@ -19,7 +19,8 @@
<?php
$normalObjectsHtml = '<ul class="tree noProgram">';
$closedObjectsHtml = '<ul class="tree noProgram">';
$link = $this->createLink($module, $method, "type=$objectType&objectID=%s");
$params = $method == 'showfiles' ||$objectType == 'custom' ? "type=$objectType&objectID=%s" : "objectID=%s";
$link = $this->createLink($module, $method, $params);
foreach($normalObjects as $normalObjectID => $normalObjectName)
{
$selected = $normalObjectID == $objectID ? 'selected' : '';
+1 -2
View File
@@ -21,13 +21,12 @@
<?php if($objectType == 'custom' and empty($libs)):?>
<?php echo html::a(helper::createLink('doc', 'createLib', "type=custom&objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $lang->doc->createLib, '', 'class="iframe hidden createCustomLib"');?>
<?php endif;?>
<?php $backLink = $this->createLink('doc', 'tableContents', "type=$linkType&objectID=$objectID&libID=$libID");?>
<div id="mainContent" class="main-content">
<form class="load-indicator main-form form-ajax" id="dataform" method='post' enctype='multipart/form-data'>
<table class='table table-form'>
<tbody>
<tr id='headerBox'>
<td width='90px'><?php echo html::a($backLink, "<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "id='backBtn' class='btn btn-secondary'");?></td>
<td width='90px'><?php echo html::backButton("<i class='icon icon-back icon-sm'></i> " . $lang->goback, "id='backBtn'", 'btn btn-secondary');?></td>
<td class="doc-title" colspan='3'><?php echo html::input('title', '', "placeholder='{$lang->doc->titlePlaceholder}' id='editorTitle' class='form-control' required");?></td>
<td class="text-right btn-tools">
<span id='savePath' class='text-gray'></span>
+8 -7
View File
@@ -39,7 +39,8 @@ body {margin-bottom: 25px;}
</p>
</div>
<?php else:?>
<?php $vars = "type=$type&objectID=$objectID&$libID=$libID&moduleID=$moduleID&browseType=$browseType&orderBy=%s&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<?php $vars = "objectID=$objectID&$libID=$libID&moduleID=$moduleID&browseType=$browseType&orderBy=%s&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<?php if($app->rawMethod == 'tablecontents') $vars = "type=$type&" . $vars;?>
<div>
<form class='main-table' method='post' id='docListForm'>
<table class="table table-files has-sort-head">
@@ -51,13 +52,13 @@ body {margin-bottom: 25px;}
<label></label>
</div>
<?php endif;?>
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB, '', 'tableContents');?>
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
</th>
<th class="c-name"><?php common::printOrderLink('title', $orderBy, $vars, $lang->doc->title, '', 'tableContents');?></th>
<th class="c-user"><?php common::printOrderLink('addedBy', $orderBy, $vars, $lang->doc->addedByAB, '', 'tableContents');?></th>
<th class="c-date"><?php common::printOrderLink('addedDate', $orderBy, $vars, $lang->doc->addedDate, '', 'tableContents');?></th>
<th class="c-user"><?php common::printOrderLink('editedBy', $orderBy, $vars, $lang->doc->editedBy, '', 'tableContents');?></th>
<th class="c-date"><?php common::printOrderLink('editedDate', $orderBy, $vars, $lang->doc->editedDate, '', 'tableContents');?></th>
<th class="c-name"><?php common::printOrderLink('title', $orderBy, $vars, $lang->doc->title);?></th>
<th class="c-user"><?php common::printOrderLink('addedBy', $orderBy, $vars, $lang->doc->addedByAB);?></th>
<th class="c-date"><?php common::printOrderLink('addedDate', $orderBy, $vars, $lang->doc->addedDate);?></th>
<th class="c-user"><?php common::printOrderLink('editedBy', $orderBy, $vars, $lang->doc->editedBy);?></th>
<th class="c-date"><?php common::printOrderLink('editedDate', $orderBy, $vars, $lang->doc->editedDate);?></th>
<th class="c-actions"><?php echo $lang->actions;?></th>
</tr>
</thead>
+18 -2
View File
@@ -366,9 +366,25 @@ $(function()
{
linkParams = linkParams.replace('%s', '&libID=' + libID + '&moduleID=' + moduleID);
if(config.currentModule == 'api') linkParams = linkParams.substring(1);
var methodName = '';
if(config.currentModule == 'api')
{
methodName = 'index';
linkParams = linkParams.substring(1);
}
else if(type == 'annex')
{
methodName = 'showFiles';
linkParams = 'type=' + objectType + '&objectID=' + objectID;
}
else
{
methodName = objectType == 'custom' ? 'tableContents' : objectType + 'Space';
linkParams = objectType == 'custom' ? 'type=custom&' + linkParams : linkParams;
}
location.href = type == 'annex' ? createLink(config.currentModule, 'showFiles', 'type=' + objectType + '&objectID=' + objectID) : createLink(config.currentModule, config.currentModule == 'api' ? 'index' : 'tableContents', linkParams);
location.href = createLink(config.currentModule, methodName, linkParams);
}
$('body').on('click', function()
-1
View File
@@ -12,7 +12,6 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('treeData', $libTree);?>
<?php js::set('linkParams', "type=$type&objectID=$objectID%s");?>
<?php js::set('docLang', $lang->doc);?>
<?php js::set('libType', 'annex');?>
<?php js::set('canViewFiles', common::hasPriv('doc', 'showfiles'));?>
+4 -3
View File
@@ -12,7 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('treeData', $libTree);?>
<?php js::set('linkParams', "type=$type&objectID=$objectID%s&browseType=&orderBy=$orderBy");?>
<?php js::set('linkParams', "objectID=$objectID%s&browseType=&orderBy=$orderBy");?>
<?php js::set('docLang', $lang->doc);?>
<?php js::set('libType', $libType);?>
<?php js::set('canViewFiles', common::hasPriv('doc', 'showfiles'));?>
@@ -21,8 +21,9 @@
<?php echo $objectDropdown;?>
<?php if(!empty($libTree)):?>
<?php foreach($lang->doc->featureBar['tableContents'] as $barType => $barName):?>
<?php $active = $barType == $browseType ? 'btn-active-text' : '';?>
<?php echo html::a($this->createLink('doc', 'tableContents', "type=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType"), $barName, '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php $active = $barType == $browseType ? 'btn-active-text' : '';?>
<?php $linkParams = $app->rawMethod == 'tablecontents' ? "type=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType": "objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType";?>
<?php echo html::a($this->createLink('doc', $app->rawMethod, $linkParams), $barName, '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php endforeach;?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->doc->searchDoc;?></a>
<?php endif;?>