* Code for finish task #87405.

This commit is contained in:
tianshujie
2023-03-21 16:01:35 +08:00
parent 0362953766
commit 8944424005
12 changed files with 309 additions and 312 deletions
-72
View File
@@ -53,78 +53,6 @@
.no-content-button {text-align: center; padding-top: 20px;}
.no-content-button a:nth-child(2) {margin-left: 20px;}
.detail .list-group-item .heading.GET {
background-color: #e7f0f7;
}
.detail .list-group-item .heading.GET a {
color: #0f6ab4;
}
.detail .list-group-item .heading.OPTIONS {
background-color: #e7f0f7;
}
.detail .list-group-item .heading.OPTIONS a {
color: #0f6ab4;
}
.detail .list-group-item .heading.POST {
background-color: #e7f6ec;
}
.detail .list-group-item .heading.POST a {
color: #10a54a;
}
.detail .list-group-item .heading.PUT {
background-color: #f9f2e9;
}
.detail .list-group-item .heading.PUT a {
color: #c5862b;
}
.detail .list-group-item .heading.PATCH {
background-color: #f9f2e9;
}
.detail .list-group-item .heading.PATCH a {
color: #c5862b;
}
.detail .list-group-item .heading.DELETE {
background-color: #f5e8e8;
border: 1px solid #e8c6c7;
}
.detail .list-group-item .heading.DELETE a {
color: #a41e22;
}
.detail .list-group-item a {
display: flex;
align-items: center;
}
.detail .list-group-item .path, .detail .list-group-item .desc {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail .list-group-item .path {
padding-left: 10px;
font-size: 14px;
color: black;
flex: 1;
}
.detail .list-group-item .desc {
width: auto;
font-size: 14px;
line-height: 38px;
float: right;
padding-right: 10px;
max-width: 200px;
}
.detail .list-group-item {list-style: none; font-size: 14px; margin-bottom: 10px; line-height: 30px}
.detail .list-group-item span {line-height: 30px; width: 65px;}
.detail .list-group-item .label+.label {margin-left: -4px;}
.detail .list-group-item .label {border-radius: 0;}
.paramsTable th {text-align: left!important; font-size: 14px;}
.paramsTable td {text-align: left;}
+6 -4
View File
@@ -394,12 +394,13 @@ class apiModel extends model
/**
* Get api doc list by module id.
*
* @param int $libID
* @param int $moduleID
* @param int $release
* @param int $libID
* @param int $moduleID
* @param int $release
* @param object $pager
* @return array $list
*/
public function getListByModuleId($libID = 0, $moduleID = 0, $release = 0)
public function getListByModuleId($libID = 0, $moduleID = 0, $release = 0, $pager = null)
{
/* Get release info. */
if($release > 0)
@@ -437,6 +438,7 @@ class apiModel extends model
->from(TABLE_API)
->where($where)
->andWhere('deleted')->eq(0)
->page($pager)
->fetchAll();
}
array_map(function ($item) {
+116
View File
@@ -0,0 +1,116 @@
<style>
.detail .list-group-item .heading.GET {
background-color: #e7f0f7;
}
.detail .list-group-item .heading.GET a {
color: #0f6ab4;
}
.detail .list-group-item .heading.OPTIONS {
background-color: #e7f0f7;
}
.detail .list-group-item .heading.OPTIONS a {
color: #0f6ab4;
}
.detail .list-group-item .heading.POST {
background-color: #e7f6ec;
}
.detail .list-group-item .heading.POST a {
color: #10a54a;
}
.detail .list-group-item .heading.PUT {
background-color: #f9f2e9;
}
.detail .list-group-item .heading.PUT a {
color: #c5862b;
}
.detail .list-group-item .heading.PATCH {
background-color: #f9f2e9;
}
.detail .list-group-item .heading.PATCH a {
color: #c5862b;
}
.detail .list-group-item .heading.DELETE {
background-color: #f5e8e8;
border: 1px solid #e8c6c7;
}
.detail .list-group-item .heading.DELETE a {
color: #a41e22;
}
.detail .list-group-item a {
display: flex;
align-items: center;
}
.detail .list-group-item .path, .detail .list-group-item .desc {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail .list-group-item .path {
padding-left: 10px;
font-size: 14px;
color: black;
flex: 1;
}
.detail .list-group-item .desc {
width: auto;
font-size: 14px;
line-height: 38px;
float: right;
padding-right: 10px;
max-width: 200px;
}
.detail .list-group-item {list-style: none; font-size: 14px; margin-bottom: 10px; line-height: 30px}
.detail .list-group-item span {line-height: 30px; width: 65px;}
.detail .list-group-item .label+.label {margin-left: -4px;}
.detail .list-group-item .label {border-radius: 0;}
</style>
<?php if($apiID):?>
<?php include './content.html.php';?>
<?php else:?>
<?php if(empty($libs) || empty($apiList)):?>
<div class="cell">
<div class="detail">
<li class="detail-title"><?php echo intval($libID) > 0 ? $lang->api->apiList : $lang->api->pageTitle;?></li>
</div>
<div class="detail">
<div class="notice text-muted"><?php echo (empty($libs)) ? $lang->api->noLib : $lang->api->noApi;?></div>
<div class="no-content-button">
<?php
if($libID && common::hasPriv('api', 'create'))
{
echo html::a(helper::createLink('api', 'create', "libID={$libID}"), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-info btn-wide"');
}
?>
</div>
</div>
</div>
<?php else:?>
<div class="cell main-col" data-min-width="400">
<div class="detail base-url">
<p><?php echo $lang->api->baseUrl . ': ' . $lib->baseUrl;?></p>
</div>
<div class="detail">
<ul class="list-group">
<?php foreach($apiList as $api):?>
<li class="list-group-item">
<div class="heading <?php echo $api->method;?>">
<a href="<?php echo helper::createLink('api', 'index', "libID={$api->lib}&moduleID=0&apiID={$api->id}&version=0&release=$release");?>">
<span class="label label-primary"><?php echo $api->method;?></span>
<span class="path" title="<?php echo $api->path;?>"><?php echo $api->path;?></span>
<span class="desc" title="<?php echo $api->title;?>"><?php echo $api->title;?></span>
</a>
</div>
</li>
<?php endforeach;?>
</ul>
</div>
</div>
<?php endif;?>
<?php endif;?>
+1 -45
View File
@@ -51,50 +51,6 @@
</div>
</div>
<?php endif;?>
<?php if($apiID):?>
<?php include './content.html.php';?>
<?php else:?>
<?php if(empty($libs) || empty($apiList)):?>
<div class="cell">
<div class="detail">
<li class="detail-title"><?php echo intval($libID) > 0 ? $lang->api->apiList : $lang->api->pageTitle;?></li>
</div>
<div class="detail">
<div class="no-content"><img src="<?php echo $config->webRoot . 'theme/default/images/main/no_content.png'?>"/></div>
<div class="notice text-muted"><?php echo (empty($libs)) ? $lang->api->noLib : $lang->api->noApi;?></div>
<div class="no-content-button">
<?php
if($libID && common::hasPriv('api', 'create'))
{
echo html::a(helper::createLink('api', 'create', "libID={$libID}"), '<i class="icon icon-plus"></i> ' . $lang->api->createApi, '', 'class="btn btn-info btn-wide"');
}
?>
</div>
</div>
</div>
<?php else:?>
<div class="cell main-col" data-min-width="400">
<div class="detail base-url">
<p><?php echo $lang->api->baseUrl . ': ' . $lib->baseUrl;?></p>
</div>
<div class="detail">
<ul class="list-group">
<?php foreach($apiList as $api):?>
<li class="list-group-item">
<div class="heading <?php echo $api->method;?>">
<a href="<?php echo helper::createLink('api', 'index', "libID={$api->lib}&moduleID=0&apiID={$api->id}&version=0&release=$release");?>">
<span class="label label-primary"><?php echo $api->method;?></span>
<span class="path" title="<?php echo $api->path;?>"><?php echo $api->path;?></span>
<span class="desc" title="<?php echo $api->title;?>"><?php echo $api->title;?></span>
</a>
</div>
</li>
<?php endforeach;?>
</ul>
</div>
</div>
<?php endif;?>
<?php endif;?>
<?php include 'apilist.html.php';?>
</div>
<?php include '../../common/view/footer.html.php';?>
+2 -2
View File
@@ -45,11 +45,11 @@ if($app->rawMethod == 'contribute') $config->doc->search['fields']['project'] =
$config->doc->search['fields']['execution'] = $lang->doc->execution;
$config->doc->search['fields']['lib'] = $lang->doc->lib;
$config->doc->search['fields']['module'] = $lang->doc->module;
$config->doc->search['fields']['keywords'] = $lang->doc->keywords;
$config->doc->search['fields']['addedBy'] = $lang->doc->addedBy;
$config->doc->search['fields']['addedBy'] = $lang->doc->addedByAB;
$config->doc->search['fields']['addedDate'] = $lang->doc->addedDate;
$config->doc->search['fields']['editedBy'] = $lang->doc->editedBy;
$config->doc->search['fields']['editedDate'] = $lang->doc->editedDate;
$config->doc->search['fields']['keywords'] = $lang->doc->keywords;
$config->doc->search['fields']['version'] = $lang->doc->version;
$config->doc->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
+27 -22
View File
@@ -1019,8 +1019,7 @@ class doc extends control
if(!empty($_POST)) $searchTitle = $this->post->title;
if(empty($_POST) and !empty($searchTitle)) $this->post->title = $searchTitle;
$this->lang->TRActions = $this->doc->buildCollectButton4Doc();
$this->lang->TRActions .= $this->doc->buildBrowseSwitch($type, $objectID, $viewType, $orderBy, $recTotal, $recPerPage, $pageID, $searchTitle);
$this->lang->TRActions = $this->doc->buildBrowseSwitch($type, $objectID, $viewType, $orderBy, $recTotal, $recPerPage, $pageID, $searchTitle);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -1134,9 +1133,6 @@ class doc extends control
/* Set Custom. */
foreach(explode(',', $this->config->doc->customObjectLibs) as $libType) $customObjectLibs[$libType] = $this->lang->doc->customObjectLibs[$libType];
$actionURL = $this->createLink('doc', 'tableContents', "type=$type&objectID=$objectID&libID=$libID&browseType=bySearch&param=myQueryID");
$this->doc->buildSearchForm(0, array(), 0, $actionURL, $type);
$moduleTree = $type == 'book' ? $this->doc->getBookStructure($libID) : $this->doc->getTreeMenu($type, $objectID, $libID, 0, $docID);
/* Get doc. */
@@ -1267,13 +1263,13 @@ class doc extends control
$libID = (int)$libID;
$moduleTree = $type == 'book' ? $this->doc->getBookStructure($libID) : $this->doc->getTreeMenu($type, $objectID, $libID);
$libTree = $this->doc->getLibTree($libID, $libs, $type, $moduleID, $objectID);
$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;
/* Build the search form. */
$queryID = $browseType == 'bySearch' ? (int)$param : 0;
$actionURL = $this->createLink('doc', 'tableContents', "type=$type&objectID=$objectID&libID=0&browseType=bySearch&param=myQueryID");
$actionURL = $this->createLink('doc', 'tableContents', "type=$type&objectID=$objectID&libID=$libID&moduleID=0&browseType=bySearch&param=myQueryID");
$this->doc->buildSearchForm($libID, $libs, $queryID, $actionURL, $type);
/* Load pager. */
@@ -1283,6 +1279,27 @@ class doc extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->app->rawMethod = $rawMethod;
$this->view->libID = $libID;
$lib = $this->doc->getLibById($libID);
$libType = zget($lib, 'type', '');
if($libType == 'api')
{
$this->view->lib = $lib;
$this->view->libs = $libs;
$this->view->apiID = 0;
$this->view->release = 0;
$this->view->apiList = $this->loadModel('api')->getListByModuleId($libID, $moduleID, 0, $pager);
}
elseif($browseType == 'annex')
{
//$this->view->files = $this->doc->getLibFiles($type, $objectID, 'id_desc', $pager);
}
else
{
$this->view->docs = $browseType == 'bySearch' ? $this->doc->getDocsBySearch($type, $objectID, $libID, $queryID, $pager) : $this->doc->getDocs($libID, $moduleID, 'id_desc', $pager);
}
$this->view->title = $title;
$this->view->type = $type;
$this->view->browseType = $browseType;
@@ -1291,23 +1308,11 @@ class doc extends control
$this->view->libTree = $libTree;
$this->view->moduleID = $moduleID;
$this->view->objectDropdown = $objectDropdown;
$this->view->docs = $browseType == 'bySearch' ? $this->doc->getDocsBySearch($type, $objectID, 0, $queryID, $pager) : $this->doc->getDocs($libID, $moduleID, 'id_desc', $pager);
$this->view->libType = $libType;
$this->view->pager = $pager;
$this->view->objectID = $objectID;
if($browseType == 'bySearch')
{
$this->view->browseType = 'bySearch';
$this->display('doc', 'browse', "browseType=bySearch&param=$queryID");
}
else
{
$this->view->libs = $libs;
$this->view->objectID = $objectID;
$this->view->libID = $libID;
$this->view->moduleTree = $moduleTree;
$this->display();
}
$this->display();
}
/**
+1
View File
@@ -60,6 +60,7 @@ li.drag-shadow ul {display: none!important;}
.createDropdown a.btn-primary, .createDropdown a.btn-info {border-right: 1px solid rgba(255,255,255,0.2);}
.createDropdown button.dropdown-toggle.btn-primary, .createDropdown button.dropdown-toggle.btn-info {padding: 6px;}
.createDropdown ul > li {text-align: left;}
.createDropdown .btn.btn-info:hover {box-shadow: none;}
.table .c-name > a.text-primary {display: inline-block; max-width: 90%; overflow: hidden;}
.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: -3px;}
-10
View File
@@ -1,15 +1,5 @@
$(function()
{
if(!moduleTree || moduleTree.length == 0)
{
var contentHeight = $('.no-content').parent().innerHeight();
var titleHeight = $('.cell div:nth-child(1)').innerHeight();
var height = $(document).height() - $('#header').height() - parent.$('#appsBar').height() - (2 * parseInt($('#main').css('padding-top')));
$('.main-content .cell').height(height);
$('.no-content').parent().css('padding-top', (height - contentHeight)/2 - titleHeight + 'px');
}
$('#main .main-content li.has-list').addClass('open in');
$('.menu-actions > a').click(function()
+1 -1
View File
@@ -49,7 +49,7 @@ $lang->doc->id = 'ID';
$lang->doc->product = '所属' . $lang->productCommon;
$lang->doc->project = "所属{$lang->projectCommon}";
$lang->doc->execution = '所属' . $lang->execution->common;
$lang->doc->lib = '所属文档库';
$lang->doc->lib = '所属库';
$lang->doc->module = '所属目录';
$lang->doc->object = '所属对象';
$lang->doc->title = '文档标题';
+22 -50
View File
@@ -954,9 +954,19 @@ class docModel extends model
}
elseif(in_array($type, array('product', 'project', 'execution', 'custom', 'book')))
{
$queryName = $type . 'Doc';
$this->config->doc->search['module'] = $queryName;
$this->config->doc->search['params']['lib']['values'] = array('' => '', $libID => (isset($libs[$libID]) ? $libs[$libID]->name : $libID), 'all' => $this->lang->doclib->all);
if(!isset($libs[$libID])) $libs[$libID] = $this->getLibById($libID);
$libType = $libs[$libID]->type;
$libPairs = array('' => '');
$queryName = $type . $libType . 'Doc';
foreach($libs as $lib)
{
if($lib->type != $libType) continue;
$libPairs[$lib->id] = $lib->name;
}
$this->config->doc->search['module'] = $queryName;
$this->config->doc->search['params']['lib']['values'] = $libPairs + array('all' => $this->lang->doclib->all);
unset($this->config->doc->search['fields']['product']);
unset($this->config->doc->search['fields']['execution']);
unset($this->config->doc->search['fields']['module']);
@@ -2795,8 +2805,10 @@ EOT;
*/
public function getDocsBySearch($type, $objectID, $libID, $queryID, $pager)
{
$queryName = $type . 'DocQuery';
$queryForm = $type . 'DocForm';
$lib = $this->getLibById($libID);
$libType = $lib->type;
$queryName = $type . $libType . 'DocQuery';
$queryForm = $type . $libType . 'DocForm';
if($queryID)
{
$query = $this->loadModel('search')->getQuery($queryID);
@@ -2817,8 +2829,8 @@ EOT;
$libs = $this->getLibsByObject($type, $objectID);
$query = $this->session->$queryName;
$query = strpos($query, "`lib` = 'all'") === false ? "$query and lib = $libID" : str_replace("`lib` = 'all'", '1', $query);
$docs = $this->dao->select('*')->from(TABLE_DOC)
if(strpos($query, "`lib` = 'all'") !== false) $query = str_replace("`lib` = 'all'", '1', $query);
return $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere($query)
->andWhere('lib')->in(array_keys($libs))
@@ -2826,47 +2838,6 @@ EOT;
->orderBy('id_desc')
->page($pager)
->fetchAll('id');
$docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc');
$files = $this->dao->select('*')->from(TABLE_FILE)
->where('objectType')->eq('doc')
->andWhere('objectID')->in(array_keys($docs))
->fetchGroup('objectID');
foreach($docs as $docID => $doc)
{
$docs[$docID]->fileSize = 0;
if(isset($files[$docID]))
{
$docContent = $docContents[$docID];
$fileSize = 0;
foreach($files[$docID] as $file)
{
if(strpos(",{$docContent->files},", ",{$file->id},") === false) continue;
$fileSize += $file->size;
}
if($fileSize < 1024)
{
$fileSize .= 'B';
}
elseif($fileSize < 1024 * 1024)
{
$fileSize = round($fileSize / 1024, 2) . 'KB';
}
elseif($fileSize < 1024 * 1024 * 1024)
{
$fileSize = round($fileSize / 1024 / 1024, 2) . 'MB';
}
else
{
$fileSize = round($fileSize / 1024 / 1024 / 1024, 2) . 'G';
}
$docs[$docID]->fileSize = $fileSize;
}
}
return $docs;
}
/**
@@ -2941,10 +2912,11 @@ EOT;
* @param int $moduleID
* @param int $objectID
* @param int $executionID
* @param string $browseType bySearch
* @access public
* @return array
*/
public function getLibTree($libID, $libs, $type, $moduleID, $objectID = 0)
public function getLibTree($libID, $libs, $type, $moduleID, $objectID = 0, $browseType = '')
{
if($type == 'project')
{
@@ -2970,7 +2942,7 @@ EOT;
$item->name = $lib->name;
$item->objectType = $type;
$item->objectID = $objectID;
$item->active = $lib->id == $libID ? 1 : 0;
$item->active = $lib->id == $libID && $browseType != 'bySearch' ? 1 : 0;
$item->children = $this->getModuleTree($lib->id, $moduleID, $lib->type == 'api' ? 'api' : 'doc');
$item->children = array_values($item->children);
if(($type == 'project' and $lib->type != 'execution') or $type != 'project')
+117
View File
@@ -0,0 +1,117 @@
<?php
/**
* The allLibs view file of doc module of ZenTaoPMS.
*
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Shujie Tian <tianshujie@easycorp.ltd>
* @package doc
* @version $Id$
* @link https://www.zentao.net
*/
?>
<?php if(empty($docs)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->doc->noDoc;?></span>
<?php
if(common::hasPriv('doc', 'create') and $browseType != 'bySearch')
{
if($libID)
{
$html = "<div class='dropdown btn-group createDropdown'>";
$html .= html::a($this->createLink('doc', 'createBasicInfo', "objectType=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&type=html", '', true), "<i class='icon icon-plus'></i> {$lang->doc->create}", '', "class='btn btn-info iframe'");
$html .= "<button type='button' class='btn btn-info dropdown-toggle' data-toggle='dropdown'><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>';
}
$html .= '</ul></div>';
echo $html;
}
}
?>
</p>
</div>
<?php else:?>
<div class="panel">
<table class="table table-borderless table-hover table-files table-fixed no-margin">
<thead>
<tr>
<th class="c-id"><?php echo $lang->doc->id;?></th>
<th class="c-name"><?php echo $lang->doc->title;?></th>
<th class="c-user"><?php echo $lang->doc->addedByAB;?></th>
<th class="c-datetime"><?php echo $lang->doc->addedDate;?></th>
<th class="c-datetime"><?php echo $lang->doc->editedBy;?></th>
<th class="c-datetime"><?php echo $lang->doc->editedDate;?></th>
<th class="w-90px text-center"><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($docs as $doc):?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $collectTitle = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<tr>
<?php $objectID = isset($doc->{$type}) ? $doc->{$type} : 0;?>
<td class="c-id" title='<?php echo $doc->id?>'>
<?php
if(common::hasPriv('doc', 'objectLibs'))
{
echo html::a($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$doc->lib&docID=$doc->id"), $doc->id, '', "title='{$doc->id}' data-app='{$this->app->tab}'");
}
else
{
echo "<i class='icon icon-file-text text-muted'></i> {$doc->id}";
}
?>
</td>
<td class="c-name" title='<?php echo $doc->title;?>'>
<?php
if(common::hasPriv('doc', 'objectLibs'))
{
echo html::a($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$doc->lib&docID=$doc->id"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "title='{$doc->title}' data-app='{$this->app->tab}' class='text-primary'");
}
else
{
echo "<i class='icon icon-file-text text-muted'></i> {$doc->title}";
}
?>
<?php if(common::canBeChanged('doc', $doc) and common::hasPriv('doc', 'collect') and $libType and $libType != 'api'):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<?php endif;?>
</td>
<td class="c-user"><?php echo zget($users, $doc->addedBy);?></td>
<td class="c-datetime"><?php echo formatTime($doc->addedDate, 'y-m-d');?></td>
<td class="c-user"><?php echo zget($users, $doc->editedBy);?></td>
<td class="c-datetime"><?php echo formatTime($doc->editedDate, 'y-m-d');?></td>
<td class="c-actions">
<?php if(common::canBeChanged('doc', $doc)):?>
<?php common::printLink('doc', 'edit', "docID=$doc->id&comment=false", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link'", true, false)?>
<?php common::printLink('doc', 'delete', "docID=$doc->id&confirm=no", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!empty($docs)):?>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<?php endif;?>
</div>
<?php endif;?>
+16 -106
View File
@@ -11,7 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('moduleTree', $moduleTree);?>
<?php js::set('treeData', $libTree);?>
<?php js::set('linkParams', "type=$type&objectID=$objectID");?>
<?php js::set('docLang', $lang->doc);?>
@@ -73,112 +72,23 @@
</div>
<div id="spliter" class="spliter col-spliter"></div>
<div class="main-col flex-full col overflow-x-auto flex-auto" data-min-width="500">
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" style="min-width: 400px" id="queryBox" data-module=<?php echo $type . 'Doc';?>></div>
<?php if(empty($docs)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->doc->noDoc;?></span>
<?php
if(common::hasPriv('doc', 'create'))
{
if($libID)
{
$html = "<div class='dropdown btn-group createDropdown'>";
$html .= html::a($this->createLink('doc', 'createBasicInfo', "objectType=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&type=html", '', true), "<i class='icon icon-plus'></i> {$lang->doc->create}", '', "class='btn btn-info iframe'");
$html .= "<button type='button' class='btn btn-info dropdown-toggle' data-toggle='dropdown'><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>';
}
$html .= '</ul></div>';
echo $html;
}
}
?>
</p>
</div>
<?php else:?>
<div class="panel">
<table class="table table-borderless table-hover table-files table-fixed no-margin">
<thead>
<tr>
<th class="c-id"><?php echo $lang->doc->id;?></th>
<th class="c-name"><?php echo $lang->doc->title;?></th>
<th class="c-user"><?php echo $lang->doc->addedByAB;?></th>
<th class="c-datetime"><?php echo $lang->doc->addedDate;?></th>
<th class="c-datetime"><?php echo $lang->doc->editedBy;?></th>
<th class="c-datetime"><?php echo $lang->doc->editedDate;?></th>
<th class="w-90px text-center"><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($docs as $doc):?>
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $collectTitle = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<tr>
<?php $objectID = isset($doc->{$type}) ? $doc->{$type} : 0;?>
<td class="c-id" title='<?php echo $doc->id?>'>
<?php
if(common::hasPriv('doc', 'objectLibs'))
{
echo html::a($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$doc->lib&docID=$doc->id"), $doc->id, '', "title='{$doc->id}' data-app='{$this->app->tab}'");
}
else
{
echo "<i class='icon icon-file-text text-muted'></i> {$doc->id}";
}
?>
</td>
<td class="c-name" title='<?php echo $doc->title;?>'>
<?php
if(common::hasPriv('doc', 'objectLibs'))
{
echo html::a($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$doc->lib&docID=$doc->id"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "title='{$doc->title}' data-app='{$this->app->tab}' class='text-primary'");
}
else
{
echo "<i class='icon icon-file-text text-muted'></i> {$doc->title}";
}
?>
<?php if(common::canBeChanged('doc', $doc) and common::hasPriv('doc', 'collect')):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<?php endif;?>
</td>
<td class="c-user"><?php echo zget($users, $doc->addedBy);?></td>
<td class="c-datetime"><?php echo formatTime($doc->addedDate, 'y-m-d');?></td>
<td class="c-user"><?php echo zget($users, $doc->editedBy);?></td>
<td class="c-datetime"><?php echo formatTime($doc->editedDate, 'y-m-d');?></td>
<td class="c-actions">
<?php if(common::canBeChanged('doc', $doc)):?>
<?php common::printLink('doc', 'edit', "docID=$doc->id&comment=false", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link'", true, false)?>
<?php common::printLink('doc', 'delete', "docID=$doc->id&confirm=no", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!empty($docs)):?>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<?php endif;?>
</div>
<?php if($browseType != 'annex'):?>
<div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" style="min-width: 400px" id="queryBox" data-module=<?php echo $type . $libType . 'Doc';?>></div>
<?php endif;?>
<?php
if($browseType == 'annex')
{
include 'showfiles.html.php';
}
elseif($libType == 'api')
{
include '../../api/view/apilist.html.php';
}
else
{
include 'doclist.html.php';
}
;?>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>