Merge branch 'dev-help-wwr' into 'develop'
新增编辑在帮助文档功能 See merge request K18_NTCS_WEB/NTC!17
This commit is contained in:
@@ -4,9 +4,10 @@
|
||||
<head>
|
||||
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/global/plugins/editor.md-master/css/editormd.css" />
|
||||
<link href="${pageContext.request.contextPath}/static/global/plugins/jquery-ztree/3.5.12/css/zTreeStyle/zTreeStyle.min.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-ztree/3.5.12/js/jquery.ztree.all-3.5.min.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/static/global/plugins/showdown-master/dist/showdown.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -39,19 +40,65 @@ $(document).ready(function(){
|
||||
//隐藏没有分配父节点权限,却有子节点权限的叶子节点
|
||||
//$("#menuTree").children("li:not(:eq(0))").hide();
|
||||
});
|
||||
var helpHrefVal=null;//用于在editHelp页面使用
|
||||
var toolLang=null;//用于editorHelp页面初始化语言
|
||||
var markdown="";//用于editorHelp填充编辑器内容
|
||||
function showHelp(helpHref) {
|
||||
|
||||
|
||||
var editBtn=$("#editHelp");
|
||||
if(editBtn!=null&&editBtn!=undefined){
|
||||
editBtn.remove();
|
||||
}
|
||||
if(helpHref!=''){
|
||||
var lang = "${cookie.Language.value }".toLowerCase();
|
||||
if(lang=="" || lang.indexOf("en")!=-1) {
|
||||
|
||||
/* if(lang=="" || lang.indexOf("en")!=-1) {
|
||||
helpHref += ".html";
|
||||
}else if(lang.indexOf("cn")!=-1) {
|
||||
helpHref += ".html";
|
||||
}else if(lang.indexOf("ru")!=-1) {
|
||||
helpHref += ".html";
|
||||
} */
|
||||
if(lang=="" || lang.indexOf("en")!=-1) {
|
||||
helpHref += ".md";
|
||||
}else if(lang.indexOf("cn")!=-1) {
|
||||
helpHref += ".md";
|
||||
}else if(lang.indexOf("ru")!=-1) {
|
||||
helpHref += ".md";
|
||||
}
|
||||
$(".help").load("${pageContext.request.contextPath}"+helpHref);
|
||||
toolLang=lang;
|
||||
helpHrefVal=helpHref;
|
||||
//$(".help").load("${pageContext.request.contextPath}"+helpHref+"?time="+new Date().getTime());
|
||||
markdown = $.ajax({
|
||||
type:"get",
|
||||
url: "${pageContext.request.contextPath}"+helpHref,
|
||||
dataType:"text",
|
||||
cache: false,
|
||||
async: false
|
||||
}).responseText;
|
||||
var converter = new showdown.Converter();//初始化showdown
|
||||
$(".help").html(converter.makeHtml(markdown));//将markdown格式文件转为html展示
|
||||
var permission="${fns:getUser().isAdmin() }";
|
||||
|
||||
if(permission!=null&&permission!=undefined&&permission=="true"){
|
||||
$("#menuTree").parent().after('<button class="btn btn-default" id="editHelp" onclick="javascript:editHelp();"><spring:message code="edit"/></button>');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
var helpInfo=null;//保存加载的信息,用于在editHelp页面使用
|
||||
function editHelp(){
|
||||
helpInfo=null;
|
||||
var editBtn=$("#editHelp");
|
||||
if(editBtn!=null&&editBtn!=undefined){
|
||||
editBtn.remove();
|
||||
}
|
||||
helpInfo=$(".help").html();
|
||||
$(".help").load("${pageContext.request.contextPath}/online-help/editHelp.html");
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -63,9 +110,10 @@ function showHelp(helpHref) {
|
||||
<div class="col-md-2">
|
||||
<div id="menuTree" class="ztree" style="margin-top:3px;float:left;"></div>
|
||||
</div>
|
||||
<div class="col-md-10 help">
|
||||
|
||||
<div class="col-md-10 help" >
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user