* Rewrite view page of doc.
This commit is contained in:
@@ -54,6 +54,7 @@ $lang->public = '公共';
|
||||
$lang->trunk = '主干';
|
||||
$lang->sort = '排序';
|
||||
$lang->required = '必填';
|
||||
$lang->noData = '暂无';
|
||||
|
||||
$lang->actions = '操作';
|
||||
$lang->comment = '备注';
|
||||
|
||||
@@ -1,9 +1,2 @@
|
||||
.versions .dropdown-menu{max-height:260px; overflow-y:auto;}
|
||||
|
||||
fieldset > .content table tr.firstRow th{border-top-width: 2px;}
|
||||
fieldset > .content table tr th { border-top: 1px solid #BBB;
|
||||
border-top-width: 1px;
|
||||
background-color: #F7F7F7;
|
||||
}
|
||||
fieldset > .content table tr th, fieldset > .content table tr td{ padding: 5px 10px; }
|
||||
.col-main{width:100%}
|
||||
.table-data > tbody > tr > th.w-80px {width:80px;}
|
||||
|
||||
@@ -310,6 +310,11 @@ class docModel extends model
|
||||
elseif($browseType == 'byediteddate')
|
||||
{
|
||||
$docIdList = $this->getPrivDocs($libID, $moduleID);
|
||||
$files = $this->dao->select('*')->from(TABLE_FILE)
|
||||
->where('objectType')->eq('doc')
|
||||
->andWhere('objectID')->in($docIdList)
|
||||
->fetchGroup('objectID');
|
||||
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('id')->in($docIdList)
|
||||
@@ -317,11 +322,6 @@ class docModel extends model
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
|
||||
$files = $this->dao->select('*')->from(TABLE_FILE)
|
||||
->where('objectType')->eq('doc')
|
||||
->andWhere('objectID')->in(array_keys($docs))
|
||||
->fetchGroup('objectID');
|
||||
|
||||
foreach($docs as $doc)
|
||||
{
|
||||
$docs[$doc->id]->fileSize = 0;
|
||||
|
||||
+154
-155
@@ -13,71 +13,165 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/ueditor.html.php';?>
|
||||
<?php echo css::internal($keTableCSS);?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix' title='DOC'><?php echo html::icon($lang->icons['doc']);?> <strong><?php echo $doc->id;?></strong></span>
|
||||
<strong><?php echo $doc->title;?></strong>
|
||||
<?php if($doc->deleted):?>
|
||||
<span class='label label-danger'><?php echo $lang->doc->deleted;?></span>
|
||||
<?php endif; ?>
|
||||
<?php if($doc->version > 1):?>
|
||||
<?php
|
||||
$versions = array();
|
||||
$i = 1;
|
||||
foreach($actions as $action)
|
||||
{
|
||||
if($action->action == 'created')
|
||||
{
|
||||
$versions[$i] = "#$i " . zget($users, $action->actor) . ' ' . substr($action->date, 2, 14);
|
||||
$i++;
|
||||
}
|
||||
if($action->action == 'edited')
|
||||
{
|
||||
foreach($action->history as $history)
|
||||
{
|
||||
if($history->field == 'content')
|
||||
{
|
||||
$versions[$i] = "#$i " . zget($users, $action->actor) . ' ' . substr($action->date, 2, 14);
|
||||
$i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
krsort($versions);
|
||||
?>
|
||||
<small class='dropdown versions'>
|
||||
<a href='#' data-toggle='dropdown' class='text-muted'><?php echo '#' . $version;?> <span class='caret'></span></a>
|
||||
<?php $browseLink = $this->session->docList ? $this->session->docList : inlink('browse');?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toolbar pull-left">
|
||||
<?php echo html::a($browseLink, "<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "class='btn btn-link'");?>
|
||||
<div class="divider"></div>
|
||||
<div class="page-title">
|
||||
<span class="label label-id"><?php echo $doc->id;?></span><span class="text"><?php echo $doc->title;?></span>
|
||||
<?php if($doc->deleted):?>
|
||||
<span class='label label-danger'><?php echo $lang->doc->deleted;?></span>
|
||||
<?php endif; ?>
|
||||
<?php if($doc->version > 1):?>
|
||||
<?php
|
||||
$versions = array();
|
||||
$i = 1;
|
||||
foreach($actions as $action)
|
||||
{
|
||||
if($action->action == 'created')
|
||||
{
|
||||
$versions[$i] = "#$i " . zget($users, $action->actor) . ' ' . substr($action->date, 2, 14);
|
||||
$i++;
|
||||
}
|
||||
if($action->action == 'edited')
|
||||
{
|
||||
foreach($action->history as $history)
|
||||
{
|
||||
if($history->field == 'content')
|
||||
{
|
||||
$versions[$i] = "#$i " . zget($users, $action->actor) . ' ' . substr($action->date, 2, 14);
|
||||
$i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
krsort($versions);
|
||||
?>
|
||||
<small class='dropdown'>
|
||||
<a href='#' data-toggle='dropdown' class='text-muted'><?php echo '#' . $version;?> <span class='caret'></span></a>
|
||||
<ul class='dropdown-menu'>
|
||||
<?php
|
||||
foreach($versions as $i => $versionTitle)
|
||||
{
|
||||
$class = $i == $version ? " class='active'" : '';
|
||||
echo '<li' . $class .'>' . html::a(inlink('view', "docID=$doc->id&version=$i"), $versionTitle) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</small>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
foreach($versions as $i => $versionTitle)
|
||||
{
|
||||
$class = $i == $version ? " class='active'" : '';
|
||||
echo '<li' . $class .'>' . html::a(inlink('view', "docID=$doc->id&version=$i"), $versionTitle) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='actions'>
|
||||
</div>
|
||||
<div id="mainContent" class="main-row">
|
||||
<div class="main-col col-8">
|
||||
<div class="cell">
|
||||
<div class="detail">
|
||||
<div class="detail-content article-content">
|
||||
<?php
|
||||
$content = $doc->content;
|
||||
if($doc->type == 'url')
|
||||
{
|
||||
$url = $doc->content;
|
||||
if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url;
|
||||
$content = html::a($url, $doc->content, '_blank');
|
||||
}
|
||||
echo $content;
|
||||
?>
|
||||
|
||||
<?php foreach($doc->files as $file):?>
|
||||
<?php if(in_array($file->extension, $config->file->imageExtensions)):?>
|
||||
<a href="<?php echo $file->webPath?>" target="_blank">
|
||||
<img onload="setImageSize(this,0)" src="<?php echo $this->createLink('file', 'read', "fileID={$file->id}");?>" alt="<?php echo $file->title?>">
|
||||
</a>
|
||||
<span class='right-icon' style='position:absolute;right:-18px;top:0px;'>
|
||||
<?php if(common::hasPriv('file', 'delete')) echo html::a('###', "<i class='icon-remove'></i>", '', "class='btn-icon' onclick='deleteFile($file->id)' title='$lang->delete'");?>
|
||||
</span>
|
||||
<?php unset($doc->files[$file->id]);?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $doc->files, 'fieldset' => 'true'));?>
|
||||
<?php $actionFormLink = $this->createLink('action', 'comment', "objectType=doc&objectID=$doc->id");?>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side-col col-4">
|
||||
<div class="cell">
|
||||
<details class="detail" open>
|
||||
<summary class="detail-title"><?php echo $lang->doc->digest;?></summary>
|
||||
<div class="detail-content">
|
||||
<?php echo !empty($doc->digest) ? $doc->digest : "<div class='text-center text-muted'>" . $lang->noData . '</div>';?>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<details class="detail" open>
|
||||
<summary class="detail-title"><?php echo $lang->doc->keywords;?></summary>
|
||||
<div class="detail-content">
|
||||
<?php echo !empty($doc->keywords) ? $doc->keywords : "<div class='text-center text-muted'>" . $lang->noData . '</div>';?>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<details class="detail" open>
|
||||
<summary class="detail-title"><?php echo $lang->doc->basicInfo;?></summary>
|
||||
<div class="detail-content">
|
||||
<table class="table table-data">
|
||||
<tbody>
|
||||
<?php if($doc->productName):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->product;?></th>
|
||||
<td><?php echo $doc->productName;?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($doc->projectName):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->project;?></th>
|
||||
<td><?php echo $doc->projectName;?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo $lang->doc->lib;?></th>
|
||||
<td><?php echo $lib->name;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->module;?></th>
|
||||
<td><?php echo $doc->moduleName ? $doc->moduleName : '/';?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->addedDate;?></th>
|
||||
<td><?php echo $doc->addedDate;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->editedBy;?></th>
|
||||
<td><?php echo $users[$doc->editedBy];?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->editedDate;?></th>
|
||||
<td><?php echo $doc->editedDate;?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mainActions">
|
||||
<?php common::printPreAndNext($preAndNext);?>
|
||||
<div class="btn-toolbar">
|
||||
<?php common::printBack($browseLink);?>
|
||||
<?php
|
||||
$browseLink = $this->session->docList ? $this->session->docList : inlink('browse');
|
||||
$params = "docID=$doc->id";
|
||||
if(!$doc->deleted)
|
||||
{
|
||||
ob_start();
|
||||
echo "<div class='btn-group'>";
|
||||
common::printCommentIcon('doc', $doc);
|
||||
common::printIcon('doc', 'edit', $params, $doc);
|
||||
common::printIcon('doc', 'delete', $params, $doc, 'button', '', 'hiddenwin');
|
||||
echo '</div>';
|
||||
echo "<div class='btn-group'>";
|
||||
common::printRPN($browseLink, $preAndNext);
|
||||
echo '</div>';
|
||||
$actionLinks = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo $actionLinks;
|
||||
echo "<div class='divider'></div>";
|
||||
common::printIcon('doc', 'edit', "docID=$doc->id", $doc);
|
||||
common::printIcon('doc', 'delete', "docID=$doc->id", $doc, 'button', '', 'hiddenwin');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -86,100 +180,5 @@
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row-table'>
|
||||
<div class='col-main'>
|
||||
<div class='main'>
|
||||
<div class='content'>
|
||||
<?php
|
||||
$content = $doc->content;
|
||||
if($doc->type == 'url')
|
||||
{
|
||||
$url = $doc->content;
|
||||
if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url;
|
||||
$content = html::a($url, $doc->content, '_blank');
|
||||
}
|
||||
echo $content;
|
||||
?>
|
||||
<div class='list-group files-list'>
|
||||
<?php foreach($doc->files as $file):?>
|
||||
<?php if(in_array($file->extension, $config->file->imageExtensions)):?>
|
||||
<?php $uploadDate = $lang->file->uploadDate . substr($file->addedDate, 0, 10);?>
|
||||
<li class='list-group-item' title='<?php echo $uploadDate?>' style='position:relative;'>
|
||||
<a href="<?php echo $file->webPath?>" target="_blank">
|
||||
<img onload="setImageSize(this,0)" src="<?php echo $this->createLink('file', 'read', "fileID={$file->id}");?>" alt="<?php echo $file->title?>">
|
||||
</a>
|
||||
<span class='right-icon' style='position:absolute;right:-18px;top:0px;'>
|
||||
<?php if(common::hasPriv('file', 'delete')) echo html::a('###', "<i class='icon-remove'></i>", '', "class='btn-icon' onclick='deleteFile($file->id)' title='$lang->delete'");?>
|
||||
</span>
|
||||
</li>
|
||||
<?php unset($doc->files[$file->id]);?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
|
||||
<div class='file-content'><?php echo $this->fetch('file', 'printFiles', array('files' => $doc->files, 'fieldset' => 'false'));?></div>
|
||||
</div>
|
||||
<div class='actions'><?php if(!$doc->deleted) echo $actionLinks;?></div>
|
||||
|
||||
<fieldset id='commentBox' class='hide'>
|
||||
<legend><?php echo $lang->comment;?></legend>
|
||||
<form method='post' action='<?php echo $this->createLink('action', 'comment', "objectType=doc&objectID=$doc->id")?>' target='hiddenwin'>
|
||||
<div class="form-group"><?php echo html::textarea('comment', '',"style='width:100%;height:100px'");?></div>
|
||||
<?php echo html::submitButton() . html::backButton();?>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-side hidden-xs'>
|
||||
<div class='main main-side'>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->doc->digest;?></legend>
|
||||
<div><?php echo $doc->digest;?></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->doc->keywords;?></legend>
|
||||
<div><?php echo $doc->keywords;?></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->doc->basicInfo;?></legend>
|
||||
<table class='table table-data table-condensed table-borderless'>
|
||||
<?php if($doc->productName):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->product;?></th>
|
||||
<td><?php echo $doc->productName;?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($doc->projectName):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->project;?></th>
|
||||
<td><?php echo $doc->projectName;?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo $lang->doc->lib;?></th>
|
||||
<td><?php echo $lib->name;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->module;?></th>
|
||||
<td><?php echo $doc->moduleName ? $doc->moduleName : '/';?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->addedDate;?></th>
|
||||
<td><?php echo $doc->addedDate;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->editedBy;?></th>
|
||||
<td><?php echo $users[$doc->editedBy];?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->editedDate;?></th>
|
||||
<td><?php echo $doc->editedDate;?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/syntaxhighlighter.html.php';?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user