* Adjust code.

This commit is contained in:
leiyong
2021-01-29 15:17:15 +08:00
parent ec275c61f5
commit 60cce4dbc8
12 changed files with 90 additions and 28 deletions
+5
View File
@@ -178,6 +178,7 @@ class commonModel extends model
if($module == 'block' and $method == 'main' and isset($_GET['hash'])) return true;
if($module == 'file' and $method == 'read') return true;
if($module == 'index' and $method == 'changelog') return true;
if($module == 'my' and $method == 'preference') return true;
if($this->loadModel('user')->isLogon() or ($this->app->company->guest and $this->app->user->account == 'guest'))
{
@@ -392,6 +393,10 @@ class commonModel extends model
{
$link = helper::createLink($menuItem->link['module'], $menuItem->link['method'], $vars, '', '', $app->session->PRJ);
}
elseif($group == 'product' && $menuItem->name == 'doc')
{
$link = helper::createLink($menuItem->link['module'], $menuItem->link['method'], $vars, '', '', 0, true);
}
else
{
$link = helper::createLink($menuItem->link['module'], $menuItem->link['method'], $vars);
+17 -17
View File
@@ -62,8 +62,8 @@ class doc extends control
$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->statisticInfo = $this->doc->getStatisticInfo();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->doingProjects = $this->loadModel('project')->getExecutionsByProject($this->projectID, 'undone', 5);
$this->view->users = $this->user->getPairs('noletter');
$this->view->doingProjects = $this->project->getExecutionsByProject($this->projectID, 'undone', 5);
$this->display();
}
@@ -115,7 +115,7 @@ class doc extends control
$this->lang->navGroup->doc = 'product';
$this->lang->doc->menuOrder = $this->lang->product->menuOrder;
$this->product->setMenu($this->product->getPairs(), $productID);
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID);
$this->lang->product->switcherMenu = $this->product->getSwitcher($productID);
$this->lang->product->mainMenuAction = $this->product->getProductMainAction();
$this->lang->noMenuModule[] = 'doc';
$this->lang->set('menugroup.doc', 'product');
@@ -151,7 +151,7 @@ class doc extends control
$this->doc->buildSearchForm($libID, $this->libs, $queryID, $actionURL, $type);
$title = '';
$module = $moduleID ? $this->loadModel('tree')->getByID($moduleID) : '';
$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];
@@ -192,12 +192,12 @@ class doc extends control
$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->users = $this->loadModel('user')->getPairs('noletter');
$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->from = $this->lang->navGroup->doc == 'project' ? 'project' : $from;
$this->view->pager = $pager;
$this->view->libs = $libs;
$this->view->currentLib = $libID ? $lib : '';
@@ -220,7 +220,7 @@ class doc extends control
$libID = $this->doc->createLib();
if(!dao::isError())
{
$this->loadModel('action')->create('docLib', $libID, 'Created');
$this->action->create('docLib', $libID, 'Created');
die(js::locate($this->createLink($this->moduleName, 'browse', "libID=$libID"), 'parent.parent'));
}
else
@@ -262,7 +262,7 @@ class doc extends control
if(dao::isError()) die(js::error(dao::getError()));
if($changes)
{
$actionID = $this->loadModel('action')->create('docLib', $libID, 'edited');
$actionID = $this->action->create('docLib', $libID, 'edited');
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink($this->moduleName, 'browse', "libID=$libID"), 'parent.parent'));
@@ -349,7 +349,7 @@ class doc extends control
$this->lang->doc->menu = $this->lang->product->menu;
$this->lang->doc->menuOrder = $this->lang->product->menuOrder;
$this->product->setMenu($this->product->getPairs(), $lib->product);
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($lib->product);
$this->lang->product->switcherMenu = $this->product->getSwitcher($lib->product);
$this->lang->product->mainMenuAction = $this->product->getProductMainAction();
$this->lang->noMenuModule[] = 'doc';
$this->lang->set('menugroup.doc', 'product');
@@ -436,7 +436,7 @@ class doc extends control
$this->lang->navGroup->doc = 'product';
$this->lang->doc->menuOrder = $this->lang->product->menuOrder;
$this->product->setMenu($this->product->getPairs(), $objectID);
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($objectID);
$this->lang->product->switcherMenu = $this->product->getSwitcher($objectID);
$this->lang->product->mainMenuAction = $this->product->getProductMainAction();
$this->lang->noMenuModule[] = 'doc';
$this->lang->set('menugroup.doc', 'product');
@@ -501,7 +501,7 @@ class doc extends control
$this->lang->navGroup->doc = 'product';
$this->lang->doc->menuOrder = $this->lang->product->menuOrder;
$this->product->setMenu($this->product->getPairs(), $objectID);
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($objectID);
$this->lang->product->switcherMenu = $this->product->getSwitcher($objectID);
$this->lang->product->mainMenuAction = $this->product->getProductMainAction();
$this->lang->noMenuModule[] = 'doc';
$this->lang->set('menugroup.doc', 'product');
@@ -529,7 +529,7 @@ class doc extends control
$this->view->lib = $lib;
$this->view->type = $type;
$this->view->version = $version ? $version : $doc->version;
$this->view->actions = $this->loadModel('action')->getList('doc', $docID);
$this->view->actions = $this->action->getList('doc', $docID);
$this->view->users = $this->user->getPairs('noclosed,noletter');
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('doc', $docID);
$this->view->keTableCSS = $this->doc->extractKETableCSS($doc->content);
@@ -603,7 +603,7 @@ class doc extends control
$this->dao->update(TABLE_DOC)->set('version')->eq($docContent->version)->where('id')->eq($docID)->exec();
$file = $this->file->getById($fileID);
$this->loadModel('action')->create($file->objectType, $file->objectID, 'deletedFile', '', $extra=$file->title);
$this->action->create($file->objectType, $file->objectID, 'deletedFile', '', $extra=$file->title);
die(js::locate($this->createLink('doc', 'view', "docID=$docID"), 'parent'));
}
}
@@ -744,7 +744,7 @@ class doc extends control
*/
public function ajaxGetChild($libID, $type = 'module')
{
$childModules = $this->loadModel('tree')->getOptionMenu($libID, 'doc');
$childModules = $this->tree->getOptionMenu($libID, 'doc');
$select = ($type == 'module') ? html::select('module', $childModules, '', "class='form-control chosen'") : html::select('parent', $childModules, '', "class='form-control chosen'");
die($select);
}
@@ -782,7 +782,7 @@ class doc extends control
if($type == 'product' or $type == 'project')
{
$subLibs = $this->doc->getSubLibGroups($type, array_keys($libs));
if($this->cookie->browseType == 'bylist') $this->view->users = $this->loadModel('user')->getPairs('noletter');
if($this->cookie->browseType == 'bylist') $this->view->users = $this->user->getPairs('noletter');
}
else
{
@@ -830,7 +830,7 @@ class doc extends control
$this->lang->navGroup->doc = 'product';
$this->lang->doc->menuOrder = $this->lang->product->menuOrder;
$this->product->setMenu($this->product->getPairs(), $objectID);
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($objectID);
$this->lang->product->switcherMenu = $this->product->getSwitcher($objectID);
$this->lang->product->mainMenuAction = $this->product->getProductMainAction();
$this->lang->noMenuModule[] = 'doc';
$this->lang->set('menugroup.doc', 'product');
@@ -877,7 +877,7 @@ class doc extends control
$this->view->type = $type;
$this->view->object = $object;
$this->view->files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->users = $this->user->getPairs('noletter');
$this->view->pager = $pager;
$this->view->viewType = $viewType;
$this->view->orderBy = $orderBy;
+1 -1
View File
@@ -56,7 +56,7 @@
<?php endif;?>
<?php common::printLink('doc', 'editLib', "libID=$lib->id", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
<?php common::printLink('doc', 'deleteLib', "libID=$lib->id", "<i class='icon icon-close'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link iframe'", '', true)?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link'")?>
</div>
<?php endif;?>
</div>
+1 -1
View File
@@ -49,7 +49,7 @@
<?php endif;?>
<?php common::printLink('doc', 'editLib', "libID=$lib->id", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
<?php common::printLink('doc', 'deleteLib', "libID=$lib->id", "<i class='icon icon-close'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link iframe'", '', true)?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link'")?>
</td>
<?php endif;?>
</tr>
+2 -2
View File
@@ -45,7 +45,7 @@
<div class="dropdown">
<button class="btn" type="button" data-toggle="dropdown"><i class='icon-cog'></i> <span class="caret"></span></button>
<ul class='dropdown-menu'>
<li><?php common::printLink('tree', 'browse', "libID=$libID&viewType=doc", "<i class='icon icon-cog'></i>" . $lang->doc->manageType, '', "class='iframe'", '', true);?></li>
<li><?php common::printLink('tree', 'browse', "libID=$libID&viewType=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>" . $lang->doc->manageType);?></li>
<li><?php common::printLink('doc', 'editLib', "libID=$libID", "<i class='icon icon-edit'></i>" . $lang->doc->editLib, '', "class='iframe'");?></li>
<li><?php common::printLink('doc', 'deleteLib', "libID=$libID", "<i class='icon icon-trash'></i>" . $lang->doc->deleteLib, 'hiddenwin');?></li>
</ul>
@@ -114,7 +114,7 @@
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$lib->id&objectType=doclib");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<?php endif;?>
<?php common::printLink('doc', 'editLib', "libID=$lib->id", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->tree->manage}' class='btn btn-link iframe'", '', true)?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&type=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->tree->manage}' class='btn btn-link'")?>
</td>
</tr>
<?php endforeach;?>
+1 -1
View File
@@ -20,7 +20,7 @@
<div class="dropdown">
<button class="btn" type="button" data-toggle="dropdown"><i class='icon-cog'></i> <span class="caret"></span></button>
<ul class='dropdown-menu'>
<li><?php common::printLink('tree', 'browse', "libID=$libID&viewType=doc", "<i class='icon icon-cog'></i>" . $lang->doc->manageType, '', "class='iframe'", '', true);?></li>
<li><?php common::printLink('tree', 'browse', "libID=$libID&viewType=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>" . $lang->doc->manageType);?></li>
<li><?php common::printLink('doc', 'editLib', "libID=$libID", "<i class='icon icon-edit'></i>" . $lang->doc->editLib, '', "class='iframe'");?></li>
<li><?php common::printLink('doc', 'deleteLib', "libID=$libID", "<i class='icon icon-trash'></i>" . $lang->doc->deleteLib, 'hiddenwin');?></li>
</ul>
+1 -1
View File
@@ -64,7 +64,7 @@
<?php endif;?>
<?php common::printLink('doc', 'editLib', "libID=$libID", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
<?php if(empty($lib->main)) common::printLink('doc', 'deleteLib', "libID=$libID", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php common::printLink('tree', 'browse', "rootID=$libID&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link iframe'", '', true)?>
<?php common::printLink('tree', 'browse', "rootID=$libID&type=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link'")?>
<?php endif;?>
</div>
<?php endif;?>
+1 -1
View File
@@ -40,7 +40,7 @@
<?php endif;?>
<?php common::printLink('doc', 'editLib', "libID=$libID", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
<?php if(empty($lib->main)) common::printLink('doc', 'deleteLib', "libID=$libID", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php common::printLink('tree', 'browse', "rootID=$libID&type=doc", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link iframe'", '', true)?>
<?php common::printLink('tree', 'browse', "rootID=$libID&type=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link'")?>
<?php endif;?>
</td>
</tr>
+10 -2
View File
@@ -69,7 +69,7 @@
{
if(link.prj) return 'project';
if(methodLowerCase === 'objectlibs' && (link.params.type || link.params.$3) == 'product') return 'product';
if(methodLowerCase === 'objectlibs' && (link.params.from || link.params.$3) == 'product') return 'product';
if(methodLowerCase === 'showfiles' && (link.params.from || link.params.$3) == 'product') return 'product';
if(methodLowerCase === 'browse' && (link.params.from || link.params.$5) == 'product') return 'product';
if(methodLowerCase === 'view' && (link.params.from || link.params.$3) == 'product') return 'product';
@@ -111,7 +111,15 @@
if(methodLowerCase === 'browse')
{
var viewType = link.params.viewType || link.params.$2;
if(['bug', 'case', 'caselib', 'doc'].includes(viewType)) return 'project';
if(['bug', 'case', 'caselib'].includes(viewType)) return 'project';
if(viewType === 'doc' && link.params.from === 'product') return 'product';
if(viewType === 'doc' && link.params.from === 'project') return 'project';
if(viewType === 'doc' && link.params.from === 'doc') return 'doc';
}
else if(methodLowerCase === 'browsetask')
{
return 'project';
}
else if(methodLowerCase === 'browsetask')
{
+40 -2
View File
@@ -22,7 +22,7 @@ class tree extends control
* @access public
* @return void
*/
public function browse($rootID, $viewType, $currentModuleID = 0, $branch = 0)
public function browse($rootID, $viewType, $currentModuleID = 0, $branch = 0, $from = '')
{
$this->loadModel('product');
@@ -139,7 +139,45 @@ class tree extends control
}
elseif(strpos($viewType, 'doc') !== false)
{
$this->lang->navGroup->tree = 'project';
$this->lang->navGroup->tree = 'doc';
if($from == 'product')
{
$productID = $lib->product;
$this->lang->noMenuModule[] = 'tree';
unset($this->lang->product->viewMenu->set['subModule']);
$this->lang->navGroup->tree = 'product';
$this->lang->product->menu = $this->lang->product->viewMenu;
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, 'story');
$this->lang->product->mainMenuAction = $this->product->getProductMainAction();
$products = $this->product->getPairs();
$this->product->saveState($productID, $products);
$this->product->setMenu($products, $productID, $branch);
}
elseif($from == 'project')
{
$projectID = $lib->project;
$this->lang->navGroup->tree = 'project';
$project = $this->loadModel('project')->getById($projectID);
/* Get all associated products. */
$products = $this->project->getProducts($projectID);
$this->view->products = $products;
$projects = $this->project->getExecutionPairs($this->session->PRJ);
/* Set menu. */
$this->project->setMenu($projects, $projectID);
$this->lang->tree->menu = $this->lang->project->menu;
$this->lang->tree->menuOrder = $this->lang->project->menuOrder;
unset($projects[$projectID]);
$currentProject = key($projects);
$parentModules = $this->tree->getParents($currentModuleID);
}
if($from == 'doc') $this->lang->navGroup->doc = 'doc';
$type = $lib->product ? 'product' : ($lib->project ? 'project' : 'custom');
$this->doc->setMenu($type, $rootID, $currentModuleID);
$this->lang->tree->menu = $this->lang->doc->menu;
+10
View File
@@ -11,6 +11,16 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php if($lang->navGroup->doc == 'doc'):?>
<style>
#subHeader {margin-top: -50px; background-color: rgba(0,0,0,0);}
#pageActions .btn-link { color: #84a2e2; font-size: 14px; line-height: 18px; border: #84a2e2 1px solid;}
.header-angle-btn {padding: 0;}
.header-angle-btn .btn{padding: 6px 12px;}
.header-angle-btn+.header-angle-btn::after, .header-angle-btn+.header-angle-btn::before {top: -50px;}
</style>
<?php endif;?>
<?php if($viewType != 'story'):?>
<style>
li.tree-item-story > .tree-actions .tree-action[data-type=sort]{display:none;}
+1
View File
@@ -1000,6 +1000,7 @@ class user extends control
if(!isset($acls['views'][$menu])) $denyType = 'noview';
$this->view->menu = $menu;
}
$this->view->denyType = $denyType;
die($this->display());