* Code for finish task #87405.

This commit is contained in:
tianshujie
2023-03-22 13:51:46 +08:00
parent d761a31c32
commit dbb17e187a
5 changed files with 83 additions and 67 deletions
+3 -1
View File
@@ -1303,7 +1303,7 @@ class doc extends control
else
{
$this->session->set('objectName', $this->lang->doc->common, 'admin');
$this->view->docs = $browseType == 'bySearch' ? $this->doc->getDocsBySearch($type, $objectID, $libID, $queryID, $pager) : $this->doc->getDocs($libID, $moduleID, 'id_desc', $pager);
$this->view->docs = $browseType == 'bySearch' ? $this->doc->getDocsBySearch($type, $objectID, $libID, $queryID, $pager) : $this->doc->getDocs($libID, $moduleID, $orderBy, $pager);
}
$this->view->title = $title;
@@ -1318,6 +1318,8 @@ class doc extends control
$this->view->pager = $pager;
$this->view->objectID = $objectID;
$this->view->orderBy = $orderBy;
$this->view->exportMethod = $type . '2export';
$this->view->canExport = common::hasPriv('doc', $type . '2export');
$this->display();
}
-1
View File
@@ -1,2 +1 @@
#mainContent .c-id {width: 70px;}
#mainContent .c-id > a {color: #0c60e1;}
-1
View File
@@ -72,4 +72,3 @@ li.drag-shadow ul {display: none!important;}
.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;}
.panel th.c-id {width: 60px;}
+78 -61
View File
@@ -10,6 +10,10 @@
* @link https://www.zentao.net
*/
?>
<style>
#docListForm table tr {border: none;}
#mainContent .c-id {width: 70px;}
</style>
<?php if(empty($docs)):?>
<div class="table-empty-tip">
<p>
@@ -50,68 +54,81 @@
</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}";?>
<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'")?>
<form class='main-table' method='post' id='docListForm' data-ride="table">
<table class="table table-borderless table-hover table-files table-fixed no-margin has-sort-head table-fixed">
<thead>
<tr>
<th class="c-id">
<?php if($canExport):?>
<div class="checkbox-primary check-all" title="<?php echo $lang->selectAll?>">
<label></label>
</div>
<?php endif;?>
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB, '', 'tableContents');?>
</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-datetime"><?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-datetime"><?php common::printOrderLink('editedDate', $orderBy, $vars, $lang->doc->editedDate, '', 'tableContents');?></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($canExport):?>
<div class="checkbox-primary">
<input type='checkbox' name='docIDList[]' value='<?php echo $doc->id;?>'/>
<label></label>
</div>
<?php endif;?>
<?php printf('%03d', $doc->id);?>
</td>
</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>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!empty($docs)):?>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<?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 if($canExport):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<?php endif;?>
<?php $pager->show('right', 'pagerjs');?>
</div>
<?php endif;?>
<form>
</div>
<?php endif;?>
+2 -3
View File
@@ -21,10 +21,9 @@
</div>
<div class="btn-toolbar pull-right">
<?php
$exportMethod = $type . '2export';
if(common::hasPriv('doc', $exportMethod))
if($canExport)
{
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'");
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}'");
}
if(common::hasPriv('doc', 'createLib'))