* code for task #89136.

This commit is contained in:
wangyidong
2023-03-29 10:39:48 +08:00
parent bb3c743d75
commit efee93ff21
8 changed files with 47 additions and 65 deletions
+1
View File
@@ -1,4 +1,5 @@
UPDATE `zt_doc` SET `type` = 'text' WHERE `type` = 'url';
UPDATE `zt_doc` SET `acl` = 'private' WHERE `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'custom' and `acl` = 'custom';
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'product' AND `acl` = 'custom';
+1 -1
View File
@@ -894,7 +894,7 @@ class commonModel extends model
global $lang, $config, $app;
if(!$tab) return;
if($tab == 'admin' and method_exists($app->control, 'loadModel')) $app->control->loadModel('admin')->setMenu();
if($tab == 'admin' and $app->control and method_exists($app->control, 'loadModel')) $app->control->loadModel('admin')->setMenu();
$icon = zget($lang->navIcons, $tab, '');
if(!in_array($tab, array('program', 'product', 'project')))
+5 -2
View File
@@ -31,9 +31,12 @@
#basicInfoLink {border: unset;}
#modalBasicInfo .modal-content {overflow-x: hidden; overflow-y: scroll;}
#modalBasicInfo .modal-dialog {width:800px;}
#modalBasicInfo .modal-content {padding:0px;}
#modalBasicInfo .modal-header {padding: 0px; border:0px; margin:0px;}
#modalBasicInfo .modal-body {padding-bottom: 10px; padding-top:0px;}
#modalBasicInfo .modal-header .close {position:absolute; right:20px; top:20px}
#modalBasicInfo .modal-body {padding:0 30px 0 10px; ;overflow-x: hidden !important;}
#basicInfoBox{margin-bottom: 10px;}
#basicInfoBox tfoot td {padding-bottom: 0;}
.aclBox .radio-inline{display:block;}
.aclBox .radio-inline+.radio-inline {margin-left: 0px !important;}
+7 -6
View File
@@ -1,11 +1,12 @@
/**
* Load modules by libID.
* Load modules by objectID and objectType.
*
* @param int $libID
* @param string $objectType
* @param int $objectID
* @access public
* @return void
*/
function loadModules(objectType, objectID)
function loadObjectModules(objectType, objectID)
{
var link = createLink('doc', 'ajaxGetModules', 'objectType=' + objectType + '&objectID=' + objectID);
$('#moduleBox').load(link, function(){$('#moduleBox').find('select').chosen()});
@@ -14,15 +15,15 @@ function loadModules(objectType, objectID)
/**
* Load executions.
*
* @param id $projectID
* @param int $projectID
* @access public
* @return void
*/
function loadExecutions(projectID)
{
var link = createLink('project', 'ajaxGetExecutions', "projectID=" + projectID + "&executionID=0&mode=multiple");
$('#executionBox').load(link, function(){$('#executionBox').find('select').attr('data-placeholder', holders.execution).attr('onchange', "loadModules(this.value, 'execution')").chosen()});
loadModules('project', projectID);
$('#executionBox').load(link, function(){$('#executionBox').find('select').attr('data-placeholder', holders.execution).attr('onchange', "loadObjectModules('execution', this.value)").chosen()});
loadObjectModules('project', projectID);
}
/**
+15 -14
View File
@@ -1,21 +1,22 @@
$(function()
{
/* Set editor content height. */
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);
/* Change for show create error. */
$('#contentBox #content').attr('id', 'contentHTML');
/* Copy doc title to modal title. */
$('#modalBasicInfo').on('show.zui.modal', function()
{
$('#modalBasicInfo #copyTitle').html($('.doc-title #editorTitle').val().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"));
});
$('iframe.ke-edit-iframe').contents().find('.article-content').css('padding', '20px 20px 0 20px');
toggleAcl($('input[name="acl"]:checked').val(), 'doc');
setTimeout(function(){initPage(docType)}, 50);
$('input[name="type"]').change(function()
{
var type = $(this).val();
if(type == 'text')
{
$('#contentBox').removeClass('hidden');
$('#urlBox').addClass('hidden');
}
else if(type == 'url')
{
$('#contentBox').addClass('hidden');
$('#urlBox').removeClass('hidden');
}
});
if(typeof(window.editor) != 'undefined')
{
$('.ke-toolbar .ke-outline:last').after("<span data-name='unlink' class='ke-outline' title='Markdown' onclick='toggleEditor(\"markdown\")' style='font-size: unset; line-height: unset;'>Markdown</span>");
+2 -7
View File
@@ -196,12 +196,8 @@ $lang->doc->libIconList['custom'] = 'icon-folder-o';
$lang->doc->systemLibs['product'] = $lang->productCommon;
$lang->doc->systemLibs['execution'] = $lang->executionCommon;
$lang->doc->aclList['open'] = '公开';
$lang->doc->aclList['custom'] = '自定义';
$lang->doc->aclList['private'] = '私有';
$lang->doc->projectAclList['open'] = "公开<span class='text-gray'>(有所属库权限即可访问)</span>";
$lang->doc->projectAclList['private'] = "私有<span class='text-gray'>(仅创建者和白名单用户可访问)</span>";
$lang->doc->aclList['open'] = "公开<span class='text-gray'>(有所属库权限即可访问)</span>";
$lang->doc->aclList['private'] = "私有<span class='text-gray'>(仅创建者和白名单用户可访问)</span>";
$lang->doc->typeList['html'] = '富文本';
$lang->doc->typeList['markdown'] = 'Markdown';
@@ -211,7 +207,6 @@ $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';
+2 -11
View File
@@ -2914,7 +2914,7 @@ class docModel extends model
*/
public function printCreateBtn($lib, $type, $objectID, $moduleID, $apiLibID = 0, $from = '')
{
$libType = isset($lib->type) && $lib->type == 'api' ? 'api' : 'lib';
if(!common::hasPriv('doc', 'create')) return null;
$class = $from == 'list' ? 'btn-info' : 'btn-primary';
$html = "<div class='dropdown btn-group createDropdown'>";
@@ -2925,19 +2925,10 @@ class docModel extends model
foreach($this->lang->doc->createList as $typeKey => $typeName)
{
if($this->config->edition != 'max' and $typeKey == 'template') continue;
if($typeKey == 'api' and (!common::hasPriv('api', 'create') or !$apiLibID)) continue;
if($typeKey != 'api' and !common::hasPriv('doc', 'create')) continue;
$attr = "data-app='{$this->app->tab}'";
$module = $typeKey == 'api' ? 'api' : 'doc';
$class = strpos($this->config->doc->officeTypes, $typeKey) !== false ? 'iframe' : '';
$params = "objectType={$lib->type}&objectID=$objectID&libID={$lib->id}&moduleID=$moduleID&type=$typeKey";
if($typeKey == 'api')
{
$attr .= " data-width='85%'";
$params = "libID=$apiLibID&moduleID=$moduleID";
}
$html .= "<li>";
if($typeKey == 'template')
@@ -2965,7 +2956,7 @@ class docModel extends model
}
else
{
$html .= html::a(helper::createLink($module, 'create', $params, '', $class ? true : false), $typeName, '', "class='$class' $attr");
$html .= html::a(helper::createLink('doc', 'create', $params, '', $class ? true : false), $typeName, '', "class='$class' $attr");
}
$html .= "</li>";
+14 -24
View File
@@ -32,8 +32,9 @@
<td colspan='5' id="editorContent">
<div class="main-row fade in">
<div id='contentBox' class="main-col">
<div class='contenthtml'><?php echo html::textarea('content', '', "style='width:100%;'");?></div>
<div class='contentmarkdown <?php if(strpos($config->doc->create->requiredFields, 'content') !== false) echo 'required'?> hidden'><?php echo html::textarea('contentMarkdown', '', "style='width:100%;'");?></div>
<?php $contentRequired = strpos($config->doc->create->requiredFields, 'content') !== false ? 'required' : '';?>
<div class='contenthtml <?php echo $contentRequired?>'><?php echo html::textarea('content', '', "style='width:100%;'");?></div>
<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');?>
</div>
@@ -43,9 +44,9 @@
</tbody>
</table>
<div class='modal fade modal-basic' id='modalBasicInfo' data-scroll-inside='true'>
<div class='modal fade modal-basic' id='modalBasicInfo'>
<div class='modal-dialog'>
<div class='modal-content with-padding'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal'>
<i class="icon icon-close"></i>
@@ -57,19 +58,24 @@
<tr><th class='w-100px'></th><td></td><th class='w-100px'></th><td></td></tr>
<tr>
<th><?php echo $lang->doc->title?></th>
<td colspan='3' class='required'><?php echo html::input('copyTitle', '', "placeholder='{$lang->doc->titlePlaceholder}' class='form-control' disabled");?></td>
<td colspan='3' id='copyTitle'></td>
</tr>
<?php if($objectType == 'project'):?>
<tr>
<th><?php echo $lang->doc->project;?></th>
<td class='required'><?php echo html::select('project', $objects, $objectID, "class='form-control chosen' onchange=loadExecutions(this.value)");?></td>
<th><?php echo $lang->doc->execution?></th>
<td id='executionBox'><?php echo html::select('execution', $executions, '', "class='form-control chosen' data-placeholder='{$lang->doc->placeholder->execution}' onchange='loadModules(this.value, \"execution\")'")?></td>
<td id='executionBox'><?php echo html::select('execution', $executions, '', "class='form-control chosen' data-placeholder='{$lang->doc->placeholder->execution}' onchange='loadObjectModules(\"execution\", this.value)'")?></td>
</tr>
<?php elseif($objectType == 'product'):?>
<tr>
<th><?php echo $lang->doc->product;?></th>
<td class='required'><?php echo html::select('product', $objects, $objectID, "class='form-control chosen' onchange='loadObjectModules(\"product\", this.value)'");?></td>
</tr>
<?php endif;?>
<tr>
<th class='w-100px'><?php echo $lang->doc->libAndModule?></th>
<td><span id='moduleBox' class='required'><?php echo html::select('module', $moduleOptionMenu, $moduleID, "class='form-control chosen'");?></span></td>
<td colspan='3'><span id='moduleBox' class='required'><?php echo html::select('module', $moduleOptionMenu, $moduleID, "class='form-control chosen'");?></span></td>
</tr>
<tr>
<th><?php echo $lang->doc->keywords;?></th>
@@ -93,9 +99,7 @@
<tr>
<th class="th-control text-top"><?php echo $lang->doclib->control;?></th>
<td colspan='3' class='aclBox'>
<?php $aclList = $lang->doc->aclList;?>
<?php if($objectType == 'project') $aclList = $lang->doc->projectAclList;?>
<?php echo html::radio('acl', $aclList, 'open', "onchange='toggleAcl(this.value, \"doc\")'");?>
<?php echo html::radio('acl', $lang->doc->aclList, 'open', "onchange='toggleAcl(this.value, \"doc\")'");?>
</td>
</tr>
<tr id='whiteListBox' class='hidden'>
@@ -128,20 +132,6 @@
</div>
</form>
</div>
<script>
$(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);
$('#modalBasicInfo .modal-content').css('max-height', contentHeight);
$('#contentBox #content').attr('id', 'contentHTML');
$('#modalBasicInfo').on('show.zui.modal', function(){$('#modalBasicInfo #copyTitle').val($('.doc-title #editorTitle').val())});
$('iframe.ke-edit-iframe').contents().find('.article-content').css('padding', '20px 20px 0 20px');
})
</script>
<?php js::set('textType', $config->doc->textTypes);?>
<?php js::set('docType', $docType);?>
<?php js::set('fromGlobal', $fromGlobal);?>