* Code for finish task #87420.

This commit is contained in:
田淑杰
2023-03-20 11:23:57 +08:00
parent cd169f412f
commit e223267649
8 changed files with 80 additions and 256 deletions
-13
View File
@@ -187,8 +187,6 @@ $lang->product->menuOrder[55] = 'settings';
$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');
@@ -237,8 +235,6 @@ $lang->scrum->menuOrder[40] = 'release';
$lang->scrum->menuOrder[45] = 'dynamic';
$lang->scrum->menuOrder[55] = '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');
@@ -289,8 +285,6 @@ $lang->waterfall->menuOrder[65] = 'build';
$lang->waterfall->menuOrder[70] = 'release';
$lang->waterfall->menuOrder[80] = 'dynamic';
$lang->waterfall->menu->doc['subMenu'] = new stdclass();
$lang->waterfall->menu->programplan['subMenu'] = new stdclass();
$lang->waterfall->menu->programplan['subMenu']->lists = array('link' => "{$lang->stage->list}|programplan|browse|projectID=%s&productID=0&type=lists", 'alias' => 'create');
@@ -372,8 +366,6 @@ $lang->execution->menuOrder[60] = 'release';
$lang->execution->menuOrder[65] = 'action';
$lang->execution->menuOrder[70] = 'settings';
$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";
@@ -523,11 +515,6 @@ $lang->doc->menuOrder[20] = 'project';
$lang->doc->menuOrder[25] = 'api';
$lang->doc->menuOrder[30] = 'custom';
$lang->doc->menu->product['subMenu'] = new stdclass();
$lang->doc->menu->project['subMenu'] = new stdclass();
$lang->doc->menu->execution['subMenu'] = new stdclass();
$lang->doc->menu->custom['subMenu'] = new stdclass();
$lang->doc->menu->api['subMenu'] = new stdclass();
$lang->doc->menu->api['subMenu']->index = array('link' => "{$lang->doc->apiDoc}|api|index|libID=%s", 'alias' => 'create,edit');
$lang->doc->menu->api['subMenu']->struct = array('link' => "{$lang->doc->apiStruct}|api|struct|libID=%s", 'alias' => 'createstruct,editstruct');
+1
View File
@@ -1305,6 +1305,7 @@ class doc extends control
$this->view->param = $queryID;
$this->view->users = $this->user->getPairs('noletter');
$this->view->libTree = $libTree;
$this->view->moduleID = $moduleID;
if($browseType == 'bySearch')
{
/* Load pager. */
+7
View File
@@ -190,6 +190,13 @@ $lang->doc->typeList['word'] = 'Word';
$lang->doc->typeList['ppt'] = 'PPT';
$lang->doc->typeList['excel'] = 'Excel';
$lang->doc->createList['html'] = 'Create Document';
$lang->doc->createList['api'] = 'Create API';
$lang->doc->createList['template'] = 'Create By Template';
$lang->doc->createList['word'] = 'Word';
$lang->doc->createList['ppt'] = 'PPT';
$lang->doc->createList['excel'] = 'Excel';
$lang->doc->types['text'] = 'Text';
$lang->doc->types['url'] = 'URL';
+7
View File
@@ -190,6 +190,13 @@ $lang->doc->typeList['word'] = 'Word';
$lang->doc->typeList['ppt'] = 'PPT';
$lang->doc->typeList['excel'] = 'Excel';
$lang->doc->createList['html'] = 'Create Document';
$lang->doc->createList['api'] = 'Create API';
$lang->doc->createList['template'] = 'Create By Template';
$lang->doc->createList['word'] = 'Word';
$lang->doc->createList['ppt'] = 'PPT';
$lang->doc->createList['excel'] = 'Excel';
$lang->doc->types['text'] = 'Text';
$lang->doc->types['url'] = 'URL';
+7
View File
@@ -190,6 +190,13 @@ $lang->doc->typeList['word'] = 'Word';
$lang->doc->typeList['ppt'] = 'PPT';
$lang->doc->typeList['excel'] = 'Excel';
$lang->doc->createList['html'] = 'Create Document';
$lang->doc->createList['api'] = 'Create API';
$lang->doc->createList['template'] = 'Create By Template';
$lang->doc->createList['word'] = 'Word';
$lang->doc->createList['ppt'] = 'PPT';
$lang->doc->createList['excel'] = 'Excel';
$lang->doc->types['text'] = 'Text';
$lang->doc->types['url'] = 'URL';
+7
View File
@@ -190,6 +190,13 @@ $lang->doc->typeList['word'] = 'Word';
$lang->doc->typeList['ppt'] = 'PPT';
$lang->doc->typeList['excel'] = 'Excel';
$lang->doc->createList['html'] = '创建文档';
$lang->doc->createList['api'] = '创建接口';
$lang->doc->createList['template'] = '由模板创建';
$lang->doc->createList['word'] = 'Word';
$lang->doc->createList['ppt'] = 'PPT';
$lang->doc->createList['excel'] = 'Excel';
$lang->doc->types['text'] = '文档';
$lang->doc->types['url'] = '链接';
+1 -126
View File
@@ -2131,123 +2131,6 @@ class docModel extends model
return $title;
}
/**
* Build document module index page create document button.
*
* @param string $objectType
* @param int $objectID
* @param int $libID
* @access public
* @return string
*/
public function buildCreateButton4Doc($objectType, $objectID, $libID)
{
if(!common::hasPriv('doc', 'create') and !common::hasPriv('doc', 'createLib')) return '';
if($objectType == 'book')
{
$html = html::a(helper::createLink('doc', 'createLib', "type=$objectType&objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $this->lang->doc->createBook, '', 'class="btn btn-secondary iframe"');
}
elseif($libID)
{
$html = "<div class='dropdown' id='createDropdown'>";
$html .= "<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> " . $this->lang->doc->createAB . " <span class='caret'></span></button>";
$html .= "<ul class='dropdown-menu pull-right'>";
if(common::hasPriv('doc', 'create'))
{
foreach($this->lang->doc->typeList as $typeKey => $typeName)
{
$class = (strpos($this->config->doc->officeTypes, $typeKey) !== false or strpos($this->config->doc->textTypes, $typeKey) !== false) ? 'iframe' : '';
$icon = zget($this->config->doc->iconList, $typeKey);
$method = strpos($this->config->doc->textTypes, $typeKey) !== false ? 'createBasicInfo' : 'create';
$html .= "<li>";
$html .= html::a(helper::createLink('doc', $method, "objectType=$objectType&objectID=$objectID&libID=$libID&moduleID=0&type=$typeKey", '', $class ? true : false), "<i class='icon-$icon icon'></i> " . $typeName, '', "class='$class' data-app='{$this->app->tab}'");
$html .= "</li>";
if($typeKey == 'url') $html .= '<li class="divider"></li>';
}
}
if(common::hasPriv('doc', 'createLib'))
{
if(common::hasPriv('doc', 'create')) $html .= '<li class="divider"></li>';
$html .= '<li>' . html::a(helper::createLink('doc', 'createLib', "type=$objectType&objectID=$objectID"), "<i class='icon-doc-lib icon'></i> " . $this->lang->doc->createLib, '', "class='iframe' data-width='70%'") . '</li>';
}
$html .= "</ul></div>";
}
else
{
$html = html::a(helper::createLink('doc', 'createLib', "type=$objectType&objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $this->lang->doc->createLib, '', 'class="btn btn-secondary iframe"');
}
return $html;
}
/**
* Build collect button from document.
*
* @access public
* @return string
*/
public function buildCollectButton4Doc()
{
$favoritesLimit = 10;
$allLibs = array_keys($this->getLibs('all'));
$docs = $this->dao->select('t1.id,t1.title,t1.lib,t2.type,t2.product,t2.project,t2.execution')->from(TABLE_DOC)->alias('t1')
->leftJoin(TABLE_DOCLIB)->alias('t2')->on('t1.lib=t2.id')
->where('t1.deleted')->eq(0)
->andWhere('t1.lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('t1.type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('t1.collector')->like("%,{$this->app->user->account},%")
->orderBy('t1.id_desc')
->limit($favoritesLimit)
->fetchAll();
$html = '';
$rawMethod = $this->app->rawMethod;
if($this->app->rawMethod == 'showfiles')
{
$html = '<div class="btn-group">';
$html .= '<form class="input-control has-icon-right table-col" method="post">';
$html .= html::input('title', $this->post->title, "class='form-control' placeholder='{$this->lang->doc->fileTitle}'");
$html .= html::submitButton("<i class='icon icon-search'></i>", '', "btn btn-icon btn-link input-control-icon-right");
$html .= '</form></div>';
}
elseif(in_array($rawMethod, array('tablecontents', 'objectlibs', 'product', 'project', 'execution', 'book', 'custom')))
{
$html = '<a class="btn btn-link querybox-toggle" id="bysearchTab"><i class="icon icon-search muted"></i> ' . $this->lang->doc->search . '</a>';
}
$html .= "<div class='btn-group dropdown-hover'>";
$html .= "<a href='javascript:;' class='btn btn-link' data-toggle='dropdown'>{$this->lang->doc->myCollection}</a>";
$html .= "<ul class='dropdown-menu pull-right' id='collection-menu'>";
if(empty($docs)) $html .= "<li>{$this->lang->noData}</li>";
foreach($docs as $doc)
{
$objectID = 0;
if($doc->type == 'product') $objectID = $doc->product;
if($doc->type == 'project') $objectID = $doc->project;
if($doc->type == 'execution') $objectID = $doc->execution;
$tab = $this->app->tab;
if($tab != 'doc') $tab = $objectID ? $doc->type : 'doc';
$html .= '<li>' . html::a(inlink('objectLibs', "type={$doc->type}&objectID=$objectID&libID={$doc->lib}&docID={$doc->id}"), "<i class='icon icon-file-text'></i> " . $doc->title, '', "data-app='$tab' title='{$doc->title}'") . '</li>';
}
$collectionCount = $this->dao->select('count(id) as count')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere('lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('collector')->like("%,{$this->app->user->account},%")
->fetch('count');
if($collectionCount > $favoritesLimit) $html .= '<li>' . html::a(inlink('browse', "type=collectedByMe"), $this->lang->doc->allCollections) . '</li>';
$html .= '</ul></div>';
return $html;
}
/**
* Build browse switch button.
*
@@ -2835,7 +2718,6 @@ EOT;
$libs = $this->getLibsByObject('custom', 0, '', $appendLib);
$this->app->rawMethod = 'custom';
if($libID == 0 and !empty($libs)) $libID = reset($libs)->id;
$this->lang->modulePageNav = $this->select($type, $objects, $objectID, $libs, $libID);
$object = new stdclass();
$object->id = 0;
@@ -2845,8 +2727,6 @@ EOT;
$libs = $this->getLibsByObject('book', 0, '', $appendLib);
$this->app->rawMethod = 'book';
if(!empty($libs) and ($libID == 0 or !isset($libs[$libID]))) $libID = reset($libs)->id;
$this->lang->modulePageNav = $this->select($type, $objects, $objectID, $libs, $libID);
$object = new stdclass();
$object->id = 0;
}
@@ -2857,8 +2737,6 @@ EOT;
$libs = $this->getLibsByObject($type, $objectID, '', $appendLib);
if($libID == 0 and !empty($libs)) $libID = reset($libs)->id;
$this->lang->modulePageNav = $this->select($type, $objects, $objectID, $libs, $libID);
if($this->app->tab == 'doc') $this->app->rawMethod = $type;
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
@@ -2874,9 +2752,6 @@ EOT;
$tab = strpos(',doc,product,project,execution,', ",{$this->app->tab},") !== false ? $this->app->tab : 'doc';
if($tab != 'doc') $this->loadModel($type)->setMenu($objectID);
$this->lang->TRActions = $this->buildCollectButton4Doc();
$this->lang->TRActions .= $this->buildCreateButton4Doc($type, $objectID, $libID);
return array($libs, $libID, $object, $objectID);
}
@@ -3096,7 +2971,7 @@ EOT;
$item->active = $lib->id == $libID ? 1 : 0;
$item->children = $this->getModuleTree($lib->id, $moduleID, $lib->type == 'api' ? 'api' : 'doc');
$item->children = array_values($item->children);
if($lib->type != 'execution')
if(($type == 'project' and $lib->type != 'execution') or $type != 'project')
{
if($item->type == 'lib') $libTree[$lib->type][$lib->id] = $item;
if($item->type == 'api') $apiLibs[$lib->id] = $item;
+50 -117
View File
@@ -14,127 +14,60 @@
<?php js::set('moduleTree', $moduleTree);?>
<?php js::set('treeData', $libTree);?>
<?php js::set('docLang', $lang->doc);?>
<?php
$sideLibs = array();
foreach($lang->doclib->tabList as $libType => $typeName) $sideLibs[$libType] = $this->doc->getLimitLibs($libType);
$allModules = $this->loadModel('tree')->getDocStructure();
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->doc->searchDoc;?></a>
</div>
<div class="btn-toolbar pull-right">
<?php
$exportMethod = $type . '2export';
if(common::hasPriv('doc', $exportMethod))
{
echo html::a($this->createLink('doc', $exportMethod, "libID=$libID&docID=0", 'html', true), "<i class='icon-export muted'> </i>" . $lang->export, '', "class='btn btn-link export' id='$exportMethod'");
}
$sideSubLibs = array();
$sideSubLibs['product'] = $this->doc->getSubLibGroups('product', array_keys($sideLibs['product']));
$sideSubLibs['execution'] = $this->doc->getSubLibGroups('execution', array_keys($sideLibs['execution']));
if($this->methodName != 'browse')
{
$browseType = '';
$moduleID = '';
}
if(empty($type)) $type = 'product';
?>
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $type . 'Doc';?>></div>
<div class="main-table-content">
if(common::hasPriv('doc', 'createLib'))
{
echo html::a(helper::createLink('doc', 'createLib', "type=$type&objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $this->lang->doc->createLib, '', 'class="btn btn-secondary iframe"');
}
if(common::hasPriv('doc', 'create'))
{
if($libID)
{
$html = "<div class='dropdown' id='createDropdown'>";
$html .= "<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> " . $this->lang->doc->create . " <span class='caret'></span></button>";
$html .= "<ul class='dropdown-menu pull-right'>";
foreach($this->lang->doc->createList as $typeKey => $typeName)
{
if($config->edition != 'max' and $typeKey == 'template') continue;
$class = (strpos($this->config->doc->officeTypes, $typeKey) !== false or strpos($this->config->doc->textTypes, $typeKey) !== false) ? 'iframe' : '';
$module = $typeKey == 'api' ? 'api' : 'doc';
$method = strpos($this->config->doc->textTypes, $typeKey) !== false ? 'createBasicInfo' : 'create';
$params = "objectType=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&type=$typeKey";
if($typeKey == 'api') $params = "libID=$libID&moduleID=$moduleID";
if($typeKey == 'template') $params = "objectType=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&type=html&fromGlobal=&from=template";
$html .= "<li>";
$html .= html::a(helper::createLink($module, $method, $params, '', $class ? true : false), $typeName, '', "class='$class' data-app='{$this->app->tab}'");
$html .= "</li>";
if($typeKey == 'template') $html .= '<li class="divider"></li>';
if($config->edition != 'max' and $typeKey == 'api') $html .= '<li class="divider"></li>';
}
echo $html;
}
}
?>
</div>
</div>
<div id='mainContent'class="main-row fade">
<div class="side panel">
<div id="fileTree" class="file-tree"></div>
</div>
<div class="content panel" id="<?php echo $type;?>">
<div class="detail">
<div class="detail-title"><?php echo $lang->doc->tableContents;?></div>
<?php
$canEditLib = common::hasPriv('doc', 'editLib');
$canManageBook = common::hasPriv('doc', 'manageBook');
$canManageMenu = common::hasPriv('tree', 'browse');
$canEditLib = common::hasPriv('doc', 'editLib');
$canDeleteLib = common::hasPriv('doc', 'deleteLib');
if($type != 'book' and ($canManageMenu or $canEditLib or $canDeleteLib) and !empty($libs))
{
echo "<div class='menu-actions'>";
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
echo "<ul class='dropdown-menu pull-left'>";
if($canManageMenu)
{
echo '<li>' . html::a($this->createLink('tree', 'browse', "rootID=$libID&view=doc&currentModuleID=0&branch=0&from={$this->app->tab}", '', true), '<i class="icon-cog-outline"></i> ' . $this->lang->doc->manageType, '', "class='iframe'") . '</li>';
echo "<li class='divider'></li>";
}
if($canEditLib) echo '<li>' . html::a($this->createLink('doc', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->doc->editLib, '', "class='iframe'") . '</li>';
if($canDeleteLib) echo '<li>' . html::a($this->createLink('doc', 'deleteLib', "rootID=$libID&confirm=no&type=lib&from=tableContents"), '<i class="icon-trash"></i> ' . $lang->doc->deleteLib, 'hiddenwin') . '</li>';
echo '</ul></div>';
}
if($type == 'book' and ($canEditLib or $canManageBook) and !empty($libs))
{
echo "<div class='menu-actions'>";
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
echo "<ul class='dropdown-menu pull-left'>";
if($canEditLib) echo '<li>' . html::a($this->createLink('doc', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->doc->editBook, '', "class='iframe'") . '</li>';
if($canManageBook) echo '<li>' . html::a($this->createLink('doc', 'manageBook', "bookID=$libID"), '<i class="icon-cog-outline"></i> ' . $lang->doc->manageBook) . '</li>';
echo '</ul></div>';
}
?>
</div>
<div class="detail">
<?php if($moduleTree):?>
<?php if($type == 'book'):?>
<?php include './bookside.html.php';?>
<?php else:?>
<?php echo $moduleTree;?>
<?php endif;?>
<?php else:?>
<div class="no-content"><img alt="" src="<?php echo $config->webRoot . 'theme/default/images/main/no_content.png'?>"/></div>
<div class="notice text-muted"><?php echo (empty($libs) and $type == 'custom') ? $lang->doc->noLib : $lang->doc->noDoc;?></div>
<div class="no-content-button">
<?php
$html = '';
if($type == 'book' and common::hasPriv('doc', 'createLib'))
{
$html = html::a(helper::createLink('doc', 'createLib', "type=$type&objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $lang->doc->createBook, '', 'class="btn btn-info btn-wide iframe"');
}
elseif(empty($libs) and $type == 'custom' and common::hasPriv('doc', 'createLib'))
{
$html = html::a(helper::createLink('doc', 'createLib', "type=$type&objectID=$objectID"), '<i class="icon icon-plus"></i> ' . $lang->doc->createLib, '', 'class="btn btn-info btn-wide iframe"');
}
elseif($libID and common::hasPriv('doc', 'create'))
{
$html = "<div class='dropdown' id='createDropdown'>";
$html .= "<button class='btn btn-info btn-wide' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> " . $lang->doc->createAB . " <span class='caret'></span></button>";
$html .= "<ul class='dropdown-menu' style='left:0px'>";
foreach($this->lang->doc->typeList as $typeKey => $typeName)
{
$icon = zget($this->config->doc->iconList, $typeKey);
$class = (strpos($this->config->doc->officeTypes, $typeKey) !== false or strpos($this->config->doc->textTypes, $typeKey) !== false) ? 'iframe' : '';
$method = strpos($this->config->doc->textTypes, $typeKey) !== false ? 'createBasicInfo' : 'create';
$html .= "<li>";
$html .= html::a(helper::createLink('doc', $method, "objectType=$type&objectID=$objectID&libID=$libID&moduleID=0&type=$typeKey", '', $class ? true : false), "<i class='icon-$icon text-muted'></i> " . $typeName, '', "class='$class' data-app='{$this->app->tab}'");
$html .= "</li>";
if($typeKey == 'url') $html .= '<li class="divider"></li>';
}
$html .= "</ul></div>";
}
echo $html;
?>
<?php
if(!empty($libs))
{
if($type == 'book')
{
common::printLink('doc', 'manageBook', "bookID=$libID", $lang->doc->manageBook, '', "class='btn btn-info btn-wide'");
}
else
{
common::printLink('tree', 'browse', "rootID=$libID&view=doc&currentModuleID=0&branch=0&from={$this->app->tab}", $lang->doc->manageType, '', "class='btn btn-info btn-wide iframe'", '', true);
}
}
?>
</div>
<?php endif;?>
</div>
<div class="main-col">
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $type . 'Doc';?>></div>
</div>
</div>
<script>
$('#pageNav .btn-group.angle-btn').click(function()
{
if($(this).hasClass('opened')) return;
$(this).addClass('opened');
scrollToSelected();
})
</script>
<?php include '../../common/view/footer.html.php';?>