* Code for task #89915.

This commit is contained in:
tianshujie
2023-04-04 14:37:45 +08:00
parent f5448921c6
commit 1bd3209351
18 changed files with 323 additions and 1009 deletions
+36 -153
View File
@@ -275,7 +275,7 @@ class doc extends control
* @param int $libID
* @param string $confirm yes|no
* @param string $type lib|book
* @param string $from tableContents|objectLibs
* @param string $from tableContents|view
* @access public
* @return void
*/
@@ -284,8 +284,7 @@ class doc extends control
if($libID == 'product' or $libID == 'execution') return;
if($confirm == 'no')
{
$deleteTip = $type == 'book' ? $this->lang->doc->confirmDeleteBook : $this->lang->doc->confirmDeleteLib;
return print(js::confirm($deleteTip, $this->createLink('doc', 'deleteLib', "libID=$libID&confirm=yes&type=$type&from=$from")));
return print(js::confirm($this->lang->doc->confirmDeleteLib, $this->createLink('doc', 'deleteLib', "libID=$libID&confirm=yes&type=$type&from=$from")));
}
else
{
@@ -293,11 +292,6 @@ class doc extends control
if(!empty($lib->main)) return print(js::alert($this->lang->doc->errorMainSysLib));
$this->doc->delete(TABLE_DOCLIB, $libID);
if(isonlybody())
{
unset($_GET['onlybody']);
return print(js::locate($this->createLink('doc', 'objectLibs', 'type=book'), 'parent.parent'));
}
if($this->app->tab == 'doc' and $from == 'tableContents') return print(js::reload('parent'));
$objectType = $lib->type;
@@ -354,8 +348,8 @@ class doc extends control
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $docID));
$objectID = zget($lib, $lib->type, 0);
$params = "type=$linkType&objectID=$objectID&libID={$lib->id}&docID=" . $docResult['id'];
$link = isonlybody() ? 'parent' : $this->createLink('doc', 'objectLibs', $params);
$params = "docID=" . $docResult['id'];
$link = isonlybody() ? 'parent' : $this->createLink('doc', 'view', $params);
$response = array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link);
return $this->send($response);
@@ -506,7 +500,7 @@ class doc extends control
if(!empty($objectType) and $objectType != 'doc' and $doc->type != 'chapter' and $doc->type != 'article')
{
$link = $this->createLink('doc', 'objectLibs', "type={$lib->type}&objectID=$objectID&libID={$doc->lib}&docID=$docID") . "#app={$this->app->tab}";
$link = $this->createLink('doc', 'view', "docID=$docID") . "#app={$this->app->tab}";
}
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
@@ -585,67 +579,6 @@ class doc extends control
$this->display();
}
/**
* View a doc.
*
* @param int $docID
* @param int $version
* @access public
* @return void
*/
public function view($docID, $version = 0)
{
/* Get doc. */
$docID = (int)$docID;
$doc = $this->doc->getById($docID, $version, true);
if(!$doc)
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found'));
return print(js::error($this->lang->notFound) . js::locate($this->createLink('doc', 'index')));
}
/* The global search opens in the document library. */
if(!isonlybody())
{
$docLib = $this->doc->getLibById($doc->lib);
if($docLib->type == 'custom')
{
$libID = $doc->lib;
$objectID = 0;
$type = 'custom';
}
else
{
$libID = $docLib->id;
$type = $docLib->type;
$objectID = $docLib->$type;
}
$browseLink = inLink('objectLibs', "type=$type&objectID=$objectID&libID=$libID&docID=$docID");
if(!(defined('RUN_MODE') && RUN_MODE == 'api')) $this->locate($browseLink);
}
/* Check priv when lib is product or project. */
$lib = $this->doc->getLibByID($doc->lib);
$type = $lib->type;
$this->view->title = "DOC #$doc->id $doc->title - " . $lib->name;
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $lib->name);
$this->view->position[] = $this->lang->doc->view;
$this->view->doc = $doc;
$this->view->lib = $lib;
$this->view->type = $type;
$this->view->version = $version ? $version : $doc->version;
$this->view->actions = $this->action->getList('doc', $docID);
$this->view->users = $this->user->getPairs('noclosed,noletter');
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('doc', $docID);
$this->view->keTableCSS = $this->doc->extractKETableCSS($doc->content);
$this->view->autoloadPage = $this->doc->checkAutoloadPage($doc);
$this->display();
}
/**
* Delete a doc.
*
@@ -697,8 +630,25 @@ class doc extends control
if($from == 'lib')
{
$objectID = $objectType == 'project' ? $doc->project : $doc->product;
$response['locate'] = $this->createLink('doc', 'objectLibs', "type=$objectType&objectID={$objectID}&libID={$doc->lib}");
$method = 'tableContents';
$objectID = 0;
if($objectType == 'product')
{
$method = 'productSpace';
$objectID = $doc->product;
}
elseif(in_array($objectType, array('project', 'execution')) and $this->app->tab != 'execution')
{
$method = 'projectSpace';
$objectID = $doc->project;
}
elseif($this->app->tab == 'execution')
{
$objectID = $doc->execution;
}
$params = "objectID={$objectID}&libID={$doc->lib}";
if($method == 'tableContents') $params = "type=$objectType&" . $params;
$response['locate'] = $this->createLink('doc', $method, $params);
}
}
return $this->send($response);
@@ -1079,53 +1029,6 @@ class doc extends control
$this->display();
}
/**
* Show all libs by type.
*
* @param string $type
* @param string $product
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function allLibs($type, $product = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
setcookie('product', $product, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
$libName = $this->lang->doc->libTypeList[$type];
$crumb = html::a(inlink('allLibs', "type=$type&product=$product"), $libName);
if($product and $type == 'executionCommon') $crumb = $this->doc->getProductCrumb($product);
$this->view->title = $libName;
$this->view->position[] = $libName;
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$libs = $this->doc->getAllLibsByType($type, $pager);
$subLibs = array();
if($type == 'product' or $type == 'execution')
{
$subLibs = $this->doc->getSubLibGroups($type, array_keys($libs));
if($this->cookie->browseType == 'bylist') $this->view->users = $this->user->getPairs('noletter');
}
else
{
$this->view->itemCounts = $this->doc->statLibCounts(array_keys($libs));
}
$this->view->type = $type;
$this->view->libs = $libs;
$this->view->subLibs = $subLibs;
$this->view->pager = $pager;
$this->view->product = $product;
$this->view->from = $this->lang->navGroup->doc == 'project' ? 'project' : 'doc';
$this->display();
}
/**
* Show accessDenied response.
*
@@ -1145,28 +1048,28 @@ class doc extends control
}
/**
* Show libs for product or project.
* Document details page.
*
* @param string $type
* @param int $objectID projectID|productID
* @param int $libID
* @param int $docID
* @param int $version
* @param int $appendLib
* @param int $docID
* @param int $version
* @param int $appendLib
* @access public
* @return void
*/
public function objectLibs($type, $objectID = 0, $libID = 0, $docID = 0, $version = 0, $appendLib = 0)
public function view($docID = 0, $version = 0, $appendLib = 0)
{
$lib = $this->doc->getLibById($libID);
if(!empty($lib) and $lib->deleted == '1') $appendLib = $libID;
$doc = $this->doc->getById($docID);
$lib = $this->doc->getLibById($doc->lib);
if(!empty($lib) and $lib->deleted == '1') $appendLib = $doc->id;
list($libs, $libID, $object, $objectID) = $this->doc->setMenuByType($type, $objectID, $libID, $appendLib);
$type = $lib->type;
$objectID = isset($doc->{$type}) ? $doc->{$type} : 0;
list($libs, $libID, $object, $objectID) = $this->doc->setMenuByType($type, $objectID, $doc->lib, $appendLib);
/* Set Custom. */
foreach(explode(',', $this->config->doc->customObjectLibs) as $libType) $customObjectLibs[$libType] = $this->lang->doc->customObjectLibs[$libType];
$moduleTree = $type == 'book' ? $this->doc->getBookStructure($libID) : $this->doc->getTreeMenu($type, $objectID, $libID, 0, $docID);
$moduleTree = $this->doc->getTreeMenu($type, $objectID, $libID, 0, $docID);
/* Get doc. */
if($docID)
@@ -1441,26 +1344,6 @@ class doc extends control
$this->display();
}
/**
* Sort libs.
* @param string $type
* @param int $objectID
*
* @access public
* @return void
*/
public function sortLibs($type, $objectID)
{
if(!empty($_POST))
{
$this->doc->updateLibOrder();
return print(js::reload('parent.parent'));
}
$this->view->title = $this->lang->doc->sortLibs;
$this->view->libs = $this->doc->getLibs($type, '', '', $objectID);
$this->display();
}
/**
* Ajax get objectType drop menu.
*
-53
View File
@@ -1,53 +0,0 @@
.lib {width: 130px; margin-bottom: 10px;}
.addbtn {padding-top: 22px; height: 63px; border: 1px dashed #ddd; width: 60px;}
.addbtn .icon-plus {font-size: 18px; display: block; opacity: 0.5; transition: opacity .2s; text-shadow: 1px 1px 3px rgba(0,0,0,.2);}
.addbtn:hover .icon-plus {opacity: .9; animation: flash-icon 1s linear alternate infinite;}
#subHeader #dropMenu {min-width: 250px; box-sizing: inherit; max-height: inherit;}
#subHeader #dropMenu .table-col .list-group {padding-top: 10px;}
.main-col .block-files .panel-heading {padding-right: 20px;}
.main-col .block-files .panel-heading .panel-title {height: 35px; line-height: 30px;}
.side-col .action a {margin: 0 auto 3px; display: block; max-width: 200px;}
.side-col .tips {padding: 0 10px;}
.main-col .doc-title {display: flex; font-size: 16px; margin-bottom: 15px;}
.main-col .doc-title .title {margin-right: 10px; line-height: 32px; font-size: 25px;}
.main-col .doc-title .info {flex: 1 1 0;}
.main-col .doc-title .version a {font-size: 13px; color: #8c8c8c;}
.main-col .doc-title .version .dropdown-menu a:hover {color: #ffffff;}
.main-col .doc-title .actions a + a {margin-left: 8px;}
.main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;}
#content .title {max-width: 54%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
#content .detail-content {padding-left: 10px;}
#mainContent .scrollbar-hover {max-height: 2000px; overflow: scroll;}
#content .editor-preview {background: #fff}
#content .CodeMirror{border: none}
#sidebar {width: 275px;}
#sidebar>.cell {width: 100%;}
#sidebar>.sidebar-toggle {left: 3px; right: auto;}
.hide-sidebar #sidebar>.cell {display: none;}
.hide-sidebar #sidebar>.sidebar-toggle>.icon:before {content: "\e314";}
.detail.empty {line-height: 200px;}
.main-col+.side-col {padding-left: 16px;}
.main-col iframe {min-height: 380px;}
.article-content .keywords {margin-bottom: 15px;}
.article-content {width: 100%; display: inline-block;}
.outline {position: relative;}
.outline .outline-toggle i.icon-angle-right, i.icon-angle-left {width: 18px; height: 18px; border-radius: 50%; position: absolute; padding-left: 2px; padding-top: 1px;}
.outline .outline-toggle i.icon-angle-right:before {content: "\e314"; cursor: pointer;}
.outline .outline-toggle i.icon-angle-left:before {content: "\e315"; cursor: pointer;}
.outline ul li {list-style: none;}
.outline-content {display: none; padding-top: 18px;}
.outline-content a {color: #838A9D;}
.outline-content li.text-ellipsis.active>a {font-weight: 700; color: #0c64eb;}
#outline li.has-list.open:before {content: unset;}
.title {font-size: 20px !important;}
.article-content.comment {width: 100% !important;}
.tree-group {position: relative;}
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
.tree-group .tree-actions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
.tree-group:hover > .module-name {width: calc(100% - 20px);}
.tree-group:hover .tree-actions {display: block}
.tree li.has-list.open:before {left: 6px;}
.sortable-sorting .tree-group:hover .tree-actions {display: none;}
-5
View File
@@ -1,5 +0,0 @@
#mainContent .doclib-name {font-size: 13px; font-weight: 550; padding: 10px 0px;}
#mainContent #libs {padding-bottom: 10px;}
#mainContent #libs .lib {padding-bottom: 5px;}
#mainContent #libs .lib .lib-name{cursor: pointer;}
#mainContent #libs .lib .icon-move {padding-left: 4px; font-size:13px; vertical-align: text-top; cursor: pointer;}
+1 -1
View File
@@ -31,7 +31,7 @@
span.item>a {padding-left: 6px;}
span.dotted-line+a {display: block;}
#modules li.doc:before, .chapterNode:before, .independent:before {content: " "; width: 100%; border-bottom: 1px dashed #b5b9c5; position: absolute; top: 13px; right: 0; left: 30px;}
.doc-title ,.item{display: inline-block !important; position: relative; padding-right: 10px; max-width:80%; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;}
.doc-title ,.item{display: inline-block !important; position: relative; padding-right: 10px; max-width:80%; white-space: nowrap; text-overflow: clip; overflow: hidden;}
#modules i.icon-file-text {color: #D0D2D6; font-size: 14px;}
.sortable-sorting .module-name > a {cursor: move;}
+51 -23
View File
@@ -1,25 +1,53 @@
.versions .dropdown-menu {max-height: 260px; overflow-y: auto;}
.table-data > tbody > tr > th.w-80px {width: 80px;}
.detail-content .file-image {position: relative; padding: 0 10px; margin-right: 10px;}
.detail-content .file-image > span.right-icon {position: absolute; right: -10px; top: 0;}
#urlIframe {border: 0px;}
.lib {width: 130px; margin-bottom: 10px;}
.addbtn {padding-top: 22px; height: 63px; border: 1px dashed #ddd; width: 60px;}
.addbtn .icon-plus {font-size: 18px; display: block; opacity: 0.5; transition: opacity .2s; text-shadow: 1px 1px 3px rgba(0,0,0,.2);}
.addbtn:hover .icon-plus {opacity: .9; animation: flash-icon 1s linear alternate infinite;}
#subHeader #dropMenu {min-width: 250px; box-sizing: inherit; max-height: inherit;}
#subHeader #dropMenu .table-col .list-group {padding-top: 10px;}
.main-col .block-files .panel-heading {padding-right: 20px;}
.main-col .block-files .panel-heading .panel-title {height: 35px; line-height: 30px;}
.side-col .action a {margin: 0 auto 3px; display: block; max-width: 200px;}
.side-col .tips {padding: 0 10px;}
.main-col .doc-title {display: flex; font-size: 16px; margin-bottom: 15px;}
.main-col .doc-title .title {margin-right: 10px; line-height: 32px; font-size: 25px;}
.main-col .doc-title .info {flex: 1 1 0;}
.main-col .doc-title .version a {font-size: 13px; color: #8c8c8c;}
.main-col .doc-title .version .dropdown-menu a:hover {color: #ffffff;}
.main-col .doc-title .actions a + a {margin-left: 8px;}
.main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;}
#content .title {max-width: 54%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
#content .detail-content {padding-left: 10px;}
#mainContent .scrollbar-hover {max-height: 2000px; overflow: scroll;}
#content .editor-preview {background: #fff}
#content .CodeMirror{border: none}
#sidebar {width: 275px;}
#sidebar>.cell {width: 100%;}
#sidebar>.sidebar-toggle {left: 3px; right: auto;}
.hide-sidebar #sidebar>.cell {display: none;}
.hide-sidebar #sidebar>.sidebar-toggle>.icon:before {content: "\e314";}
.detail.empty {line-height: 200px;}
.main-col+.side-col {padding-left: 16px;}
.main-col iframe {min-height: 380px;}
.article-content .keywords {margin-bottom: 15px;}
#urlCard {border: 1px solid #ccc; width: 100%; min-height: 100px; padding: 8px; border-radius: 4px; margin: 103px 0;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05), 0 2px 6px 0 rgba(0,0,0,.045);
box-shadow: 0 1px 1px rgba(0,0,0,.05), 0 2px 6px 0 rgba(0,0,0,.045);
}
#urlCard .url-icon {float: left; width: 45px; height: 45px; margin-right: 5px;}
#urlCard .url-content {padding-left: 55px;}
#urlCard .url-title {font-weight:bold; font-size: 16px; min-height: 20px;}
#urlCard .url-href a {color: #888;}
.article-content {width: 100%; display: inline-block;}
.outline {position: relative;}
.outline .outline-toggle i.icon-angle-right, i.icon-angle-left {width: 18px; height: 18px; border-radius: 50%; position: absolute; padding-left: 2px; padding-top: 1px;}
.outline .outline-toggle i.icon-angle-right:before {content: "\e314"; cursor: pointer;}
.outline .outline-toggle i.icon-angle-left:before {content: "\e315"; cursor: pointer;}
.outline ul li {list-style: none;}
.outline-content {display: none; padding-top: 18px;}
.outline-content a {color: #838A9D;}
.outline-content li.text-ellipsis.active>a {font-weight: 700; color: #0c64eb;}
#outline li.has-list.open:before {content: unset;}
.main-row > .side-col {transition: width .2s;}
.main-row > .main-col .article-content {transition: max-width; margin: 0 auto !important;}
.main-row > .side-col > .cell {transition: opacity .2s; margin-bottom: 10px;}
.doc-fullscreen .main-row > .side-col {width: 0; position: relative; overflow: hidden;}
.doc-fullscreen .fullscreen-btn > .icon-fullscreen:before {content: '\e972';}
.right-icon a {color: #1183fb;}
.cell th,td {word-break: break-word;}
.main-actions {width: 100% !important;}
.main-col .editor-preview {background: #fff}
.main-col .CodeMirror{border: none}
.title {font-size: 20px !important;}
.article-content.comment {width: 100% !important;}
.tree-group {position: relative;}
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
.tree-group .tree-actions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
.tree-group:hover > .module-name {width: calc(100% - 20px);}
.tree-group:hover .tree-actions {display: block}
.tree li.has-list.open:before {left: 6px;}
.sortable-sorting .tree-group:hover .tree-actions {display: none;}
-202
View File
@@ -1,202 +0,0 @@
$(function()
{
if($.cookie('isFullScreen') == 1) fullScreen();
$('.menu-actions > a').click(function()
{
$(this).parent().hasClass('open') ? $(this).css('background', 'none') : $(this).css('background', '#f1f1f1');
})
$('.menu-actions > a').blur(function() {$(this).css('background', 'none');})
})
/**
* Ajax delete doc.
*
* @param string $link
* @param int $replaceID
* @param stirng $notice
* @access public
* @return void
*/
function ajaxDeleteDoc(link, replaceID, notice)
{
if(confirm(notice))
{
$.get(link, function(data)
{
location.href = JSON.parse(data).locate;
});
}
}
/**
* Delete a file.
*
* @param int $fileID
* @access public
* @return void
*/
function deleteFile(fileID)
{
if(!fileID) return;
hiddenwin.location.href = createLink('file', 'delete', 'fileID=' + fileID);
}
/**
* Display the document in full screen.
*
* @access public
* @return void
*/
function fullScreen()
{
var element = document.getElementById('content');
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen;
if(requestMethod)
{
var afterEnterFullscreen = function()
{
$('#mainActions').removeClass('hidden');
$('#content').addClass('scrollbar-hover');
$('#content .actions').addClass('hidden');
$('#content .file-image .right-icon').addClass('hidden');
$('#content .detail').eq(1).addClass('hidden');
$.cookie('isFullScreen', 1);
};
var whenFailEnterFullscreen = function(error)
{
$.cookie('isFullScreen', 0);
};
try
{
var result = requestMethod.call(element);
if(result && (typeof result.then === 'function' || result instanceof window.Promise))
{
result.then(afterEnterFullscreen).catch(whenFailEnterFullscreen);
}
else
{
afterEnterFullscreen();
}
}
catch (error)
{
whenFailEnterFullscreen(error);
}
}
$('.main-col iframe').css('min-height', $(window).height() + 'px');
}
/**
* Exit full screen.
*
* @access public
* @return void
*/
function exitFullScreen()
{
$('#mainActions').addClass('hidden');
$('#content').removeClass('scrollbar-hover');
$('#content .actions').removeClass('hidden');
$('#content .file-image .right-icon').removeClass('hidden');
$('#content .detail').eq(1).removeClass('hidden');
$('.main-col iframe').css('min-height', '380px');
$.cookie('isFullScreen', 0);
}
document.addEventListener('fullscreenchange', function (e)
{
if(!document.fullscreenElement) exitFullScreen();
});
document.addEventListener('webkitfullscreenchange', function (e)
{
if(!document.webkitFullscreenElement) exitFullScreen();
});
document.addEventListener('mozfullscreenchange', function (e)
{
if(!document.mozFullScreenElement) exitFullScreen();
});
document.addEventListener('msfullscreenChange', function (e)
{
if(!document.msfullscreenElement) exitFullScreen();
});
$(function()
{
$(document).keydown(function(event)
{
if($.cookie('isFullScreen') == 1)
{
if(event.keyCode == 37) $('#prevPage').click();
if(event.keyCode == 39) $('#nextPage').click();
}
});
$('.outline').height($('.article-content').height());
$('#content').on('click', '.outline .outline-toggle i.icon-angle-right', function()
{
$('.article-content').css('width', '85%');
$('.outline').css({'min-width' : '180px', 'border-left' : '2px solid #efefef'});
$(this).removeClass('icon-angle-right').addClass('icon-angle-left').css('left', '-9px');
$('.outline-content').show();
if($('#sidebar>.cell').is(':visible')) $('#sidebar .icon.icon-angle-right').trigger("click");
}).on('click', '.outline .outline-toggle i.icon-angle-left', function()
{
$('.article-content').width('100%');
$(this).removeClass('icon-angle-left').addClass('icon-angle-right');
$('.outline-content').hide();
}).on('click', '#outline li', function(e)
{
$('#outline li.active').removeClass('active');
$(e.target).closest('li').addClass('active');
});
$('#outline li.has-list').addClass('open in');
$('#outline li.has-list>i+ul').prev('i').remove();
$(document).on('click', '.detail-content a', function(event)
{
var target = $(this).attr('target');
if($.cookie('isFullScreen') == 1 && target != '_blank') exitFullScreen();
})
/* Update doc content silently on switch doc version, story #40503 */
$(document).on('click', '.doc-version-menu a, #mainActions .container a', function(event)
{
var $tmpDiv = $('<div>');
$tmpDiv.load($(this).data('url') + ' #mainContent', function()
{
$('#content').html($tmpDiv.find('#content').html());
$('#sidebarContent').html($tmpDiv.find('#sidebarContent').html());
$('#actionbox .histories-list').html($tmpDiv.find('#actionbox .histories-list').html());
if($.cookie('isFullScreen') == 1) fullScreen();
$('#content [data-ride="tree"]').tree();
$('#outline li.has-list').addClass('open in');
$('#outline li.has-list>i+ul').prev('i').remove();
if($('#markdownContent').val())
{
var simplemde = new SimpleMDE({element: $("#markdownContent")[0],toolbar:false, status: false});
simplemde.value(String($('#markdownContent').val()));
simplemde.togglePreview();
}
});
});
$('#sidebar .icon.icon-angle-right').click(function()
{
if($('#sidebar>.cell').is(':hidden') && $('.outline-content').is(':visible'))
{
$('.outline .outline-toggle i.icon-angle-left').trigger("click");
}
})
$('.outline .outline-toggle i.icon-angle-right').trigger("click");
})
-40
View File
@@ -1,40 +0,0 @@
$(function()
{
/* Make libs sortable. */
$('#libs').sortable(
{
trigger: '.lib > .icon-move, .lib > .lib-name',
dropToClass: 'sort-to',
stopPropagation: true,
nested: true,
selector: 'div',
dragCssClass: 'drop-here',
canMoveHere: function($ele, $target)
{
var maxTop = $('#libs .libList').height() - $ele.height();
if(parseFloat($('.drag-shadow').css('top')) < 0) $('.drag-shadow').css('top', '0');
if(parseFloat($('.drag-shadow').css('left')) != 0) $('.drag-shadow').css('left', '0');
if(parseFloat($('.drag-shadow').css('top')) > maxTop) $('.drag-shadow').css('top', maxTop + 'px');
if(parseFloat($('.drag-shadow').css('bottom')) > $('#libs').height()) $('.drag-shadow').css('bottom', '0');
return true;
},
targetSelector: function($ele, $root)
{
var $libs = $ele.closest('#libs .libList');
return $libs.children('div.lib');
},
always: function()
{
$('#libs,#libs .is-sorting').removeClass('is-sorting');
},
finish: function(e)
{
var orders = ',';
$('#libs .libList').find('div.lib').each(function()
{
orders += $(this).attr('data-id') + ',';
});
$('#libIdList').attr('value', orders);
}
});
});
+191 -31
View File
@@ -1,42 +1,202 @@
$(function()
{
var isFullscreen = $.cookie('docFullscreen') == 'true';
$('body').toggleClass('doc-fullscreen', isFullscreen);
$('.side-col').toggleClass('hidden', isFullscreen);
$('#mainMenu .fullscreen-btn').attr('title', isFullscreen ? retrack : fullscreen);
$('#mainMenu .fullscreen-btn').html('<i class="icon icon-fullscreen"></i> ' + (isFullscreen ? retrack : fullscreen));
if($.cookie('isFullScreen') == 1) fullScreen();
$('#mainMenu .fullscreen-btn').click(function()
$('.menu-actions > a').click(function()
{
$('.side-col').toggleClass('hidden');
$('body').toggleClass('doc-fullscreen');
$(this).parent().hasClass('open') ? $(this).css('background', 'none') : $(this).css('background', '#f1f1f1');
})
var isFullscreen = $('body').hasClass('doc-fullscreen');
$('#mainMenu .fullscreen-btn').attr('title', isFullscreen ? retrack : fullscreen);
$('#mainMenu .fullscreen-btn').html('<i class="icon icon-fullscreen"></i> ' + (isFullscreen ? retrack : fullscreen));
$.cookie('docFullscreen', isFullscreen);
setTimeout($.resetToolbarPosition, 50);
});
if(!canDeleteFile)
{
$('.detail-content .files-list li').each(function()
{
$(this).find('a[onclick^=deleteFile]').remove();
});
}
if($('#urlIframe').size() > 0)
{
var defaultHeight = $('#mainContent .main-col').height() - 50;
$('#urlIframe').height(defaultHeight);
setTimeout($.resetToolbarPosition, 50);
}
$('.menu-actions > a').blur(function() {$(this).css('background', 'none');})
})
/**
* Ajax delete doc.
*
* @param string $link
* @param int $replaceID
* @param stirng $notice
* @access public
* @return void
*/
function ajaxDeleteDoc(link, replaceID, notice)
{
if(confirm(notice))
{
$.get(link, function(data)
{
location.href = JSON.parse(data).locate;
});
}
}
/**
* Delete a file.
*
* @param int $fileID
* @access public
* @return void
*/
function deleteFile(fileID)
{
if(!fileID) return;
hiddenwin.location.href =createLink('doc', 'deleteFile', 'docID=' + docID + '&fileID=' + fileID);
hiddenwin.location.href = createLink('file', 'delete', 'fileID=' + fileID);
}
/**
* Display the document in full screen.
*
* @access public
* @return void
*/
function fullScreen()
{
var element = document.getElementById('content');
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen;
if(requestMethod)
{
var afterEnterFullscreen = function()
{
$('#mainActions').removeClass('hidden');
$('#content').addClass('scrollbar-hover');
$('#content .actions').addClass('hidden');
$('#content .file-image .right-icon').addClass('hidden');
$('#content .detail').eq(1).addClass('hidden');
$.cookie('isFullScreen', 1);
};
var whenFailEnterFullscreen = function(error)
{
$.cookie('isFullScreen', 0);
};
try
{
var result = requestMethod.call(element);
if(result && (typeof result.then === 'function' || result instanceof window.Promise))
{
result.then(afterEnterFullscreen).catch(whenFailEnterFullscreen);
}
else
{
afterEnterFullscreen();
}
}
catch (error)
{
whenFailEnterFullscreen(error);
}
}
$('.main-col iframe').css('min-height', $(window).height() + 'px');
}
/**
* Exit full screen.
*
* @access public
* @return void
*/
function exitFullScreen()
{
$('#mainActions').addClass('hidden');
$('#content').removeClass('scrollbar-hover');
$('#content .actions').removeClass('hidden');
$('#content .file-image .right-icon').removeClass('hidden');
$('#content .detail').eq(1).removeClass('hidden');
$('.main-col iframe').css('min-height', '380px');
$.cookie('isFullScreen', 0);
}
document.addEventListener('fullscreenchange', function (e)
{
if(!document.fullscreenElement) exitFullScreen();
});
document.addEventListener('webkitfullscreenchange', function (e)
{
if(!document.webkitFullscreenElement) exitFullScreen();
});
document.addEventListener('mozfullscreenchange', function (e)
{
if(!document.mozFullScreenElement) exitFullScreen();
});
document.addEventListener('msfullscreenChange', function (e)
{
if(!document.msfullscreenElement) exitFullScreen();
});
$(function()
{
$(document).keydown(function(event)
{
if($.cookie('isFullScreen') == 1)
{
if(event.keyCode == 37) $('#prevPage').click();
if(event.keyCode == 39) $('#nextPage').click();
}
});
$('.outline').height($('.article-content').height());
$('#content').on('click', '.outline .outline-toggle i.icon-angle-right', function()
{
$('.article-content').css('width', '85%');
$('.outline').css({'min-width' : '180px', 'border-left' : '2px solid #efefef'});
$(this).removeClass('icon-angle-right').addClass('icon-angle-left').css('left', '-9px');
$('.outline-content').show();
if($('#sidebar>.cell').is(':visible')) $('#sidebar .icon.icon-angle-right').trigger("click");
}).on('click', '.outline .outline-toggle i.icon-angle-left', function()
{
$('.article-content').width('100%');
$(this).removeClass('icon-angle-left').addClass('icon-angle-right');
$('.outline-content').hide();
}).on('click', '#outline li', function(e)
{
$('#outline li.active').removeClass('active');
$(e.target).closest('li').addClass('active');
});
$('#outline li.has-list').addClass('open in');
$('#outline li.has-list>i+ul').prev('i').remove();
$(document).on('click', '.detail-content a', function(event)
{
var target = $(this).attr('target');
if($.cookie('isFullScreen') == 1 && target != '_blank') exitFullScreen();
})
/* Update doc content silently on switch doc version, story #40503 */
$(document).on('click', '.doc-version-menu a, #mainActions .container a', function(event)
{
var $tmpDiv = $('<div>');
$tmpDiv.load($(this).data('url') + ' #mainContent', function()
{
$('#content').html($tmpDiv.find('#content').html());
$('#sidebarContent').html($tmpDiv.find('#sidebarContent').html());
$('#actionbox .histories-list').html($tmpDiv.find('#actionbox .histories-list').html());
if($.cookie('isFullScreen') == 1) fullScreen();
$('#content [data-ride="tree"]').tree();
$('#outline li.has-list').addClass('open in');
$('#outline li.has-list>i+ul').prev('i').remove();
if($('#markdownContent').val())
{
var simplemde = new SimpleMDE({element: $("#markdownContent")[0],toolbar:false, status: false});
simplemde.value(String($('#markdownContent').val()));
simplemde.togglePreview();
}
});
});
$('#sidebar .icon.icon-angle-right').click(function()
{
if($('#sidebar>.cell').is(':hidden') && $('.outline-content').is(':visible'))
{
$('.outline .outline-toggle i.icon-angle-left').trigger("click");
}
})
$('.outline .outline-toggle i.icon-angle-right').trigger("click");
})
+7 -38
View File
@@ -1036,7 +1036,7 @@ class docModel extends model
$moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($libID, 'doc', $startModuleID = 0);
$this->config->doc->search['params']['module']['values'] = $moduleOptionMenu;
if($type == 'index' || $type == 'objectLibs' || ($this->app->rawMethod != 'contribute' and $libID == 0))
if($type == 'index' || $type == 'view' || ($this->app->rawMethod != 'contribute' and $libID == 0))
{
unset($this->config->doc->search['fields']['module']);
unset($this->config->doc->search['fields']['lib']);
@@ -1965,37 +1965,6 @@ class docModel extends model
return $node;
}
/**
* Get product crumb.
*
* @param int $productID
* @param int $executionID
* @access public
* @return string
*/
public function getProductCrumb($productID, $executionID = 0)
{
if(empty($productID)) return '';
if($executionID)
{
$executionProduct = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($productID)->andWhere('project')->eq($executionID)->fetch();
if(empty($executionProduct))
{
setcookie('product', 0, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
return html::a(helper::createLink('doc', 'allLibs', "type=execution"), $this->lang->executionCommon) . $this->lang->doc->separator;
}
}
$object = $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('id')->eq($productID)->fetch();
if(empty($object)) return '';
$crumb = '';
$crumb .= html::a(helper::createLink('doc', 'allLibs', "type=product"), $this->lang->productCommon) . $this->lang->doc->separator;
$crumb .= html::a(helper::createLink('doc', 'objectLibs', "type=product&objectID=$productID"), $object->name) . $this->lang->doc->separator;
$crumb .= html::a(helper::createLink('doc', 'allLibs', "type=execution&product=$productID"), $this->lang->doclib->execution);
if($executionID) $crumb .= $this->lang->doc->separator;
return $crumb;
}
/**
* Set lib users.
*
@@ -2436,10 +2405,10 @@ class docModel extends model
{
$treeMenu[0] .= '<div class="tree-group"><span class="tail-info">' . zget($users, $doc->editedBy) . ' &nbsp;' . $doc->editedDate . '</span>';
}
if($currentMethod == 'objectlibs')
if($currentMethod == 'view')
{
$class = common::hasPriv('doc', 'updateOrder') ? 'sortDoc' : '';
$treeMenu[0] .= "<div class='tree-group'><span class='module-name'>" . html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$rootID&docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'") . '</span>';
$treeMenu[0] .= "<div class='tree-group'><span class='module-name'>" . html::a(inlink('view', "docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'") . '</span>';
if(common::hasPriv('doc', 'edit') or common::hasPriv('doc', 'updateOrder'))
{
$treeMenu[0] .= "<div class='tree-actions'>";
@@ -2451,7 +2420,7 @@ class docModel extends model
else
{
$class = common::hasPriv('doc', 'updateOrder') ? 'sortDoc' : '';
$treeMenu[0] .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$rootID&docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'");
$treeMenu[0] .= html::a(inlink('view', "docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'");
$treeMenu[0] .= '</div>';
}
@@ -2513,10 +2482,10 @@ class docModel extends model
$treeMenu[$module->id] .= '<div class="tree-group"><span class="tail-info">' . zget($users, $doc->editedBy) . ' &nbsp;' . $doc->editedDate . '</span>';
}
if($currentMethod == 'objectlibs')
if($currentMethod == 'view')
{
$class = common::hasPriv('doc', 'updateOrder') ? 'sortDoc' : '';
$treeMenu[$module->id] .= "<div class='tree-group'><span class='module-name'>" . html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$libID&docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'") . '</span>';
$treeMenu[$module->id] .= "<div class='tree-group'><span class='module-name'>" . html::a(inlink('view', "docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'") . '</span>';
if(common::hasPriv('doc', 'edit') or common::hasPriv('doc', 'updateOrder'))
{
$treeMenu[$module->id] .= "<div class='tree-actions'>";
@@ -2529,7 +2498,7 @@ class docModel extends model
elseif($currentMethod == 'tablecontents')
{
$class = common::hasPriv('doc', 'updateOrder') ? 'sortDoc' : '';
$treeMenu[$module->id] .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$libID&docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'");
$treeMenu[$module->id] .= html::a(inlink('view', "docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> &nbsp;" . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'");
$treeMenu[$module->id] .= '</div>';
}
-70
View File
@@ -1,70 +0,0 @@
<?php
/**
* The allLibs view file of doc module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(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 Yidong Wang <yidong@cnezsoft.com>
* @package doc
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php $spliter = (empty($this->app->user->feedback) && !$this->cookie->feedbackView) ? true : false;?>
<div class="main-row <?php if($spliter) echo 'split-row';?> fade" id="mainRow">
<?php include './side.html.php';?>
<?php if($this->cookie->browseType == 'bylist'):?>
<?php include dirname(__FILE__) . '/alllibsbylist.html.php';?>
<?php else:?>
<div class="main-col" data-min-width="400">
<div class="panel block-files block-sm no-margin">
<div class="panel-heading">
<div class="panel-title font-normal">
<?php $panelTitle = zget($lang->doclib->tabList, $type);?>
<i class="icon icon-folder-open-o text-muted"></i> <?php echo $panelTitle;?>
<div class="btn-group">
<?php echo html::a('javascript:setBrowseType("bygrid")', "<i class='icon icon-cards-view'></i>", '', "title='{$lang->doc->browseTypeList['grid']}' class='btn btn-icon text-primary'");?>
<?php echo html::a('javascript:setBrowseType("bylist")', "<i class='icon icon-bars'></i>", '', "title='{$lang->doc->browseTypeList['list']}' class='btn btn-icon'");?>
</div>
</div>
</div>
<div class="panel-body">
<div class="row row-grid files-grid" data-size="300">
<?php if($type == 'product') $icon = 'icon-product text-secondary';?>
<?php if($type == 'execution') $icon = 'icon-execution text-green';?>
<?php if($type != 'product' and $type != 'execution') $icon = 'icon-folder text-yellow';?>
<?php foreach($libs as $lib):?>
<?php $link = ($type == 'product' or $type == 'execution') ? $this->createLink('doc', 'objectLibs', "type=$type&objectID=$lib->id") : $this->createLink('doc', 'browse', "libID=$lib->id");?>
<div class="col">
<a class="file" href="<?php echo $link;?>">
<i class="file-icon icon <?php echo $icon;?>"></i>
<div class="file-name"><?php echo ($type != 'product' && $type != 'execution' && strpos($lib->collector, $this->app->user->account) !== false ? "<i class='icon icon-star text-yellow'></i> " : '') . $lib->name;?></div>
<?php if($type == 'product' or $type == 'execution'):?>
<div class="text-primary file-info"><?php echo count($subLibs[$lib->id]) . $lang->doc->item;?></div>
<?php else:?>
<div class="text-primary file-info"><?php echo $itemCounts[$lib->id] . $lang->doc->item;?></div>
<?php endif;?>
</a>
<?php if($type != 'product' and $type != 'execution'):?>
<div class="actions">
<?php $star = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $collectTitle = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<?php if(common::hasPriv('doc', 'collect')):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$lib->id&objectType=doclib");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<?php endif;?>
<?php common::printLink('doc', 'editLib', "libID=$lib->id", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
<?php common::printLink('doc', 'deleteLib', "libID=$lib->id", "<i class='icon icon-close'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&viewType=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link'")?>
</div>
<?php endif;?>
</div>
<?php endforeach;?>
</div>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
</div>
</div>
</div>
<?php endif;?>
</div>
<?php include '../../common/view/footer.html.php';?>
-62
View File
@@ -1,62 +0,0 @@
<div class="main-col" data-min-width="400">
<div class="panel block-files block-sm no-margin">
<div class="panel-heading">
<div class="panel-title font-normal">
<?php $panelTitle = zget($lang->doclib->tabList, $type);?>
<i class="icon icon-folder-open-o text-muted"></i> <?php echo $panelTitle;?>
<div class="btn-group pull-right">
<?php echo html::a('javascript:setBrowseType("bygrid")', "<i class='icon icon-cards-view'></i>", '', "title='{$lang->doc->browseTypeList['grid']}' class='btn btn-icon'");?>
<?php echo html::a('javascript:setBrowseType("bylist")', "<i class='icon icon-bars'></i>", '', "title='{$lang->doc->browseTypeList['list']}' class='btn btn-icon text-primary'");?>
</div>
</div>
</div>
<div class="panel-body">
<table class="table table-borderless table-hover table-files table-fixed no-margin">
<thead>
<tr>
<?php if($type != 'product' and $type != 'execution') $name = $lang->doclib->nameList[$type];?>
<th class="c-name"><?php echo $lang->doc->libName;?></th>
<th class="c-num"><?php echo $lang->doc->num;?></th>
<?php if($type == 'product' or $type == 'execution'):?>
<th class="c-user"><?php echo $lang->doc->addedBy;?></th>
<th class="c-datetime"><?php echo $lang->doc->addedDate;?></th>
<?php else:?>
<th class="w-120px"><?php echo $lang->actions;?></th>
<?php endif;?>
</tr>
</thead>
<tbody>
<?php foreach($libs as $lib):?>
<?php $link = ($type == 'product' or $type == 'execution') ? $this->createLink('doc', 'objectLibs', "type=$type&objectID=$lib->id") : $this->createLink('doc', 'browse', "libID=$lib->id");?>
<tr>
<td class="c-name"><?php echo html::a($link, $lib->name);?></td>
<td class="c-num">
<?php if($type != 'product' and $type != 'execution'):?>
<?php echo $itemCounts[$lib->id] . $lang->doc->item;?>
<?php else:?>
<?php echo count($subLibs[$lib->id]) . $lang->doc->item;?>
<?php endif;?>
</td>
<?php if($type == 'product' or $type == 'execution'):?>
<td class="c-user"><?php if($lib->createdBy) echo zget($users, $lib->createdBy);?></td>
<td class="c-datetime"><?php if($lib->createdDate != '00-00-00 00:00:00') echo formatTime($lib->createdDate, 'Y-m-d');?></td>
<?php else:?>
<td class="c-actions">
<?php $star = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $collectTitle = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<?php if(common::hasPriv('doc', 'collect')):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$lib->id&objectType=doclib");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<?php endif;?>
<?php common::printLink('doc', 'editLib', "libID=$lib->id", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
<?php common::printLink('doc', 'deleteLib', "libID=$lib->id", "<i class='icon icon-close'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php common::printLink('tree', 'browse', "rootID=$lib->id&viewType=doc&currentModuleID=0&branch=0&from=$from", "<i class='icon icon-cog'></i>", '', "title='{$lang->doc->manageType}' class='btn btn-link'")?>
</td>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
</div>
</div>
</div>
+1 -1
View File
@@ -21,7 +21,7 @@
</a>
<ul class='dropdown-menu doc-version-menu' style='max-height:240px; max-width: 300px; overflow-y:auto'>
<?php for($version = $doc->version; $version > 0; $version--): ?>
<li><a href='javascript:void(0)' data-url='<?php echo $this->createLink('doc', 'objectLibs', "type=$objectType&objectID=$object->id&libID=$libID&docID=$doc->id&version=$version"); ?>'>#<?php echo $version; ?></a></li>
<li><a href='javascript:void(0)' data-url='<?php echo $this->createLink('doc', 'view', "docID=$doc->id&version=$version"); ?>'>#<?php echo $version; ?></a></li>
<?php endfor; ?>
</ul>
</div>
+2 -2
View File
@@ -82,9 +82,9 @@ body {margin-bottom: 25px;}
<?php
$docType = $doc->type == 'text' ? 'wiki-file' : $doc->type;
$icon = html::image("static/svg/{$docType}.svg", "class='file-icon'");
if(common::hasPriv('doc', 'objectLibs'))
if(common::hasPriv('doc', 'view'))
{
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}'");
echo html::a($this->createLink('doc', 'view', "docID=$doc->id"), $icon . $doc->title, '', "title='{$doc->title}' class='doc-title' data-app='{$this->app->tab}'");
}
else
{
+1 -1
View File
@@ -18,7 +18,7 @@
.container {padding: 0 !important;}
#mainContent {padding: 0 !important;}
</style>
<?php $backLink = $app->session->docList ? $app->session->docList : $this->createLink('doc', 'objectlibs', "type=$type&objectID=$objectID&libID={$lib->id}&docID={$doc->id}") . "#app={$this->app->tab}";?>
<?php $backLink = $app->session->docList ? $app->session->docList : $this->createLink('doc', 'view', "docID={$doc->id}") . "#app={$this->app->tab}";?>
<div id="mainContent" class="main-content">
<form class="load-indicator main-form form-ajax" id="dataform" method='post' enctype='multipart/form-data'>
<table class='table table-form'>
-52
View File
@@ -1,52 +0,0 @@
<?php
/**
* The objectLibs view file of doc module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(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 Yidong Wang <yidong@cnezsoft.com>
* @package doc
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php if($app->tab == 'execution'):;?>
<style>.panel-body{min-height: 180px}</style>
<?php endif;?>
<div class="cell<?php if($type == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $type . 'Doc';?>></div>
<div class="fade main-row split-row" id="mainRow">
<?php if($libID):?>
<?php include './side.html.php';?>
<div class="main-col" data-min-width="400">
<?php if($docID):?>
<?php include './content.html.php';?>
<?php else:?>
<div class="cell">
<div class="detail empty text-center">
<?php echo $type == 'book' ? $lang->doc->noArticle : $lang->doc->noDoc;?>
</div>
</div>
<?php endif;?>
</div>
<?php else:?>
<div class="cell">
<div class="detail empty text-center">
<?php echo $type == 'book' ? $lang->doc->noBook : $lang->doc->noLib;?>
<?php if($type != 'book') echo html::a($this->createLink('doc', 'createLib', "type={$objectType}&objectID=$object->id"), "<i class='icon icon-plus'></i> " . $lang->doc->createLib, '', "class='btn btn-info iframe'");?>
</div>
</div>
<?php endif;?>
</div>
<?php js::set('type', 'doc');?>
<script>
$('#pageNav .btn-group.angle-btn').click(function()
{
if($(this).hasClass('opened')) return;
$(this).addClass('opened');
scrollToSelected();
})
</script>
<?php include '../../common/view/footer.html.php';?>
-35
View File
@@ -1,35 +0,0 @@
<?php
/**
* The sortlibs view file of doc module of ZenTaoPMS.
*
* @copyright Copyright 2009-2022 禅道软件(青岛)有限公司(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 Mengyi Liu <liumengyi@easycorp.ltd>
* @package doc
* @version $Id: sorlibs.html.php 958 2022-06-21 14:20:42Z $
* @link https://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id="main">
<div class='main-header'>
<h2><?php echo $lang->doc->order;?></h2>
</div>
<div id='mainContent' class='main-content'>
<div class='doclib-name'><?php echo $lang->doclib->name?></div>
<?php $libIdList = ',';?>
<form id='libs' class='load-indicator main-form' method='post' target='hiddenwin'>
<div class='libList'>
<?php foreach($libs as $libID => $libName):?>
<?php $libIdList .= "$libID,";?>
<div class='lib' data-id='<?php echo $libID;?>'>
<span class='lib-name'><?php echo $libName;?></span><i class='icon-move'></i>
</div>
<?php endforeach;?>
</div>
<?php echo html::hidden('libIdList', trim($libIdList, ','));?>
<div class='text-center'><?php echo html::submitButton($lang->save);?></div>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+32 -239
View File
@@ -1,259 +1,52 @@
<?php
/**
* The view of doc module of ZenTaoPMS.
* The view view file of doc module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(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 Jia Fu <fujia@cnezsoft.com>
* @author Yidong Wang <yidong@cnezsoft.com>
* @package doc
* @version $Id: view.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php echo css::internal($keTableCSS);?>
<style>.detail-content .file-image {padding: 0 50px 0 10px;}</style>
<?php $browseLink = $this->session->docList ? $this->session->docList : inlink('browse', 'browseType=byediteddate');?>
<?php $sessionString = session_name() . '=' . session_id();?>
<?php
js::set('fullscreen', $lang->fullscreen);
js::set('retrack', $lang->retrack);
js::set('sysurl', common::getSysUrl());
js::set('docID', $doc->id);
?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php if(!isonlybody()):?>
<?php echo html::a($browseLink, "<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "class='btn btn-primary'");?>
<div class="divider"></div>
<?php endif;?>
<div class="page-title">
<span class="label label-id"><?php echo $doc->id;?></span><span class="text" title='<?php echo $doc->title;?>'><?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' or $action->action == 'deletedfile' or $action->action == 'commented')
{
$versions[$i] = "#$i " . zget($users, $action->actor) . ' ' . substr($action->date, 2, 14);
$i++;
}
elseif($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&from={$lang->navGroup->doc}"), $versionTitle) . '</li>';
}
?>
</ul>
</small>
<?php endif; ?>
<?php if($app->tab == 'execution'):;?>
<style>.panel-body{min-height: 180px}</style>
<?php endif;?>
<div class="cell<?php if($type == 'bySearch') echo ' show';?>" id="queryBox" data-module=<?php echo $type . 'Doc';?>></div>
<div class="fade main-row split-row" id="mainRow">
<?php if($libID):?>
<?php include './side.html.php';?>
<div class="main-col" data-min-width="400">
<?php if($docID):?>
<?php include './content.html.php';?>
<?php else:?>
<div class="cell">
<div class="detail empty text-center">
<?php echo $type == 'book' ? $lang->doc->noArticle : $lang->doc->noDoc;?>
</div>
</div>
<?php endif;?>
</div>
<?php else:?>
<div class="cell">
<div class="detail empty text-center">
<?php echo $type == 'book' ? $lang->doc->noBook : $lang->doc->noLib;?>
<?php if($type != 'book') echo html::a($this->createLink('doc', 'createLib', "type={$objectType}&objectID=$object->id"), "<i class='icon icon-plus'></i> " . $lang->doc->createLib, '', "class='btn btn-info iframe'");?>
</div>
</div>
</div>
<?php if(!isonlybody()):?>
<div class='btn-toolbar pull-right'>
<button type='button' class='btn btn-secondary fullscreen-btn' title='<?php echo $lang->retrack;?>'><i class='icon icon-fullscreen'></i><?php echo ' ' . $lang->retrack;?></button>
</div>
<?php endif;?>
</div>
<div id="mainContent" class="main-row">
<div class="main-col col-8">
<div class="cell">
<div class="detail no-padding">
<div class="detail-content article-content no-margin no-padding">
<?php
if($doc->type == 'url' and $autoloadPage)
{
$url = $doc->content;
if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url;
$urlIsHttps = strpos($url, 'https://') === 0;
$serverIsHttps = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') or (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https'));
if(($urlIsHttps and $serverIsHttps) or (!$urlIsHttps and !$serverIsHttps))
{
echo "<iframe width='100%' id='urlIframe' src='$url'></iframe>";
}
else
{
$parsedUrl = parse_url($url);
$urlDomain = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
$title = '';
$response = common::http($url);
preg_match_all('/<title>(.*)<\/title>/Ui', $response, $out);
if(isset($out[1][0])) $title = $out[1][0];
echo "<div id='urlCard'>";
echo "<div class='url-icon'><img src='{$urlDomain}/favicon.ico' width='45' height='45' /></div>";
echo "<div class='url-content'>";
echo "<div class='url-title'>{$title}</div>";
echo "<div class='url-href'>" . html::a($url, $url, '_target') . "</div>";
echo "</div></div>";
}
}
elseif($doc->contentType == 'markdown')
{
echo "<textarea id='markdownContent'></textarea>";
}
else
{
echo $doc->content;
}
?>
<?php foreach($doc->files as $file):?>
<?php if(in_array($file->extension, $config->file->imageExtensions)):?>
<div class='file-image'>
<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?>" title="<?php echo $file->title;?>">
</a>
<span class='right-icon'>
<?php
if(common::hasPriv('file', 'download'))
{
$downloadLink = $this->createLink('file', 'download', 'fileID=' . $file->id);
$downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&';
$downloadLink .= $sessionString;
echo html::a($downloadLink, "<i class='icon icon-import'></i>", '', "class='btn-icon' style='margin-right: 10px;' title=\"{$lang->doc->download}\"");
}
?>
<?php if(common::hasPriv('doc', 'deleteFile')) echo html::a('###', "<i class='icon icon-trash'></i>", '', "class='btn-icon' title=\"{$lang->doc->deleteFile}\" onclick='deleteFile($file->id)'");?>
</span>
</div>
<?php unset($doc->files[$file->id]);?>
<?php endif;?>
<?php endforeach;?>
</div>
</div>
<?php echo $this->fetch('file', 'printFiles', array('files' => $doc->files, 'fieldset' => 'true', 'object' => $doc));?>
</div>
<div class='main-actions'>
<div class="btn-toolbar">
<?php common::printBack($browseLink);?>
<div class='divider'></div>
<?php
if(!$doc->deleted)
{
common::printIcon('doc', 'edit', "docID=$doc->id", $doc);
common::printIcon('doc', 'delete', "docID=$doc->id&confirm=no", $doc, 'button', 'trash', 'hiddenwin');
}
?>
</div>
</div>
</div>
<div class="side-col col-4 hidden">
<?php if(!empty($doc->digest)):?>
<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>
<?php endif;?>
<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 class='w-90px'><?php echo $lang->doc->product;?></th>
<td><?php echo $doc->productName;?></td>
</tr>
<?php endif;?>
<?php if($doc->executionName):?>
<tr>
<th class='w-80px'><?php echo $lang->doc->execution;?></th>
<td><?php echo $doc->executionName;?></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 zget($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 class='cell'>
<?php
$canBeChanged = common::canBeChanged('doc', $doc);
if($canBeChanged) $actionFormLink = $this->createLink('action', 'comment', "objectType=doc&objectID=$doc->id");
?>
<?php include '../../common/view/action.html.php';?>
</div>
</div>
</div>
<div id="mainActions" class='main-actions'>
<?php common::printPreAndNext($preAndNext);?>
</div>
<?php js::set('canDeleteFile', common::hasPriv('doc', 'deleteFile'));?>
<?php include '../../common/view/syntaxhighlighter.html.php';?>
<?php if($doc->contentType == 'markdown'):?>
<?php css::import($jsRoot . "markdown/simplemde.min.css");?>
<?php js::import($jsRoot . 'markdown/simplemde.min.js'); ?>
<?php js::set('markdownText', htmlspecialchars($doc->content));?>
<?php js::set('type', 'doc');?>
<script>
$(function()
$('#pageNav .btn-group.angle-btn').click(function()
{
var simplemde = new SimpleMDE({element: $("#markdownContent")[0],toolbar:false, status: false});
simplemde.value(String(markdownText));
simplemde.togglePreview();
if($(this).hasClass('opened')) return;
$(this).addClass('opened');
$('#content .CodeMirror .editor-preview a').attr('target', '_blank');
scrollToSelected();
})
</script>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -96,7 +96,7 @@
if((link.params.from || link.params.$3) == 'product')
{
if(['objectlibs', 'showfiles', 'browse', 'view', 'edit', 'delete', 'create'].includes(methodLowerCase)) return 'product';
if(['showfiles', 'browse', 'view', 'edit', 'delete', 'create'].includes(methodLowerCase)) return 'product';
}
return 'doc';
}