* Fix doc module.
This commit is contained in:
@@ -158,6 +158,8 @@ $lang->product->menuOrder[55] = 'setting';
|
||||
$lang->product->menuOrder[60] = 'create';
|
||||
$lang->product->menuOrder[65] = 'all';
|
||||
|
||||
$lang->product->menu->doc['subMenu'] = new stdclass();
|
||||
|
||||
$lang->product->menu->settings['subMenu'] = new stdclass();
|
||||
$lang->product->menu->settings['subMenu']->view = array('link' => "{$lang->overview}|product|view|productID=%s", 'alias' => 'edit');
|
||||
$lang->product->menu->settings['subMenu']->module = array('link' => "{$lang->module}|tree|browse|product=%s&view=story", 'subModule' => 'tree');
|
||||
@@ -197,6 +199,8 @@ $lang->scrum->menuOrder[40] = 'release';
|
||||
$lang->scrum->menuOrder[48] = 'dynamic';
|
||||
$lang->scrum->menuOrder[50] = 'settings';
|
||||
|
||||
$lang->scrum->menu->doc['subMenu'] = new stdclass();
|
||||
|
||||
$lang->scrum->menu->qa['subMenu'] = new stdclass();
|
||||
//$lang->scrum->menu->qa['subMenu']->index = array('link' => "$lang->dashboard|project|qa|projectID=%s");
|
||||
$lang->scrum->menu->qa['subMenu']->bug = array('link' => "{$lang->bug->common}|project|bug|projectID=%s", 'subModule' => 'bug');
|
||||
@@ -245,6 +249,8 @@ $lang->execution->menuOrder[55] = 'release';
|
||||
$lang->execution->menuOrder[60] = 'action';
|
||||
$lang->execution->menuOrder[65] = 'setting';
|
||||
|
||||
$lang->execution->menu->doc['subMenu'] = new stdclass();
|
||||
|
||||
$lang->execution->menu->view['subMenu'] = new stdclass();
|
||||
$lang->execution->menu->view['subMenu']->groupTask = "$lang->groupView|execution|grouptask|executionID=%s";
|
||||
$lang->execution->menu->view['subMenu']->tree = "$lang->treeView|execution|tree|executionID=%s";
|
||||
@@ -320,8 +326,8 @@ $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->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product");
|
||||
$lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project");
|
||||
$lang->doc->menu->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product", 'alias' => 'product');
|
||||
$lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project", 'alias' => 'project');
|
||||
$lang->doc->menu->custom = array('link' => "{$lang->doc->custom}|doc|objectLibs|libID=0");
|
||||
|
||||
$lang->doc->dividerMenu = ',product,';
|
||||
@@ -335,6 +341,9 @@ $lang->doc->menuOrder[25] = 'product';
|
||||
$lang->doc->menuOrder[30] = 'project';
|
||||
$lang->doc->menuOrder[35] = 'custom';
|
||||
|
||||
$lang->doc->menu->product['subMenu'] = new stdclass();
|
||||
$lang->doc->menu->project['subMenu'] = new stdclass();
|
||||
|
||||
/* Report menu.*/
|
||||
$lang->report->menu = new stdclass();
|
||||
$lang->report->menu->annual = array('link' => "{$lang->report->annual}|report|annualData|year=&dept=&userID=" . (isset($_SESSION['user']) ? zget($_SESSION['user'], 'id', 0) : 0), 'target' => '_blank');
|
||||
|
||||
+27
-6
@@ -47,10 +47,6 @@ class doc extends control
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager(0, 5, 1);
|
||||
|
||||
$this->lang->TRActions = $this->doc->setFastMenu($this->lang->doc->fast);
|
||||
$this->lang->TRActions .= common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), "<i class='icon icon-plus'></i> " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
|
||||
$this->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc() : '';
|
||||
|
||||
$actionURL = $this->createLink('doc', 'browse', "lib=0&browseType=bySearch&queryID=myQueryID");
|
||||
$this->doc->buildSearchForm(0, array(), 0, $actionURL, 'index');
|
||||
|
||||
@@ -859,12 +855,37 @@ class doc extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function objectLibs($type, $objectID = 0)
|
||||
public function objectLibs($type, $objectID = 0, $libID = 0)
|
||||
{
|
||||
// setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', false, true);
|
||||
$this->session->set('docList', $this->app->getURI(true), 'doc');
|
||||
|
||||
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
|
||||
if($type == 'product')
|
||||
{
|
||||
$objects = $this->loadModel('product')->getPairs('nocode');
|
||||
$objectID = $this->product->saveState($objectID, $objects);
|
||||
$table = TABLE_PRODUCT;
|
||||
|
||||
$libs = $this->doc->getLibsByObject('product', $objectID);
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID == 0 ? key($libs) : $libID);
|
||||
|
||||
$this->app->rawMethod = 'product';
|
||||
}
|
||||
else
|
||||
{
|
||||
$objects = $this->loadModel('project')->getPairsByProgram();
|
||||
$objectID = $this->project->saveState($objectID, $objects);
|
||||
$table = TABLE_PROJECT;
|
||||
|
||||
$libs = $this->doc->getLibsByObject('project', $objectID);
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID == 0 ? key($libs) : $libID);
|
||||
|
||||
$this->app->rawMethod = 'project';
|
||||
}
|
||||
|
||||
$this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), "<i class='icon icon-plus'></i> " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
|
||||
$this->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc() : '';
|
||||
|
||||
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
if(empty($object)) $this->locate($this->createLink($type, 'create', '', '', '', $this->session->project));
|
||||
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
#dropMenu {min-width: 250px; box-sizing: inhert;}
|
||||
.main-col .block-files .panel-heading {padding-right: 20px;}
|
||||
.main-col .block-files .panel-heading .panel-title {height: 35px; line-height: 30px;}
|
||||
#dropMenu .table-col .list-group {padding-top: 10px;}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
$lang->doc->common = 'Document';
|
||||
$lang->doc->id = 'ID';
|
||||
$lang->doc->product = $lang->productCommon;
|
||||
$lang->doc->project = 'Project';
|
||||
$lang->doc->execution = $lang->executionCommon;
|
||||
$lang->doc->lib = 'Library';
|
||||
$lang->doc->module = 'Category';
|
||||
@@ -82,6 +83,8 @@ $lang->doc->collect = 'Add Favorite';
|
||||
$lang->doc->cancelCollection = 'Remove Favorite';
|
||||
$lang->doc->deleteFile = 'Delete File';
|
||||
|
||||
$lang->doc->collectAction = 'Add Favorite';
|
||||
|
||||
$lang->doc->libName = 'Document Library';
|
||||
$lang->doc->libType = 'Category';
|
||||
$lang->doc->custom = 'Custom Document Library';
|
||||
@@ -212,6 +215,7 @@ $lang->doclib->create['execution'] = 'Create ' . $lang->executionCommon . ' Libr
|
||||
$lang->doclib->create['custom'] = 'Create Custom Library';
|
||||
|
||||
$lang->doclib->main['product'] = 'Primary Library';
|
||||
$lang->doclib->main['project'] = 'Primary Library';
|
||||
$lang->doclib->main['execution'] = 'Primary Library';
|
||||
|
||||
$lang->doclib->tabList['product'] = $lang->productCommon;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
$lang->doc->common = '文档';
|
||||
$lang->doc->id = '文档编号';
|
||||
$lang->doc->product = '所属' . $lang->productCommon;
|
||||
$lang->doc->project = '所属项目';
|
||||
$lang->doc->execution = '所属' . $lang->executionCommon;
|
||||
$lang->doc->lib = '所属文档库';
|
||||
$lang->doc->module = '所属分类';
|
||||
@@ -214,6 +215,7 @@ $lang->doclib->create['execution'] = '创建' . $lang->executionCommon . '文档
|
||||
$lang->doclib->create['custom'] = '创建自定义文档库';
|
||||
|
||||
$lang->doclib->main['product'] = $lang->productCommon . '主库';
|
||||
$lang->doclib->main['project'] = '项目主库';
|
||||
$lang->doclib->main['execution'] = $lang->executionCommon . '主库';
|
||||
|
||||
$lang->doclib->tabList['product'] = $lang->productCommon;
|
||||
|
||||
+46
-1
@@ -1117,6 +1117,7 @@ class docModel extends model
|
||||
public function getLibsByObject($type, $objectID, $mode = '')
|
||||
{
|
||||
if($type != 'product' and $type != 'project' and $type != 'execution') return false;
|
||||
|
||||
$objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere($type)->eq($objectID)->orderBy('`order`, id')->fetchAll('id');
|
||||
|
||||
if($type == 'product')
|
||||
@@ -1139,12 +1140,14 @@ class docModel extends model
|
||||
$itemCounts = $this->statLibCounts(array_keys($libs));
|
||||
foreach($libs as $libID => $lib) $libs[$libID]->allCount = $itemCounts[$libID];
|
||||
|
||||
/*
|
||||
if(common::hasPriv('doc', 'showFiles'))
|
||||
{
|
||||
$libs['files'] = new stdclass();
|
||||
$libs['files']->name = $this->lang->doclib->files;
|
||||
$libs['files']->allCount = count($this->getLibFiles($type, $objectID, 'id_desc'));
|
||||
}
|
||||
*/
|
||||
|
||||
return $libs;
|
||||
}
|
||||
@@ -1203,6 +1206,7 @@ class docModel extends model
|
||||
public function getLibFiles($type, $objectID, $orderBy, $pager = null)
|
||||
{
|
||||
if($type != 'execution' and $type != 'project' and $type != 'product') return true;
|
||||
|
||||
$this->loadModel('file');
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)->where($type)->eq($objectID)->fetchAll('id');
|
||||
foreach($docs as $id => $doc)
|
||||
@@ -1289,7 +1293,8 @@ class docModel extends model
|
||||
$executionIdList = join(',', $executionIdList);
|
||||
$files = $this->dao->select('*')->from(TABLE_FILE)->alias('t1')
|
||||
->where('size')->gt('0')
|
||||
->andWhere("(objectType = 'execution' and objectID in ($executionIdList))", true)
|
||||
->andWhere("(objectType = 'project' and objectID = $objectID)", true)
|
||||
->orWhere("(objectType = 'execution' and objectID in ($executionIdList))")
|
||||
->orWhere("(objectType = 'doc' and objectID in ($docIdList))")
|
||||
->orWhere("(objectType = 'task' and objectID in ($taskIdList))")
|
||||
->orWhere("(objectType = 'build' and objectID in ($buildIdList))")
|
||||
@@ -1767,4 +1772,44 @@ EOF;
|
||||
}
|
||||
return $navCSS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the select code of doc.
|
||||
*
|
||||
* @param string $type
|
||||
* @param array $objects
|
||||
* @param int $objectID
|
||||
* @param array $libs
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function select($type, $objects, $objectID, $libs, $libID = 0)
|
||||
{
|
||||
if(empty($objects)) return '';
|
||||
|
||||
$output = '';
|
||||
$dropMenuLink = helper::createLink('repo', 'ajaxGetDropMenu');
|
||||
|
||||
$output = "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$objects[$objectID]}'><span class='text'>{$objects[$objectID]}</span> <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "<div class='table-col'><div class='list-group'>";
|
||||
foreach($objects as $key => $object)
|
||||
{
|
||||
$output .= html::a(inlink('objectLibs', "type=$type&objectID=$key"), $object);
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
|
||||
$dropMenuLink = helper::createLink('repo', 'ajaxGetBranchDropMenu');
|
||||
$output .= "<div class='btn-group angle-btn'><div class='btn-group'><button id='currentBranch' data-toggle='dropdown' type='button' class='btn btn-limit'>{$libs[$libID]->name} <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "<div class='table-col'><div class='list-group'>";
|
||||
foreach($libs as $key => $lib)
|
||||
{
|
||||
$output .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$key"), $lib->name);
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php $pageCSS .= $this->doc->appendNavCSS();?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php if($app->openApp == 'execution'):;?>
|
||||
<style>.panel-body{min-height: 180px}</style>
|
||||
|
||||
@@ -842,6 +842,16 @@ class projectModel extends model
|
||||
$this->dao->replace(TABLE_USERGROUP)->data($groupPriv)->exec();
|
||||
}
|
||||
|
||||
/* Create doc lib. */
|
||||
$this->app->loadLang('doc');
|
||||
$lib = new stdclass();
|
||||
$lib->project = $projectID;
|
||||
$lib->name = $this->lang->doclib->main['project'];
|
||||
$lib->type = 'project';
|
||||
$lib->main = '1';
|
||||
$lib->acl = 'default';
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ function switchRepo(repoID, module, method)
|
||||
if(typeof(eventKeyCode) == 'undefined') eventKeyCode = 0;
|
||||
if(eventKeyCode > 0 && eventKeyCode != 13) return false;
|
||||
|
||||
/* The projec id is a string, use it as the project model. */
|
||||
/* The project id is a string, use it as the project model. */
|
||||
if(isNaN(repoID))
|
||||
{
|
||||
$.cookie('projectMode', repoID, {expires:config.cookieLife, path:config.webRoot});
|
||||
|
||||
Reference in New Issue
Block a user