* code for task #89166.

This commit is contained in:
wangyidong
2023-03-30 17:36:19 +08:00
parent 0adc8a965e
commit efc419ca6e
17 changed files with 151 additions and 19 deletions
+2
View File
@@ -1,5 +1,6 @@
UPDATE `zt_doc` SET `type` = 'text' WHERE `type` = 'url';
UPDATE `zt_doc` SET `acl` = 'private' WHERE `acl` = 'custom';
UPDATE `zt_doc` SET `status` = 'normal' WHERE `status` = '';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'custom' and `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'product' AND `acl` = 'custom';
@@ -12,6 +13,7 @@ UPDATE `zt_doclib` SET `acl` = 'default' WHERE `main` = '1';
ALTER TABLE `zt_doclib` ADD `addedBy` varchar(30) NOT NULL AFTER `order`;
ALTER TABLE `zt_doclib` ADD `addedDate` datetime NOT NULL AFTER `addedBy`;
ALTER TABLE `zt_doc` CHANGE `status` `status` varchar(30) COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'normal';
/* Update doc lib. */
UPDATE zt_doclib AS t1
+3 -1
View File
@@ -44,6 +44,7 @@ $config->doc->search['fields']['product'] = $lang->doc->product;
if($app->rawMethod == 'contribute') $config->doc->search['fields']['project'] = $lang->doc->project;
$config->doc->search['fields']['execution'] = $lang->doc->execution;
$config->doc->search['fields']['lib'] = $lang->doc->lib;
$config->doc->search['fields']['status'] = $lang->doc->status;
$config->doc->search['fields']['module'] = $lang->doc->module;
$config->doc->search['fields']['addedBy'] = $lang->doc->addedByAB;
$config->doc->search['fields']['addedDate'] = $lang->doc->addedDate;
@@ -54,7 +55,8 @@ $config->doc->search['fields']['version'] = $lang->doc->version;
$config->doc->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->doc->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->doc->search['params']['lib'] = array('operator' => '=', 'control' => 'select', 'values' => '' );
$config->doc->search['params']['lib'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->doc->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->doc->statusList);
$config->doc->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => '');
if($app->rawMethod == 'contribute') $config->doc->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->doc->search['params']['execution'] = array('operator' => '=', 'control' => 'select', 'values' => '');
+3 -3
View File
@@ -1268,7 +1268,7 @@ class doc extends control
* @param int $objectID
* @param int $libID
* @param int $moduleID
* @param string $browseType
* @param string $browseType all|draft|bysearch
* @param string $orderBy
* @param int $param
* @param int $recTotal
@@ -1277,7 +1277,7 @@ class doc extends control
* @access public
* @return void
*/
public function tableContents($type, $objectID = 0, $libID = 0, $moduleID = 0, $browseType = '', $orderBy = 'id_desc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function tableContents($type, $objectID = 0, $libID = 0, $moduleID = 0, $browseType = 'all', $orderBy = 'status,id_desc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->session->set('createProjectLocate', $this->app->getURI(true), 'doc');
@@ -1324,7 +1324,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, $orderBy, $pager) : $this->doc->getDocs($libID, $moduleID, $orderBy, $pager);
$this->view->docs = $browseType == 'bySearch' ? $this->doc->getDocsBySearch($type, $objectID, $libID, $queryID, $orderBy, $pager) : $this->doc->getDocs($libID, $moduleID, $browseType, $orderBy, $pager);
}
$apiObjectType = $type == 'product' || $type == 'project' ? $type : '';
+3 -2
View File
@@ -1,12 +1,13 @@
#main {padding: 0;}
.container {padding: 0 !important;}
#mainContent {padding: 0;}
.doc-title {width:400px;}
.doc-title input {border: unset; font-size: 18px; font-weight: bold; color: #3c4353; padding-left: 16px;}
.doc-title .form-control:focus {border: unset; box-shadow: unset;}
.doc-title input::-webkit-input-placeholder {color: #D8DBDE;}
.doc-title.required:after {top: 4px; right: 0; left: 12px; display: inline-table;}
#savePath {display:inline-block; width:320px; overflow:hidden; white-space: nowrap; height: 19px; padding-top: 4px; padding-right:8px;}
.contentmarkdown.required:after, .contenthtml.required:after {right:3px;}
#submit {margin-right: 16px;}
#headerBox {border-bottom: 1px solid #e3e3e3;}
#headerBox td:last-child {padding-right: 24px;}
#editorContent {padding: 0;}
@@ -34,7 +35,7 @@
#modalBasicInfo .modal-dialog {width:800px;}
#modalBasicInfo .modal-content {padding:0px;}
#modalBasicInfo .modal-body {padding:10px 30px 10px 10px; overflow-x: hidden !important;}
#modalBasicInfo .modal-body .close {position:absolute; right:15px; top:15px}
#modalBasicInfo .modal-body .close {position:fixed; right:15px; top:15px}
#basicInfoBox{margin-bottom: 10px;}
#basicInfoBox tfoot td {padding-bottom: 0;}
.aclBox .radio-inline{display:block; padding-bottom:5px;}
+2 -1
View File
@@ -89,7 +89,8 @@ li.drag-shadow ul {display: none!important;}
.createDropdown ul > li {text-align: left;}
.createDropdown .btn.btn-info:hover {box-shadow: none;}
.table .c-name > a:first-child {display: inline-block; max-width: 90%; overflow: hidden;}
.table .c-name > .doc-title {display: inline-block; max-width: 90%; overflow: hidden; background: transparent; padding-right:0px;}
.table .c-name > .draft {background-color:rgba(129, 102, 238, 0.12); color:#8166EE;}
.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: -3px;}
table.table > thead > tr {height: 32px;}
+31
View File
@@ -315,3 +315,34 @@ function locateNewLib(type, objectID, libID)
{
location.href = createLink('doc', 'tableContents', 'type=' + type + '&objectID=' + objectID + '&libID=' + libID);
}
/**
* Set save path.
*
* @access public
* @return void
*/
function setSavePath()
{
savePath = defaultSave;
if($('#modalBasicInfo #product').length == 1)
{
savePath += $('#modalBasicInfo #product option:checked').text() + '/';
}
else if($('#modalBasicInfo #project').length == 1 && $('#modalBasicInfo #execution').length == 0)
{
savePath += $('#modalBasicInfo #project option:checked').text() + '/';
}
else if($('#modalBasicInfo #project').length == 1 && $('#modalBasicInfo #execution').length == 1)
{
if($('#modalBasicInfo #execution').val() == '') savePath += $('#modalBasicInfo #project option:checked').text() + '/';
if($('#modalBasicInfo #execution').val() != '') savePath += $('#modalBasicInfo #execution option:checked').text() + '/';
}
else if($('#modalBasicInfo #execution').length == 1)
{
savePath += $('#modalBasicInfo #execution option:checked').text() + '/';
}
savePath += $('#modalBasicInfo #module option:checked').text();
$('#savePath').html(savePath).attr('title', savePath);
}
+35 -1
View File
@@ -4,6 +4,9 @@ $(function()
var contentHeight = $(document).height() - 92;
setTimeout(function(){$('.ke-edit-iframe, .ke-edit, .ke-edit-textarea').height(contentHeight);}, 100);
setTimeout(function(){$('.CodeMirror').height($(document).height() - 112);}, 100);
$('iframe.ke-edit-iframe').contents().find('.article-content').css('padding', '20px 20px 0 20px');
setSavePath();
/* Change for show create error. */
$('#contentBox #content').attr('id', 'contentHTML');
@@ -12,8 +15,39 @@ $(function()
{
$('#modalBasicInfo #copyTitle').html($('.doc-title #editorTitle').val().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"));
});
$('#modalBasicInfo').on('hide.zui.modal', function(){setSavePath();});
$('iframe.ke-edit-iframe').contents().find('.article-content').css('padding', '20px 20px 0 20px');
$('#saveDraft').click(function()
{
if($('#editorTitle').val() == '')
{
bootbox.alert(titleNotEmpty);
return false;
}
$('#status').val('draft');
$('#dataform').submit();
});
$('#basicInfoLink').click(function()
{
if($('#editorTitle').val() == '')
{
bootbox.alert(titleNotEmpty);
return false;
}
if(requiredFields.indexOf('content') >= 0)
{
var contentType = $('#contentType').val();
var content = '';
if(contentType == 'html') content = $('#contentHTML').val();
if(contentType == 'markdown')content = $('#contentMarkdown').val();
if(content == '')
{
bootbox.alert(contentNotEmpty);
return false;
}
}
$('#status').val('normal');
});
setTimeout(function(){initPage(docType)}, 50);
if(typeof(window.editor) != 'undefined')
+9
View File
@@ -1,5 +1,14 @@
$(function()
{
$('#docListForm .table .c-name').each(function()
{
var $this = $(this);
if($this.find('.draft').length > 0)
{
$this.find('.doc-title').css('max-width', parseInt($this.width()) - parseInt($this.find('.draft').width()) - parseInt($this.find('.ajaxCollect').width()) - parseInt($this.find('.file-icon').width()) - 24);
}
});
/**
* Render Dropdown dom.
*
+10
View File
@@ -71,6 +71,7 @@ $lang->doc->comment = 'Bemerkung';
$lang->doc->type = 'Typ';
$lang->doc->content = 'Text';
$lang->doc->keywords = 'Tags';
$lang->doc->status = 'Status';
$lang->doc->url = 'URL';
$lang->doc->files = 'Datei';
$lang->doc->addedBy = 'Angelegt von';
@@ -111,6 +112,8 @@ $lang->doc->doc = 'Document';
$lang->doc->updateOrder = 'Update Order';
$lang->doc->nextStep = 'Next';
$lang->doc->closed = 'Closed';
$lang->doc->saveDraft = 'Save Draft';
$lang->doc->defaultSave = 'Default Save: ';
$lang->doc->moduleDoc = 'Nach Modulen';
$lang->doc->searchDoc = 'Suche';
@@ -196,6 +199,10 @@ $lang->doc->libIconList['custom'] = 'icon-folder-o';
$lang->doc->systemLibs['product'] = $lang->productCommon . 'Dok Bibliothek';
$lang->doc->systemLibs['execution'] = $lang->executionCommon . 'Dok Bibliothek';
$lang->doc->statusList[''] = "";
$lang->doc->statusList['normal'] = "Released";
$lang->doc->statusList['draft'] = "Draft";
$lang->doc->aclList['open'] = "Öffentlich <span class='text-gray'>(Access with library permissions)</span>";
$lang->doc->aclList['private'] = "Privat <span class='text-gray'>(Only creators and whitelist users can access)</span>";
@@ -307,3 +314,6 @@ $lang->doc->libDropdown['addSameModule'] = 'Add Same Directory';
$lang->doc->libDropdown['addSubModule'] = 'Add Sub Directory';
$lang->doc->libDropdown['editModule'] = 'Edit Directory';
$lang->doc->libDropdown['delModule'] = 'Delete Directory';
$lang->doc->featureBar['tableContents']['all'] = 'All';
$lang->doc->featureBar['tableContents']['draft'] = 'Draft';
+10
View File
@@ -71,6 +71,7 @@ $lang->doc->comment = 'Comment';
$lang->doc->type = 'Type';
$lang->doc->content = 'Text';
$lang->doc->keywords = 'Tags';
$lang->doc->status = 'Status';
$lang->doc->url = 'URL';
$lang->doc->files = 'Files';
$lang->doc->addedBy = 'Author';
@@ -111,6 +112,8 @@ $lang->doc->doc = 'Document';
$lang->doc->updateOrder = 'Update Order';
$lang->doc->nextStep = 'Next';
$lang->doc->closed = 'Closed';
$lang->doc->saveDraft = 'Save Draft';
$lang->doc->defaultSave = 'Default Save: ';
$lang->doc->moduleDoc = 'By Module';
$lang->doc->searchDoc = 'Search';
@@ -196,6 +199,10 @@ $lang->doc->libIconList['custom'] = 'icon-folder-o';
$lang->doc->systemLibs['product'] = $lang->productCommon;
$lang->doc->systemLibs['execution'] = $lang->executionCommon;
$lang->doc->statusList[''] = "";
$lang->doc->statusList['normal'] = "Released";
$lang->doc->statusList['draft'] = "Draft";
$lang->doc->aclList['open'] = "Public <span class='text-gray'>(Access with library permissions)</span>";
$lang->doc->aclList['private'] = "Private <span class='text-gray'>(Only creators and whitelist users can access)</span>";
@@ -307,3 +314,6 @@ $lang->doc->libDropdown['addSameModule'] = 'Add Same Directory';
$lang->doc->libDropdown['addSubModule'] = 'Add Sub Directory';
$lang->doc->libDropdown['editModule'] = 'Edit Directory';
$lang->doc->libDropdown['delModule'] = 'Delete Directory';
$lang->doc->featureBar['tableContents']['all'] = 'All';
$lang->doc->featureBar['tableContents']['draft'] = 'Draft';
+10
View File
@@ -71,6 +71,7 @@ $lang->doc->comment = 'Commentaire';
$lang->doc->type = 'Type';
$lang->doc->content = 'Texte';
$lang->doc->keywords = 'Tags';
$lang->doc->status = 'Status';
$lang->doc->url = 'URL';
$lang->doc->files = 'Fichiers';
$lang->doc->addedBy = 'Auteur';
@@ -111,6 +112,8 @@ $lang->doc->doc = 'Document';
$lang->doc->updateOrder = 'Update Order';
$lang->doc->nextStep = 'Next';
$lang->doc->closed = 'Closed';
$lang->doc->saveDraft = 'Save Draft';
$lang->doc->defaultSave = 'Default Save: ';
$lang->doc->moduleDoc = 'Par Module';
$lang->doc->searchDoc = 'Rechercher';
@@ -196,6 +199,10 @@ $lang->doc->libIconList['custom'] = 'icon-folder-o';
$lang->doc->systemLibs['product'] = $lang->productCommon;
$lang->doc->systemLibs['execution'] = $lang->executionCommon;
$lang->doc->statusList[''] = "";
$lang->doc->statusList['normal'] = "Released";
$lang->doc->statusList['draft'] = "Draft";
$lang->doc->aclList['open'] = "Public <span class='text-gray'>(Access with library permissions)</span>";
$lang->doc->aclList['private'] = "Privé <span class='text-gray'>(Only creators and whitelist users can access)</span>";
@@ -308,3 +315,6 @@ $lang->doc->libDropdown['addSameModule'] = 'Add Same Directory';
$lang->doc->libDropdown['addSubModule'] = 'Add Sub Directory';
$lang->doc->libDropdown['editModule'] = 'Edit Directory';
$lang->doc->libDropdown['delModule'] = 'Delete Directory';
$lang->doc->featureBar['tableContents']['all'] = 'All';
$lang->doc->featureBar['tableContents']['draft'] = 'Draft';
+10
View File
@@ -71,6 +71,7 @@ $lang->doc->comment = '文档备注';
$lang->doc->type = '文档类型';
$lang->doc->content = '文档正文';
$lang->doc->keywords = '关键字';
$lang->doc->status = '文档状态';
$lang->doc->url = '文档URL';
$lang->doc->files = '附件';
$lang->doc->addedBy = '由谁添加';
@@ -111,6 +112,8 @@ $lang->doc->doc = '文档';
$lang->doc->updateOrder = '更新排序';
$lang->doc->nextStep = '下一步';
$lang->doc->closed = '已关闭';
$lang->doc->saveDraft = '存为草稿';
$lang->doc->defaultSave = '默认存入:';
$lang->doc->moduleDoc = '按模块浏览';
$lang->doc->searchDoc = '搜索';
@@ -196,6 +199,10 @@ $lang->doc->libIconList['custom'] = 'icon-folder-o';
$lang->doc->systemLibs['product'] = $lang->productCommon;
$lang->doc->systemLibs['execution'] = $lang->executionCommon;
$lang->doc->statusList[''] = "";
$lang->doc->statusList['normal'] = "已发布";
$lang->doc->statusList['draft'] = "草稿";
$lang->doc->aclList['open'] = "公开<span class='text-gray'>(有所属库权限即可访问)</span>";
$lang->doc->aclList['private'] = "私有<span class='text-gray'>(仅创建者和白名单用户可访问)</span>";
@@ -307,3 +314,6 @@ $lang->doc->libDropdown['addSameModule'] = '添加同级目录';
$lang->doc->libDropdown['addSubModule'] = '添加子目录';
$lang->doc->libDropdown['editModule'] = '编辑目录';
$lang->doc->libDropdown['delModule'] = '删除目录';
$lang->doc->featureBar['tableContents']['all'] = '全部';
$lang->doc->featureBar['tableContents']['draft'] = '草稿';
+7 -6
View File
@@ -367,7 +367,7 @@ class docModel extends model
if($browseType == "all")
{
$docs = $this->getDocs(0, 0, $sort, $pager);
$docs = $this->getDocs(0, 0, $browseType, $sort, $pager);
}
elseif($browseType == 'bySearch')
{
@@ -598,13 +598,15 @@ class docModel extends model
* @access public
* @return void
*/
public function getDocs($libID, $module, $orderBy, $pager = null)
public function getDocs($libID, $module, $browseType, $orderBy, $pager = null)
{
$docIdList = $this->getPrivDocs($libID, $module);
return $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->andWhere('id')->in($docIdList)
->beginIF($browseType == 'all')->andWhere("(status = 'normal' or (status = 'draft' and addedBy='{$this->app->user->account}'))")->fi()
->beginIF($browseType == 'draft')->andWhere('status')->eq('draft')->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
@@ -778,6 +780,7 @@ class docModel extends model
unset($doc->contentMarkdown, $doc->contentType, $doc->url);
$requiredFields = $this->config->doc->create->requiredFields;
if($doc->status == 'draft') $requiredFields = '';
if(strpos("url|word|ppt|excel", $this->post->type) !== false) $requiredFields = trim(str_replace(",content,", ",", ",{$requiredFields},"), ',');
$checkContent = strpos(",$requiredFields,", ',content,') !== false;
@@ -930,10 +933,8 @@ class docModel extends model
*/
public function saveDraft($docID)
{
$data = fixer::input('post')
->stripTags($this->config->doc->editor->edit['id'], $this->config->allowedTags)
->get();
$doc = new stdclass();
$data = fixer::input('post')->stripTags($this->config->doc->editor->edit['id'], $this->config->allowedTags)->get();
$doc = new stdclass();
$doc->draft = $data->content;
$docType = $this->dao->select('type')->from(TABLE_DOCCONTENT)->where('doc')->eq((int)$docID)->orderBy('version_desc')->fetch();
+7 -1
View File
@@ -24,7 +24,9 @@
<tr id='headerBox'>
<td width='90px'><?php echo html::a($backLink, '<i class="icon icon-back icon-sm"></i> ' . $lang->goback, '', "class='btn btn-secondary' id='backBtn'");?></td>
<td class="doc-title" colspan='3'><?php echo html::input('title', '', "placeholder='{$lang->doc->titlePlaceholder}' id='editorTitle' class='form-control' required");?></td>
<td class="text-right">
<td class="text-right btn-tools">
<span id='savePath' class='text-gray'></span>
<?php echo html::commonButton($lang->doc->saveDraft, "id='saveDraft'", "btn btn-secondary");?>
<?php echo html::a('#modalBasicInfo', $lang->release->common, '', "data-toggle='modal' id='basicInfoLink' class='btn btn-primary'");?>
</td>
</tr>
@@ -37,6 +39,7 @@
<div class='contentmarkdown <?php echo $contentRequired;?> hidden'><?php echo html::textarea('contentMarkdown', '', "style='width:100%;'");?></div>
<?php echo html::hidden('contentType', 'html');?>
<?php echo html::hidden('type', 'text');?>
<?php echo html::hidden('status', 'normal');?>
</div>
</div>
</td>
@@ -145,4 +148,7 @@
<?php js::set('libNotEmpty', sprintf($lang->error->notempty, $lang->doc->lib));?>
<?php js::set('keywordsNotEmpty', sprintf($lang->error->notempty, $lang->doc->keywords));?>
<?php js::set('from', $from);?>
<?php js::set('defaultSave', $lang->doc->defaultSave);?>
<?php js::set('titleNotEmpty', sprintf($lang->error->notempty, $lang->doc->title));?>
<?php js::set('contentNotEmpty', sprintf($lang->error->notempty, $lang->doc->content));?>
<?php include '../../common/view/footer.lite.html.php';?>
+4 -3
View File
@@ -81,16 +81,17 @@ body {margin-bottom: 25px;}
<td class="c-name" title='<?php echo $doc->title;?>'>
<?php
$docType = $doc->type == 'text' ? 'wiki-file' : $doc->type;
$icon = html::image("static/svg/{$docType}.svg");
$icon = html::image("static/svg/{$docType}.svg", "class='file-icon'");
if(common::hasPriv('doc', 'objectLibs'))
{
echo html::a($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$doc->lib&docID=$doc->id"), $icon . $doc->title, '', "title='{$doc->title}' data-app='{$this->app->tab}'");
echo html::a($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$doc->lib&docID=$doc->id"), $icon . $doc->title, '', "title='{$doc->title}' class='doc-title' data-app='{$this->app->tab}'");
}
else
{
echo "$icon {$doc->title}";
echo "<span class='doc-title'>$icon {$doc->title}</span>";
}
?>
<?php if($doc->status == 'draft') echo "<span class='label label-badge draft'>{$lang->doc->draft}</span>";?>
<?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;?>
+4
View File
@@ -22,6 +22,10 @@
<div id="leftBar" class="btn-toolbar pull-left">
<?php echo $objectDropdown;?>
<?php if(!empty($libTree)):?>
<?php foreach($lang->doc->featureBar['tableContents'] as $barType => $barName):?>
<?php $active = $barType == $browseType ? 'btn-active-text' : '';?>
<?php echo html::a($this->createLink('doc', 'tableContents', "type=$type&objectID=$objectID&libID=$libID&moduleID=$moduleID&browseType=$barType"), $barName, '', "class='btn btn-link $active' id='{$barType}Tab'");?>
<?php endforeach;?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->doc->searchDoc;?></a>
<?php endif;?>
</div>
+1 -1
View File
@@ -126,7 +126,7 @@ class execution extends control
if(!isset($_SESSION['limitedExecutions'])) $this->execution->getLimitedExecution();
if($executionID) $this->session->set("storyList", $this->createLink("execution", "story", "&executionID=" . $executionID));
if($executionID) $this->session->set("storyList", $this->createLink("execution", "story", "&executionID=" . $executionID));
/* Set browse type. */
$browseType = strtolower($status);