300 lines
11 KiB
HTML
300 lines
11 KiB
HTML
<style>
|
|
.treeDimension {
|
|
background: url("../apps/com.actionsoft.apps.kms/img/kms_icon.png") no-repeat -206px -63px !important;
|
|
width: 16px !important;
|
|
height: 16px !important;
|
|
vertical-align: middle !important;
|
|
margin-right: 10px !important;
|
|
}
|
|
.treeHotspot {
|
|
background: url("../apps/com.actionsoft.apps.kms/img/kms_icon.png") no-repeat -279px -63px !important;
|
|
width: 16px !important;
|
|
height: 16px !important;
|
|
vertical-align: middle !important;
|
|
margin-right: 10px !important;
|
|
}
|
|
</style>
|
|
<script name="xpagejsContext">
|
|
var rootDimensionTree;
|
|
var kmsurltool = {
|
|
// 展开节点
|
|
getChildren: function (treeNode) {
|
|
var nodeDom = rootDimensionTree.getNodeDomById(treeNode.id);
|
|
if (nodeDom.find("span:eq(1)[class=root-open]").length == 1) { // 闭合时无需请求网络
|
|
return false;
|
|
}
|
|
if (nodeDom.siblings("ul").length == 1) { // 已经请求的网络的节点无需再次请求网络
|
|
return false;
|
|
}
|
|
if (treeNode.open != null) {
|
|
rootDimensionTree.setting.dataModel.params.parentId = treeNode.id;
|
|
var result = rootDimensionTree.getData(rootDimensionTree.setting.dataModel);
|
|
rootDimensionTree.buildChilren(result, treeNode);
|
|
}
|
|
},
|
|
treeClick: function (treeNode) {
|
|
$("#xpageConfigtable #rootDirectory").val(treeNode.name);
|
|
$("#xpageConfigtable #rootDirectoryId").val(treeNode.id);
|
|
$("#selectDimension").dialog("close");
|
|
kmsurltool.setText();
|
|
},
|
|
initDimensionTree: function () {
|
|
$("#dimensionTree").empty();
|
|
var treeDataUrl = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_dimension_tree_json";
|
|
var setting = {
|
|
showLine: false,
|
|
sort: true,
|
|
event: {
|
|
beforeExpand: kmsurltool.getChildren,
|
|
onClick: kmsurltool.treeClick
|
|
},
|
|
animate: true,
|
|
dataModel: {
|
|
url: treeDataUrl,
|
|
method: "POST",
|
|
dataType: "json",
|
|
params: {
|
|
parentId: ''
|
|
}
|
|
}
|
|
};
|
|
rootDimensionTree = awsui.tree.init($("#dimensionTree"), setting);
|
|
},
|
|
init: function (opt) {
|
|
$("#xpageConfigtable .awsui-checkbox").check();
|
|
$("#xpageConfigtable .awsui-radio").check();
|
|
$("#xpageConfigtable #orderIndex").select2();
|
|
$("#xpageConfigtable .showIndex").select2({"multiple":true,"minimumResultsForSearch":"Infinity"});
|
|
$("#xpageConfigtable .publishTimeFormat").select2({"minimumResultsForSearch":"Infinity"});
|
|
$("#xpageConfigtable .showIndex").val(["cardName","publishUser","publishTime","readCount","commentCount"]).trigger("change");
|
|
$("#xpageConfigtable #rootDirectory").buttonedit({
|
|
isClearData: true,
|
|
clearField: "rootDirectoryId",
|
|
onClick: openDimensionWin
|
|
});
|
|
$("#xpageConfigtable #orderIndex").on("change", function () {
|
|
kmsurltool.setText();
|
|
});
|
|
$("#xpageConfigtable .showIndex").on("change", function () {
|
|
kmsurltool.setText();
|
|
});
|
|
$("#xpageConfigtable #ifShowDirectory").on("ifChanged", function () {
|
|
kmsurltool.setText();
|
|
});
|
|
|
|
$("#xpageConfigtable input[name='showType']").on("ifChanged", function () {
|
|
if($("#list").prop("checked")){
|
|
$("#xpageConfigtable .showIndexTr").show();
|
|
$("#xpageConfigtable .showStyleTr").show();
|
|
}else{
|
|
$("#xpageConfigtable .showIndexTr").hide();
|
|
$("#xpageConfigtable .publishTimeFormatTr").hide();
|
|
$("#xpageConfigtable .showStyleTr").hide();
|
|
}
|
|
kmsurltool.setText();
|
|
});
|
|
/*$("#xpageConfigtable .showIndex").on("change", function () {
|
|
if($("#list").prop("checked")) {
|
|
if ($("#xpageCardConfigtable #cardlist").prop("checked")) {
|
|
if ($(this).val().indexOf("publishTime") > -1) {
|
|
$("#xpageConfigtable .publishTimeFormatTr").show();
|
|
$("#xpageConfigtable .showStyleTr").hide();
|
|
} else {
|
|
$("#xpageConfigtable .publishTimeFormatTr").hide();
|
|
$("#xpageConfigtable .showStyleTr").show();
|
|
}
|
|
}
|
|
}
|
|
});*/
|
|
kmsurltool.initCondition();
|
|
},
|
|
setText: function () {
|
|
var str = "./w";
|
|
str = str + "?sid=@sid&cmd=com.actionsoft.apps.kms_xpage_opencardbydirctory";
|
|
str += $("#xpageConfigtable #rootDirectoryId").val() != '' ? "&rootDirectoryId=" + $("#xpageConfigtable #rootDirectoryId").val() : "";
|
|
str += $("#xpageConfigtable #rootDirectory").val() != '' ? "&rootDirectory=" + $("#xpageConfigtable #rootDirectory").val() : "";
|
|
str += $("#xpageConfigtable #list").prop("checked") ? "&showType=list" : "&showType=icon";
|
|
str += $("#xpageConfigtable #ifShowDirectory").prop("checked") ? "&ifShowDirectory=true" : "&ifShowDirectory=false";
|
|
str += $("#xpageConfigtable #orderIndex").val() != '' ? "&sortIndx=" + $("#xpageConfigtable #orderIndex").val() : "";
|
|
str += $("#xpageConfigtable .showIndex").val() != '' ? "&showIndex=" + $("#xpageConfigtable .showIndex").val() : "";
|
|
str += $("#xpageConfigtable .publishTimeFormat").val() != '' ? "&publishTimeFormat=" + $("#xpageConfigtable .publishTimeFormat").val() : "";
|
|
str += $("#xpageConfigtable #singlecolumn").prop("checked") ? "&showStyle=singlecolumn" :"&showStyle=doublecolumn" ;
|
|
$(".xpagesContent").val(str);
|
|
},
|
|
getTextUrl:function(){
|
|
var str = "./w";
|
|
str = str + "?sid=@sid&cmd=com.actionsoft.apps.kms_xpage_opencardbydirctory";
|
|
str += $("#xpageConfigtable #rootDirectoryId").val() != '' ? "&rootDirectoryId=" + $("#xpageConfigtable #rootDirectoryId").val() : "";
|
|
str += $("#xpageConfigtable #rootDirectory").val() != '' ? "&rootDirectory=" + $("#xpageConfigtable #rootDirectory").val() : "";
|
|
str += $("#xpageConfigtable #list").prop("checked") ? "&showType=list" : "&showType=icon";
|
|
str += $("#xpageConfigtable #ifShowDirectory").prop("checked") ? "&ifShowDirectory=true" : "&ifShowDirectory=false";
|
|
str += $("#xpageConfigtable #orderIndex").val() != '' ? "&sortIndx=" + $("#xpageConfigtable #orderIndex").val() : "";
|
|
str += $("#xpageConfigtable .showIndex").val() != '' ? "&showIndex=" + $("#xpageConfigtable .showIndex").val() : "";
|
|
str += $("#xpageConfigtable .publishTimeFormat").val() != '' ? "&publishTimeFormat=" + $("#xpageConfigtable .publishTimeFormat").val() : "";
|
|
str += $("#xpageConfigtable #singlecolumn").prop("checked") ? "&showStyle=singlecolumn" :"&showStyle=doublecolumn" ;
|
|
return str;
|
|
},
|
|
initCondition:function(){
|
|
var url = $(".cwUrl").val();
|
|
var params = kmsurltool.getParams(url);
|
|
var isSelected = false;
|
|
for(var key in params){
|
|
if(key=="cmd"){
|
|
if(params[key]=="com.actionsoft.apps.kms_xpage_opencardbydirctory"){
|
|
isSelected = true;
|
|
}
|
|
}
|
|
}
|
|
if(isSelected) {
|
|
for (var key in params) {
|
|
if (key == "rootDirectoryId") {
|
|
$("#xpageConfigtable #rootDirectoryId").val(params[key]);
|
|
} else if (key == "rootDirectory") {
|
|
$("#xpageConfigtable #rootDirectory").val(params[key]);
|
|
} else if (key == "ifShowDirectory") {
|
|
if(params[key] == "true"){
|
|
$("#xpageConfigtable #ifShowDirectory").check("check");
|
|
}else{
|
|
$("#xpageConfigtable #ifShowDirectory").check("uncheck");
|
|
}
|
|
|
|
} else if (key == "showType") {
|
|
if(params[key] == "list"){
|
|
$("#xpageConfigtable #list").check("check");
|
|
$("#xpageConfigtable .showStyleTr").show();
|
|
}else{
|
|
$("#xpageConfigtable #icon").check("check");
|
|
$("#xpageConfigtable .publishTimeFormatTr").hide();
|
|
$("#xpageConfigtable .showStyleTr").hide();
|
|
}
|
|
} else if (key == "sortIndx") {
|
|
if(params[key] != "null") {
|
|
$("#xpageConfigtable #orderIndex").val(params[key]).trigger("change");
|
|
}
|
|
} else if (key == "showIndex") {
|
|
if(params[key] != "null") {
|
|
$("#xpageConfigtable .showIndex").val(params[key].split(",")).trigger("change");
|
|
}
|
|
} else if (key == "publishTimeFormat") {
|
|
if(params[key] != "null") {
|
|
$("#xpageConfigtable .publishTimeFormat").val(params[key]).trigger("change");
|
|
}
|
|
} else if (key == "showStyle") {
|
|
if(params[key] == "singlecolumn"){
|
|
$("#xpageConfigtable #singlecolumn").check("check");
|
|
}else{
|
|
$("#xpageConfigtable #doublecolumn").check("check");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
getParams: function (url) {
|
|
var params = {};
|
|
try {
|
|
var ps = url.split("?")[1].split("&");
|
|
for (var i = 0; i< ps.length; i++) {
|
|
var paramStr = ps[i];
|
|
var map = paramStr.split("=");
|
|
if (map.length == 2) {
|
|
params[map[0]] = map[1];
|
|
}
|
|
}
|
|
} catch (e) {
|
|
}
|
|
return params;
|
|
}
|
|
};
|
|
|
|
function openDimensionWin() {
|
|
kmsurltool.initDimensionTree();
|
|
$('#selectDimension').dialog({
|
|
title: "选择根目录",
|
|
width: 600,
|
|
buttons: [{
|
|
text: '确定',
|
|
cls: "blue",
|
|
handler: function () {
|
|
var checkedDimensions = rootDimensionTree.getCheckedNodes();
|
|
}
|
|
}, {
|
|
text: '取消',
|
|
handler: function () {
|
|
$('#selectDimension').dialog('close');
|
|
}
|
|
}]
|
|
});
|
|
}
|
|
function kmsdirectory_getUrl(){
|
|
if($("#rootDirectory").val()==''){
|
|
$.simpleAlert("[根目录]不能为空");
|
|
return false;
|
|
}
|
|
kmsurltool.setText();
|
|
}
|
|
</script>
|
|
<textarea style="display: none;" class="xpagesContent"></textarea>
|
|
<table id="xpageConfigtable" style="font-size:13px;width:100%;">
|
|
<colgroup>
|
|
<col width="24%"/>
|
|
<col width="76%"/>
|
|
</colgroup>
|
|
<tr>
|
|
<td>根目录</td>
|
|
<td>
|
|
<span class="required"></span><input id="rootDirectory" type="text" readonly style="margin-right: 13px; width: 355px; outline: none;" class="txt awsui-buttonedit" placeholder=""/>
|
|
<input id="rootDirectoryId" type="hidden" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>显示方式</td>
|
|
<td>
|
|
<input class="awsui-radio" checked name="showType" id="list" value="list" type="radio">
|
|
<label class="awsui-radio-label" for="list">列表</label>
|
|
<input class="awsui-radio" name="showType" id="icon" value="icon" type="radio">
|
|
<label class="awsui-radio-label" for="icon">图标</label>
|
|
</td>
|
|
</tr>
|
|
<tr class="showIndexTr">
|
|
<td>显示列</td>
|
|
<td><select class="showIndex" style="width: 360px;">
|
|
<option value="cardName">名称</option>
|
|
<option value="publishUser">发布人</option>
|
|
<option value="publishTime">发布时间</option>
|
|
<option value="readCount">阅读次数</option>
|
|
<option value="commentCount">讨论次数</option>
|
|
</select></td>
|
|
</tr>
|
|
<tr>
|
|
<td>显示目录</td>
|
|
<td>
|
|
<input class="awsui-checkbox" checked=checked id="ifShowDirectory" value="" type="checkbox" >
|
|
</td>
|
|
</tr>
|
|
<tr class="showStyleTr" style="display:none">
|
|
<td>显示样式</td>
|
|
<td>
|
|
<input class="awsui-radio" checked name="showStyle" id="singlecolumn" value="singlecolumn" type="radio">
|
|
<label class="awsui-radio-label" for="singlecolumn">单行</label>
|
|
<input class="awsui-radio" name="showStyle" id="doublecolumn" value="doublecolumn" type="radio">
|
|
<label class="awsui-radio-label" for="doublecolumn">双行</label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>排序</td>
|
|
<td><select id="orderIndex" style="width: 360px;">
|
|
<option value="publishTime">发布时间</option>
|
|
<option value="READCOUNT">阅读次数</option>
|
|
<option value="commentCount">评论次数</option>
|
|
<option value="CARDNAME">知识名称</option>
|
|
</select></td>
|
|
</tr>
|
|
</table>
|
|
<div id='selectDimension' style="display: none;">
|
|
<div class="dlg-content" style="height: 360px;">
|
|
<ul id="dimensionTree" style="width: 600px; height: 360px;"></ul>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
kmsurltool.init();
|
|
</script> |