KMS代码提交
This commit is contained in:
parent
b2f0f03c9f
commit
d789b5294f
@ -0,0 +1,713 @@
|
||||
/*
|
||||
* 该代码已经作废,仅被压缩使用在aws.userinput.js,livesearch.js中,该js没有被直接引用的地方,留作备份以便混淆用
|
||||
*
|
||||
* jQuery verson 1.10.2
|
||||
* AWS UI Combobox
|
||||
* author chengy
|
||||
* 2013年10月23日19:13:42
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
*/
|
||||
(function($, undefined) {
|
||||
|
||||
// used to prevent race conditions with remote data sources
|
||||
var requestIndex = 0;
|
||||
|
||||
$.widget("awsui.combobox_old", {
|
||||
version : "1.10.3",
|
||||
defaultElement : "<input>",
|
||||
options : {
|
||||
renderTo : null,
|
||||
target : null,
|
||||
autoFocus : true,
|
||||
hiddenName : null,
|
||||
delay : 300,
|
||||
minLength : 0,
|
||||
trigger : true,
|
||||
triggerClass : "awsui-combobox-trigger",
|
||||
triggerOpenClass : "awsui-combobox-trigger-open",
|
||||
source : null,
|
||||
disabled : false,
|
||||
editable : true,
|
||||
multiple : false,
|
||||
multipleCheck : "awsui-combobox-item-check",
|
||||
multipleUnCheck : "awsui-combobox-item-uncheck",
|
||||
seperator : ",",
|
||||
valueField : "value",
|
||||
displayField : "label",
|
||||
|
||||
// callbacks
|
||||
change : null,
|
||||
close : null,
|
||||
focus : null,
|
||||
open : null,
|
||||
response : null,
|
||||
search : null,
|
||||
select : null
|
||||
},
|
||||
|
||||
pending : 0,
|
||||
|
||||
_initTrigger : function() {
|
||||
if (this.options.trigger !== false) {
|
||||
var input = this.element, self = this;
|
||||
this.wrapper = this.element.wrap("<span class='awsui-combobox-wrap'></span>").parent();
|
||||
this.trigger = $('<a href="javaScript:void" class="' + this.options.triggerClass + '"> </a>').appendTo(this.wrapper).click(function() {
|
||||
self._triggerClick();
|
||||
});
|
||||
var tw = this.trigger.outerWidth(true);
|
||||
input.css({
|
||||
// 21是trigger padding,4是ux对齐的右内边距
|
||||
width : input.width() - tw + 4
|
||||
});
|
||||
// 防止内容遮盖
|
||||
input.css({
|
||||
'padding-right' : tw
|
||||
});
|
||||
if (this.options.triggerOpenClass != null) {
|
||||
var self = this;
|
||||
this.element.on("comboboxopen", function() {
|
||||
if (self.trigger != null) {
|
||||
self.trigger.addClass(self.options.triggerOpenClass);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
widget : function() {
|
||||
return this.wrapper || this.element;
|
||||
},
|
||||
// menu impl start-------------------------------------------------------------------
|
||||
_isExpanded : function() {
|
||||
return this.list.is(":visible");
|
||||
},
|
||||
_scrollIntoView : function(item) {
|
||||
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
|
||||
if (this.list.outerHeight() < this.list.prop("scrollHeight")) {
|
||||
borderTop = parseFloat($.css(this.list[0], "borderTopWidth")) || 0;
|
||||
paddingTop = parseFloat($.css(this.list[0], "paddingTop")) || 0;
|
||||
offset = item.offset().top - this.list.offset().top - borderTop - paddingTop;
|
||||
scroll = this.list.scrollTop();
|
||||
elementHeight = this.list.height();
|
||||
itemHeight = item.height();
|
||||
|
||||
if (offset < 0) {
|
||||
this.list.scrollTop(scroll + offset);
|
||||
} else if (offset + itemHeight > elementHeight) {
|
||||
this.list.scrollTop(scroll + offset - elementHeight + itemHeight);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
_initList : function() {
|
||||
var t = this.element;
|
||||
this.list = $("<ul id='" + t.attr("id") + "_menu" + "'>").addClass("awsui-menu").appendTo(this.__renderTo());
|
||||
if (this.options.triggerOpenClass != null) {
|
||||
var self = this;
|
||||
this.list.on("close", function() {
|
||||
if (self.trigger != null) {
|
||||
self.trigger.removeClass(self.options.triggerOpenClass);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this._on(this.element, {
|
||||
keyup : function(event) {
|
||||
if (this.element.prop("readOnly")) {
|
||||
return;
|
||||
}
|
||||
var keyCode = $.ui.keyCode;
|
||||
switch (event.keyCode) {
|
||||
case keyCode.UP:
|
||||
// 1.未打开执行搜索;2.如果已经选中第一个返回;3.选择最后一个或者当前的上一个
|
||||
// if (!this._isExpanded()) {
|
||||
// this.search(null, event);
|
||||
// if (this.options.autoFocus) {
|
||||
// this._menuselect($("li:last", this.list));
|
||||
// }
|
||||
// } else {
|
||||
// if ($("li:first", this.list)[0] === $("li.active", this.list)[0]) {
|
||||
// return;
|
||||
// }
|
||||
// if ($("li.active", this.list).length == 0) {
|
||||
// this._menuselect($("li:last", this.list));
|
||||
// } else {
|
||||
// this._menuselect($("li.active", this.list).prev());
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
case keyCode.DOWN:
|
||||
// 1.未打开执行搜索;2.如果已经选中最后一个返回;3.选择第一个或者当前的下一个
|
||||
// if (!this._isExpanded()) {
|
||||
// this.search(null, event);
|
||||
// this._menuselect($("li:first", this.list));
|
||||
// } else {
|
||||
// if ($("li:last", this.list)[0] === $("li.active", this.list)[0]) {
|
||||
// return;
|
||||
// }
|
||||
// if ($("li.active", this.list).length == 0) {
|
||||
// this._menuselect($("li:first", this.list));
|
||||
// } else {
|
||||
// this._menuselect($("li.active", this.list).next());
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
case keyCode.ENTER:
|
||||
case keyCode.NUMPAD_ENTER:
|
||||
// var active=$("li.active",this.list);
|
||||
// if(this._isExpanded() && active.length==1){
|
||||
// event.preventDefault();
|
||||
// var item=active.data("awsui-combobox-item");
|
||||
// this._select(active, item);
|
||||
// }
|
||||
if (this.element.val() != '') {
|
||||
var itemData = {
|
||||
iconCls : "awsui-combobox-item-check",
|
||||
label : $.trim(this.element.val()),
|
||||
text : $.trim(this.element.val()),
|
||||
value : $.trim(this.element.val())
|
||||
};
|
||||
//如果不存在的话则添加
|
||||
// if (this.options.value) {
|
||||
// var valueArr = this.options.value.split(this.options.seperator);
|
||||
// if (valueArr.length < 10) {
|
||||
// if ($.inArray(this.element.val(), valueArr) == -1) {
|
||||
// this._addItemValue(itemData);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// this._addItemValue(itemData);
|
||||
// }
|
||||
//如果不存在的话则添加
|
||||
var valueSpans = $('#usersuper span[class=awsui-supertext-item]');
|
||||
if (valueSpans.length < 10) {
|
||||
var isExistValue = false;
|
||||
for (var i = 0; i < valueSpans.length; i++) {
|
||||
var thisValue = $.trim(this.element.val());
|
||||
if (thisValue == $(valueSpans[i]).text()) {
|
||||
isExistValue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isExistValue) {
|
||||
this._addItemValue(itemData);
|
||||
}
|
||||
}
|
||||
this.element.val('');
|
||||
}
|
||||
break;
|
||||
case keyCode.ESCAPE:
|
||||
// if (this._isExpanded()) {
|
||||
// this.close(event);
|
||||
// event.preventDefault();
|
||||
// }
|
||||
break;
|
||||
default:
|
||||
// search timeout should be triggered before the input value is changed
|
||||
// clearTimeout(this.searching);
|
||||
// this.searching = this._delay(function() {
|
||||
// // only search if the value has changed
|
||||
// if (this.lastQuery !== this._value()) {
|
||||
// this.selectedItem = null;
|
||||
// this.search(null, event);
|
||||
// }
|
||||
// }, this.options.delay);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_menuselect : function(item) {
|
||||
$("li.active", this.list).removeClass("active");
|
||||
item.addClass("active");
|
||||
this._scrollIntoView(item);
|
||||
},
|
||||
/**
|
||||
* 根据搜索结果重新初始化下拉列表
|
||||
*
|
||||
* @param items
|
||||
* 数据源
|
||||
*
|
||||
*/
|
||||
_reList : function(items) {
|
||||
var self = this;
|
||||
var f = function(event) {
|
||||
self._select($(this), event.data);
|
||||
};
|
||||
var value = this._value();
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i];
|
||||
item.text = item[this.options.displayField];
|
||||
if (this.options.multiple) {
|
||||
item.iconCls = this.options.multipleUnCheck;
|
||||
if (this._isChecked(item[this.options.valueField])) {
|
||||
item.iconCls = this.options.multipleCheck;
|
||||
}
|
||||
}
|
||||
item.method = f;
|
||||
}
|
||||
var t = this.options.target != null ? this.options.target : this.element;
|
||||
this.list.menu({
|
||||
target : t,
|
||||
items : items
|
||||
});
|
||||
if (this.options.autoFocus) {
|
||||
this._menuselect($("li:first", this.list));
|
||||
}
|
||||
},
|
||||
// menu impl end-------------------------------------------------------------------
|
||||
|
||||
_initState : function() {
|
||||
if (this.options.editable === false) {
|
||||
this._setOption("editable", false);
|
||||
}
|
||||
if (this.options.disabled === true) {
|
||||
this.disable();
|
||||
}
|
||||
},
|
||||
|
||||
_initSize : function() {
|
||||
var ul = this.list;
|
||||
if (this.options.listHeight != null) {
|
||||
ul.css({
|
||||
'max-height' : this.options.listHeight,
|
||||
'overflow-y' : 'auto',
|
||||
'overflow-x' : 'hidden'
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.width != null) {
|
||||
this.element.css({
|
||||
width : width
|
||||
});
|
||||
}
|
||||
var width = this.options.target != null ? this.options.target.outerWidth() : this.element.outerWidth();
|
||||
var tw = this.options.listWidth != null ? this.options.listWidth : width;
|
||||
ul.outerWidth(tw);
|
||||
},
|
||||
_create : function() {
|
||||
this.element.addClass("awsui-combobox-input").attr("autocomplete", "off");
|
||||
if (this.options.hiddenName != null) {
|
||||
this.hiddenField = $("<input type='hidden' id='" + this.options.hiddenName + "' name='" + this.options.hiddenName + "'>").insertBefore(
|
||||
this.element);
|
||||
if (this.element.attr("name") == this.options.hiddenName) {
|
||||
this.element.removeAttr("name");
|
||||
}
|
||||
}
|
||||
this._initTrigger();
|
||||
this._initList();
|
||||
this._initSize();
|
||||
this._initSource();
|
||||
this._initData();
|
||||
this._initState();
|
||||
|
||||
// turning off autocomplete prevents the browser from remembering the
|
||||
// value when navigating through history, so we re-enable autocomplete
|
||||
// if the page is unloaded before the widget is destroyed. #7790
|
||||
this._on(this.window, {
|
||||
beforeunload : function() {
|
||||
this.element.removeAttr("autocomplete");
|
||||
}
|
||||
});
|
||||
},
|
||||
_initData : function() {
|
||||
if (this.options.value == null) {
|
||||
if (this.options.initData != null && $.isArray(this.options.initData)) {
|
||||
var self = this;
|
||||
$.each(this.options.initData, function(index, item) {
|
||||
self._addItemValue(self._normItem(item));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
_destroy : function() {
|
||||
clearTimeout(this.searching);
|
||||
this.element.removeClass("awsui-combobox-input").removeAttr("autocomplete");
|
||||
this.list.element.remove();
|
||||
if (this.trigger) {
|
||||
this.trigger.remove();
|
||||
}
|
||||
if (this.hiddenField) {
|
||||
this.hiddenField.remove();
|
||||
}
|
||||
},
|
||||
|
||||
_setOption : function(key, value) {
|
||||
this._super(key, value);
|
||||
if (key === "source") {
|
||||
this._initSource();
|
||||
}
|
||||
if (key === "appendTo") {
|
||||
this.list.appendTo(this.__renderTo());
|
||||
}
|
||||
|
||||
if (key === "editable") {
|
||||
this.element.prop('readOnly', !value);
|
||||
if (value === false) {
|
||||
var self = this;
|
||||
this.element.on("mousedown", function(e) {
|
||||
// 防止menu隐藏
|
||||
if (!self._isExpanded()) {
|
||||
e.stopPropagation();
|
||||
self._triggerClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (key === "disabled") {
|
||||
this.element.prop('disabled', value);
|
||||
if (value && this.xhr) {
|
||||
this.xhr.abort();
|
||||
}
|
||||
}
|
||||
},
|
||||
_triggerClick : function() {
|
||||
this.element.focus();
|
||||
// Close if already visible
|
||||
if (this._isExpanded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Pass empty string as value to search for, displaying all results
|
||||
this.search("", null);
|
||||
},
|
||||
_select : function(item, data) {
|
||||
var self = this;
|
||||
var rr = this._trigger("select", null, {
|
||||
item : item,
|
||||
data : data,
|
||||
value : data[self.options.valueField],
|
||||
oldVal : this._value()
|
||||
});
|
||||
if (rr !== false) {
|
||||
if (this.options.multiple === true) {
|
||||
var v = this._value();
|
||||
var nowCheck = item.find(".icon").hasClass(this.options.multipleCheck);
|
||||
if (nowCheck) {
|
||||
this._deleteItemValue(data);
|
||||
item.find(".icon").removeClass(this.options.multipleCheck).addClass(this.options.multipleUnCheck);
|
||||
} else {
|
||||
this._addItemValue(data);
|
||||
item.find(".icon").removeClass(this.options.multipleUnCheck).addClass(this.options.multipleCheck);
|
||||
}
|
||||
} else {
|
||||
this._addItemValue(data);
|
||||
}
|
||||
|
||||
this._trigger("selected", null, {
|
||||
item : item,
|
||||
data : data,
|
||||
value : self._value()
|
||||
});
|
||||
}
|
||||
if (this.options.multiple !== true) {
|
||||
this._close();
|
||||
}
|
||||
},
|
||||
_addItemValue : function(data) {
|
||||
var v = data[this.options.valueField];
|
||||
var label = data[this.options.displayField];
|
||||
if (this.options.multiple === true) {
|
||||
label = this._value().length > 0 ? this._value() + this.options.seperator + data[this.options.displayField] : data[this.options.displayField];
|
||||
v = this.option("value") != null && this.option("value").length > 0 ? this.option("value") + this.options.seperator
|
||||
+ data[this.options.valueField] : data[this.options.valueField];
|
||||
}
|
||||
this._setvalue(v);
|
||||
this._value(label);
|
||||
},
|
||||
_deleteItemValue : function(data) {
|
||||
var vts = this.value().split(this.options.seperator);
|
||||
var lts = this._value().split(this.options.seperator);
|
||||
for (var i = 0; i < vts.length; i++) {
|
||||
if (vts[i] == data[this.options.valueField]) {
|
||||
vts.splice(i, 1);
|
||||
lts.splice(i, 1);
|
||||
}
|
||||
}
|
||||
this._setvalue(vts.join(this.options.seperator));
|
||||
this._value(lts.join(this.options.seperator));
|
||||
},
|
||||
_setvalue : function(v) {
|
||||
this.option("value", v);
|
||||
if (this.hiddenField) {
|
||||
this.hiddenField.val(v);
|
||||
}
|
||||
},
|
||||
value : function() {
|
||||
return this.option("value") == null ? "" : this.option("value");
|
||||
},
|
||||
_initSource : function() {
|
||||
var array, url, that = this;
|
||||
if ($.isArray(this.options.source)) {
|
||||
array = this.options.source;
|
||||
this.source = function(request, response) {
|
||||
response(that._filter(array, request.term));
|
||||
};
|
||||
} else if (typeof this.options.source === "string") {
|
||||
url = this.options.source;
|
||||
this.source = function(request, response) {
|
||||
if (that.xhr) {
|
||||
that.xhr.abort();
|
||||
}
|
||||
that.xhr = $.ajax({
|
||||
url : url,
|
||||
dataType : "json",
|
||||
data : request,
|
||||
success : function(data) {
|
||||
if ($.isArray(data)) {
|
||||
response(data);
|
||||
} else {
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
response([]);
|
||||
}
|
||||
});
|
||||
};
|
||||
} else {
|
||||
this.source = this.options.source;
|
||||
}
|
||||
},
|
||||
|
||||
search : function(value, event) {
|
||||
value = value != null ? value : this._value();
|
||||
|
||||
// always save the actual value, not the one passed as an argument
|
||||
this.lastQuery = this._value();
|
||||
|
||||
if (value.length < this.options.minLength) {
|
||||
return this.close(event);
|
||||
}
|
||||
|
||||
var q = {
|
||||
term : value
|
||||
};
|
||||
if (this._trigger("search", event, q) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.pending++;
|
||||
this.element.addClass("ui-autocomplete-loading");
|
||||
this.cancelSearch = false;
|
||||
|
||||
this.source(q, this._query());
|
||||
},
|
||||
|
||||
_query : function() {
|
||||
var that = this, index = ++requestIndex;
|
||||
|
||||
return function(content) {
|
||||
if (index === requestIndex) {
|
||||
that._process(content);
|
||||
}
|
||||
|
||||
that.pending--;
|
||||
if (!that.pending) {
|
||||
that.element.removeClass("ui-autocomplete-loading");
|
||||
}
|
||||
};
|
||||
},
|
||||
_isChecked : function(v) {
|
||||
var value = this.value();
|
||||
return value != "" && (this.options.seperator + value + this.options.seperator).indexOf(this.options.seperator + v + this.options.seperator) != -1;
|
||||
},
|
||||
_process : function(content) {
|
||||
if (content) {
|
||||
content = this._normalize(content);
|
||||
}
|
||||
this._trigger("response", null, {
|
||||
content : content
|
||||
});
|
||||
if (!this.options.disabled && content && content.length && !this.cancelSearch) {
|
||||
this._reList(content);
|
||||
this._trigger("open");
|
||||
} else {
|
||||
// use ._close() instead of .close() so we don't cancel future searches
|
||||
this._close();
|
||||
}
|
||||
},
|
||||
|
||||
close : function(event) {
|
||||
this.cancelSearch = true;
|
||||
this._close(event);
|
||||
},
|
||||
|
||||
_close : function(event) {
|
||||
this.list.menu("close");
|
||||
},
|
||||
_normItem : function(item) {
|
||||
if (typeof item === "string") {
|
||||
return {
|
||||
label : item,
|
||||
value : item
|
||||
};
|
||||
}
|
||||
return $.extend({
|
||||
label : item[this.options.displayField] || item[this.options.valueField],
|
||||
value : item[this.options.valueField] || item[this.options.displayField]
|
||||
}, item);
|
||||
},
|
||||
_normalize : function(items) {
|
||||
if (items == null && items == "") {
|
||||
items = [];
|
||||
}
|
||||
// assume all items have the right format when the first item is complete
|
||||
if (items.length && items[0][this.options.displayField] && items[0][this.options.valueField]) {
|
||||
return items;
|
||||
}
|
||||
return $.map(items, this._normItem);
|
||||
},
|
||||
|
||||
_value : function() {
|
||||
var nodeName = this.element[0].nodeName.toLowerCase(), isTextarea = nodeName === "textarea", isInput = nodeName === "input";
|
||||
var valueMethod = this.element[isTextarea || isInput ? "val" : "text"];
|
||||
return valueMethod.apply(this.element, arguments);
|
||||
},
|
||||
_escapeRegex : function(value) {
|
||||
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
||||
},
|
||||
_filter : function(array, term) {
|
||||
var matcher = new RegExp(this._escapeRegex(term), "i");
|
||||
var self = this;
|
||||
return $.grep(array, function(value) {
|
||||
return matcher.test(value[self.options.displayField] || value[self.options.valueField] || value);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Menu渲染位置
|
||||
*
|
||||
*/
|
||||
__renderTo : function() {
|
||||
var element = this.options.appendTo;
|
||||
if (element) {
|
||||
element = element.jquery || element.nodeType ? $(element) : this.document.find(element).eq(0);
|
||||
}
|
||||
if (!element) {
|
||||
element = this.element.closest(".ui-front");
|
||||
}
|
||||
if (!element.length) {
|
||||
element = this.document[0].body;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
|
||||
/*!
|
||||
*
|
||||
* AWS UI UserInput主函数
|
||||
* jQuery verson 1.10.2
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
$.widget("awsui.userinputkms", $.awsui.combobox_old, {
|
||||
options : {
|
||||
trigger : false
|
||||
},
|
||||
_initData : function() {
|
||||
//div上添加overflow防止换行后问题 hel
|
||||
this.box = $("<div style='overflow:auto;'></div>").prependTo(this.options.superbox);
|
||||
$.awsui.combobox_old.prototype._initData.call(this);
|
||||
if (this.options.disabled) {
|
||||
this.box.find(".close").hide();
|
||||
}
|
||||
},
|
||||
_setOption : function(key, value) {
|
||||
this._super(key, value);
|
||||
if (this.box && key === "disabled") {
|
||||
this.box.find(".close")[value ? "hide" : "show"]();
|
||||
this.options.superbox[value ? "addClass" : "removeClass"]("disable");
|
||||
}
|
||||
},
|
||||
_addItemValue : function(data) {
|
||||
var notfindClass = "";
|
||||
if (data.notfind) {
|
||||
notfindClass = "notfind";
|
||||
}
|
||||
var html = $(
|
||||
"<span class='awsui-supertext-items " + notfindClass + "'><span class='awsui-supertext-item'>" + data[this.options.displayField]
|
||||
+ "</span><span class='forms-icon down close'></span></span>").appendTo(this.box);
|
||||
html.data("awsui-supertext-items-data", data);
|
||||
var self = this;
|
||||
html.find(".close").on("click", function() {
|
||||
$(this).parent().fadeOut(function() {
|
||||
self.__r($(this));
|
||||
});
|
||||
});
|
||||
self._setvalue(self._getvalue());
|
||||
self._trigger("add", null, {
|
||||
label : data[this.options.displayField],
|
||||
v : data.value
|
||||
});
|
||||
// 选择item后,重新设置menu位置
|
||||
// by wsz of 2015-01-27
|
||||
var _input = this.element;
|
||||
var _menu = $('#' + _input.attr('id') + '_menu');
|
||||
_menu.css({
|
||||
left : this.options.target.offset().left,
|
||||
top : this.options.target.offset().top + this.options.target.outerHeight(true)
|
||||
});
|
||||
if (this.options.callback != null) {
|
||||
this.options.callback();
|
||||
}
|
||||
},
|
||||
__r : function(jq) {
|
||||
var d = jq.data("awsui-supertext-items-data");
|
||||
jq.remove();
|
||||
this._setvalue(this._getvalue());
|
||||
this._trigger("del", null, {
|
||||
label : d[this.options.displayField],
|
||||
v : d.value
|
||||
});
|
||||
},
|
||||
_deleteItemValue : function(data) {
|
||||
var self = this;
|
||||
$.each(this.box.find(".awsui-supertext-items"), function() {
|
||||
if (data.value == $(this).data("awsui-supertext-items-data")[self.options.valueField]) {
|
||||
$(this).fadeOut(function() {
|
||||
self.__r($(this));
|
||||
});
|
||||
}
|
||||
});
|
||||
// 选择item后,重新设置menu位置
|
||||
// by wsz of 2015-01-27
|
||||
var _input = this.element;
|
||||
var _menu = $('#' + _input.attr('id') + '_menu');
|
||||
_menu.css({
|
||||
left : this.options.target.offset().left,
|
||||
top : this.options.target.offset().top + this.options.target.outerHeight(true)
|
||||
});
|
||||
},
|
||||
_isChecked : function(v) {
|
||||
var c = false;
|
||||
var self = this;
|
||||
$.each(this.box.find(".awsui-supertext-items"), function() {
|
||||
if (v == $(this).data("awsui-supertext-items-data")[self.options.valueField]) {
|
||||
c = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return c;
|
||||
},
|
||||
_getvalue : function() {
|
||||
var v = "";
|
||||
var self = this;
|
||||
$.each(this.box.find(".awsui-supertext-items"), function() {
|
||||
if (v != "") {
|
||||
v += self.options.seperator;
|
||||
}
|
||||
v += $(this).data("awsui-supertext-items-data")[self.options.valueField];
|
||||
});
|
||||
return v;
|
||||
},
|
||||
_destroy : function() {
|
||||
$.awsui.combobox_old.prototype._destroy.call(this);
|
||||
this.box.remove();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@ -0,0 +1,246 @@
|
||||
|
||||
<div id="browseCardDialog" class="browse-card-dialog">
|
||||
<div class="browse-card-title">
|
||||
<span name="closeBrowseDialogSpan" class="browse-card-hidden-operate">>></span> <span class="title"></span>
|
||||
</div>
|
||||
<div name="head" style="width: 100%; height: 160px;padding:0 20px; background-color:#f8f8f8">
|
||||
<div name="cardUserInfo" style="width: 60%; height: 100%; float: left; box-sizing: border-box; padding-top: 35px;">
|
||||
<div style="width:80px;display:inline-block">
|
||||
<div style="width: 80px; margin: 0 auto;">
|
||||
<img name="cardCreateUserPhoto" alt="知识作者" src="" class="radius5" style="width: 80px; height: 80px;">
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:200px;display:inline-block">
|
||||
<div style="text-align: left; margin-left:15px;text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">
|
||||
<span name="cardCreateUsername" style="font-size: 14px;color: #666;"></span><br><span name="cardCreateDept" style="font-size: 12px;color: #666;display:inline-block;margin-top:5px"></span>
|
||||
</div>
|
||||
<div name="doRateWrap" style="margin-left:15px;margin-top:15px;height:25px; width: 190px;">
|
||||
<div style="float: left; font-size: 14px; color: #666;">您的评分:</div>
|
||||
<div style="float: left;" name="rateDiv"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div name="ratingWrap" style="width: 40%; height: 100%; float: left;position:relative">
|
||||
<div class="rating_wrap clearbox" style="position:absolute;left:0px;top:0px">
|
||||
<div class="rating_self clearfix" style="width: 165px; display: block;">
|
||||
<strong name="avgScore" class="ll rating_num" style="margin-right: 2px;">0</strong> <span></span>
|
||||
<div class="rating_right ">
|
||||
<div name="avgRate"></div>
|
||||
<div class="rating_sum">
|
||||
<span name="rateUserCounts">0</span>人评分
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div name="percentDiv">
|
||||
<span class="stars5 starstop"> 5星 </span>
|
||||
<div name="fiveStarBar" class="power"></div>
|
||||
<span name="fiveStar" class="rating_per"></span> <br> <span class="stars4 starstop"> 4星 </span>
|
||||
<div name="fourStarBar" class="power"></div>
|
||||
<span name="fourStar" class="rating_per"></span> <br> <span class="stars3 starstop"> 3星 </span>
|
||||
<div name="threeStarBar" class="power"></div>
|
||||
<span name="threeStar" class="rating_per"></span> <br> <span class="stars2 starstop"> 2星 </span>
|
||||
<div name="twoStarBar" class="power"></div>
|
||||
<span name="twoStar" class="rating_per"></span> <br> <span class="stars1 starstop"> 1星 </span>
|
||||
<div name="oneStarBar" class="power"></div>
|
||||
<span name="oneStar" class="rating_per"></span> <br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='cardContext-readOnly' name='cardEditInfo' style='padding:10px 20px;height:100px;white-space: normal;width:95%;overflow:auto' ></div>
|
||||
<!--<table width="100%">
|
||||
<tr>
|
||||
<td colspan = 2 id="cardContext-readOnly-td"></td>
|
||||
</tr>
|
||||
</table>-->
|
||||
<div name="toolbar" style="height: 26px; padding: 5px 10px; border-bottom: 1px solid #E7E7E7;">
|
||||
<input type="hidden" id="groupValue">
|
||||
<input type="hidden" id="fileValue">
|
||||
<button name="packageFiles" class="button blue">打包下载</button>
|
||||
<button name="editCard" class="button green" style="display: none;">编辑文档</button>
|
||||
<button name="reloadCard" class="button red" style="display: none;">刷新知识</button>
|
||||
<span name="reportCard" class="button white browsebtn" style="width: 58px; margin-right: 0;"><span class="report"></span><span class="reportword">反馈</span></span> <span name="collectCard" class="button white browsebtn" style="display: none; width: 56px;"><span class="collection"></span><span class="collectionword">收藏</span></span> <span name="browseInvitation" class="button white browsebtn" style="width: 86px;"><span class="share"></span><span class="shareword">阅读邀请</span></span>
|
||||
</div>
|
||||
<div name="fileAndCommentDiv" style="overflow-x: hidden; overflow-y: auto; position: absolute; bottom: 0; top: 313px;">
|
||||
<div style="width: 100%;">
|
||||
<table style="width: 100%; height: 100%; border-top: 0;" class="table table-thin no-padding">
|
||||
<tbody>
|
||||
<tr valign="top" style="height: 27px; font-weight: bold;word-break: normal;">
|
||||
<td style="width: 35px; border-top: 0; text-align: center;">序号</td>
|
||||
<td style="width: 270px; border-top: 0; padding-left: 8px;">文件名</td>
|
||||
<td style="width: 15px; border-top: 0; text-align: center;"> </td>
|
||||
<td style="width: 100px; border-top: 0;">上传人</td>
|
||||
<td style="width: 80px; border-top: 0;">大小</td>
|
||||
<td style="width: 130px; border-top: 0; text-align: center;">日期</td>
|
||||
<td style="width: 70px; border-top: 0; text-align: center;">下载/阅读</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" style="padding: 0; border: 0;">
|
||||
<div name="attachDiv" style="overflow-x: hidden; overflow-y: auto;">
|
||||
<table name="attachTable" style="width: 100%; border-top: 0;" class="table table-thin">
|
||||
<tbody>
|
||||
<tr id='attachColTR'>
|
||||
<td align="center" style="width: 35px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="left" style="width: 270px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 15px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 100px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 80px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 130px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 70px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div name="commentDiv" style="width: 100%; overflow-x: hidden; overflow-y: auto; box-sizing: border-box; padding-bottom: 60px;"></div>
|
||||
<div name="submitCommentDiv" style="position: absolute; bottom: 0px; border-top: 1px solid #E7E7E7; width: 100%; padding-top: 5px; padding-bottom: 5px; display: none; background-color: white;">
|
||||
<img name="mePhoto" class="radius30 user-img" />
|
||||
<textarea name="commentContent" placeholder="请输入评论内容..." style="width: 440px; height: 27px; vertical-align: middle; margin-left: 16px;" class="txt awsui-textarea"></textarea>
|
||||
<button name="reportCommentBtn" type="button" class="button blue" style="vertical-align: middle; margin-left: 16px;">提交</button>
|
||||
</div>
|
||||
<div name="comment-toogle" class="add-comment-wrap">
|
||||
<div class="add-comment"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div name="fullscreenWrap" style="filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#E5000000,endColorstr=#E5000000);position: fixed; left: 0; right: 0; top: 0; bottom: 0; display: none; z-index: 501;">
|
||||
<!-- <div name="fullscreenpanel" class="fullscreenpanel"></div> -->
|
||||
<div name='fstoolbar' class="fstoolbar">
|
||||
<div class='toolbar-photo'>
|
||||
<img src="" class="awsui-user-profile">
|
||||
</div>
|
||||
<div class='toolbar-title'></div>
|
||||
<div name="fsclosebtn" class="fsclosebtn" title="关闭"></div>
|
||||
<div name="fsdownloadbtn" class="fsdownloadbtn" onclick="downloadFile(this)" title="下载文件"></div>
|
||||
</div>
|
||||
<div name="previewpanel" class="previewpanel"></div>
|
||||
</div>
|
||||
<input id="sid" name="sid" type="hidden" />
|
||||
<div id='knwlDocDialog' style="display: none;">
|
||||
<table class="awsui-ux" style="padding: 0px 10px;">
|
||||
<tbody>
|
||||
<tr >
|
||||
<td>
|
||||
|
||||
<table class="awsui-ux" style="padding: 0px 0px;">
|
||||
<colgroup>
|
||||
<col class="awsui-ux-title" style="width: 10%;">
|
||||
<col style="width: 30%;">
|
||||
<col class="awsui-ux-title" style="width: 60%;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr height="35px">
|
||||
<td >标题</td>
|
||||
<td><span class="required"> <input id="cardName" name="cardName" type="text" class="txt" style="width: 264px;" />
|
||||
</span></td>
|
||||
<td rowspan="6">
|
||||
<div id='cardEditTd'><script type='text/plain' id='cardEditInfo' name='cardEditInfo' style='height:170px;white-space: normal;width:100%' ></script></div>
|
||||
<div id="cardEditNoContent" style="text-align:center;height:275px;display:none;cursor:pointer;background:url(../apps/com.actionsoft.apps.kms/img/no_content.png) no-repeat top;background-size:40% 80%;" onclick="showEditor()">
|
||||
|
||||
<span style="display:inline-block;position:relative;top:230px;color:#C0C2C4">暂无正文,点击此处编辑,或左下角上传文件</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="35px">
|
||||
<td >有效期</td>
|
||||
<td><input id="validDate" name="validDate" type="text" class="txt" placeholder="默认长期有效" title="默认长期有效" style="width: 162px;" /></td>
|
||||
</tr>
|
||||
<tr height="35px" class="onlineLevelTr">
|
||||
<td >格式转换</td>
|
||||
<td>
|
||||
<!--<input class="awsui-radio" name="radioxOL" checked="checked" id="rdoOL1" value="1" type="radio">
|
||||
<label class="awsui-radio-label" for="rdoOL1">在线阅读和下载</label>
|
||||
<input class="awsui-radio" name="radioxOL" id="rdoOL0" value="0" type="radio">
|
||||
<label class="awsui-radio-label" for="rdoOL0">在线阅读</label>
|
||||
<input class="awsui-radio" name="radioxOL" id="rdoOL2" value="2" type="radio">
|
||||
<label class="awsui-radio-label" for="rdoOL0">只下载</label>-->
|
||||
<select id="rdoOL"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<!--<tr height="35px">
|
||||
<td >可以评论</td>
|
||||
<td></td>
|
||||
</tr>-->
|
||||
<tr height="35px">
|
||||
<td >保密级别</td>
|
||||
<td><input class="awsui-radio" checked="checked" name="radioxSL" id="rdoSL0" value="0" type="radio"> <label class="awsui-radio-label" for="rdoSL0">普通</label> <input class="awsui-radio" name="radioxSL" id="rdoSL1" value="1" type="radio"> <label class="awsui-radio-label" for="rdoSL1">秘密</label> <input class="awsui-radio" name="radioxSL" id="rdoSL2" value="2" type="radio"> <label class="awsui-radio-label" for="rdoSL2">机密</label></td>
|
||||
</tr>
|
||||
<tr height="35px">
|
||||
<td >互动选项</td>
|
||||
<td><input id="isCommentSB" type="checkbox"> <input id="isRateSB" type="checkbox"></td>
|
||||
</tr>
|
||||
<!--<tr>
|
||||
<td class="awsui-ux-title">知识内容</td>
|
||||
<td colspan = '3'><textarea class="txt awsui-textarea" placeholder="" id="cardContext" name="cardContext" title="" style="height: 80px; width: 530px;"></textarea></td>
|
||||
</tr>-->
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<fieldset style="margin: 0;">
|
||||
<legend style="margin: 0;"> 文件 </legend>
|
||||
<table style="width: 100%; border-top: 0;" class="table table-thin no-padding">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 45px; border: 0; text-align: center;">序号</td>
|
||||
<td style="width: 300px; border: 0;">名称</td>
|
||||
<td style="width: 15px; border: 0; text-align: center;"> </td>
|
||||
<td style="width: 50px; border: 0;">版本</td>
|
||||
<td style="width: 100px; border: 0;">上传人</td>
|
||||
<td style="width: 80px; border: 0;">大小</td>
|
||||
<td style="width: 130px; border: 0; text-align: center;">日期</td>
|
||||
<td style="width: 40px; border: 0;">删除</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" style="padding: 0; border: 0;">
|
||||
<div id="fileDiv" style="overflow-x: hidden; overflow-y: auto; height: 100px; border: 1px solid #e5e5e5;">
|
||||
<table id="fileTable" style="width: 100%; border-top: 0;" class="table table-thin">
|
||||
<tr id='colTR'>
|
||||
<td align="center" style="width: 45px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="left" style="width: 300px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 15px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 50px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 100px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 80px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 130px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
<td align="center" style="width: 40px; height: 0; min-height: 0; max-height: 0; margin: 0; padding: 0; border: 0;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" style="text-align: right; border: 0;">
|
||||
<div id="uploadDoc" class="upbtn-wrapper" style="display: inline-block; float: left;">
|
||||
<div class="upbtn-icon"></div>
|
||||
<div class="upbtn-inner">
|
||||
<span class="upbtn-span">上传文件</span>
|
||||
</div>
|
||||
</div>
|
||||
<button id="knwlDocOkBtn" class="button blue">保存</button>
|
||||
<button id="knwlDocNoBtn" class="button" style="margin-right: 0;">关闭</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="reportCardPopbox" class="awsui-popbox" style="z-index:301">
|
||||
<div style="margin: 20px">
|
||||
<textarea id="reportTextarea" placeholder="反馈内容将发送给管理员。如果要参与评论,请点击右下角图标。" style="width: 200px; height: 100px; margin-bottom: 10px;" class="txt awsui-textarea"></textarea>
|
||||
<button id="reportButton" class="button green" style="float: right; margin-right: 0;">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
<div title="选择分享类型" id="select-share-dlg" style='display: none;'>
|
||||
<div id="select-share-dlg-content" style='padding-top: 10px; overflow: hidden;'></div>
|
||||
</div>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@
|
||||
<div id="logDiv" style="display: none;">
|
||||
<div id="logGrid"></div>
|
||||
</div>
|
||||
@ -0,0 +1,110 @@
|
||||
/**
|
||||
* kms通用操作 查看日志 编辑知识等
|
||||
*
|
||||
* 依赖aws.dialog aws.grid
|
||||
*/
|
||||
$(function() {
|
||||
try{
|
||||
//todo临时注释掉ie8的quicktip,有bug32933
|
||||
if(!$.support.leadingWhitespace){//判断IE8
|
||||
$(document).off('mouseover.over');
|
||||
}
|
||||
}catch(e){}
|
||||
$(document.body).append('<div id="tmpOptDiv"></div>');
|
||||
$('#tmpOptDiv').load('../apps/com.actionsoft.apps.kms/js/com.actionsoft.apps.kms.common.opt.htm', {}, function() {
|
||||
$('#logDiv').appendTo($(document.body));
|
||||
$('#tmpOptDiv').remove();
|
||||
});
|
||||
})
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
var logGrid = undefined;
|
||||
function showLog(cardId, cardName) {
|
||||
$("#logDiv").dialog({
|
||||
title : "访问日志",
|
||||
width : 800,
|
||||
height : 510,
|
||||
model : true,
|
||||
buttons : [ {
|
||||
text : '关闭',
|
||||
cls : "blue",
|
||||
handler : function() {
|
||||
$("#logDiv").dialog("close");
|
||||
}
|
||||
} ],
|
||||
onClose : function() {
|
||||
logGrid.awsGrid("option", "dataModel").data = [];
|
||||
}
|
||||
});
|
||||
var logGridConfig = {
|
||||
width : 786,
|
||||
height : 420,
|
||||
title : '知识名称:' + unescape(cardName),
|
||||
editable : false,
|
||||
columnBorders : false,
|
||||
scrollModel : {
|
||||
autoFit : true,
|
||||
horizontal : true
|
||||
},
|
||||
colModel : [ {
|
||||
title : "访问内容",
|
||||
width : 504,
|
||||
sortable : true,
|
||||
editable : false,
|
||||
dataType : "string",
|
||||
dataIndx : "logContent",
|
||||
resizable : true,
|
||||
showText : false
|
||||
}, {
|
||||
title : "访问人",
|
||||
width : 100,
|
||||
sortable : true,
|
||||
editable : false,
|
||||
dataType : "string",
|
||||
dataIndx : "accessUsername",
|
||||
resizable : true,
|
||||
showText : false
|
||||
}, {
|
||||
title : "访问时间",
|
||||
width : 150,
|
||||
editable : false,
|
||||
sortable : true,
|
||||
align : 'center',
|
||||
dataIndx : "accessTime"
|
||||
} ],
|
||||
dataModel : {
|
||||
location : "remote",
|
||||
sorting : "remote",
|
||||
sortIndx : 'accessTime',
|
||||
sortDir : 'down',
|
||||
paging : "remote",
|
||||
method : "POST",
|
||||
curPage : 1, // 当前页
|
||||
rPP : parent.gridRowPP, // 每页个数
|
||||
getUrl : function() {
|
||||
return {
|
||||
url : "./jd",
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_knwl_center_log_list",
|
||||
curPage : logGrid == undefined ? 1 : (logGrid.awsGrid("option").dataModel.curPage <= 0 ? 1 : logGrid.awsGrid("option").dataModel.curPage),
|
||||
rowsPerPage : logGridConfig.dataModel.rPP,
|
||||
cardId : cardId,
|
||||
sortIndx : this.sortIndx,
|
||||
sortDir : this.sortDir
|
||||
}
|
||||
};
|
||||
},
|
||||
getData : function(responseObject) {
|
||||
return {
|
||||
curPage : responseObject.data.curPage,
|
||||
totalRecords : responseObject.data.totalRecords,
|
||||
data : responseObject.data.data
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
logGrid = $("#logGrid").awsGrid(logGridConfig);
|
||||
logGrid.find(".pq-pager").awsGridPager("option", $.awsgrid.awsGridPager.regional["zh"]);
|
||||
}
|
||||
@ -0,0 +1,972 @@
|
||||
var allDG = {
|
||||
dragSeparator: function () {
|
||||
/* 拖动分隔栏开始 */
|
||||
if (all.isDimensionKnwlPage) {
|
||||
if (getCookie('kms.knwlcenter.separater.' + dimensionId + '.originalWidth')) {
|
||||
$('#all-left').css('width', getCookie('kms.knwlcenter.separater.' + dimensionId + '.originalWidth'));
|
||||
$('#all-right').css('margin-left', ($('#all-left').outerWidth(true) + $('#all-separater').outerWidth(true)));
|
||||
}
|
||||
} else {
|
||||
if (getCookie('kms.knwlcenter.separater.originalWidth')) {
|
||||
$('#all-left').css('width', getCookie('kms.knwlcenter.separater.originalWidth'));
|
||||
$('#all-right').css('margin-left', ($('#all-left').outerWidth(true) + $('#all-separater').outerWidth(true)));
|
||||
}
|
||||
}
|
||||
var dragFlag = false; // 拖动标记,mousedown时可以拖动,mouseup时不可以拖动
|
||||
var originalPageX = 0;
|
||||
var originalWidth = parseInt($('#all-left').css('width'));
|
||||
$('#all-separater').off('mousedown').on('mousedown', function (e) {
|
||||
dragFlag = true;
|
||||
originalPageX = e.pageX;
|
||||
$(document).on("selectstart.dimension", function () {
|
||||
return false;
|
||||
});
|
||||
$(document).off('mousemove.dimension').on('mousemove.dimension', function (e) {
|
||||
if (dragFlag === true) {
|
||||
var minWidthControl = parseInt($('#all-left').css('width'));
|
||||
var movePx = e.pageX - originalPageX;
|
||||
if (!((movePx > 0 && minWidthControl > 500) || (movePx < 0 && minWidthControl < 240))) {
|
||||
$('#all-left').css('width', (originalWidth + movePx));
|
||||
$('#all-right').css('margin-left', ($('#all-left').outerWidth(true) + $('#all-separater').outerWidth(true)));
|
||||
all.resizeDimensionCardGrid();
|
||||
} else {
|
||||
$(document).trigger('mouseup.dimension');
|
||||
}
|
||||
}
|
||||
});
|
||||
$(document).off('mouseup.dimension').on('mouseup.dimension', function (e) {
|
||||
if (dragFlag === true) {
|
||||
dragFlag = false;
|
||||
originalWidth = parseInt($('#all-left').css('width'));
|
||||
$(document).off("selectstart.dimension");
|
||||
$(document).off('mousemove.dimension');
|
||||
$(document).off('mouseup.dimension');
|
||||
// 记录cookie
|
||||
if (all.isDimensionKnwlPage) {
|
||||
setCookie('kms.knwlcenter.separater.' + dimensionId + '.originalWidth', originalWidth);
|
||||
} else {
|
||||
setCookie('kms.knwlcenter.separater.originalWidth', originalWidth);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
/* 拖动分隔栏结束 */
|
||||
},
|
||||
dimensionId: '',
|
||||
treeObj: undefined,
|
||||
tmpIsDimensionKnwlPage: false,//临时变量,第一次加载完树的data后置为false
|
||||
initTree: function () {
|
||||
all.tmpIsDimensionKnwlPage = (all.isDimensionKnwlPage == true ? true : false);
|
||||
// 初始化维度树
|
||||
if (!all.treeObj) {
|
||||
var treeDataUrl = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_dimension_tree_json";
|
||||
var setting = {
|
||||
showLine: false,
|
||||
sort: true,
|
||||
event: {
|
||||
beforeExpand: all.getChildren,
|
||||
onClick: all.treeClick
|
||||
},
|
||||
animate: true,
|
||||
dataModel: {
|
||||
url: treeDataUrl,
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
params: {
|
||||
parentId: all.isDimensionKnwlPage ? dimensionId : '',
|
||||
isDimensionKnwlPage: all.tmpIsDimensionKnwlPage
|
||||
}
|
||||
}
|
||||
};
|
||||
all.treeObj = awsui.tree.init($("#dimensionTree"), setting);
|
||||
// 无权限维度的cursor为default
|
||||
var result = all.treeObj.getRootNode();
|
||||
for (var i = 0 && result != null; i < result.length; i++) {
|
||||
if (result[i].hasPerm === false) {
|
||||
all.treeObj.getNodeDomById(result[i].id).addClass('treeNoPerm');
|
||||
}
|
||||
}
|
||||
// 取第一个维度的维度列表
|
||||
var rootNodes = all.treeObj.getRootNode();
|
||||
if (rootNodes.length === 0) {
|
||||
$('#dimensionTree').html('<div class="kms-no-record">无知识分类</div>');
|
||||
} else {
|
||||
if (all.isDimensionKnwlPage) {//如果是独立部署页面,并且只有根节点,则不显示左侧left区域
|
||||
if (rootNodes[0].open === undefined) {
|
||||
$('#all-left,#all-separater').hide();
|
||||
$('#all-right').css({'margin-left': 0, 'left': 0});
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < rootNodes.length; i++) {
|
||||
if (rootNodes[i].hasPerm === true) {
|
||||
var firstNodeDom = all.treeObj.getNodeDomById(rootNodes[i].id);
|
||||
firstNodeDom.trigger('click');
|
||||
break;
|
||||
}
|
||||
}
|
||||
all.treeObj.setting.dataModel.params.isDimensionKnwlPage = false;
|
||||
if (all.isDimensionKnwlPage) {
|
||||
if (rootNodes[0].open == false) {
|
||||
var itemId = all.treeObj.config.treeObj.find("[tbindex='" + rootNodes[0].id + "']");
|
||||
all.treeObj.expandNode(itemId);
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 第一层维度的font-size为16 其余的层级为14(默认就是14)
|
||||
// $("#dimensionTree li[level=0] > a").css('font-size', '16px');
|
||||
}
|
||||
},
|
||||
// 展开节点
|
||||
getChildren: function (treeNode) {
|
||||
var nodeDom = all.treeObj.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) {
|
||||
all.treeObj.setting.dataModel.params.parentId = treeNode.id;
|
||||
var result = all.treeObj.getData(all.treeObj.setting.dataModel);
|
||||
all.treeObj.buildChilren(result, treeNode);
|
||||
// 无权限维度的cursor为default
|
||||
for (var i = 0 && result != null; i < result.length; i++) {
|
||||
if (result[i].hasPerm === false) {
|
||||
all.treeObj.getNodeDomById(result[i].id).addClass('treeNoPerm');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 维度树单击事件
|
||||
treeClick: function (treeNode) {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").hide();
|
||||
if (treeNode.hasPerm === true) {
|
||||
if (!all.isDimensionKnwlPage) {
|
||||
// 展示维度路径
|
||||
var pathNodeArr = [];
|
||||
var parentNodeTmp = treeNode;
|
||||
while (parentNodeTmp) {
|
||||
pathNodeArr[pathNodeArr.length] = parentNodeTmp;
|
||||
parentNodeTmp = all.treeObj.getParentNodeById(parentNodeTmp.id);
|
||||
}
|
||||
$('#dimensionPath').empty();
|
||||
if (pathNodeArr.length === 1) {
|
||||
var dimensionPathHtml = '' + pathNodeArr[0].name + '';
|
||||
$('#dimensionPath').html(dimensionPathHtml);
|
||||
} else {
|
||||
var dimensionPathHtml = '<a href="javascript:" onclick="window.all.treeUp();return false;" style="color:#079cda;padding-right: 10px;border-right: 1px solid #bdbdbd;margin-right:10px;">返回</a>';
|
||||
for (var i = pathNodeArr.length - 1; i >= 0; i--) {
|
||||
if (i != 0) {
|
||||
dimensionPathHtml += ('<a href="javascript:" style="color:#079cda;" onclick="javascript:window.all.treeObj.getNodeDomById(\'' + pathNodeArr[i].id + '\').trigger(\'click\');return false;">' + pathNodeArr[i].name + '</a>');
|
||||
dimensionPathHtml += '<span class="dimension-path"></span>';
|
||||
} else {
|
||||
dimensionPathHtml += pathNodeArr[i].name;
|
||||
}
|
||||
}
|
||||
dimensionPathHtml += '</ul>';
|
||||
$('#dimensionPath').html(dimensionPathHtml);
|
||||
}
|
||||
}
|
||||
if (treeNode.showType == 1 || treeNode.showType == 2) { // 普通维度
|
||||
// 清空过滤input内容
|
||||
$('#filterAllInput').val('');
|
||||
$('#dimensionCardToolbar,#dimension-card-grid').show();
|
||||
$('#hotspotDiv').hide();
|
||||
// 刷新列表
|
||||
all.dimensionId = treeNode.id;
|
||||
if (!all.dimensionCardGrid) {
|
||||
all.initDimensionCardGrid();
|
||||
} else {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").hide();
|
||||
all.dimensionCardGrid.awsGrid("refreshDataAndView");
|
||||
}
|
||||
} else if (treeNode.showType == 0) { // 知识地图
|
||||
$('#dimensionCardToolbar,#dimension-card-grid').hide();
|
||||
$('#hotspotDiv').show();
|
||||
var src = encodeURI("./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_hotspot_home&dimensionId=" + treeNode.id + "");
|
||||
if ($("#hotspotFrame").attr('src') != src) {
|
||||
$("#hotspotFrame").attr('src', src);
|
||||
}
|
||||
}
|
||||
all.resizeDimensionCardGrid();
|
||||
}
|
||||
},
|
||||
isDimensionKnwlPage: false,// 是否是独立的知识列表页面
|
||||
dimensionCardGrid: undefined,
|
||||
isNeedBorrow: false,
|
||||
isDimensionManager: false,
|
||||
totalRecords: 0,
|
||||
// 全部-维度知识grid初始化
|
||||
initDimensionCardGrid: function () {
|
||||
if (!all.dimensionCardGrid) {
|
||||
// 计算每页展示多少条比较合适(5的倍数,不出现滚动条,且能尽量充满页面)
|
||||
// var gridHeight = $('#tabs-content').height() -
|
||||
// $('#dimensionCardToolbar').outerHeight(true) - 2;
|
||||
// var gridContentHeight = gridHeight - 25 - 27; // 25为grid的top
|
||||
// 27位grid的bottom
|
||||
// var gridCounts = Math.floor(Math.floor(gridContentHeight / 34) /
|
||||
// 5) * 5;
|
||||
var dimensionCardGridConfig = {
|
||||
width: all.isDimensionKnwlPage ? $(window).width() - ($('#all-left').is('visible') ? $('#all-left').outerWidth(true) : 0) - 2 : $('#tab-all').outerWidth(true) - $('#all-left').outerWidth(true) - 2,
|
||||
height: all.isDimensionKnwlPage ? $(window).height() - $('#dimensionCardToolbar').outerHeight(true) - 2 : $('#tabs-content').height() - $('#dimensionCardToolbar').outerHeight(true) - 2,
|
||||
flexWidth: false,
|
||||
flexHeight: false,
|
||||
wrap: false,
|
||||
nowrapTitle: false,
|
||||
topVisible: false,
|
||||
editable: true,
|
||||
columnBorders: false,
|
||||
scrollModel: {
|
||||
autoFit: false,
|
||||
horizontal: true,
|
||||
vertical: true
|
||||
},
|
||||
colModel: [{
|
||||
title: "",
|
||||
checkbox: true,
|
||||
resizable: false,
|
||||
editable: false,
|
||||
align: "center",
|
||||
width: 30
|
||||
}, {
|
||||
title: "名称",
|
||||
width: 300,
|
||||
sortable: true,
|
||||
editable: false,
|
||||
dataType: "string",
|
||||
dataIndx: "cardName",
|
||||
resizable: true,
|
||||
showText: false,
|
||||
render: function (ui) {
|
||||
var cardNameText = ui.rowData[ui.dataIndx];
|
||||
if (all.isNeedBorrow === true) { // 借阅无法预览
|
||||
if (ui.rowData['createUser'] !== uid) {
|
||||
return cardNameText;
|
||||
} else {
|
||||
if (getCharCodeLength(cardNameText) > 46) { // 显示qtip
|
||||
return "<span style='cursor:pointer;color:#0000EE;' title=\"" + cardNameText + "\" onclick='parent.browseCard.browse(\"" + ui.rowData.cardId + "\",\"\",true,\"" + ui.rowData.dimensionId + "\"," + ui.rowIndxPage + ",\"all\");parent.stopPropagation(event);'>" + cardNameText + "</span>";
|
||||
} else {
|
||||
return "<span style='cursor:pointer;color:#0000EE;' onclick='parent.browseCard.browse(\"" + ui.rowData.cardId + "\",\"\",true,\"" + ui.rowData.dimensionId + "\"," + ui.rowIndxPage + ",\"all\");parent.stopPropagation(event);'>" + cardNameText + "</span>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (getCharCodeLength(cardNameText) > 46) { // 显示qtip
|
||||
return "<span style='cursor:pointer;color:#0000EE;' title=\"" + cardNameText + "\" onclick='parent.browseCard.browse(\"" + ui.rowData.cardId + "\",\"\",true,\"" + ui.rowData.dimensionId + "\"," + ui.rowIndxPage + ",\"all\");parent.stopPropagation(event);'>" + cardNameText + "</span>";
|
||||
} else {
|
||||
return "<span style='cursor:pointer;color:#0000EE;' onclick='parent.browseCard.browse(\"" + ui.rowData.cardId + "\",\"\",true,\"" + ui.rowData.dimensionId + "\"," + ui.rowIndxPage + ",\"all\");parent.stopPropagation(event);'>" + cardNameText + "</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
title: "发布人",
|
||||
width: 100,
|
||||
sortable: true,
|
||||
editable: false,
|
||||
dataType: "string",
|
||||
dataIndx: "publishUsername",
|
||||
resizable: true,
|
||||
showText: false
|
||||
}, {
|
||||
title: "发布时间",
|
||||
width: 120,
|
||||
sortable: true,
|
||||
editable: false,
|
||||
dataType: "string",
|
||||
align: 'center',
|
||||
dataIndx: "publishTime",
|
||||
resizable: true,
|
||||
showText: false
|
||||
}, {
|
||||
title: "知识类型",
|
||||
// width: 200,
|
||||
editable: false,
|
||||
editable: false,
|
||||
dataIndx: "cardType",
|
||||
hidden: true,
|
||||
render: function (ui) {
|
||||
var cardType = ui.rowData[ui.dataIndx];
|
||||
if (cardType == 0) {
|
||||
return "文档";
|
||||
} else if (cardType == 1) {
|
||||
return "图集";
|
||||
} else if (cardType == 2) {
|
||||
return "视频集";
|
||||
} else if (cardType == 3) {
|
||||
return "文本文件";
|
||||
} else {
|
||||
return "数据错误[知识类型]";
|
||||
}
|
||||
}
|
||||
}, {
|
||||
title: "阅读次数",
|
||||
sortable: true,
|
||||
editable: false,
|
||||
width: 70,
|
||||
align: 'center',
|
||||
dataIndx: "readCount"
|
||||
}, {
|
||||
title: "重要级别",
|
||||
width: 80,
|
||||
editable: false,
|
||||
dataIndx: "rdoSL"
|
||||
}, {
|
||||
title: "操作",
|
||||
width: 150,
|
||||
align: 'left',
|
||||
sortable: false,
|
||||
editable: false,
|
||||
dataIndx: "",
|
||||
render: function (ui) {
|
||||
var btnHtml = '';
|
||||
if (all.isDimensionManager) {
|
||||
btnHtml += "<span class='opt_icon edit' onclick='me.editCardDialog(\"" + ui.rowIndxPage + "\",\"all\");parent.stopPropagation(event);' title='编辑'></span>";
|
||||
btnHtml += "<span class='opt_icon publish' onclick='me.publishCardDialog(\"all\",\"" + ui.rowIndxPage + "\");parent.stopPropagation(event);' title='发布'></span>";
|
||||
btnHtml += "<span class='opt_icon cancelpublish' onclick='publish.cancelPublishCard(" + ui.rowIndxPage + ",\"all\");parent.stopPropagation(event);' title='取消发布'></span>";
|
||||
btnHtml += "<span class='opt_icon log' onclick='showLog(\"" + ui.rowData['cardId'] + "\",\"" + encodeURIComponent(ui.rowData['cardName']) + "\");parent.stopPropagation(event);' title='日志'></span>";
|
||||
}
|
||||
if (all.isNeedBorrow) {// 如果需要借阅并且不是知识创建人
|
||||
if (ui.rowData['createUser'] !== uid) {
|
||||
btnHtml += "<span class='opt_icon borrow' onclick='window.all.borrowCard(" + ui.rowIndxPage + ");parent.stopPropagation(event);' title='借阅'></span>";
|
||||
}
|
||||
}
|
||||
return btnHtml;
|
||||
}
|
||||
}],
|
||||
dataModel: {
|
||||
location: "remote",
|
||||
sorting: "remote",
|
||||
sortIndx: 'publishTime',
|
||||
sortDir: 'down',
|
||||
paging: "remote",
|
||||
method: "POST",
|
||||
curPage: 1, // 当前页
|
||||
rPP: parent.gridRowPP, // 每页个数
|
||||
getUrl: function () {
|
||||
return {
|
||||
url: "./jd",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_dimension_card_list_json",
|
||||
dimensionId: all.dimensionId,
|
||||
curPage: all.dimensionCardGrid == undefined ? 1 : (all.dimensionCardGrid.awsGrid("option").dataModel.curPage <= 0 ? 1 : all.dimensionCardGrid.awsGrid("option").dataModel.curPage),
|
||||
rowsPerPage: dimensionCardGridConfig.dataModel.rPP,
|
||||
sortIndx: this.sortIndx,
|
||||
sortDir: this.sortDir,
|
||||
filter: encodeURIComponent($('#filterAllInput').val())
|
||||
}
|
||||
};
|
||||
},
|
||||
getData: function (responseObject) {
|
||||
all.isNeedBorrow = responseObject.data.isNeedBorrow;
|
||||
all.isDimensionManager = responseObject.data.isDimensionManager;
|
||||
all.totalRecords = responseObject.data.totalRecords;
|
||||
return {
|
||||
curPage: responseObject.data.curPage,
|
||||
totalRecords: responseObject.data.totalRecords,
|
||||
data: responseObject.data.data
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
all.dimensionCardGrid = $("#dimension-card-grid").awsGrid(dimensionCardGridConfig);
|
||||
all.dimensionCardGrid.find(".pq-pager").awsGridPager("option", $.awsgrid.awsGridPager.regional["zh"]);
|
||||
all.dimensionCardGrid.awsGrid({
|
||||
load: function (event, ui) {
|
||||
if (all.totalRecords === 0) {
|
||||
$("#dimension-card-grid .pq-cont").html('<div class="kms-no-km"></br><div class="title"> 没有知识</div><div class="content">该路径下没有知识,可以在“知识中心-个人”中新建知识、发布到这里</div></div>');
|
||||
} else {
|
||||
$("#dimension-card-grid .pq-cont .kms-no-km").remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
all.dimensionCardGrid.awsGrid({
|
||||
refresh: function (event, ui) {
|
||||
var length = all.dimensionCardGrid.awsGrid("getSelectedRow").length;
|
||||
if (length > 0) {
|
||||
if (all.isDimensionManager) {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").show();
|
||||
}
|
||||
} else {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
all.dimensionCardGrid.on("awsgridrowselect", function (evt, ui) {
|
||||
if (all.isDimensionManager) {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").show();
|
||||
}
|
||||
});
|
||||
all.dimensionCardGrid.on("awsgridrowunselect", function (evt, ui) {
|
||||
var length = all.dimensionCardGrid.awsGrid("getSelectedRow").length;
|
||||
if (length > 1) {
|
||||
if (all.isDimensionManager) {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").show();
|
||||
}
|
||||
} else {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
all.resizeDimensionCardGrid();
|
||||
}
|
||||
},
|
||||
borrowCard: function (rowIndx) {
|
||||
$.confirm({
|
||||
title: "请确认",
|
||||
content: "确认启动知识借阅流程吗?",
|
||||
onConfirm: function () {
|
||||
var rowData = all.dimensionCardGrid.awsGrid("getRowData", rowIndx);
|
||||
$('#cardId').val(rowData.cardId);
|
||||
$('#dimensionId').val(all.dimensionId);
|
||||
$('#borrowProcessDialog').dialog({
|
||||
title: '知识借阅流程',
|
||||
width: 900,
|
||||
height: $(window).height() * 0.9,
|
||||
onClose: function () {
|
||||
}
|
||||
});
|
||||
document.getElementById('borrowProcessForm').submit();
|
||||
$('#borrowProcessDialog .dlg-close').off('click').on('click', function () {
|
||||
if ($('#borrowProcessFrame').contents().find('#REASON').length != 0) { // 如果是可编辑状态(因为有的时候并非可编辑状态,比如提示错误时)
|
||||
$.confirm({
|
||||
title: "请确认",
|
||||
content: "流程已经启动,确认关闭该对话框吗?(并不会作废流程)",
|
||||
onConfirm: function () {
|
||||
$('#borrowProcessDialog').dialog('close');
|
||||
},
|
||||
onCancel: function () {
|
||||
}
|
||||
});
|
||||
} else { // 直接关闭
|
||||
$('#borrowProcessDialog').dialog('close');
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: function () {
|
||||
}
|
||||
});
|
||||
},
|
||||
resizeDimensionCardGrid: function () {
|
||||
if (all.dimensionCardGrid) {
|
||||
all.dimensionCardGrid.width(all.isDimensionKnwlPage ? $(window).width() - ($('#all-left').is(':visible') ? $('#all-left').outerWidth(true) : 0) - 2 : $('#tab-all').outerWidth(true) - $('#all-left').outerWidth(true) - 2);
|
||||
all.dimensionCardGrid.height(all.isDimensionKnwlPage ? $(window).height() - $('#dimensionCardToolbar').outerHeight(true) - 2 : $('#tabs-content').height() - $('#dimensionCardToolbar').outerHeight(true) - 2);
|
||||
all.dimensionCardGrid.awsGrid("refresh");
|
||||
if (all.totalRecords === 0) {
|
||||
$("#dimension-card-grid .pq-cont").html('<div class="kms-no-km"></br><div class="title"> 没有知识</div><div class="content">该路径下没有知识,可以在“知识中心-个人”中新建知识、发布到这里</div></div>');
|
||||
} else {
|
||||
$("#dimension-card-grid .pq-cont .kms-no-km").remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function showEditor() {
|
||||
$("#cardEditTd").show();
|
||||
$("#cardEditNoContent").hide();
|
||||
}
|
||||
|
||||
var meDG = {
|
||||
cardUUID: '',
|
||||
// 编辑知识
|
||||
editCardDialog: function (rowIndxPage, gridType) {
|
||||
var rowData = {};
|
||||
if (gridType === 'all') {
|
||||
rowData = all.dimensionCardGrid.awsGrid("getRowData", rowIndxPage);
|
||||
} else if (gridType === 'me') {
|
||||
rowData = me.meGrid.awsGrid("getRowData", rowIndxPage);
|
||||
} else if (gridType === 'publish') {
|
||||
rowData = publish.publishGrid.awsGrid("getRowData", rowIndxPage);
|
||||
}
|
||||
// 表单数据使用已经查询的Grid数据,文件列表请求数据库
|
||||
me.cardUUID = rowData.cardId;
|
||||
$("#fileValue").val(rowData.cardId);
|
||||
$('#cardName').val(rowData.cardName);
|
||||
$('#validDate').val(rowData.validDate);
|
||||
//$('#cardContext').val(rowData.cardContext);
|
||||
if (window.cardContentUM) {
|
||||
cardContentUM.destroy();
|
||||
}
|
||||
if (rowData.cardContext == "") {
|
||||
$("#cardEditTd").hide();
|
||||
$("#cardEditNoContent").show();
|
||||
} else {
|
||||
$("#cardEditTd").show();
|
||||
$("#cardEditNoContent").hide();
|
||||
}
|
||||
$("#cardEditTd").html("<script type='text/plain' id='cardEditInfo' name='cardEditInfo' style='height:170px;white-space: normal;width:98%' >" + rowData.cardContext + "</script>");
|
||||
var toolbar = window.advancedToolbar;
|
||||
toolbar.autoHeightEnabled = false;
|
||||
UE.Editor.prototype.placeholder = function (justPlainText) {
|
||||
var _editor = this;
|
||||
_editor.addListener("focus", function () {
|
||||
/*var localHtml = _editor.getContent();
|
||||
if ($.trim(localHtml) === $.trim("<p>" + justPlainText + "</p>")) {
|
||||
_editor.setContent(" ");
|
||||
}*/
|
||||
});
|
||||
_editor.addListener("blur", function () {
|
||||
var localHtml = _editor.getContent();
|
||||
if (!localHtml) {
|
||||
$("#cardEditTd").hide();
|
||||
$("#cardEditNoContent").show();
|
||||
//_editor.setContent(justPlainText);
|
||||
}
|
||||
});
|
||||
_editor.ready(function () {
|
||||
_editor.fireEvent("blur");
|
||||
});
|
||||
};
|
||||
cardContentUM = UE.getEditor("cardEditInfo", toolbar);
|
||||
cardContentUM.placeholder("");
|
||||
AddBtnFunc(cardContentUM, "cardEditInfo", "", false, false, false);
|
||||
//$("#rdoOL" + rowData.onlineLevel).check("option", "checked", true);
|
||||
var rdoOLOption = {
|
||||
width: 250,
|
||||
data: [
|
||||
{
|
||||
text: "常规",
|
||||
children: [
|
||||
{id: "1", text: "转换PDF格式在线阅读,允许下载"},
|
||||
{id: "2", text: "转换PDF格式在线阅读,禁止下载"}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: "安全",
|
||||
children: [
|
||||
{id: "0", text: "转换图片格式在线阅读,禁止下载(首次转换时间较长,客户端阅读快)"}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
if ($("#rdoOL").attr("data-select2-id") != "rdoOL") {
|
||||
$("#rdoOL").select2(rdoOLOption);
|
||||
}
|
||||
$("#rdoOL").val(rowData.onlineLevel).trigger("change");
|
||||
$("#rdoSL" + rowData.securityLevel).check("option", "checked", true);
|
||||
if (!me.isCommentSB) {
|
||||
me.isCommentSB = $("#isCommentSB").switchButton({
|
||||
swheight: 25,
|
||||
swwidth: 100,
|
||||
ontext: "允许评论",
|
||||
offtext: "禁止评论"
|
||||
});
|
||||
}
|
||||
me.isCommentSB.changeStatus(rowData.isComment === 1 ? true : false);
|
||||
if (!me.isRateSB) {
|
||||
me.isRateSB = $("#isRateSB").switchButton({
|
||||
swheight: 25,
|
||||
swwidth: 100,
|
||||
ontext: "允许打分",
|
||||
offtext: "禁止打分"
|
||||
});
|
||||
}
|
||||
me.isRateSB.changeStatus(rowData.isRate === 1 ? true : false);
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_file_list_json",
|
||||
cardId: me.cardUUID
|
||||
},
|
||||
ok: function (responseObject) {
|
||||
var fileJA = responseObject.data;
|
||||
if (fileJA.length === 0) {
|
||||
$('#fileTable').append('<tr><td colspan="10" style="text-align: center;"><div class="kms-no-file">无文件</div></td></tr>');
|
||||
} else {
|
||||
if (typeof browserPreview == 'string') {
|
||||
var browserPreview = $.grep(parent.browserPreview.split(','), function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
});
|
||||
} else {
|
||||
var browserPreview = $.grep(parent.browserPreview, function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
});
|
||||
}
|
||||
for (var i = 0; i < fileJA.length; i++) {
|
||||
var file = fileJA[i];
|
||||
var tr = "<tr id='" + file.id + "TR'>";
|
||||
tr += "<td style='text-align:center;'>" + (i + 1) + "</td>";
|
||||
if (file.fileState == 2) {
|
||||
tr += "<td><div class='file_icon file-type-" + file.fileSuffixIcon + "'></div><div class='browse_file_name' title='" + file.fileName + "'><a href='javascript:' onclick='browserPreviewFun(\"" + file.id + "\",\"" + encodeURIComponent(file.fileName) + "\",0,\"" + file.createUserPhoto + "\",\"" + file.createUser + "\");'>" + file.fileName + "</a></div></td>";
|
||||
} else {
|
||||
var fileType = file.fileName.lastIndexOf(".") > -1 ? file.fileName.substring(file.fileName.lastIndexOf(".") + 1, file.fileName.length) : "";
|
||||
if ($.inArray(fileType, browserPreview) != -1) {// 浏览器直接预览,不使用onlinedoc
|
||||
tr += "<td><div class='file_icon file-type-" + file.fileSuffixIcon + "'></div><div class='browse_file_name' title='" + file.fileName + "'><a href='javascript:' onclick='browserPreviewFun(\"" + file.id + "\",\"" + encodeURIComponent(file.fileName) + "\",1,\"" + file.createUserPhoto + "\",\"" + file.createUser + "\");'>" + file.fileName + "</a></div></td>";
|
||||
} else {
|
||||
if (parent.isOnlinedocAppActive) {
|
||||
tr += "<td><div class='file_icon file-type-" + file.fileSuffixIcon + "'></div><div class='browse_file_name' title='" + file.fileName + "'><a href='javascript:' onclick='showFullScreenPanel(\"" + parent.canPreviewType + "\",\"" + file.id + "\",\"" + encodeURIComponent(file.fileName) + "\",\"" + encodeURIComponent(file.fileName) + "\",\"0\",\"1\",\"" + file.createUserPhoto + "\",\"" + file.createUser + "\")'>" + file.fileName + "</a></div></td>";
|
||||
} else {
|
||||
tr += "<td><div class='file_icon file-type-" + file.fileSuffixIcon + "'></div><div class='browse_file_name' title='" + file.fileName + "'>" + file.fileName + "</div></td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
var deleteBtn = '<a href="javascript:" onclick="me.deleteFile(\'' + file.id + '\');return false;"><span class="icon_delete_file"></span></a>';
|
||||
tr += "<td>";
|
||||
if (file.fileState == 2) {
|
||||
} else {
|
||||
tr += "<a class='file_download' target='_blank' href='" + file.fileDownloadURL + "'></a>"
|
||||
}
|
||||
tr += "</td><td>" + file.fileVer + "</td><td class='browse_createuser'>" + file.createUsername + "</td><td>" + AWSFile.formatSize(file.fileSize) + "</td><td style='text-align: center;'>" + file.createTime + "</td><td style='text-align: center;'>" + deleteBtn + "</td></tr>";
|
||||
$('#fileTable').append(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#knwlDocDialog').dialog({
|
||||
title: '编辑知识',
|
||||
width: 1000,
|
||||
height: 538,
|
||||
onClose: function () {
|
||||
// 清空表单和文件列表
|
||||
$('#cardName').val('');
|
||||
$('#validDate').val('');
|
||||
//$("#rdoOL1").check("option", "checked", true);
|
||||
//$("#rdoSL0").check("option", "checked", true);
|
||||
$("#rdoOL").val("").trigger("change");
|
||||
me.isCommentSB.changeStatus(true);
|
||||
me.isRateSB.changeStatus(true);
|
||||
$('#fileTable tr[id!=colTR]').remove();
|
||||
if (window.cardContentUM) {
|
||||
cardContentUM.destroy();
|
||||
}
|
||||
$("#cardEditTd").hide();
|
||||
$("#cardEditNoContent").show();
|
||||
$("#cardEditTd").html("<script type='text/plain' id='cardEditInfo' name='cardEditInfo' style='height:170px;white-space: normal;width:98%' ></script>");
|
||||
var toolbar = window.advancedToolbar;
|
||||
toolbar.autoHeightEnabled = false;
|
||||
UE.Editor.prototype.placeholder = function (justPlainText) {
|
||||
var _editor = this;
|
||||
_editor.addListener("focus", function () {
|
||||
/*var localHtml = _editor.getContent();
|
||||
if ($.trim(localHtml) === $.trim("<p>" + justPlainText + "</p>")) {
|
||||
_editor.setContent(" ");
|
||||
}*/
|
||||
});
|
||||
_editor.addListener("blur", function () {
|
||||
var localHtml = _editor.getContent();
|
||||
if (!localHtml) {
|
||||
$("#cardEditTd").hide();
|
||||
$("#cardEditNoContent").show();
|
||||
//_editor.setContent(justPlainText);
|
||||
}
|
||||
});
|
||||
_editor.ready(function () {
|
||||
_editor.fireEvent("blur");
|
||||
});
|
||||
};
|
||||
cardContentUM = UE.getEditor("cardEditInfo", toolbar);
|
||||
cardContentUM.placeholder("");
|
||||
AddBtnFunc(cardContentUM, "cardEditInfo", "", false, false, false);
|
||||
}
|
||||
});
|
||||
$('#knwlDocOkBtn').off('click').on('click', {
|
||||
gridType: gridType
|
||||
}, me.editKnwl);
|
||||
$('#knwlDocNoBtn').off('click').on('click', {
|
||||
btn: "edit"
|
||||
}, me.closeKnwlDialog);
|
||||
$('#knwlDocDialog .dlg-close').off('click.knwlDoc').on('click.knwlDoc', {
|
||||
btn: "edit"
|
||||
}, me.closeKnwlDialog);
|
||||
// 上传文档
|
||||
$("#uploadDoc").upfile({
|
||||
sid: sid,
|
||||
appId: "com.actionsoft.apps.kms",
|
||||
groupValue: rowData.createUser,
|
||||
fileValue: me.cardUUID,
|
||||
numLimit: 0,
|
||||
sizeLimit: maxFileSize * 1024 * 1024,
|
||||
filesToFilter: [["*", "*"]],
|
||||
repositoryName: "-doc-",
|
||||
done: function (e, data) {
|
||||
// 增加一行
|
||||
if (data['result']['data']['result'] == 'ok') {
|
||||
$('#fileTable div.kms-no-file').parent().parent().remove();
|
||||
var fileName = decodeURIComponent(data['files'][0]['name']);
|
||||
var fileDownloadURL = data['result']['data']['data']['attrs']['fileDownloadURL'];
|
||||
var fileSize = data['result']['files']['size'];
|
||||
var fileVer = data['result']['data']['data']['attrs']['fileVer'];
|
||||
var createTime = data['result']['data']['data']['attrs']['createTime'];
|
||||
var fileSuffixIcon = data['result']['data']['data']['attrs']['fileSuffixIcon'];
|
||||
var createUsername = data['result']['data']['data']['attrs']['createUsername'];
|
||||
var fileId = data['result']['data']['data']['attrs']['fileId'];
|
||||
var fileCreateUserPhoto = data['result']['data']['data']['attrs']['fileCreateUserPhoto'];
|
||||
var fileCreateUser = data['result']['data']['data']['attrs']['fileCreateUser'];
|
||||
var tr = "<tr id='" + fileId + "TR'>";
|
||||
tr += "<td style='text-align:center;'>" + ($('#fileTable tr[id!=colTR]').length + 1) + "</td>";
|
||||
if (typeof browserPreview == 'string') {
|
||||
var browserPreview = $.grep(parent.browserPreview.split(','), function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
});
|
||||
} else {
|
||||
var browserPreview = $.grep(parent.browserPreview, function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
});
|
||||
}
|
||||
var fileType = fileName.lastIndexOf(".") > -1 ? fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length) : "";
|
||||
if ($.inArray(fileType, browserPreview) != -1) {// 浏览器直接预览,不使用onlinedoc
|
||||
tr += "<td><div class='file_icon file-type-" + fileSuffixIcon + "'></div><div class='browse_file_name' title='" + fileName + "'><a href='javascript:' onclick='browserPreviewFun(\"" + fileId + "\",\"" + encodeURIComponent(fileName) + "\",1,\"" + fileCreateUserPhoto + "\",\"" + fileCreateUser + "\");return false;'>" + fileName + "</a></div></td>";
|
||||
} else {
|
||||
if (parent.isOnlinedocAppActive) {
|
||||
tr += "<td><div class='file_icon file-type-" + fileSuffixIcon + "'></div><div class='browse_file_name' title='" + fileName + "'><a href='javascript:' onclick='showFullScreenPanel(\"" + parent.canPreviewType + "\",\"" + fileId + "\",\"" + encodeURIComponent(fileName) + "\",\"" + encodeURIComponent(fileName) + "\",\"0\",\"1\",\"" + fileCreateUserPhoto + "\",\"" + fileCreateUser + "\")'>" + fileName + "</a></div></td>";
|
||||
} else {
|
||||
tr += "<td><div class='file_icon file-type-" + fileSuffixIcon + "'></div><div class='browse_file_name' title='" + fileName + "'>" + fileName + "</div></td>";
|
||||
}
|
||||
}
|
||||
var deleteBtn = '<a href="javascript:" onclick="me.deleteFile(\'' + fileId + '\');return false;"><span class="icon_delete_file"></span></a>';
|
||||
tr += "<td><a class='file_download' target='_blank' href='" + fileDownloadURL + "'></a></td><td>" + fileVer + "</td><td class='browse_createuser'>" + createUsername + "</td><td>" + AWSFile.formatSize(fileSize) + "</td><td style='text-align: center;'>" + createTime + "</td><td style='text-align: center;'>" + deleteBtn + "</td></tr>";
|
||||
$('#fileTable').append(tr);
|
||||
$('#fileDiv').scrollTop($('#fileDiv').prop("scrollHeight")); // 滚动到最底端
|
||||
}
|
||||
},
|
||||
add: function (e, data) {
|
||||
var flag = true;
|
||||
// 判断大小
|
||||
var sizeLimit = maxFileSize * 1024 * 1024;
|
||||
if (data.originalFiles.length > 0) {
|
||||
$.each(data.originalFiles, function (index, file) {
|
||||
if (file.size > 0) {
|
||||
if (sizeLimit != 0 && sizeLimit < file.size) {
|
||||
flag = false;
|
||||
var _sizeLimitStr = AWSFile.formatSize(sizeLimit);
|
||||
_sizeLimitStr = _sizeLimitStr.replace(".00", "");
|
||||
$.simpleAlert(文件大小不允许超过 + _sizeLimitStr, "info");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
flag = false;
|
||||
$.simpleAlert(空文件不能上传, "info");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 判断后缀
|
||||
if (flag) {
|
||||
if (data.originalFiles.length > 0) {
|
||||
$.each(data.originalFiles, function (index, file) {
|
||||
var dotIndex = file.name.lastIndexOf(".");
|
||||
var fileType = file.name.substring(dotIndex + 1, file.name.length);
|
||||
var blackFileArr = blackFileList.split('@`@');
|
||||
if ($.inArray(fileType, blackFileArr) !== -1) {
|
||||
flag = false;
|
||||
$.simpleAlert('后缀为' + fileType + '的文件不允许上传', "info");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
},
|
||||
complete: function (e, data) {
|
||||
}
|
||||
});
|
||||
},
|
||||
editKnwl: function (event) {
|
||||
var cardName = $.trim($('#cardName').val());
|
||||
if (cardName == '') {
|
||||
$.simpleAlert('[知识名称]不允许为空', 'info');
|
||||
return false;
|
||||
} else {
|
||||
cardName = $('#cardName').val();
|
||||
}
|
||||
if (cardName.length > 128) {
|
||||
$.simpleAlert('[知识名称]长度不能超过128个字符', 'info');
|
||||
return false;
|
||||
}
|
||||
var onlineLevel = 0;
|
||||
/*if ($("#rdoOL0").prop("checked")) {
|
||||
onlineLevel = 0;
|
||||
} else if ($("#rdoOL1").prop("checked")) {
|
||||
onlineLevel = 1;
|
||||
} else if ($("#rdoOL2").prop("checked")) {
|
||||
onlineLevel = 2;
|
||||
}*/
|
||||
onlineLevel = $("#rdoOL").val();
|
||||
if (onlineLevel == '') {
|
||||
$.simpleAlert('[格式转换]不允许为空', 'info');
|
||||
return false;
|
||||
}
|
||||
var securityLevel = 0;
|
||||
if ($("#rdoSL0").prop("checked")) {
|
||||
securityLevel = 0;
|
||||
} else if ($("#rdoSL1").prop("checked")) {
|
||||
securityLevel = 1;
|
||||
} else if ($("#rdoSL2").prop("checked")) {
|
||||
securityLevel = 2;
|
||||
}
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_update_card",
|
||||
cardId: me.cardUUID,
|
||||
cardName: cardName,
|
||||
validDate: $('#validDate').val(),
|
||||
onlineLevel: onlineLevel,
|
||||
securityLevel: securityLevel,
|
||||
cardType: 0,
|
||||
isComment: $("#isCommentSB")[0].checked,
|
||||
isRate: $("#isRateSB")[0].checked,
|
||||
cardContext: UE.getEditor("cardEditInfo").getContent()
|
||||
},
|
||||
ok: function (responseObject) {
|
||||
$('#knwlDocDialog').dialog('close');
|
||||
if (event.data.gridType === 'all') {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").hide();
|
||||
all.dimensionCardGrid.awsGrid("refreshDataAndView");
|
||||
} else if (event.data.gridType === 'me') {
|
||||
$("#publishCardBtn,#deleteKnwlBtn").hide();
|
||||
me.meGrid.awsGrid("refreshDataAndView");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteFile: function (fileId) {
|
||||
$.confirm({
|
||||
title: "请确认",
|
||||
content: "确定要删除该文件吗?",
|
||||
onConfirm: function () {
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_delete_file",
|
||||
cardId: me.cardUUID,
|
||||
fileId: fileId
|
||||
},
|
||||
ok: function (responseObject) {
|
||||
$('#' + fileId + 'TR').remove();
|
||||
// 重新计算序号
|
||||
$('#fileTable tr[id!=colTR]').each(function (i) {
|
||||
$(this).find('td:first').text(i + 1);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
closeKnwlDialog: function (event) {
|
||||
if (event.data.btn === 'add') { // 新建未保存时,删除已经上传的文件
|
||||
if ($('#fileTable tr[id!=colTR]').length != 0) { // 已经上传文件,发送请求删除无用的文件
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
alert: false,
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_delete_unsaved_files",
|
||||
cardId: me.cardUUID
|
||||
},
|
||||
ok: function (responseObject) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
try {
|
||||
$('#knwlDocDialog').dialog('close');
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
refreshGridConditional: function (cardId) {// 如果满足条件则刷新grid
|
||||
if (me.meGrid) {
|
||||
var meGridData = me.meGrid.awsGrid('getAllRows');
|
||||
$.each(meGridData, function (i, obj) {
|
||||
if (obj.cardId === cardId) {
|
||||
// 刷新grid
|
||||
$("#publishCardBtn,#deleteKnwlBtn").hide();
|
||||
me.meGrid.awsGrid("refreshDataAndView");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
var publishDG = {
|
||||
cancelPublishCard: function (rowIndx, gridType) {
|
||||
var rowData = {};
|
||||
if (gridType === 'all') {
|
||||
rowData = all.dimensionCardGrid.awsGrid("getRowData", rowIndx);
|
||||
} else if (gridType === 'publish') {
|
||||
rowData = publish.publishGrid.awsGrid("getRowData", rowIndx);
|
||||
}
|
||||
$.confirm({
|
||||
title: "请确认",
|
||||
content: "确认取消发布知识分类[" + rowData.dimensionName + "]下的知识[" + rowData.cardName + "]吗?",
|
||||
onConfirm: function () {
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_cancel_publish_card",
|
||||
publishId: rowData.publishId
|
||||
},
|
||||
success: function (responseObject) {
|
||||
var resultJO = responseObject.data.resultJO;
|
||||
if (resultJO.result === 'success') {
|
||||
if (gridType === 'all') {
|
||||
$("#publishCardBtnForAll,#moveCardBtn,#changeCardUserBtn").hide();
|
||||
all.dimensionCardGrid.awsGrid("refreshDataAndView");
|
||||
} else if (gridType === 'publish') {
|
||||
publish.publishGrid.awsGrid("refreshDataAndView");
|
||||
}
|
||||
// 检查"我的知识"中是否有该知识,如果有的话刷新
|
||||
me.refreshGridConditional(rowData.cardId);
|
||||
$.simpleAlert("取消发布成功", "ok");
|
||||
} else if (resultJO.result === 'failure') {
|
||||
$.simpleAlert("取消发布失败", "warn");
|
||||
} else if (resultJO.result === 'process') {
|
||||
$('#cancelPublishProcessForm input[name=publishId]').val(rowData.publishId);
|
||||
$('#cancelPublishProcessDialog').dialog({
|
||||
title: '知识取消发布流程',
|
||||
width: 900,
|
||||
height: $(window).height() * 0.9,
|
||||
onClose: function () {
|
||||
}
|
||||
});
|
||||
$('#cancelPublishProcessDialog .dlg-close').off('click').on('click', function () {
|
||||
if ($('#cancelPublishProcessFrame').contents().find('#REASON').length != 0) { // 如果是可编辑状态(因为有的时候并非可编辑状态,比如提示"不能重新启动取消发布流程"的类似错误时)
|
||||
$.confirm({
|
||||
title: "请确认",
|
||||
content: "流程已经启动,确认关闭该对话框吗?(并不会作废流程)",
|
||||
onConfirm: function () {
|
||||
$('#cancelPublishProcessDialog').dialog('close');
|
||||
},
|
||||
onCancel: function () {
|
||||
}
|
||||
});
|
||||
} else { // 直接关闭
|
||||
$('#cancelPublishProcessDialog').dialog('close');
|
||||
}
|
||||
});
|
||||
document.getElementById('cancelPublishProcessForm').submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取char长度(一个汉字两个长度)
|
||||
*
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
function getCharCodeLength(str) {
|
||||
var len = 0;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str.charCodeAt(i) > 127) {
|
||||
len += 2;
|
||||
} else {
|
||||
len++;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
$(function() {
|
||||
// 合并all对象和me对象
|
||||
allDG.isDimensionKnwlPage = true;
|
||||
$.extend(all, allDG);
|
||||
$.extend(me, meDG);
|
||||
$.extend(publish, publishDG);
|
||||
// 加载公共html到本页面
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
async : false,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_dimension_grid_html"
|
||||
},
|
||||
ok : function(responseObject) {
|
||||
$(document.body).append('<div id="dimensionGridLoadDiv" style="display: none;"></div>');
|
||||
$('#dimensionGridLoadDiv').append(responseObject.data.html);
|
||||
// 将各个模块儿定位到各自的位置
|
||||
$('#all-left,#all-separater').prependTo(document.body);
|
||||
$('#filterAllBtn,#filterAllInput').appendTo($('#dimensionCardToolbar'));
|
||||
$('#dimension-card-grid,#hotspotDiv').appendTo($('#all-right'));
|
||||
$('#knwlDocDialog').appendTo(document.body);
|
||||
$('#publishCardDialog').appendTo(document.body);
|
||||
$('#borrowProcessForm,#borrowProcessDialog').appendTo(document.body);
|
||||
$('#fullscreenWrap').appendTo(document.body);
|
||||
|
||||
//渲染check
|
||||
$("input[type=radio]").check()
|
||||
|
||||
$('#dimensionGridLoadDiv').remove();
|
||||
},
|
||||
err : function() {
|
||||
$.simpleAlert("页面加载错误", "error");
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
// todo临时注释掉ie8的quicktip,有bug32933
|
||||
if (!$.support.leadingWhitespace) {// 判断IE8
|
||||
$(document).off('mouseover.over');
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
$("#validDate").datepicker({
|
||||
minDate : today
|
||||
});
|
||||
$('#filterAllBtn').off('click').on('click', function() {
|
||||
all.dimensionCardGrid.awsGrid("refreshDataAndView");
|
||||
});
|
||||
$('#filterAllInput').off('keypress').on('keypress', function(e) {
|
||||
if (e.which == 13) {
|
||||
$('#filterAllBtn').click();
|
||||
}
|
||||
});
|
||||
all.dragSeparator();
|
||||
all.initTree();
|
||||
|
||||
$(window).resize(function(event) {
|
||||
all.resizeDimensionCardGrid();
|
||||
})
|
||||
});
|
||||
var all = {};
|
||||
var me = {};
|
||||
var publish = {};
|
||||
@ -0,0 +1,26 @@
|
||||
var browseCard;
|
||||
$(function() {
|
||||
// 初始化右侧浏览dialog
|
||||
browseCard = $('#browseCardDialog').browsecard({
|
||||
mePhoto : mePhoto,
|
||||
isFavoriteAppActive : isFavoriteAppActive,
|
||||
isOnlinedocAppActive: isOnlinedocAppActive,
|
||||
canPreviewType : canPreviewType,
|
||||
isNetworkAppActive : isNetworkAppActive,
|
||||
browserPreview: $.grep(browserPreview.split(','), function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
/**
|
||||
* 利用jquery组织冒泡
|
||||
*
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
function stopPropagation(event) {
|
||||
var eve = $.Event(event);
|
||||
eve.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
@ -0,0 +1,328 @@
|
||||
$(function () {
|
||||
fullsearch.search();
|
||||
});
|
||||
var fullsearch = {
|
||||
rowsPerPage: 50,
|
||||
curPage: 0,
|
||||
searchText: '',
|
||||
search: function () {
|
||||
fullsearch.searchText = $.trim(searchWords);
|
||||
// 检索关键词
|
||||
if (fullsearch.searchText == '') {
|
||||
$.simpleAlert('请输入检索关键词', 'info');
|
||||
return false;
|
||||
}
|
||||
// 清空列表
|
||||
$('#fullsearchListOl').empty();
|
||||
fullsearch.firstSearchFlag = true;
|
||||
// 重置分页
|
||||
fullsearch.curPage = 0;
|
||||
fullsearch.doSearch(true);
|
||||
},
|
||||
doSearch: function (firstSearchFlag) {
|
||||
$('#pagination button').hide();
|
||||
$('#pagination img,#pagination span').hide();
|
||||
// 全文检索开始
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
//loading: true,
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_fullsearch_list_json",
|
||||
curPage: fullsearch.curPage,
|
||||
rowsPerPage: fullsearch.rowsPerPage,
|
||||
searchText: encodeURIComponent(fullsearch.searchText)
|
||||
},
|
||||
success: function (responseObject) {
|
||||
var hasNextPage = responseObject.data.data.hasNextPage;
|
||||
$('#pagination img,#pagination span').hide();
|
||||
if (hasNextPage === true) {//如果还有下一页,则显示“加载更多”按钮
|
||||
$('#pagination button').show();
|
||||
$('#pagination img,#pagination span').hide();
|
||||
} else {
|
||||
$('#pagination span').text('已经显示全部结果').show();
|
||||
}
|
||||
fullsearch.curPage = responseObject.data.data.curPage;
|
||||
var datas = responseObject.data.data.result;
|
||||
if (datas.length == 0) {
|
||||
if (firstSearchFlag) {
|
||||
$('#pagination button').hide();
|
||||
$('#pagination img,#pagination span').hide();
|
||||
$('#fullsearchListOl').append('<div class="kms-no-file"></br><div class="title"> 没有搜索到内容</div><div class="content">查询“' + fullsearch.searchText + '”没有结果,请尝试其他关键字</div></div></div>');
|
||||
}
|
||||
} else {
|
||||
var browserPreview = $.grep(browserPreviewStr.split(','), function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
});
|
||||
for (var i = 0; i < datas.length; i++) {
|
||||
var data = datas[i];
|
||||
var li = '<li class="result-item" id="search-result-item' + i + '"><div style="position:relative;">';
|
||||
var fileType = data.fileName.lastIndexOf(".") > -1 ? data.fileName.substring(data.fileName.lastIndexOf(".") + 1, data.fileName.length) : "";
|
||||
if ($.inArray(fileType, browserPreview) != -1 && data.isExistAttachment) {// 浏览器直接预览,不使用onlinedoc
|
||||
if (data.onlineLevel != "0" && data.onlineLevel != "2") {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='browserPreviewFun(\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",1,\"" + data.createUserPhoto + "\",\"" + data.createUser + "\");return false;'>" + data.fileName + "</span>";
|
||||
} else {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='browserPreviewFun(\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",0,\"" + data.createUserPhoto + "\",\"" + data.createUser + "\");return false;'>" + data.fileName + "</span>";
|
||||
}
|
||||
} else {
|
||||
if (isOnlinedocAppActive && data.isExistAttachment) {
|
||||
if (data.onlineLevel != "0" && data.onlineLevel != "2") {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='showFullScreenPanel(\"" + canPreviewType + "\",\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"0\",\"1\",\"" + data.createUserPhoto + "\",\"" + data.createUser + "\"," + data.onlineLevel + ")'>" + data.fileName + "</span>";
|
||||
} else {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='showFullScreenPanel(\"" + canPreviewType + "\",\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"0\",\"0\",\"" + data.createUserPhoto + "\",\"" + data.createUser + "\"," + data.onlineLevel + ")'>" + data.fileName + "</span>";
|
||||
}
|
||||
} else {
|
||||
li += '<span class="result-title">' + data.fileName + '</span>';
|
||||
}
|
||||
}
|
||||
if (data.onlineLevel != "0" && data.onlineLevel != "2" && data.isExistAttachment) {
|
||||
if (data.externalUrl !== undefined && data.externalUrl !== '') {
|
||||
li += '<br><span style="color: #65A61E">文件简介:</span> <span class="result-abstract">' + data.cardContent + '</span><br> <span class="result-dimension">位置:' + data.dimensionPath + ' </span><span class="result-dimension">文件名称:' + data.cardName + '</span><span class="result-timeauthor">' + data.fileCreateTime + ' ' + data.fileCreateUser + '</span><span class="result-know-detail" urlexp="' + data.externalUrl + '" onclick="addressJump(this)" >文件详情</span><span onclick="downloadFile(this)" aFileId="' + data.fileId + '" class="result-download">下载</span></div></li>';
|
||||
} else {
|
||||
li += '<br><span style="color: #65A61E">文件简介:</span> <span class="result-abstract">' + data.cardContent + '</span><br> <span class="result-dimension">位置:' + data.dimensionPath + ' </span><span class="result-dimension">文件名称:' + data.cardName + '</span><span class="result-timeauthor">' + data.fileCreateTime + ' ' + data.fileCreateUser + '</span><span onclick="downloadFile(this)" aFileId="' + data.fileId + '" class="result-download">下载</span></div></li>';
|
||||
}
|
||||
} else {
|
||||
if (data.externalUrl !== undefined && data.externalUrl !== '') {
|
||||
li += '<br><span style="color: #65A61E">文件简介:</span> <span class="result-abstract">' + data.cardContent + '</span><br> <span class="result-dimension">位置:' + data.dimensionPath + ' </span><span class="result-dimension">文件名称:' + data.cardName + '</span><span class="result-timeauthor">' + data.fileCreateTime + ' ' + data.fileCreateUser + '</span><span class="result-know-detail" urlexp="' + data.externalUrl + '" onclick="addressJump(this)" style="right: 0;">文件详情</span></div></li>';
|
||||
} else {
|
||||
li += '<br><span style="color: #65A61E">文件简介:</span> <span class="result-abstract">' + data.cardContent + '</span><br> <span class="result-dimension">位置:' + data.dimensionPath + ' </span><span class="result-dimension">文件名称:' + data.cardName + '</span><span class="result-timeauthor">' + data.fileCreateTime + ' ' + data.fileCreateUser + '</span></div></li>';
|
||||
}
|
||||
}
|
||||
if (data.isExistAttachment) {
|
||||
$('#search-result-item' + i).find('span.result-snippet').html(data.content);
|
||||
}
|
||||
$('#fullsearchListOl').append(li);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
function downloadFile(obj) {
|
||||
var fileId;
|
||||
if (typeof obj === 'string') { // fileId
|
||||
fileId = obj;
|
||||
} else { // html element
|
||||
fileId = $(obj).attr('aFileId')
|
||||
}
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
alert: false,
|
||||
// loading: true,
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_download_file",
|
||||
fileId: fileId
|
||||
},
|
||||
success: function (responseObject) {
|
||||
if (responseObject.result == 'ok') {
|
||||
if ($('#signleFilesHref').length === 0) {
|
||||
// $(document.body).append("<iframe id='signleFilesIframe'
|
||||
// name='signleFilesIframe'
|
||||
// style='display:none;'>tmpIframe</iframe>");
|
||||
$(document.body).append("<a id='signleFilesHref' style='display:none;' target='_blank'>tmpLink</a>");
|
||||
// if (document.getElementById('signleFilesHref').download
|
||||
// == undefined) { //
|
||||
// 如果只是download属性则支持预览,target为_blank.否则target为iframe
|
||||
// document.getElementById('signleFilesHref').target =
|
||||
// 'signleFilesIframe';
|
||||
// }
|
||||
}
|
||||
$('#signleFilesHref').attr('href', responseObject.data.downloadURL);
|
||||
$('#signleFilesHref')[0].click();
|
||||
return false;
|
||||
} else {
|
||||
$.simpleAlert(responseObject.msg, responseObject.result);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* onlinedoc预览
|
||||
*/
|
||||
function showFullScreenPanel(canPreviewType, fileId, fileName, fileNameVersion, canPreviewFlag, canDownloadFlag, createUserPhoto, createUser, onlineLevel) {
|
||||
if (canPreviewFlag != undefined && canPreviewFlag == '0') { // 文件允许预览
|
||||
} else {// 文件不允许预览
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
parent.downloadFile(fileId);
|
||||
} else {
|
||||
$.simpleAlert('该文件不支持预览和下载', "info");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
fileName = decodeURIComponent(fileName);
|
||||
fileNameVersion = decodeURIComponent(fileNameVersion);
|
||||
var fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length);
|
||||
if (canPreviewType.indexOf(fileType) != -1) {
|
||||
} else {
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
parent.downloadFile(fileId);
|
||||
} else {
|
||||
$.simpleAlert('该文件不支持预览和下载', "info");
|
||||
}
|
||||
return;
|
||||
}
|
||||
$('#fullscreenWrap').show();
|
||||
$("body").css("overflow", "hidden");
|
||||
// 将文件标题显示
|
||||
$(".toolbar-title").empty();
|
||||
$(".toolbar-title").append(fileName);
|
||||
$(".toolbar-photo img").attr('src', createUserPhoto);
|
||||
$(".toolbar-photo img").attr('userId', createUser);
|
||||
var isCopy = 1;
|
||||
if (onlineLevel == 0) {
|
||||
isCopy = 0;
|
||||
} else if (onlineLevel == 1 || onlineLevel == 2) {
|
||||
isCopy = 1;
|
||||
}
|
||||
previewMyFile(fileId, canDownloadFlag, isCopy);
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '0') {
|
||||
$('fsdownloadbtn').hide();
|
||||
} else if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
$('#fsdownloadbtn').show();
|
||||
} else {
|
||||
}
|
||||
$('#fsdownloadbtn').attr('aFileId', fileId);
|
||||
$('#fsclosebtn').click(function () {
|
||||
closeFsPanel();
|
||||
});
|
||||
}
|
||||
|
||||
function previewMyFile(fileId, canDownloadFlag, isCopy) {
|
||||
$('#previewpanel').empty();
|
||||
// $.simpleAlert("文件正在加载,请稍侯...", "loading");
|
||||
var params = {
|
||||
fileId: fileId,
|
||||
isCopy: isCopy == 1
|
||||
};
|
||||
var url = './jd?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_center_preview_file&isDownload=' + (canDownloadFlag == 1);
|
||||
awsui.ajax.post(url, params, function (responseObject) {
|
||||
if (responseObject['result'] == 'ok') {
|
||||
// $.simpleAlert("close");
|
||||
var url = responseObject["data"]['url'];
|
||||
$('#previewpanel').empty();
|
||||
$('#previewpanel').append("<iframe frameBorder='0' class='previewfrm' id='previewfrm'></iframe>");
|
||||
$('#previewfrm').attr("src", url);
|
||||
var iframemy = document.getElementById("previewfrm");
|
||||
if (iframemy.attachEvent) {
|
||||
iframemy.attachEvent("onload", function () {
|
||||
closePreviewFile();
|
||||
// $.simpleAlert("close");
|
||||
});
|
||||
} else {
|
||||
iframemy.onload = function () {
|
||||
closePreviewFile();
|
||||
// $.simpleAlert("close");
|
||||
};
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert(responseObject['msg'], responseObject['result']);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
//关闭预览
|
||||
function closePreviewFile() {
|
||||
var back = $("#previewfrm").contents().find("#filepre_back");
|
||||
back.click(function () {
|
||||
// $('div[name=previewpanel]').hide();//页面关闭销毁转换请求
|
||||
$("body").css("overflow", "auto");
|
||||
$("#fullscreenWrap").hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭预览
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function closeFsPanel() {
|
||||
$('#fullscreenWrap').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览器预览
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function browserPreviewFun(fileId, fileName, canDownloadFlag, createUserPhoto, createUser, onlineLevel) {
|
||||
fileName = decodeURIComponent(fileName);
|
||||
$('#fullscreenWrap').show();
|
||||
$("body").css("overflow", "hidden");
|
||||
// 将文件标题显示
|
||||
$(".toolbar-title").empty();
|
||||
$(".toolbar-title").append(fileName);
|
||||
$(".toolbar-photo img").attr('src', createUserPhoto);
|
||||
$(".toolbar-photo img").attr('userId', createUser);
|
||||
$('#previewpanel').empty();
|
||||
$.simpleAlert("正在加载文件,请稍侯。。。", "loading");
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
fileId: fileId,
|
||||
sid: sid,
|
||||
cmd: 'com.actionsoft.apps.kms_knwl_browser_preview'
|
||||
},
|
||||
ok: function (responseObject) {
|
||||
if (responseObject['result'] == 'ok') {
|
||||
// $.simpleAlert("close");
|
||||
var url = responseObject["data"]['url'];
|
||||
$('#previewpanel').empty();
|
||||
$('#previewpanel').append("<iframe frameBorder='0' class='previewfrm' id='previewfrm'></iframe>");
|
||||
if (responseObject.data.isImg === true) {
|
||||
$('#previewfrm').attr("src", './w?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_browser_preview_image&fileId=' + fileId);
|
||||
} else {
|
||||
$('#previewfrm').attr("src", responseObject.data.url);
|
||||
}
|
||||
var iframemy = document.getElementById("previewfrm");
|
||||
if (iframemy.attachEvent) {
|
||||
iframemy.attachEvent("onload", function () {
|
||||
$.simpleAlert("close");
|
||||
});
|
||||
} else {
|
||||
iframemy.onload = function () {
|
||||
$.simpleAlert("close");
|
||||
};
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert(responseObject['msg'], responseObject['result']);
|
||||
}
|
||||
},
|
||||
err: function () {
|
||||
$('#window-mask').hide();
|
||||
$('#fsclosebtn').click();
|
||||
}
|
||||
});
|
||||
if (canDownloadFlag === 0) {
|
||||
$('#fsdownloadbtn').hide();
|
||||
} else if (canDownloadFlag == 1) {
|
||||
$('#fsdownloadbtn').show();
|
||||
} else {
|
||||
}
|
||||
$('#fsdownloadbtn').attr('aFileId', fileId);
|
||||
$('#fsclosebtn').click(function () {
|
||||
closeFsPanel();
|
||||
});
|
||||
}
|
||||
|
||||
function addressJump(val) {
|
||||
//debugger;
|
||||
var url = val.getAttribute("urlexp");
|
||||
if (url !== '') {
|
||||
window.open(url);
|
||||
} else {
|
||||
$.simpleAlert('文件详细地址不存在', 'info', 2000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,304 @@
|
||||
$(function(){
|
||||
fullsearch.search();
|
||||
});
|
||||
var fullsearch = {
|
||||
rowsPerPage: 50,
|
||||
curPage: 0,
|
||||
searchText: '',
|
||||
search: function () {
|
||||
fullsearch.searchText = $.trim(searchWords);
|
||||
// 检索关键词
|
||||
if (fullsearch.searchText == '') {
|
||||
$.simpleAlert('请输入检索关键词', 'info');
|
||||
return false;
|
||||
}
|
||||
// 清空列表
|
||||
$('#fullsearchListOl').empty();
|
||||
fullsearch.firstSearchFlag = true;
|
||||
// 重置分页
|
||||
fullsearch.curPage = 0;
|
||||
fullsearch.doSearch(true);
|
||||
},
|
||||
doSearch: function (firstSearchFlag) {
|
||||
$('#pagination button').hide();
|
||||
$('#pagination img,#pagination span').hide();
|
||||
// 全文检索开始
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
//loading: true,
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_fullsearch_list_json",
|
||||
curPage: fullsearch.curPage,
|
||||
rowsPerPage: fullsearch.rowsPerPage,
|
||||
searchText: encodeURIComponent(fullsearch.searchText)
|
||||
},
|
||||
success: function (responseObject) {
|
||||
var hasNextPage = responseObject.data.data.hasNextPage;
|
||||
$('#pagination img,#pagination span').hide();
|
||||
if (hasNextPage === true) {//如果还有下一页,则显示“加载更多”按钮
|
||||
$('#pagination button').show();
|
||||
$('#pagination img,#pagination span').hide();
|
||||
} else {
|
||||
$('#pagination span').text('已经显示全部结果').show();
|
||||
}
|
||||
fullsearch.curPage = responseObject.data.data.curPage;
|
||||
var datas = responseObject.data.data.result;
|
||||
if (datas.length == 0) {
|
||||
if (firstSearchFlag) {
|
||||
$('#pagination button').hide();
|
||||
$('#pagination img,#pagination span').hide();
|
||||
$('#fullsearchListOl').append('<div class="kms-no-file"></br><div class="title"> 没有搜索到内容</div><div class="content">查询“' + fullsearch.searchText + '”没有结果,请尝试其他关键字</div></div></div>');
|
||||
}
|
||||
} else {
|
||||
var browserPreview = $.grep(browserPreviewStr.split(','), function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
});
|
||||
for (var i = 0; i < datas.length; i++) {
|
||||
var data = datas[i];
|
||||
var li = '<li class="result-item" id="search-result-item' + i + '"><div style="position:relative;">';
|
||||
var fileType = data.fileName.lastIndexOf(".") > -1 ? data.fileName.substring(data.fileName.lastIndexOf(".") + 1, data.fileName.length) : "";
|
||||
if ($.inArray(fileType, browserPreview) != -1) {// 浏览器直接预览,不使用onlinedoc
|
||||
if (data.onlineLevel != "0" && data.onlineLevel != "2") {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='browserPreviewFun(\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",1,\"" + data.createUserPhoto + "\",\"" + data.createUser + "\");return false;'>" + data.fileName + "</span>";
|
||||
} else {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='browserPreviewFun(\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",0,\"" + data.createUserPhoto + "\",\"" + data.createUser + "\");return false;'>" + data.fileName + "</span>";
|
||||
}
|
||||
} else {
|
||||
if (isOnlinedocAppActive) {
|
||||
if (data.onlineLevel != "0" && data.onlineLevel != "2") {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='showFullScreenPanel(\"" + canPreviewType + "\",\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"0\",\"1\",\"" + data.createUserPhoto + "\",\"" + data.createUser + "\","+data.onlineLevel+")'>" + data.fileName + "</span>";
|
||||
} else {
|
||||
li += "<span class='result-title' style='cursor:pointer;' onclick='showFullScreenPanel(\"" + canPreviewType + "\",\"" + data.fileId + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"" + encodeURIComponent(data.fileName.replace("style='color:red'", "")) + "\",\"0\",\"0\",\"" + data.createUserPhoto + "\",\"" + data.createUser + "\","+data.onlineLevel+")'>" + data.fileName + "</span>";
|
||||
}
|
||||
} else {
|
||||
li += '<span class="result-title">' + data.fileName + '</span>';
|
||||
}
|
||||
}
|
||||
if (data.onlineLevel != "0" && data.onlineLevel != "2") {
|
||||
li += '<br> <span class="result-snippet">' + data.content + '</span><br> <span class="result-dimension">位置:' + data.dimensionPath + ' </span><span class="result-dimension">文档名称:' + data.cardName + '</span><span class="result-timeauthor">' + data.fileCreateTime + ' ' + data.fileCreateUser + '</span><span onclick="downloadFile(this)" aFileId="' + data.fileId + '" class="result-download">下载</span></div></li>';
|
||||
} else {
|
||||
li += '<br> <span class="result-snippet">' + data.content + '</span><br> <span class="result-dimension">位置:' + data.dimensionPath + ' </span><span class="result-dimension">文档名称:' + data.cardName + '</span><span class="result-timeauthor">' + data.fileCreateTime + ' ' + data.fileCreateUser + '</span></div></li>';
|
||||
}
|
||||
$('#fullsearchListOl').append(li);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
function downloadFile(obj) {
|
||||
var fileId;
|
||||
if (typeof obj === 'string') { // fileId
|
||||
fileId = obj;
|
||||
} else { // html element
|
||||
fileId = $(obj).attr('aFileId')
|
||||
}
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
alert: false,
|
||||
// loading: true,
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_knwl_center_download_file",
|
||||
fileId: fileId
|
||||
},
|
||||
success: function (responseObject) {
|
||||
if (responseObject.result == 'ok') {
|
||||
if ($('#signleFilesHref').length === 0) {
|
||||
// $(document.body).append("<iframe id='signleFilesIframe'
|
||||
// name='signleFilesIframe'
|
||||
// style='display:none;'>tmpIframe</iframe>");
|
||||
$(document.body).append("<a id='signleFilesHref' style='display:none;' target='_blank'>tmpLink</a>");
|
||||
// if (document.getElementById('signleFilesHref').download
|
||||
// == undefined) { //
|
||||
// 如果只是download属性则支持预览,target为_blank.否则target为iframe
|
||||
// document.getElementById('signleFilesHref').target =
|
||||
// 'signleFilesIframe';
|
||||
// }
|
||||
}
|
||||
$('#signleFilesHref').attr('href', responseObject.data.downloadURL);
|
||||
$('#signleFilesHref')[0].click();
|
||||
return false;
|
||||
} else {
|
||||
$.simpleAlert(responseObject.msg, responseObject.result);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* onlinedoc预览
|
||||
*/
|
||||
function showFullScreenPanel(canPreviewType, fileId, fileName, fileNameVersion, canPreviewFlag, canDownloadFlag, createUserPhoto, createUser,onlineLevel) {
|
||||
if (canPreviewFlag != undefined && canPreviewFlag == '0') { // 文件允许预览
|
||||
} else {// 文件不允许预览
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
parent.downloadFile(fileId);
|
||||
} else {
|
||||
$.simpleAlert('该文件不支持预览和下载', "info");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
fileName = decodeURIComponent(fileName);
|
||||
fileNameVersion = decodeURIComponent(fileNameVersion);
|
||||
var fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length);
|
||||
if (canPreviewType.indexOf(fileType) != -1) {
|
||||
} else {
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
parent.downloadFile(fileId);
|
||||
} else {
|
||||
$.simpleAlert('该文件不支持预览和下载', "info");
|
||||
}
|
||||
return;
|
||||
}
|
||||
$('#fullscreenWrap').show();
|
||||
$("body").css("overflow", "hidden");
|
||||
// 将文件标题显示
|
||||
$(".toolbar-title").empty();
|
||||
$(".toolbar-title").append(fileName);
|
||||
$(".toolbar-photo img").attr('src', createUserPhoto);
|
||||
$(".toolbar-photo img").attr('userId', createUser);
|
||||
var isCopy = 1;
|
||||
if (onlineLevel == 0) {
|
||||
isCopy = 0;
|
||||
} else if (onlineLevel == 1 || onlineLevel == 2) {
|
||||
isCopy = 1;
|
||||
}
|
||||
previewMyFile(fileId, canDownloadFlag,isCopy);
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '0') {
|
||||
$('fsdownloadbtn').hide();
|
||||
} else if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
$('#fsdownloadbtn').show();
|
||||
} else {
|
||||
}
|
||||
$('#fsdownloadbtn').attr('aFileId', fileId);
|
||||
$('#fsclosebtn').click(function () {
|
||||
closeFsPanel();
|
||||
});
|
||||
}
|
||||
function previewMyFile(fileId, canDownloadFlag,isCopy) {
|
||||
$('#previewpanel').empty();
|
||||
// $.simpleAlert("文件正在加载,请稍侯...", "loading");
|
||||
var params = {
|
||||
fileId: fileId,
|
||||
isCopy:isCopy == 1
|
||||
};
|
||||
var url = './jd?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_center_preview_file&isDownload=' + (canDownloadFlag == 1);
|
||||
awsui.ajax.post(url, params, function (responseObject) {
|
||||
if (responseObject['result'] == 'ok') {
|
||||
// $.simpleAlert("close");
|
||||
var url = responseObject["data"]['url'];
|
||||
$('#previewpanel').empty();
|
||||
$('#previewpanel').append("<iframe frameBorder='0' class='previewfrm' id='previewfrm'></iframe>");
|
||||
$('#previewfrm').attr("src", url);
|
||||
var iframemy = document.getElementById("previewfrm");
|
||||
if (iframemy.attachEvent) {
|
||||
iframemy.attachEvent("onload", function () {
|
||||
closePreviewFile();
|
||||
// $.simpleAlert("close");
|
||||
});
|
||||
} else {
|
||||
iframemy.onload = function () {
|
||||
closePreviewFile();
|
||||
// $.simpleAlert("close");
|
||||
};
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert(responseObject['msg'], responseObject['result']);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
//关闭预览
|
||||
function closePreviewFile() {
|
||||
var back = $("#previewfrm").contents().find("#filepre_back");
|
||||
back.click(function () {
|
||||
// $('div[name=previewpanel]').hide();//页面关闭销毁转换请求
|
||||
$("body").css("overflow", "auto");
|
||||
$("#fullscreenWrap").hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭预览
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function closeFsPanel() {
|
||||
$('#fullscreenWrap').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览器预览
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function browserPreviewFun(fileId, fileName, canDownloadFlag, createUserPhoto, createUser,onlineLevel) {
|
||||
fileName = decodeURIComponent(fileName);
|
||||
$('#fullscreenWrap').show();
|
||||
$("body").css("overflow", "hidden");
|
||||
// 将文件标题显示
|
||||
$(".toolbar-title").empty();
|
||||
$(".toolbar-title").append(fileName);
|
||||
$(".toolbar-photo img").attr('src', createUserPhoto);
|
||||
$(".toolbar-photo img").attr('userId', createUser);
|
||||
$('#previewpanel').empty();
|
||||
$.simpleAlert("正在加载文件,请稍侯。。。", "loading");
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
fileId: fileId,
|
||||
sid: sid,
|
||||
cmd: 'com.actionsoft.apps.kms_knwl_browser_preview'
|
||||
},
|
||||
ok: function (responseObject) {
|
||||
if (responseObject['result'] == 'ok') {
|
||||
// $.simpleAlert("close");
|
||||
var url = responseObject["data"]['url'];
|
||||
$('#previewpanel').empty();
|
||||
$('#previewpanel').append("<iframe frameBorder='0' class='previewfrm' id='previewfrm'></iframe>");
|
||||
if (responseObject.data.isImg === true) {
|
||||
$('#previewfrm').attr("src", './w?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_browser_preview_image&fileId=' + fileId);
|
||||
} else {
|
||||
$('#previewfrm').attr("src", responseObject.data.url);
|
||||
}
|
||||
var iframemy = document.getElementById("previewfrm");
|
||||
if (iframemy.attachEvent) {
|
||||
iframemy.attachEvent("onload", function () {
|
||||
$.simpleAlert("close");
|
||||
});
|
||||
} else {
|
||||
iframemy.onload = function () {
|
||||
$.simpleAlert("close");
|
||||
};
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert(responseObject['msg'], responseObject['result']);
|
||||
}
|
||||
},
|
||||
err: function () {
|
||||
$('#window-mask').hide();
|
||||
$('#fsclosebtn').click();
|
||||
}
|
||||
});
|
||||
if (canDownloadFlag === 0) {
|
||||
$('#fsdownloadbtn').hide();
|
||||
} else if (canDownloadFlag == 1) {
|
||||
$('#fsdownloadbtn').show();
|
||||
} else {
|
||||
}
|
||||
$('#fsdownloadbtn').attr('aFileId', fileId);
|
||||
$('#fsclosebtn').click(function () {
|
||||
closeFsPanel();
|
||||
});
|
||||
}
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
function initKnwlUI(selectId) {
|
||||
if ($('#isMobile').val() === 'true') {
|
||||
return;
|
||||
}
|
||||
var $select = $("#" + selectId + "");
|
||||
$select.select2({
|
||||
placeholder: "请输入知识名称检索...",
|
||||
ajax: {
|
||||
url: "./jd",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function (params) {
|
||||
return {
|
||||
sid: $('#sid').val(),
|
||||
cmd: 'com.actionsoft.apps.kms_knwl_attr_search_dosearch',
|
||||
curPage: params.page || 1,
|
||||
rowsPerPage: 10,
|
||||
searchDimensionIds: JSON.stringify([]),
|
||||
schemaMetaData: encodeURIComponent(JSON.stringify({'01': [], '2': []})),
|
||||
cardName: params.term,
|
||||
publishTime: JSON.stringify({"startPublishTime": "", "endPublishTime": ""}),
|
||||
publishUser: '',
|
||||
tags: encodeURIComponent(JSON.stringify([])),
|
||||
sortIndx: 'publishTime',
|
||||
sortDir: 'down'
|
||||
};
|
||||
},
|
||||
processResults: function (data, params) {
|
||||
params.page = data.data.curPage || 1;
|
||||
return {
|
||||
results: data.data.data,
|
||||
pagination: {
|
||||
more: (params.page * 10) < data.data.totalRecords
|
||||
}
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
},
|
||||
minimumInputLength: 0,
|
||||
templateResult: function (repo) {
|
||||
var markup = repo.cardName + " (" + repo.publishUsername + " 发布于 " + repo.publishTime + ")";
|
||||
return markup;
|
||||
},
|
||||
templateSelection: function (repo) {
|
||||
return repo.cardName || repo.text;
|
||||
},
|
||||
allowClear: true
|
||||
});
|
||||
var optionArr = eval(selectId + 'Value');
|
||||
for (var i = 0; i < optionArr.length; i++) {
|
||||
var option = optionArr[i];
|
||||
var $option = $('<option selected>' + option.cardName + '</option>').val(option.id);
|
||||
$select.append($option);
|
||||
}
|
||||
$select.trigger('change');
|
||||
}
|
||||
@ -0,0 +1,438 @@
|
||||
var targetCB;
|
||||
$(function() {
|
||||
try {
|
||||
// todo临时注释掉ie8的quicktip,有bug32933
|
||||
if (!$.support.leadingWhitespace) {// 判断IE8
|
||||
$(document).off('mouseover.over');
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
if (getCookie('kms.knwlmgr.separater.originalWidth')) {
|
||||
$('#dimension-left').css('width', getCookie('kms.knwlmgr.separater.originalWidth'));
|
||||
$('#dimension-right').css('margin-left', ($('#dimension-left').outerWidth(true) + $('#dimension-separater').outerWidth(true)));
|
||||
}
|
||||
// 悬浮窗口
|
||||
$('div[popContent]').on('mouseover', function(e) {
|
||||
var popContent = JSON.parse($(this).attr('popContent'));
|
||||
$("#popboxCommon .popHead").text(popContent.title);
|
||||
$("#popboxCommon .popBody").html(popContent.content);
|
||||
$("#popboxCommon").popbox({
|
||||
target : $(this)[0]
|
||||
});
|
||||
$('#popboxCommon').css('height', 'auto').css('border-radius', '6px').css('z-index', '100');
|
||||
});
|
||||
$('div[popContent]').on('mouseout', function(e) {
|
||||
$("#popboxCommon").popbox("close");
|
||||
});
|
||||
// 绑定知识
|
||||
$('.closeKnwl').off('click').on('click', function() {
|
||||
$('#knwlListDiv').hide();
|
||||
resizeKnwlListDiv();
|
||||
});
|
||||
$('#knwlListDiv').off('scroll').on('scroll', function() {
|
||||
$('.closeKnwl').css('top', $(this).scrollTop() + 14);
|
||||
});
|
||||
$(window).resize(function() {
|
||||
resizeKnwlListDiv();
|
||||
});
|
||||
|
||||
targetCB = $("#target").combobox({
|
||||
width : 239,
|
||||
height : 30,
|
||||
menuMaxHeight : 230,
|
||||
multiple : false,
|
||||
placeholder : "请选择目标",
|
||||
sep : ",",
|
||||
data : [ "_self", "_blank", "_parent", "_top" ]
|
||||
});
|
||||
// 初始化树
|
||||
dimension.initTree();
|
||||
});
|
||||
|
||||
var clickShapeId;// 图形ID
|
||||
var clickShapeName;// 图形名称
|
||||
var clickHotspotId;// 绑定后的数据ID
|
||||
/**
|
||||
* 打开绑定菜单
|
||||
*
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
function bindDimensionDialog(obj) {
|
||||
clickShapeId = $(obj).attr('shapeId');
|
||||
clickShapeName = $(obj).attr('shapeName');
|
||||
clickHotspotId = $(obj).attr('hotspotId');
|
||||
|
||||
var bindMenuItems = [ {
|
||||
text : "绑定维度",
|
||||
tit : "add",
|
||||
iconCls : "icon-add",
|
||||
method : bindDimension
|
||||
}, {
|
||||
text : "绑定链接",
|
||||
iconCls : "icon-add",
|
||||
method : bindLink
|
||||
} ];
|
||||
if($('#knwlListDiv').is(':visible') && $('#knwlListDiv tbody tr').length > 0){
|
||||
bindMenuItems[bindMenuItems.length] = {
|
||||
text : "绑定知识",
|
||||
iconCls : "icon-add",
|
||||
method : bindKnwl
|
||||
};
|
||||
}
|
||||
if (clickHotspotId) {
|
||||
bindMenuItems[bindMenuItems.length] = {
|
||||
text : "删除绑定",
|
||||
iconCls : "icon-remove",
|
||||
method : deleteBind
|
||||
};
|
||||
}
|
||||
$("#bindMenu").menu({
|
||||
target : $(obj),
|
||||
items : bindMenuItems
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 绑定维度
|
||||
*
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
function bindDimension() {
|
||||
$('#bindMenu').hide();
|
||||
// 从树上获取维度ID和维度名称
|
||||
var treeNode = dimension.treeObj.getSelectedNode();
|
||||
if (!treeNode) {
|
||||
$.simpleAlert('请选择一个维度', "info");
|
||||
return false;
|
||||
}
|
||||
if (treeNode.showType == 2) {
|
||||
$.simpleAlert('该维度不允许发布知识', "info");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.confirm({
|
||||
title : "请确认",
|
||||
content : "确定将维度 [" + treeNode.name + "] 绑定到 [" + clickShapeName + "] 吗?",
|
||||
onConfirm : function() {
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : 'com.actionsoft.apps.kms_hotspot_bind',
|
||||
dimensionId : treeNode.id,
|
||||
shapeId : clickShapeId,
|
||||
hotspotDefId : $('#hotspotDefId').val()
|
||||
},
|
||||
success : function(r) {
|
||||
if (r.result === 'ok') {
|
||||
renderShapeDiv();
|
||||
dimension.treeObj.getNodeDomById(dimension.treeObj.getSelectedNode().id).trigger('click');// 重新click下,渲染出current属性
|
||||
$.simpleAlert(r.msg, "ok");
|
||||
} else {
|
||||
$.simpleAlert(r.msg, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel : function() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 绑定链接
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function bindLink() {
|
||||
$('#bindMenu').hide();
|
||||
var linkURL = $('#hotspotDiv div[shapeId=' + clickShapeId + ']').attr('linkURL');
|
||||
if (linkURL) {
|
||||
var target = $('#hotspotDiv div[shapeId=' + clickShapeId + ']').attr('target');
|
||||
linkURL = decodeURIComponent(linkURL);
|
||||
$('#linkURL').val(linkURL)
|
||||
target = decodeURIComponent(target);
|
||||
$("#target").setComboboxVal(target);
|
||||
}
|
||||
$('#linkURLDialog').dialog({
|
||||
title : '设置链接',
|
||||
buttons : [ {
|
||||
text : '确定',
|
||||
cls : "blue",
|
||||
handler : function() {
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : 'com.actionsoft.apps.kms_hotspot_bind_linkurl',
|
||||
linkurl : encodeURIComponent($('#linkURL').val()),
|
||||
target : encodeURIComponent(targetCB.getValue()),
|
||||
shapeId : clickShapeId,
|
||||
hotspotDefId : $('#hotspotDefId').val()
|
||||
},
|
||||
success : function(r) {
|
||||
if (r.result === 'ok') {
|
||||
$('#linkURLDialog').dialog('close');
|
||||
renderShapeDiv();
|
||||
$.simpleAlert(r.msg, "ok");
|
||||
} else {
|
||||
$.simpleAlert(r.msg, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
text : '取消',
|
||||
handler : function() {
|
||||
$('#linkURLDialog').dialog('close');
|
||||
}
|
||||
} ],
|
||||
onClose : function() {
|
||||
$('#linkURL').val('');
|
||||
$('#target').setComboboxVal('');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 绑定知识
|
||||
* @returns
|
||||
*/
|
||||
function bindKnwl(){
|
||||
$('#bindMenu').hide();
|
||||
if($('#knwlListDiv').is(':hidden') || $('#knwlListDiv tbody tr.knwl_selected').length < 1){
|
||||
$.simpleAlert('请选择一个知识', "info");
|
||||
return false;
|
||||
}
|
||||
var cardId = $('#knwlListDiv tbody tr.knwl_selected').attr('cardId');
|
||||
|
||||
$.confirm({
|
||||
title : "请确认",
|
||||
content : "确定将知识 [" + $('#knwlListDiv tbody tr.knwl_selected td[name=cardName]').text() + "] 绑定到 [" + clickShapeName + "] 吗?",
|
||||
onConfirm : function() {
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : 'com.actionsoft.apps.kms_hotspot_bind_card',
|
||||
cardId : cardId,
|
||||
shapeId : clickShapeId,
|
||||
hotspotDefId : $('#hotspotDefId').val()
|
||||
},
|
||||
success : function(r) {
|
||||
if (r.result === 'ok') {
|
||||
renderShapeDiv();
|
||||
$.simpleAlert(r.msg, "ok");
|
||||
} else {
|
||||
$.simpleAlert(r.msg, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel : function() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除绑定
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function deleteBind() {
|
||||
$('#bindMenu').hide();
|
||||
$.confirm({
|
||||
title : "请确认",
|
||||
content : "确认删除绑定吗?",
|
||||
onConfirm : function() {
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : 'com.actionsoft.apps.kms_hotspot_delete_bind',
|
||||
hotspotId : clickHotspotId
|
||||
},
|
||||
success : function(r) {
|
||||
if (r.result === 'ok') {
|
||||
$.simpleAlert(r.msg, "ok");
|
||||
renderShapeDiv();
|
||||
} else {
|
||||
$.simpleAlert(r.msg, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel : function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 重新渲染shape的div
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function renderShapeDiv() {
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
async : false,// 同步执行:渲染完毕后需要根据返回结果计算render信息
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : 'com.actionsoft.apps.kms_hotspot_render_hotspot_div',
|
||||
dimensionId : dimensionId,
|
||||
shapeId : clickShapeId
|
||||
},
|
||||
success : function(r) {
|
||||
if (r.result === 'ok') {
|
||||
$('#hotspotDiv div[shapeId=' + clickShapeId + ']').replaceWith(r.msg);
|
||||
} else {
|
||||
$.simpleAlert('解析图形出现错误', "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var dimension = {
|
||||
treeObj : undefined,
|
||||
initTree : function() { // 初始化维度树(tree)
|
||||
if (!dimension.treeObj) {
|
||||
var treeDataUrl = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_dimension_tree_bindhotspot_json";
|
||||
var setting = {
|
||||
sort : true,
|
||||
showLine : false,
|
||||
event : {
|
||||
beforeExpand : dimension.getChildren,
|
||||
onClick : dimension.treeClick
|
||||
},
|
||||
animate : true,
|
||||
dataModel : {
|
||||
url : treeDataUrl,
|
||||
method : "POST",
|
||||
dataType : "json",
|
||||
params : {
|
||||
parentId : ''
|
||||
}
|
||||
}
|
||||
};
|
||||
dimension.treeObj = awsui.tree.init($("#dimensionTree"), setting);
|
||||
// 取第一个维度的维度列表
|
||||
var rootNodes = dimension.treeObj.getRootNode();
|
||||
if (rootNodes.length === 0) {
|
||||
$('#dimensionTree').html('<div class="kms-no-record">无知识分类</div>');
|
||||
} else {
|
||||
for (var i = 0; i < rootNodes.length; i++) {
|
||||
var firstNodeDom = dimension.treeObj.getNodeDomById(rootNodes[i].id);
|
||||
firstNodeDom.trigger('click');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getChildren : function(treeNode) {
|
||||
var nodeDom = dimension.treeObj.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) {
|
||||
dimension.treeObj.setting.dataModel.params.parentId = treeNode.id;
|
||||
var result = dimension.treeObj.getData(dimension.treeObj.setting.dataModel, treeNode.id);
|
||||
dimension.treeObj.buildChilren(result, treeNode);
|
||||
}
|
||||
},
|
||||
treeClick : function(treeNode) {
|
||||
$('#hotspotDiv div').removeClass('currHotspotDimension');
|
||||
$('#hotspotDiv div[dimensionId=' + treeNode.id + ']').addClass('currHotspotDimension');
|
||||
// 打开知识列表
|
||||
var showtype = treeNode.showType;
|
||||
if (showtype == 1) {
|
||||
// 打开维度列表
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : 'com.actionsoft.apps.kms_knwl_center_dimension_card_list_all_json',
|
||||
dimensionId : treeNode.id
|
||||
},
|
||||
ok : function(r) {
|
||||
$('#knwlListDiv tbody tr').remove();
|
||||
var html = '';
|
||||
var list = r.data.list;
|
||||
if (list.length && list.length > 0) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var card = list[i];
|
||||
html += "<tr style='cursor:pointer;' onclick='selectKnwl(this)' cardId='"+card.cardId+"'>";
|
||||
html += "<td>" + (i + 1) + "</td>";
|
||||
html += "<td name='cardName'>";
|
||||
html += "<span>" + card.cardName + "</span>";
|
||||
html += "</td>";
|
||||
html += "<td>" + card.publishUsername + "</td><td>" + card.publishTime + "</td>";
|
||||
html += "<tr>";
|
||||
}
|
||||
|
||||
$('#knwlListDiv tbody').append(html)
|
||||
$('#knwlListDiv').show();
|
||||
} else {
|
||||
$('#knwlListDiv').hide();
|
||||
}
|
||||
resizeKnwlListDiv();
|
||||
return false;
|
||||
},
|
||||
err : function() {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#knwlListDiv').hide();
|
||||
resizeKnwlListDiv();
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 重新计算知识列表的高度
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function resizeKnwlListDiv() {
|
||||
if ($('#knwlListDiv').is(':visible')) {
|
||||
$('#hotspotDiv').css('height', $('#contentWrap').height() - $('#knwlListDiv').outerHeight(true));
|
||||
} else {
|
||||
$('#hotspotDiv').css('height', '100%');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选中知识(行)
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
function selectKnwl(obj){
|
||||
$('#knwlListDiv tbody tr.knwl_selected').removeClass('knwl_selected');
|
||||
$(obj).addClass('knwl_selected');
|
||||
}
|
||||
@ -0,0 +1,189 @@
|
||||
$(function() {
|
||||
try {
|
||||
// todo临时注释掉ie8的quicktip,有bug32933
|
||||
if (!$.support.leadingWhitespace) {// 判断IE8
|
||||
$(document).off('mouseover.over');
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
var fullscreenEnabled = document.fullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled;
|
||||
if (fullscreenEnabled) {// 如果允许全屏
|
||||
$('#fullscreenImg').show();
|
||||
$('#fullscreenImg').off('click').on('click', function() {
|
||||
toggleFullscreen();
|
||||
});
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
resizeKnwlListDiv();
|
||||
});
|
||||
$('.closeKnwl').off('click').on('click', function() {
|
||||
$('#knwlListDiv').hide();
|
||||
resizeKnwlListDiv();
|
||||
});
|
||||
$('#knwlListDiv').off('scroll').on('scroll', function() {
|
||||
$('.closeKnwl').css('top', $(this).scrollTop() + 14);
|
||||
});
|
||||
|
||||
$('#contentWrap').off('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange').on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange',function(){
|
||||
var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
|
||||
if (fullscreenElement) {
|
||||
$('#fullscreenImg').attr({
|
||||
'alt' : '取消全屏',
|
||||
'title' : '取消全屏',
|
||||
'src' : '../apps/com.actionsoft.apps.kms/img/fullscreen_exit_24px.png'
|
||||
});
|
||||
} else {
|
||||
$('#fullscreenImg').attr({
|
||||
'alt' : '全屏',
|
||||
'title' : '全屏',
|
||||
'src' : '../apps/com.actionsoft.apps.kms/img/fullscreen_24px.png'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
// 切换全屏/非全屏
|
||||
function toggleFullscreen() {
|
||||
var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
|
||||
if (fullscreenElement) {// 全屏状态,点击取消全屏
|
||||
exitFullscreen();
|
||||
} else {
|
||||
launchFullscreen(document.getElementById('contentWrap'));
|
||||
}
|
||||
}
|
||||
// 全屏
|
||||
function launchFullscreen(element) {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
} else if (element.mozRequestFullScreen) {
|
||||
element.mozRequestFullScreen();
|
||||
} else if (element.msRequestFullscreen) {
|
||||
element.msRequestFullscreen();
|
||||
} else if (element.webkitRequestFullscreen) {
|
||||
element.webkitRequestFullScreen();
|
||||
}
|
||||
}
|
||||
// 取消全屏
|
||||
function exitFullscreen() {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.webkitExitFullscreen) {
|
||||
document.webkitExitFullscreen();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 根据知识地图的图形Id查询知识(改为下方展示列表)
|
||||
*
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
function showCardByDimensionPath(obj) {
|
||||
var linkURL = $(obj).attr('linkURL');
|
||||
if (linkURL) {// 打开链接
|
||||
var target = $(obj).attr('target');
|
||||
var aTag = '<a id="hotspotLinkURL" href="' + decodeURIComponent(linkURL) + '" target="' + target + '" style="display:none"></a>';
|
||||
$(document.body).append(aTag);
|
||||
$('#hotspotLinkURL')[0].click();
|
||||
$('#hotspotLinkURL').remove();
|
||||
} else {
|
||||
var showtype = $(obj).attr('showtype');
|
||||
if (showtype == 1) {//维度
|
||||
// 打开维度列表
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sessionId,
|
||||
cmd : 'com.actionsoft.apps.kms_knwl_center_dimension_card_list_all_json',
|
||||
dimensionId : $(obj).attr('dimensionId')
|
||||
},
|
||||
ok : function(r) {
|
||||
$('#knwlListDiv tbody tr').remove();
|
||||
var html = '';
|
||||
var list = r.data.list;
|
||||
if (list.length && list.length > 0) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var card = list[i];
|
||||
html += "<tr>";
|
||||
html += "<td>" + (i + 1) + "</td>";
|
||||
html += "<td>";
|
||||
if (r.data.isNeedBorrow === true) { // 借阅无法预览
|
||||
if (card['createUser'] !== uid) {
|
||||
html += card.cardName;
|
||||
} else {
|
||||
html += "<span class='knwl-span' onclick='parent.parent.browseCard.browse(\"" + card.cardId + "\",\"\",true,\"" + card.dimensionId + "\");'>" + card.cardName + "</span>";
|
||||
}
|
||||
} else {
|
||||
html += "<span class='knwl-span' onclick='parent.parent.browseCard.browse(\"" + card.cardId + "\",\"\",true,\"" + card.dimensionId + "\");'>" + card.cardName + "</span>";
|
||||
}
|
||||
html += "</td>";
|
||||
html += "<td>" + card.publishUsername + "</td><td>" + card.publishTime + "</td>";
|
||||
html += "<tr>";
|
||||
}
|
||||
|
||||
$('#knwlListDiv tbody').append(html)
|
||||
$('#knwlListDiv').show();
|
||||
} else {
|
||||
$('#knwlListDiv').hide();
|
||||
}
|
||||
resizeKnwlListDiv();
|
||||
return false;
|
||||
},
|
||||
err : function() {
|
||||
|
||||
}
|
||||
});
|
||||
} else if (showtype == 0) {//链接
|
||||
// 跳转到对应的流程图
|
||||
awsui.ajax.request({
|
||||
url : './jd',
|
||||
method : 'POST',
|
||||
loading : true,
|
||||
dataType : 'json',
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sessionId,
|
||||
cmd : 'com.actionsoft.apps.kms_get_dimension_path_from_root',
|
||||
dimensionId : $(obj).attr('dimensionId')
|
||||
},
|
||||
success : function(r) {
|
||||
try {
|
||||
// 层层递进展开左侧流程树
|
||||
var dimensionIdList = r.data.dimensionIdList;
|
||||
for (var i = 0; i < dimensionIdList.length; i++) {
|
||||
var dimensionId = dimensionIdList[i];
|
||||
parent.all.treeObj.expandNode(parent.all.treeObj.getNodeDomById(dimensionId), true);
|
||||
}
|
||||
// 触发左侧树的click事件展示右侧的知识
|
||||
var dimnensionNodeDom = parent.all.treeObj.getNodeDomById(dimensionIdList[dimensionIdList.length - 1]);
|
||||
dimnensionNodeDom.trigger('click');
|
||||
return false;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}else if (showtype == 2) {//知识
|
||||
parent.parent.browseCard.browse($(obj).attr('cardId'),'',true)
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 重新计算知识列表的高度
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function resizeKnwlListDiv() {
|
||||
if ($('#knwlListDiv').is(':visible')) {
|
||||
$('#hotspotDiv').css('height', $('#contentWrap').height() - $('#knwlListDiv').outerHeight(true));
|
||||
} else {
|
||||
$('#hotspotDiv').css('height', '100%');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
var browseCard;
|
||||
$(function() {
|
||||
try{
|
||||
//todo临时注释掉ie8的quicktip,有bug32933
|
||||
if(!$.support.leadingWhitespace){//判断IE8
|
||||
$(document).off('mouseover.over');
|
||||
}
|
||||
}catch(e){}
|
||||
// 判断权限
|
||||
if (hasKnwlCenterNavPerm === false) {
|
||||
$('*[indx=center]').remove();
|
||||
}
|
||||
if (hasKnwlSearchPerm === false) {
|
||||
$('*[indx=search]').remove();
|
||||
}
|
||||
$('.top-item').off('click').on('click', function() {// 导航click
|
||||
if ($(this).find('span.current').length != 0) {
|
||||
return false;
|
||||
}
|
||||
$('.top-item span.top-item-line.current').animate({
|
||||
width : 0,
|
||||
left : '50%'
|
||||
}, 400, function() {
|
||||
$(this).removeClass('current');
|
||||
$(this).siblings('span.top-item-word').removeClass('current');
|
||||
});
|
||||
$(this).find('span').addClass('current');
|
||||
// 打开页面
|
||||
var knwlIndx = $(this).attr('indx');
|
||||
$('div.content-item[indx!="' + knwlIndx + '"]').hide();
|
||||
$('div.content-item[indx="' + knwlIndx + '"]').show();
|
||||
|
||||
var iframeJQ = $('iframe[indx="' + knwlIndx + '"]');
|
||||
if (!iframeJQ.attr('src')) {
|
||||
if (knwlIndx === 'center') {
|
||||
iframeJQ.attr('src', './w?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_center');
|
||||
} else if (knwlIndx === 'search') {
|
||||
iframeJQ.attr('src', './w?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_search');
|
||||
}
|
||||
}
|
||||
});
|
||||
$('.top-item').off('mouseenter').on('mouseenter', function(e) {// 飘入动画效果
|
||||
if ($(this).find('span.current').length === 0) {// 如果不是选中状态
|
||||
$(this).find('span.top-item-line').animate({
|
||||
width : $(this).width(),
|
||||
left : 0
|
||||
}, 400);
|
||||
}
|
||||
});
|
||||
$('.top-item').off('mouseleave').on('mouseleave', function(e) {// 飘出动画效果
|
||||
if ($(this).find('span.current').length === 0) {// 如果不是选中状态
|
||||
$(this).find('span.top-item-line').animate({
|
||||
width : 0,
|
||||
left : '50%'
|
||||
}, 400);
|
||||
}
|
||||
});
|
||||
|
||||
$('.top-item[indx="' + page + '"]').mouseenter();// 根据参数打开某个页面
|
||||
$('.top-item[indx="' + page + '"]').click();
|
||||
// 初始化右侧浏览dialog
|
||||
browseCard = $('#browseCardDialog').browsecard({
|
||||
mePhoto : mePhoto,
|
||||
isFavoriteAppActive : isFavoriteAppActive,
|
||||
isOnlinedocAppActive: isOnlinedocAppActive,
|
||||
canPreviewType : canPreviewType,
|
||||
isNetworkAppActive : isNetworkAppActive,
|
||||
browserPreview: $.grep(browserPreview.split(','), function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
})
|
||||
});
|
||||
});
|
||||
/**
|
||||
* 利用jquery组织冒泡
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
function stopPropagation(event){
|
||||
var eve = $.Event(event);
|
||||
eve.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,321 @@
|
||||
var isFullInited = false; // 知识检索-全文 是否已经初始化过
|
||||
var isAttrInited = false; // 知识维护-属性 是否已经初始化过
|
||||
var tabs;
|
||||
var parentIdForList = '';
|
||||
$(function () {
|
||||
topList.initGrid(sortIndx);
|
||||
});
|
||||
var topList = {
|
||||
searchGrid: undefined,
|
||||
initGrid: function (topType) {
|
||||
var gridConfig = {
|
||||
width: $(window).width() - 2,
|
||||
height: $(window).height(),
|
||||
flexWidth: false,
|
||||
flexHeight: false,
|
||||
columnBorders: false,
|
||||
wrap: false,
|
||||
nowrapTitle: false,
|
||||
topVisible: false,
|
||||
editable: true,
|
||||
scrollModel: {
|
||||
autoFit: false,
|
||||
horizontal: true,
|
||||
vertical: true
|
||||
},
|
||||
colModel: [{
|
||||
title: "标题",
|
||||
width: 500,
|
||||
sortable: true,
|
||||
editable: false,
|
||||
dataType: "string",
|
||||
dataIndx: "cardName",
|
||||
resizable: true,
|
||||
showText: false,
|
||||
render: function (ui) {
|
||||
var cardNameHtml = '';
|
||||
if (getCharCodeLength(ui.rowData[ui.dataIndx]) > 46) {// 显示qtip
|
||||
if (ui.rowData['hasPerm'] != true) {
|
||||
cardNameHtml += "<span title=\"" + ui.rowData[ui.dataIndx] + "\" style='cursor:pointer; position: relative;top: -7px;'>" + ui.rowData[ui.dataIndx] + "</span>";
|
||||
} else {
|
||||
cardNameHtml += "<span title=\"" + ui.rowData[ui.dataIndx] + "\" style='cursor:pointer;color:#0000ee; position: relative;top: -7px;' onclick='parent.parent.parent.browseCard.browse(\"" + ui.rowData.cardId + "\",\"\",false,\"" + ui.rowData.dimensionId + "\");parent.parent.parent.stopPropagation(event);'>" + ui.rowData[ui.dataIndx] + "</span>";
|
||||
}
|
||||
} else {
|
||||
if (ui.rowData['hasPerm'] != true) {
|
||||
cardNameHtml += "<span style='cursor:pointer;position: relative;top: -7px;' >" + ui.rowData[ui.dataIndx] + "</span>";
|
||||
} else {
|
||||
cardNameHtml += "<span style='cursor:pointer;color:#0000ee;position: relative;top: -7px;' onclick='parent.parent.parent.browseCard.browse(\"" + ui.rowData.cardId + "\",\"\",false,\"" + ui.rowData.dimensionId + "\");parent.parent.parent.stopPropagation(event);'>" + ui.rowData[ui.dataIndx] + "</span>";
|
||||
}
|
||||
}
|
||||
cardNameHtml += '<span class="searchDimensionPath" >' + ui.rowData.dimensionPath + '</span>';
|
||||
return cardNameHtml;
|
||||
}
|
||||
}, {
|
||||
title: "发布人",
|
||||
width: 120,
|
||||
sortable: false,
|
||||
editable: false,
|
||||
dataType: "string",
|
||||
dataIndx: "publishUsername",
|
||||
resizable: true,
|
||||
showText: false
|
||||
}, {
|
||||
title: "发布时间",
|
||||
width: 140,
|
||||
sortable: true,
|
||||
editable: false,
|
||||
dataType: "string",
|
||||
align: 'center',
|
||||
dataIndx: "publishTime",
|
||||
resizable: true,
|
||||
showText: false
|
||||
}, {
|
||||
title: "阅读次数",
|
||||
sortable: true,
|
||||
width: 100,
|
||||
align: 'center',
|
||||
editable: false,
|
||||
dataIndx: "readCount"
|
||||
}, {
|
||||
title: "讨论次数",
|
||||
sortable: true,
|
||||
width: 100,
|
||||
align: 'center',
|
||||
editable: false,
|
||||
dataIndx: "commentCount"
|
||||
}, {
|
||||
title: "重要级别",
|
||||
width: 80,
|
||||
editable: false,
|
||||
dataIndx: "rdoSL"
|
||||
}, {
|
||||
title: "操作",
|
||||
width: 75,
|
||||
sortable: false,
|
||||
align: 'left',
|
||||
editable: false,
|
||||
dataIndx: "",
|
||||
render: function (ui) {
|
||||
var btnHtml = "";
|
||||
btnHtml += "<span class='opt_icon log' onclick='parent.parent.showLog(\"" + ui.rowData['cardId'] + "\",\"" + encodeURIComponent(ui.rowData['cardName']) + "\");' title='日志'></span>";
|
||||
if (ui.rowData['hasPerm'] != true) {
|
||||
btnHtml += "<span class='opt_icon borrow' onclick='parent.parent.fullsearch.borrowCard(\"" + ui.rowData['cardId'] + "\",\"" + ui.rowData['dimensionId'] + "\");' title='借阅'></span>";
|
||||
}
|
||||
return btnHtml;
|
||||
}
|
||||
}],
|
||||
dataModel: {
|
||||
location: "remote",
|
||||
//paging: "remote",
|
||||
method: "POST",
|
||||
getUrl: function () {
|
||||
return {
|
||||
url: "./jd",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_querycardtoplist",
|
||||
sortIndx: topType
|
||||
}
|
||||
};
|
||||
},
|
||||
getData: function (responseObject) {
|
||||
return {
|
||||
data: responseObject.data.data
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
topList.searchGrid = $("#attrsearchGrid").awsGrid(gridConfig);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取char长度(一个汉字两个长度)
|
||||
*
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
function getCharCodeLength(str) {
|
||||
var len = 0;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str.charCodeAt(i) > 127) {
|
||||
len += 2;
|
||||
} else {
|
||||
len++;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览
|
||||
*
|
||||
* @param fileId
|
||||
* @param fileName
|
||||
* @param fileType
|
||||
* @param canPreviewFlag
|
||||
* @param canDownloadFlag
|
||||
* @returns
|
||||
*/
|
||||
function showFullScreenPanel(canPreviewType, fileId, fileName, fileNameVersion, canPreviewFlag, canDownloadFlag, createUserPhoto, createUser) {
|
||||
if (canPreviewFlag != undefined && canPreviewFlag == '0') { // 文件允许预览
|
||||
} else {// 文件不允许预览
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
parent.downloadFile(fileId);
|
||||
} else {
|
||||
$.simpleAlert('该文件不支持预览和下载', "info");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
fileName = decodeURIComponent(fileName);
|
||||
fileNameVersion = decodeURIComponent(fileNameVersion);
|
||||
var fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length);
|
||||
if (canPreviewType.indexOf(fileType) != -1) {
|
||||
} else {
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
parent.downloadFile(fileId);
|
||||
} else {
|
||||
$.simpleAlert('该文件不支持预览和下载', "info");
|
||||
}
|
||||
return;
|
||||
}
|
||||
$('#fullscreenWrap').show();
|
||||
$("body").css("overflow", "hidden");
|
||||
// 将文件标题显示
|
||||
$(".toolbar-title").empty();
|
||||
/* $(".toolbar-title").append(fileName);*/
|
||||
$(".toolbar-photo img").attr('src', createUserPhoto);
|
||||
$(".toolbar-photo img").attr('userId', createUser);
|
||||
previewMyFile(fileId, canDownloadFlag);
|
||||
if (canDownloadFlag != undefined && canDownloadFlag == '0') {
|
||||
$('fsdownloadbtn').hide();
|
||||
} else if (canDownloadFlag != undefined && canDownloadFlag == '1') {
|
||||
$('#fsdownloadbtn').show();
|
||||
} else {
|
||||
}
|
||||
$('#fsdownloadbtn').attr('aFileId', fileId);
|
||||
$('#fsclosebtn').click(function () {
|
||||
closeFsPanel();
|
||||
});
|
||||
}
|
||||
|
||||
function previewMyFile(fileId, canDownloadFlag) {
|
||||
$('#previewpanel').empty();
|
||||
// $.simpleAlert("文件正在加载,请稍侯...", "loading");
|
||||
var params = {
|
||||
fileId: fileId
|
||||
};
|
||||
var url = './jd?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_center_preview_file&isDownload=' + (canDownloadFlag == 1);
|
||||
awsui.ajax.post(url, params, function (responseObject) {
|
||||
if (responseObject['result'] == 'ok') {
|
||||
// $.simpleAlert("close");
|
||||
var url = responseObject["data"]['url'];
|
||||
$('#previewpanel').empty();
|
||||
$('#previewpanel').append("<iframe frameBorder='0' class='previewfrm' id='previewfrm'></iframe>");
|
||||
$('#previewfrm').attr("src", url);
|
||||
var iframemy = document.getElementById("previewfrm");
|
||||
if (iframemy.attachEvent) {
|
||||
iframemy.attachEvent("onload", function () {
|
||||
closePreviewFile();
|
||||
// $.simpleAlert("close");
|
||||
});
|
||||
} else {
|
||||
iframemy.onload = function () {
|
||||
closePreviewFile();
|
||||
// $.simpleAlert("close");
|
||||
};
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert(responseObject['msg'], responseObject['result']);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
//关闭预览
|
||||
function closePreviewFile() {
|
||||
var back = $("#previewfrm").contents().find("#filepre_back");
|
||||
back.click(function () {
|
||||
// $('div[name=previewpanel]').hide();//页面关闭销毁转换请求
|
||||
$("#fullscreenWrap").hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭预览
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function closeFsPanel() {
|
||||
$('#fullscreenWrap').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览器预览
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function browserPreviewFun(fileId, fileName, canDownloadFlag, createUserPhoto, createUser) {
|
||||
fileName = decodeURIComponent(fileName);
|
||||
$('#fullscreenWrap').show();
|
||||
$("body").css("overflow", "hidden");
|
||||
// 将文件标题显示
|
||||
$(".toolbar-title").empty();
|
||||
/* $(".toolbar-title").append(fileName);*/
|
||||
$(".toolbar-photo img").attr('src', createUserPhoto);
|
||||
$(".toolbar-photo img").attr('userId', createUser);
|
||||
$('#previewpanel').empty();
|
||||
$.simpleAlert("正在加载文件,请稍侯。。。", "loading");
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
fileId: fileId,
|
||||
sid: sid,
|
||||
cmd: 'com.actionsoft.apps.kms_knwl_browser_preview'
|
||||
},
|
||||
ok: function (responseObject) {
|
||||
if (responseObject['result'] == 'ok') {
|
||||
// $.simpleAlert("close");
|
||||
var url = responseObject["data"]['url'];
|
||||
$('#previewpanel').empty();
|
||||
$('#previewpanel').append("<iframe frameBorder='0' class='previewfrm' id='previewfrm'></iframe>");
|
||||
if (responseObject.data.isImg === true) {
|
||||
$('#previewfrm').attr("src", './w?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_browser_preview_image&fileId=' + fileId);
|
||||
} else {
|
||||
$('#previewfrm').attr("src", responseObject.data.url);
|
||||
}
|
||||
var iframemy = document.getElementById("previewfrm");
|
||||
if (iframemy.attachEvent) {
|
||||
iframemy.attachEvent("onload", function () {
|
||||
$.simpleAlert("close");
|
||||
});
|
||||
} else {
|
||||
iframemy.onload = function () {
|
||||
$.simpleAlert("close");
|
||||
};
|
||||
}
|
||||
} else {
|
||||
$.simpleAlert(responseObject['msg'], responseObject['result']);
|
||||
}
|
||||
},
|
||||
err: function () {
|
||||
$('#window-mask').hide();
|
||||
$('#fsclosebtn').click();
|
||||
}
|
||||
});
|
||||
if (canDownloadFlag === 0) {
|
||||
$('#fsdownloadbtn').hide();
|
||||
} else if (canDownloadFlag == 1) {
|
||||
$('#fsdownloadbtn').show();
|
||||
} else {
|
||||
}
|
||||
$('#fsdownloadbtn').attr('aFileId', fileId);
|
||||
$('#fsclosebtn').click(function () {
|
||||
closeFsPanel();
|
||||
});
|
||||
}
|
||||
|
||||
function moreTop() {
|
||||
var iframeJQ = $("iframe[indx=\"search\"]", parent.parent.parent.document);
|
||||
iframeJQ.attr("src", "./w?cmd=com.actionsoft.apps.kms_knwl_search");
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
var browseCard;
|
||||
$(function() {
|
||||
try{
|
||||
//todo临时注释掉ie8的quicktip,有bug32933
|
||||
if(!$.support.leadingWhitespace){//判断IE8
|
||||
$(document).off('mouseover.over');
|
||||
}
|
||||
}catch(e){}
|
||||
// 判断权限
|
||||
if (hasKnwlMgrNavPerm === false) {
|
||||
$('*[indx=knwl]').remove();
|
||||
}
|
||||
if (hasSystemMgrPerm === false) {
|
||||
$('*[indx=system]').remove();
|
||||
}
|
||||
$('.top-item').off('click').on('click', function() {// 导航click
|
||||
if($(this).find('span.current').length != 0){
|
||||
return false;
|
||||
}
|
||||
$('.top-item span.top-item-line.current').animate({
|
||||
width : 0,
|
||||
left : '50%'
|
||||
}, 400, function() {
|
||||
$(this).removeClass('current');
|
||||
$(this).siblings('span.top-item-word').removeClass('current');
|
||||
});
|
||||
$(this).find('span').addClass('current');
|
||||
// 打开页面
|
||||
var knwlIndx = $(this).attr('indx');
|
||||
$('div.content-item[indx!="' + knwlIndx + '"]').hide();
|
||||
$('div.content-item[indx="' + knwlIndx + '"]').show();
|
||||
|
||||
var iframeJQ = $('iframe[indx="' + knwlIndx + '"]');
|
||||
if (!iframeJQ.attr('src')) {//初次加载
|
||||
if (knwlIndx === 'knwl') {
|
||||
if(tab){
|
||||
//设置cookie 打开tab
|
||||
setCookie('kms.knwlmgr.opendtab', 'fromUrlParam');
|
||||
iframeJQ.off('load').on('load', function() {
|
||||
iframeJQ[0].contentWindow.tabs.focusTab('nav-tab-'+tab);
|
||||
//取消绑定
|
||||
iframeJQ.off('load');
|
||||
});
|
||||
}
|
||||
iframeJQ.attr('src', './w?sid='+sid+'&cmd=com.actionsoft.apps.kms_knwl_mgr');
|
||||
} else if (knwlIndx === 'system') {
|
||||
iframeJQ.attr('src', './w?sid='+sid+'&cmd=com.actionsoft.apps.kms_system_mgr');
|
||||
}
|
||||
}
|
||||
});
|
||||
$('.top-item').off('mouseenter').on('mouseenter', function(e) {// 飘入动画效果
|
||||
if ($(this).find('span.current').length === 0) {// 如果不是选中状态
|
||||
$(this).find('span.top-item-line').animate({
|
||||
width : $(this).width(),
|
||||
left : 0
|
||||
}, 400);
|
||||
}
|
||||
});
|
||||
$('.top-item').off('mouseleave').on('mouseleave', function(e) {// 飘出动画效果
|
||||
if ($(this).find('span.current').length === 0) {// 如果不是选中状态
|
||||
$(this).find('span.top-item-line').animate({
|
||||
width : 0,
|
||||
left : '50%'
|
||||
}, 400);
|
||||
}
|
||||
});
|
||||
|
||||
$('.top-item[indx="' + page + '"]').mouseenter();// 根据参数打开某个页面
|
||||
$('.top-item[indx="' + page + '"]').click();
|
||||
//初始化右侧浏览dialog
|
||||
browseCard = $('#browseCardDialog').browsecard({
|
||||
mePhoto: mePhoto,
|
||||
isFavoriteAppActive: isFavoriteAppActive,
|
||||
isOnlinedocAppActive: isOnlinedocAppActive,
|
||||
canPreviewType: canPreviewType,
|
||||
isNetworkAppActive: isNetworkAppActive,
|
||||
browserPreview: $.grep(browserPreview.split(','), function (n, i) {// 浏览器直接预览,不调用onlinedoc
|
||||
return n != '';
|
||||
})
|
||||
});
|
||||
});
|
||||
/**
|
||||
* 利用jquery组织冒泡
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
function stopPropagation(event){
|
||||
var eve = $.Event(event);
|
||||
eve.stopPropagation();
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
var newWorkTree;
|
||||
var sid ;
|
||||
var selectedNode;
|
||||
$(document).ready(function(){
|
||||
initNetWorkTree();
|
||||
});
|
||||
//初始化文件层级树
|
||||
function initNetWorkTree(){
|
||||
sid = frmMain.sid.value;
|
||||
var dataUrl = './jd?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_center_get_network_tree';
|
||||
//相当于刷新树
|
||||
$("#networkTree").html('');
|
||||
var setting = {
|
||||
showIcon:true,
|
||||
dblClickToExpand:true,
|
||||
animate:true,
|
||||
remember:true,
|
||||
autoHeight:true,
|
||||
event:{
|
||||
onClick: selectNode
|
||||
},
|
||||
dataModel:{
|
||||
url:dataUrl,
|
||||
method:"POST",
|
||||
dataType:"text",
|
||||
params:{ }
|
||||
}
|
||||
};
|
||||
newWorkTree = awsui.tree.init($("#networkTree"), setting);
|
||||
newWorkTree.resizeTree();
|
||||
}
|
||||
function buildChildNode(treeNode){
|
||||
var dataUrl = './jd?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_center_get_network_tree';
|
||||
var dataModel = {
|
||||
url:dataUrl,
|
||||
method:"POST",
|
||||
dataType:"text",
|
||||
params:{
|
||||
userId: treeNode.id
|
||||
}
|
||||
};
|
||||
if(treeNode.open != null){
|
||||
var result = newWorkTree.getData(dataModel);
|
||||
newWorkTree.buildChilren(result, treeNode);
|
||||
}
|
||||
}
|
||||
function selectNode(treeNode){
|
||||
selectedNode = treeNode;
|
||||
}
|
||||
@ -0,0 +1,679 @@
|
||||
var isParamInited = false; // 系统维护-参数 是否已经初始化过
|
||||
//var isImgInited = false; // 系统维护-图片 是否已经初始化过
|
||||
var isStatInited = false; // 系统维护-统计 是否已经初始化过
|
||||
var tabs;
|
||||
var versionGrid;
|
||||
var hotspotDefGrid;
|
||||
$(function() {
|
||||
try{
|
||||
//todo临时注释掉ie8的quicktip,有bug32933
|
||||
if(!$.support.leadingWhitespace){//判断IE8
|
||||
$(document).off('mouseover.over');
|
||||
}
|
||||
}catch(e){}
|
||||
// 初始化tab
|
||||
tabs = awsui.tabs.init($("#tabs"), {
|
||||
contentPanel : $("#tabs-content"),
|
||||
height : 50,
|
||||
focusShowAfter : function(tab) {
|
||||
if (tab.beforeTabIndex !== tab.index) {
|
||||
// 更改样式
|
||||
if(tab.index === 'nav-tab-param'){
|
||||
$('#tabs div[index=nav-tab-stat]').addClass('nav-tab-left-border');
|
||||
$('#tabs div[index=nav-tab-param]').removeClass('nav-tab-right-border');
|
||||
}else if(tab.index === 'nav-tab-stat'){
|
||||
$('#tabs div[index=nav-tab-param]').addClass('nav-tab-right-border');
|
||||
$('#tabs div[index=nav-tab-stat]').removeClass('nav-tab-left-border');
|
||||
}
|
||||
// 记录cookie-最后打开的tab
|
||||
if (getCookie('kms.systemmgr.opendtab') !== tab.index) {
|
||||
setCookie('kms.systemmgr.opendtab', tab.index);
|
||||
}
|
||||
if (tab.beforeTabIndex === undefined) { // 页面初始化
|
||||
if (tab.index === 'nav-tab-param') {
|
||||
isParamInited = true;
|
||||
initParam();
|
||||
}
|
||||
// else if (tab.index === 'nav-tab-img') {
|
||||
// isImgInited = true;
|
||||
// }
|
||||
else if (tab.index === 'nav-tab-stat') {
|
||||
isStatInited = true;
|
||||
stat.initStat();
|
||||
}
|
||||
} else {
|
||||
if (tab.index === 'nav-tab-param') {
|
||||
if (!isParamInited) {
|
||||
initParam();
|
||||
}
|
||||
}
|
||||
// else if (tab.index === 'nav-tab-img') {
|
||||
// if (!isImgInited) {}
|
||||
// }
|
||||
if (tab.index === 'nav-tab-stat') {
|
||||
if (!isStatInited) {
|
||||
stat.initStat();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
tabs.addTab({
|
||||
item : {
|
||||
title : "<span class='tab-icon tab-icon-param'></span><span style='font-size: 13px;float:left;'> 参数</span>",
|
||||
index : "nav-tab-param"
|
||||
},
|
||||
close : false
|
||||
});
|
||||
tabs.addTab({
|
||||
item : {
|
||||
title : "<span class='tab-icon tab-icon-stat'></span><span style='font-size: 13px;float:left;'> 统计</span>",
|
||||
index : "nav-tab-stat"
|
||||
},
|
||||
close : false
|
||||
});
|
||||
// tabs.addTab({
|
||||
// item : {
|
||||
// title : "图片配置",
|
||||
// index : "nav-tab-img"
|
||||
// },
|
||||
// close : false
|
||||
// });
|
||||
tabs.focusTab('0000-0000-0000'); // 制造一个undefined的tab的beforeTabIndex,打开页面的时候使用
|
||||
var opendtab = getCookie('kms.systemmgr.opendtab');
|
||||
if (opendtab) { // 取上次打开的tab
|
||||
tabs.focusTab(opendtab);
|
||||
} else { // 第一次打开all
|
||||
tabs.focusTab('nav-tab-param');
|
||||
}
|
||||
$('#tabs .awsui-tabs-container').width(200);
|
||||
$(window).resize(function() {
|
||||
if ($('#tab-param').is(':visible')) {
|
||||
resizeVersionGrid();
|
||||
resizeHotspotDefGrid();
|
||||
} else if ($('#tab-stat').is(':visible')) {
|
||||
// stat.statChart.resize();
|
||||
}
|
||||
});
|
||||
});
|
||||
function initParam(){
|
||||
initVersionGrid();
|
||||
initHotspotDefGrid();
|
||||
// 获取知识参数并且初始化
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
loading : true,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_system_mgr_get_param_json"
|
||||
},
|
||||
success : function(responseObject) {
|
||||
$('#maxFileSize').numberbox({
|
||||
uplength : 5,
|
||||
max : 500
|
||||
});
|
||||
$('#maxFileSize').val(responseObject.data.systemParam.maxFileSize);
|
||||
|
||||
$('#gridRowPP').numberbox({
|
||||
uplength : 1,
|
||||
max : 100
|
||||
});
|
||||
$('#gridRowPP').val(responseObject.data.systemParam.gridRowPP);
|
||||
var availableTags = [];
|
||||
$("#blackFileList").userinputkms({
|
||||
superbox : $("#usersuper"),
|
||||
target : $("#usersuper"),
|
||||
seperator : '@`@',
|
||||
initData : responseObject.data.systemParam.blackFileList.split('@`@'),
|
||||
listHeight : 120,
|
||||
multiple : true, // 多选
|
||||
source : availableTags,
|
||||
add : function(e, d) {
|
||||
},
|
||||
del : function(e, d) {
|
||||
}
|
||||
});
|
||||
$("#browserPreview").userinputkms({
|
||||
superbox : $("#browserPreviewWrap"),
|
||||
target : $("#browserPreviewWrap"),
|
||||
seperator : ',',
|
||||
initData : responseObject.data.systemParam.browserPreview.split(','),
|
||||
listHeight : 120,
|
||||
multiple : true, // 多选
|
||||
source : availableTags,
|
||||
add : function(e, d) {
|
||||
},
|
||||
del : function(e, d) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 上传知识地图
|
||||
var hotspotResultFlag = undefined;
|
||||
$("#hotspotName").upfile({
|
||||
sid : sid,
|
||||
appId : "com.actionsoft.apps.kms",
|
||||
groupValue : "grouphotspot",
|
||||
fileValue : "filehotspot",
|
||||
numLimit : 1,
|
||||
filesToFilter : [ [ "Pos (*.pos)", "*.pos" ] ],
|
||||
repositoryName : "hotspot",
|
||||
done : function(e, data) {
|
||||
// 增加一行
|
||||
if (data['result']['data']['result'] == 'ok') {
|
||||
var hotspotResult = data['result']['data']['data']['attrs']['hotspotResult'];
|
||||
if(hotspotResult){
|
||||
hotspotResultFlag = hotspotResult;
|
||||
}else{
|
||||
var fileName = decodeURIComponent(data['files'][0]['name']);
|
||||
$("#hotspotName").val(fileName);
|
||||
$('#hotspotMetaId').val(data['result']['data']['data']['attrs']['hotspotMetaId']);
|
||||
}
|
||||
}else{
|
||||
hotspotResultFlag = data['result']['data']['msg'];
|
||||
}
|
||||
},
|
||||
complete : function(e, data) {
|
||||
if(hotspotResultFlag){
|
||||
$.simpleAlert(hotspotResultFlag, 'error');
|
||||
hotspotResultFlag = undefined;
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error : function(e, data){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveSystemParam() {
|
||||
// 取值
|
||||
var maxFileSize = $('#maxFileSize').val();
|
||||
if (!/^(\d)+$/.test(maxFileSize)) {
|
||||
$.simpleAlert('单文件上传最大值格式错误,请输入正整数', 'info');
|
||||
return false;
|
||||
}
|
||||
var gridRowPP = $('#gridRowPP').val();
|
||||
if (!/^(\d)+$/.test(gridRowPP)) {
|
||||
$.simpleAlert('分页列表每页的行数格式错误,请输入正整数', 'info');
|
||||
return false;
|
||||
}
|
||||
|
||||
var blackFileList = $('#usersuper span[class=awsui-supertext-item]').map(function() {
|
||||
return $(this).text();
|
||||
}).toArray().join('@`@');
|
||||
var browserPreview = $('#browserPreviewWrap span[class=awsui-supertext-item]').map(function() {
|
||||
return $(this).text();
|
||||
}).toArray().join(',');
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
loading : true,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_system_mgr_save_param",
|
||||
maxFileSize : maxFileSize,
|
||||
gridRowPP : gridRowPP,
|
||||
blackFileList : encodeURIComponent(blackFileList),
|
||||
browserPreview : encodeURIComponent(browserPreview)
|
||||
},
|
||||
success : function(responseObject) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initVersionGrid() {
|
||||
if (!versionGrid) {
|
||||
// 初始化版本号列表(grid)
|
||||
var versionGridConfig = {
|
||||
width : $('#tab-param').width() -502,
|
||||
height : $('#tab-param').height() / 2 -40 - 3,
|
||||
flexWidth : false,
|
||||
flexHeight : false,
|
||||
wrap : false,
|
||||
nowrapTitle : false,
|
||||
topVisible : false,
|
||||
bottomVisible : false,
|
||||
columnBorders : false,
|
||||
editModel : {
|
||||
clicksToEdit : 0
|
||||
},
|
||||
scrollModel: {
|
||||
autoFit: false,
|
||||
horizontal: true,
|
||||
vertical :true
|
||||
},
|
||||
colModel : [ {
|
||||
title : "",
|
||||
checkbox : true,
|
||||
resizable : false,
|
||||
align : "center",
|
||||
width : 30
|
||||
}, {
|
||||
title : "版本号",
|
||||
width : 200,
|
||||
sortable : false,
|
||||
dataType : "string",
|
||||
dataIndx : "versionNo",
|
||||
resizable : true,
|
||||
showText : false
|
||||
}, {
|
||||
title : "创建人",
|
||||
width : 100,
|
||||
sortable : false,
|
||||
dataType : "string",
|
||||
dataIndx : "createUsername",
|
||||
resizable : true,
|
||||
showText : false
|
||||
}, {
|
||||
title : "创建时间",
|
||||
sortable : false,
|
||||
showText : false,
|
||||
width : 130,
|
||||
align : 'center',
|
||||
dataIndx : "createTime"
|
||||
}, {
|
||||
title : "描述",
|
||||
sortable : false,
|
||||
showText : false,
|
||||
align : 'left',
|
||||
dataIndx : "memo",
|
||||
width : $('#tab-param').width() -502 - 30 - 200 - 130 -120 -50
|
||||
} ],
|
||||
dataModel : {
|
||||
location : "remote",
|
||||
sorting : "remote",
|
||||
method : "POST",
|
||||
getUrl : function() {
|
||||
return {
|
||||
url : "./jd",
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_version_list_json"
|
||||
}
|
||||
};
|
||||
},
|
||||
getData : function(responseObject) {
|
||||
return {
|
||||
data : responseObject.data
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
versionGrid = $("#version-grid").awsGrid(versionGridConfig);
|
||||
versionGrid.on("awsgridrowselect", function(evt, ui) {
|
||||
$("#deleteVersionBtn").show();
|
||||
});
|
||||
versionGrid.on("awsgridrowunselect", function(evt, ui) {
|
||||
var length = versionGrid.awsGrid("getSelectedRow").length;
|
||||
if (length > 1) {
|
||||
$("#deleteVersionBtn").show();
|
||||
} else {
|
||||
$("#deleteVersionBtn").hide();
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
resizeVersionGrid();
|
||||
}
|
||||
}
|
||||
|
||||
function resizeVersionGrid() {
|
||||
versionGrid.width($('#tab-param').width() -502);
|
||||
versionGrid.height($('#tab-param').height() / 2 -40 - 3);
|
||||
versionGrid.awsGrid("refresh");
|
||||
}
|
||||
|
||||
function initHotspotDefGrid() {
|
||||
if (!hotspotDefGrid) {
|
||||
// 初始化知识地图定义列表(grid)
|
||||
var hotspotDefGridConfig = {
|
||||
width : $('#tab-param').width() -502,
|
||||
height : $('#tab-param').height() / 2 -40 - 3,
|
||||
flexWidth : false,
|
||||
flexHeight : false,
|
||||
wrap : false,
|
||||
nowrapTitle : false,
|
||||
topVisible : false,
|
||||
columnBorders : false,
|
||||
bottomVisible : false,
|
||||
editModel : {
|
||||
clicksToEdit : 0
|
||||
},
|
||||
scrollModel: {
|
||||
autoFit: false,
|
||||
horizontal: true,
|
||||
vertical :true
|
||||
},
|
||||
colModel : [ {
|
||||
title : "",
|
||||
checkbox : true,
|
||||
resizable : false,
|
||||
align : "center",
|
||||
width : 30
|
||||
}, {
|
||||
title : "知识地图名称",
|
||||
width : 200,
|
||||
sortable : true,
|
||||
dataType : "string",
|
||||
dataIndx : "hotspotName",
|
||||
resizable : true,
|
||||
showText : false
|
||||
}, {
|
||||
title : "创建人",
|
||||
width : 100,
|
||||
sortable : true,
|
||||
dataType : "string",
|
||||
dataIndx : "createUsername",
|
||||
resizable : true,
|
||||
showText : false
|
||||
}, {
|
||||
title : "创建时间",
|
||||
sortable : true,
|
||||
showText : false,
|
||||
width : 130,
|
||||
align : 'center',
|
||||
dataIndx : "createTime"
|
||||
}, {
|
||||
title : "描述",
|
||||
sortable : false,
|
||||
showText : false,
|
||||
align : 'left',
|
||||
dataIndx : "memo",
|
||||
width : $('#tab-param').width() -502 - 30 - 200 - 130 -120 -50
|
||||
} ],
|
||||
dataModel : {
|
||||
location : "remote",
|
||||
sorting : "local",
|
||||
sortIndx : 'createTime',
|
||||
sortDir : 'down',
|
||||
method : "POST",
|
||||
getUrl : function() {
|
||||
return {
|
||||
url : "./jd",
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_hotspot_def_list_json"
|
||||
}
|
||||
};
|
||||
},
|
||||
getData : function(responseObject) {
|
||||
return {
|
||||
data : responseObject.data
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
hotspotDefGrid = $("#hotspot-def-grid").awsGrid(hotspotDefGridConfig);
|
||||
hotspotDefGrid.on("awsgridrowselect", function(evt, ui) {
|
||||
$("#deleteHotspotDefBtn").show();
|
||||
});
|
||||
hotspotDefGrid.on("awsgridrowunselect", function(evt, ui) {
|
||||
var length = hotspotDefGrid.awsGrid("getSelectedRow").length;
|
||||
if (length > 1) {
|
||||
$("#deleteHotspotDefBtn").show();
|
||||
} else {
|
||||
$("#deleteHotspotDefBtn").hide();
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
resizeHotspotDefGrid();
|
||||
}
|
||||
}
|
||||
function resizeHotspotDefGrid() {
|
||||
hotspotDefGrid.width($('#tab-param').width() -502);
|
||||
hotspotDefGrid.height($('#tab-param').height() / 2 -40 - 3);
|
||||
hotspotDefGrid.awsGrid("refresh");
|
||||
}
|
||||
/**
|
||||
* 新建版本号
|
||||
*/
|
||||
function addVersion() {
|
||||
$('#versionNo,#memo').val('');
|
||||
$('#versionDialog').dialog({
|
||||
title : '新建版本号',
|
||||
width : 380,
|
||||
height : 235,
|
||||
buttons : [ {
|
||||
text : '确定',
|
||||
cls : "blue",
|
||||
handler : function() {
|
||||
if($('#versionNo').val() == ''){
|
||||
$.simpleAlert('版本号不能为空', 'info');
|
||||
$('#versionNo').focus();
|
||||
return false;
|
||||
}
|
||||
var versionNo = $('#versionNo').val();
|
||||
if (!/^[1-9][0-9]*(\.[0-9]+)?$/.test(versionNo)) {
|
||||
$.simpleAlert('版本号格式错误,请输入整数或小数', 'info');
|
||||
$('#versionNo').focus();
|
||||
return false;
|
||||
}
|
||||
var memo = $('#memo').val();
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
loading : true,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_system_mgr_add_version",
|
||||
versionNo : versionNo,
|
||||
memo : encodeURIComponent(memo)
|
||||
},
|
||||
success : function(responseObject) {
|
||||
if (responseObject.result === 'ok') {
|
||||
$('#versionDialog').dialog('close');
|
||||
$.simpleAlert('新建成功', 'ok');
|
||||
$("#deleteVersionBtn").hide();
|
||||
versionGrid.awsGrid("refreshDataAndView");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
text : '取消',
|
||||
handler : function() {
|
||||
$('#versionDialog').dialog('close');
|
||||
}
|
||||
} ],
|
||||
onClose : function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 新建知识地图定义
|
||||
*/
|
||||
function addHotspotDef() {
|
||||
$('#hotspotDefMemo,#hotspotName,#hotspotMetaId').val('');
|
||||
$('#hotspotDefDialog').dialog({
|
||||
title : '新建知识地图',
|
||||
width : 380,
|
||||
height : 235,
|
||||
buttons : [ {
|
||||
text : '确定',
|
||||
cls : "blue",
|
||||
handler : function() {
|
||||
var hotspotName = $('#hotspotName').val();
|
||||
if ($.trim(hotspotName) == '') {
|
||||
$.simpleAlert('请上传知识地图文件', 'info');
|
||||
return false;
|
||||
}
|
||||
if($('#hotspotMetaId').val() === ''){
|
||||
$.simpleAlert('请上传知识地图文件', 'info');
|
||||
return false;
|
||||
}
|
||||
var memo = $('#hotspotDefMemo').val();
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
loading : true,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_system_mgr_add_hotspot_def",
|
||||
hotspotName : encodeURIComponent(hotspotName),
|
||||
memo : encodeURIComponent(memo),
|
||||
hotspotMetaId : $('#hotspotMetaId').val()
|
||||
},
|
||||
success : function(responseObject) {
|
||||
if (responseObject.result === 'ok') {
|
||||
$('#hotspotDefDialog').dialog('close');
|
||||
$.simpleAlert('新建成功', 'ok');
|
||||
$("#deleteHotspotDefBtn").hide();
|
||||
hotspotDefGrid.awsGrid("refreshDataAndView");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
text : '取消',
|
||||
handler : function() {
|
||||
$('#hotspotDefDialog').dialog('close');
|
||||
}
|
||||
} ],
|
||||
onClose : function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除版本号
|
||||
*/
|
||||
function deleteVersion() {
|
||||
var selectedRows = versionGrid.awsGrid("getRows");
|
||||
if (selectedRows.length < 1) {
|
||||
$.simpleAlert("请选中需要删除的版本号", "info");
|
||||
return false;
|
||||
}
|
||||
var versionNoArr = [];
|
||||
for (var i = 0; i < selectedRows.length; i++) {
|
||||
var obj = selectedRows[i];
|
||||
versionNoArr[i] = obj.id;
|
||||
}
|
||||
$.confirm({
|
||||
title : "请确认",
|
||||
content : "是否删除选中的版本号?",
|
||||
onConfirm : function() {
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
loading : true,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_knwl_center_delete_version",
|
||||
versionNos : versionNoArr.toString()
|
||||
},
|
||||
success : function(responseObject) {
|
||||
if (responseObject.result == 'ok') {
|
||||
$.simpleAlert('删除成功', 'ok');
|
||||
$("#deleteVersionBtn").hide();
|
||||
versionGrid.awsGrid('refreshDataAndView');
|
||||
} else {
|
||||
$.simpleAlert('删除错误', responseObject.result);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除知识地图定义
|
||||
*/
|
||||
function deleteHotspotDef() {
|
||||
var selectedRows = hotspotDefGrid.awsGrid("getRows");
|
||||
if (selectedRows.length < 1) {
|
||||
$.simpleAlert("请选中需要删除的知识地图", "info");
|
||||
return false;
|
||||
}
|
||||
var hotspotIdArr = [];
|
||||
for (var i = 0; i < selectedRows.length; i++) {
|
||||
var obj = selectedRows[i];
|
||||
hotspotIdArr[i] = obj.id;
|
||||
}
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
loading : true,
|
||||
alert : false,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_knwl_center_delete_hotspot_check",
|
||||
hotspotDefIds : hotspotIdArr.toString()
|
||||
},
|
||||
success : function(responseObject) {
|
||||
if (responseObject.result == 'ok') {
|
||||
$.confirm({
|
||||
title : "请确认",
|
||||
content : "是否删除选中的知识地图?该知识地图的图形和维度的关联也将被删除",
|
||||
onConfirm : function() {
|
||||
awsui.ajax.request({
|
||||
url : "./jd",
|
||||
method : "POST",
|
||||
loading : true,
|
||||
data : {
|
||||
sid : sid,
|
||||
cmd : "com.actionsoft.apps.kms_knwl_center_delete_hotspot_def",
|
||||
hotspotDefIds : hotspotIdArr.toString()
|
||||
},
|
||||
success : function(responseObject) {
|
||||
if (responseObject.result == 'ok') {
|
||||
$.simpleAlert('删除成功', 'ok');
|
||||
$("#deleteHotspotDefBtn").hide();
|
||||
hotspotDefGrid.awsGrid('refreshDataAndView');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else{
|
||||
$.simpleAlert(responseObject.msg, responseObject.result);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
var stat = {
|
||||
statChart : undefined,
|
||||
initStat: function () {
|
||||
statChart = echarts.init(document.getElementById('statChart'));
|
||||
|
||||
statChart.showLoading();
|
||||
$.get('./jd?sid=' + sid + '&cmd=com.actionsoft.apps.kms_knwl_center_stat_json').done(function (data) {
|
||||
statChart.hideLoading();
|
||||
statChart.setOption({
|
||||
title: {
|
||||
text: '知识、文件'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: ['知识', '文件']
|
||||
},
|
||||
dataZoom: {
|
||||
orient: "horizontal",
|
||||
show: true,
|
||||
start: 0, // 起始值百分比
|
||||
end: (6 / (data.data.createUserList.length)) * 100 // 结束值百分比(计算规则:chart宽度能容纳的最大个数/数据长度
|
||||
// 再乘以100)
|
||||
},
|
||||
xAxis: {
|
||||
data: data.data.createUserList
|
||||
},
|
||||
yAxis: {},
|
||||
series: [{
|
||||
name: '知识',
|
||||
type: 'bar',
|
||||
barWidth: 20,
|
||||
data: data.data.cardList
|
||||
}, {
|
||||
name: '文件',
|
||||
type: 'bar',
|
||||
barWidth: 20,
|
||||
data: data.data.fileList
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,34 @@
|
||||
var usertaskDimensionTree;
|
||||
$(function() {
|
||||
if (usertaskDimensionTreeJson.length == 0) {
|
||||
$("#innerTableNoData").show();
|
||||
}
|
||||
var setting = {
|
||||
sort : true,
|
||||
showLine : false,
|
||||
checkbox : true,
|
||||
checkInherit : false,
|
||||
event : {
|
||||
},
|
||||
animate : true,
|
||||
dataModel : {
|
||||
data : usertaskDimensionTreeJson
|
||||
}
|
||||
};
|
||||
usertaskDimensionTree = awsui.tree.init($("#dimensionTree"), setting);
|
||||
try {
|
||||
parent.$("formToKMSDimensionDialog").find("iframe").css("height", "99%")
|
||||
} catch (e) {
|
||||
}
|
||||
checkUsertaskDimension();
|
||||
});
|
||||
|
||||
function checkUsertaskDimension() {
|
||||
// 根据usertask页面传过来的值选中维度
|
||||
var formToKMSOptionDimensionIdJsonArray = formToKMSOptionDimensionIdJA;
|
||||
var formToKMSOptionDimensionIdArray = [];
|
||||
for (var i = 0; i < formToKMSOptionDimensionIdJsonArray.length; i++) {
|
||||
formToKMSOptionDimensionIdArray[i] = formToKMSOptionDimensionIdJsonArray[i];
|
||||
}
|
||||
usertaskDimensionTree.setCheckNodes(formToKMSOptionDimensionIdArray);
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
var transparent="1";
|
||||
$(document).ready(function(){
|
||||
var kmsDataListInfo=kmsDataList[0];
|
||||
renderKmsData(kmsDataListInfo);
|
||||
if (kmsDataListInfo.length == 0) {
|
||||
$(".nocontent").show();
|
||||
}
|
||||
});
|
||||
|
||||
function reBytes(str) {
|
||||
var num = str.length;
|
||||
for (var i = 0; i < num; i++) {
|
||||
if (str.charCodeAt(i) > 255) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
function renderKmsData(kmsDataListInfo){
|
||||
var htmStr="";
|
||||
if(kmsDataListInfo.length>0){
|
||||
for (var i=0; i < kmsDataListInfo.length; i++) {
|
||||
var info= kmsDataListInfo[i];
|
||||
var id= info.id;
|
||||
if (showStyle == "singlecolumn") {
|
||||
htmStr += "<ul class=\"kms-list-row \" rowid=\"" + id + "\" style=' background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 10px no-repeat;height:30px;border-bottom: 0px solid #e6e6e6; ' >";
|
||||
htmStr += "<li rowid=\"" + id + "\" class=\"w70 leftalign\" style=\"height:30px;\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
htmStr += "<div class=\"cardname\" style=\"color: rgb(0, 0, 0); opacity: 0.75;margin-left:15px;font-size:13px;padding-top:0px;height:30px;line-height:30px;\">" + info.cardName + "</div>";
|
||||
}
|
||||
htmStr += "</li>";
|
||||
htmStr += "<li class=\"w30 rightalign\" style=\"height:30px;\">";
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
htmStr += "<div class=\"\" awsui-qtip='阅读' style=\"color:#888888;width:32px;font-size:12px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + info.readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
htmStr += "<div class=\"\" awsui-qtip='评论' style=\"color:#888888;width:32px;font-size:12px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + info.commentCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
if (reBytes(info.publishUsername) > 8) {
|
||||
htmStr += "<div class=\"cardright\" awsui-qtip = \" " + info.publishUsername + "\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + info.publishUsername + "</div>";
|
||||
} else {
|
||||
htmStr += "<div class=\"cardright\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + info.publishUsername + "</div>";
|
||||
}
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1) {
|
||||
var dateWidth = "85px";
|
||||
if (info.publishTime.length >= 16) {
|
||||
} else if (info.publishTime.length == 10) {
|
||||
dateWidth = "65px";
|
||||
} else if (info.publishTime.length == 5) {
|
||||
dateWidth = "32px";
|
||||
} else if (info.publishTime.length == 4) {
|
||||
dateWidth = "30px";
|
||||
}
|
||||
htmStr += "<div style=\"color:#888888;width:" + dateWidth + ";font-size:12px;display:inline-block;margin-right:2px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + info.publishTime + "</div>";
|
||||
}
|
||||
htmStr += "</li>";
|
||||
htmStr += "</ul>";
|
||||
} else {
|
||||
htmStr += "<ul class=\"kms-list-row\" style=' background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 15px no-repeat;' rowid=\"" + id + "\" >" +
|
||||
"<li style='' rowid=\"" + id + "\" class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
htmStr += "<div class=\"cardname\" style='margin-left:15px'>" + info.cardName + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
htmStr += "<div class=\"readcount\" style='margin-left:15px'>阅读:" + info.readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
htmStr += "<div class=\"readcount\">评论:" + info.commentCount + "</div>";
|
||||
}
|
||||
htmStr += "</li>";
|
||||
htmStr += "<li class=\"w30 rightalign\" style=\"\">";
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
htmStr += "<div class=\"cardright\" style='padding-top: 9px;'>" + info.publishUsername + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1 && showIndex.indexOf("publishUser") == -1) {
|
||||
htmStr += "<div class=\"cardright\" style='padding-top: 9px;'>" + info.publishTime + "</div>";
|
||||
} else if (showIndex.indexOf("publishTime") > -1) {
|
||||
htmStr += "<div class=\"cardright\" >" + info.publishTime + "</div>";
|
||||
}
|
||||
htmStr += "</li>";
|
||||
htmStr += "</ul>";
|
||||
}
|
||||
};
|
||||
}else{
|
||||
htmStr+="<div class='no-record-div'></div>";
|
||||
}
|
||||
|
||||
$(".kmsmsg-list").empty();
|
||||
$(".kmsmsg-list").append(htmStr);
|
||||
$(".kms-list-row").find(".cardname").off("click").on("click", function () {
|
||||
//侧边栏
|
||||
var width = "700px";
|
||||
var id = $(this).parent().attr("rowid");
|
||||
var url = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_browse_card_page&cardId=" + id + "&isPage=true";
|
||||
var topwindow = window.top;
|
||||
if (!topwindow) {
|
||||
topwindow = window;
|
||||
}
|
||||
$("html", topwindow.document).css("overflow", "hidden");
|
||||
topwindow.$.openSidebar({
|
||||
url: url,
|
||||
title: "",
|
||||
closeText: "收起",
|
||||
width: width,
|
||||
isMode: false,
|
||||
iframeId: "kmsbrowsecard",
|
||||
onClose: function () {
|
||||
$("html", topwindow.document).css("overflow", "");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var frameId = window.frameElement && window.frameElement.id || '';
|
||||
//通过页面找iframe
|
||||
if(window.parent.$("#"+frameId).length!=0){
|
||||
transparent= window.parent.$("#"+frameId).attr("transparent");
|
||||
}
|
||||
|
||||
//透明度
|
||||
if(0< parseFloat(transparent) && parseFloat(transparent)<1){
|
||||
$("body").css("background","none");//ffffff
|
||||
$("body").css("background-color","none");//ffffff
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,643 @@
|
||||
var fileIconArr = [
|
||||
{"fileIcon": "docx", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "doc", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "pptx", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "ppt", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "xlsx", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "xls", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "txt", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "pdf", "iconfont": "", "color": "#cf4a4b"},
|
||||
{"fileIcon": "html", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "htm", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "png", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "gif", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "jpg", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "jpeg", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "bmp", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "zip", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "rar", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "exe", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "tar", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "tz", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "avi", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "mp4", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "mp3", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "psd", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "svg", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "eps", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "ai", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "apk", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "unknown", "iconfont": "", "color": "#5483f4"}
|
||||
];
|
||||
$(document).ready(function () {
|
||||
$("#cardList").height($(window).height());
|
||||
if (data.length == 0) {
|
||||
$(".nocontent").show();
|
||||
$("#cardList").hide();
|
||||
} else {
|
||||
$("#cardList").show();
|
||||
}
|
||||
if (showType == "list") {
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var deleteHtml = "";
|
||||
if (showStyle == "singlecolumn") {
|
||||
if (isManager == "true") {
|
||||
var deleteHtml = "<div class='fastcard-del' style='cursor:pointer;position:absolute;right:30%;width:60px;height:30px;background-color:#E8574E;line-height:30px;color:#ffffff' onclick=\"deleteFastCard('" + data[i].id + "')\">移除</div>";
|
||||
}
|
||||
listHtml += "<ul class=\"kms-list-row kms-row\" style='background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 10px no-repeat;height:30px;border-bottom: 0px solid #e6e6e6;' cardid = \"" + data[i].cardId + "\" orderIdx = \"" + i + "\" rowid=\"" + data[i].id + "\">" +
|
||||
deleteHtml +
|
||||
"<li class=\"w70 leftalign\" style=\"height:30px;\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style=\"margin-left:15px;font-size:13px;padding-top:0px;height:30px;line-height:30px;\">" + data[i].cardName + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"height:30px;\">";
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='阅读' style=\"color:#888888;width:32px;font-size:12px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='评论' style=\"color:#888888;width:32px;font-size:12px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].commentCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
if (data[i].publishUsername == "") {
|
||||
listHtml += "<div class=\"cardright\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>未知</div>";
|
||||
} else {
|
||||
if (reBytes(data[i].publishUsername) > 8) {
|
||||
listHtml += "<div class=\"cardright\" awsui-qtip = \" " + data[i].publishUsername + "\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + data[i].publishUsername + "</div>";
|
||||
} else {
|
||||
listHtml += "<div class=\"cardright\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + data[i].publishUsername + "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1) {
|
||||
var dateWidth = "85px";
|
||||
if (data[i].publishTime.length >= 16) {
|
||||
} else if (data[i].publishTime.length == 10) {
|
||||
dateWidth = "65px";
|
||||
} else if (data[i].publishTime.length == 5) {
|
||||
dateWidth = "32px";
|
||||
} else if (data[i].publishTime.length == 4) {
|
||||
dateWidth = "30px";
|
||||
}
|
||||
listHtml += "<div style=\"width:" + dateWidth + "; color:#888888;font-size:12px;display:inline-block;margin-right:2px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
} else {
|
||||
if (isManager == "true") {
|
||||
var deleteHtml = "<div class='fastcard-del' style='cursor:pointer;position:absolute;right:30%;width:60px;height:60px;background-color:#E8574E;line-height:60px;color:#ffffff' onclick=\"deleteFastCard('" + data[i].id + "')\">移除</div>";
|
||||
}
|
||||
listHtml += "<ul class=\"kms-list-row kms-row\" style='background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 15px no-repeat;' cardid = \"" + data[i].cardId + "\" orderIdx = \"" + i + "\" rowid=\"" + data[i].id + "\">" +
|
||||
deleteHtml +
|
||||
"<li style='' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style='margin-left:15px;font-size:13px;'>" + data[i].cardName + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\" style='margin-left:15px'>阅读:" + data[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\">评论:" + data[i].commentCount + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"\">";
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + data[i].publishUsername + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1 && showIndex.indexOf("publishUser") == -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + data[i].publishTime + "</div>";
|
||||
} else if (showIndex.indexOf("publishTime") > -1) {
|
||||
listHtml += "<div class=\"cardright\" >" + data[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
}
|
||||
}
|
||||
$("#cardList").html(listHtml);
|
||||
} else if (showType == "icon") {
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var newName = reNewName(data[i].cardName);
|
||||
var fileIcon = data[i].fileIcon;
|
||||
var fileIconfont = "";
|
||||
var fileColor = "#5483f4";
|
||||
for (var j = 0; j < fileIconArr.length; j++) {
|
||||
if (fileIconArr[j].fileIcon == fileIcon) {
|
||||
fileIconfont = fileIconArr[j].iconfont;
|
||||
fileColor = fileIconArr[j].color;
|
||||
}
|
||||
}
|
||||
var deleteHtml = "";
|
||||
if (isManager == "true") {
|
||||
deleteHtml = "<div class=\"awsui-iconfont fastcard-del\" style=\"display:none;cursor:pointer;position: absolute; right: 0px; z-index: 5; cursor:pointer;color:#E8574E\" onclick=\"deleteFastCard('" + data[i].id + "')\" awsui-qtip=\"移除\"></div>";
|
||||
}
|
||||
var awsuiqtip = data[i].cardName;
|
||||
if (newName.indexOf("...") == -1) {
|
||||
awsuiqtip = "";
|
||||
}
|
||||
var move_area_panel = $("<div class='kms-icon-row kms-row' cardid = \"" + data[i].cardId + "\" orderIdx = \"" + i + "\" rowid=\"" + data[i].id + "\" style=\"border:solid 1px #ffffff;margin:4px 5px;position:relative;display:inline-block;cursor:pointer;width:100px;height:104px;\">" +
|
||||
deleteHtml +
|
||||
"<table height=\"100%\" width=\"100%\" class='carditem'>" +
|
||||
"<tr height='59px'>" +
|
||||
"<td valign=\"middle\" align='center'><div class=\"awsui-iconfont\" style=\"display:inline-block;font-size:45px;color:" + fileColor + "\">" + fileIconfont + "</div></td>" +
|
||||
"</tr>" +
|
||||
"<tr height='38px'>" +
|
||||
"<td valign=\"top\" align='center'><div awsui-qtip = \"" + awsuiqtip + "\" style=\"font-size:12px;cursor:pointer;max-height:34px;overflow:hidden\">" + newName + "</div></td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</div>");
|
||||
$("#cardList").append(move_area_panel);
|
||||
}
|
||||
}
|
||||
bindCardDetailEvent();
|
||||
$("body").on("mouseenter", function () {
|
||||
if (isManager == "true") {
|
||||
$("#addfastcard").show();
|
||||
if (showType == "icon") {
|
||||
$("#orderfastcard").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
$("body").on("mouseleave", function () {
|
||||
$("#addfastcard").hide();
|
||||
$("#orderfastcard").hide();
|
||||
});
|
||||
});
|
||||
|
||||
function openOrderModel() {
|
||||
$(".kms-row .fastcard-del").css("display", "");
|
||||
$(".kms-row").each(function () {
|
||||
$(this).addClass("ordermodel");
|
||||
bindMoveEvent($(this));
|
||||
});
|
||||
$("#addfastcard").hide();
|
||||
$("#orderfastcard").hide();
|
||||
$("#closeorder").show();
|
||||
}
|
||||
|
||||
function closeOrderModel() {
|
||||
$(".kms-row .fastcard-del").css("display", "none");
|
||||
$(".kms-row").removeClass("ordermodel");
|
||||
$(".kms-row").each(function () {
|
||||
$(this).off("mousedown");
|
||||
});
|
||||
bindCardDetailEvent();
|
||||
$("#orderfastcard").show();
|
||||
$("#closeorder").hide();
|
||||
$("#addfastcard").show();
|
||||
}
|
||||
function openCardDialog() {
|
||||
var dlg = parent.parent.FrmDialog.open({
|
||||
width: 600,
|
||||
height: 600,
|
||||
url: "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_xpage_getcardtree",
|
||||
data: {},
|
||||
id: "cardtreedialog",
|
||||
buttons:
|
||||
[
|
||||
{
|
||||
text: '确定', cls: "blue", handler: function () {
|
||||
var win = getContentWindow("id-awsui-win-frm-2013-frmcardtreedialog");
|
||||
if (win.checkedNodes()) {
|
||||
var nodes = win.getCheckedCard();
|
||||
var cardIds = "";
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
cardIds += nodes[i].id + ",";
|
||||
}
|
||||
if (cardIds != '') {
|
||||
cardIds = cardIds.substring(0, cardIds.length - 1);
|
||||
}
|
||||
addFastCard(categoryName, cardIds);
|
||||
parent.parent.FrmDialog.close();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '取消', handler: function () {
|
||||
parent.parent.FrmDialog.close();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function getContentWindow(id) {
|
||||
var ifrm = parent.parent.$("#" + id)[0];
|
||||
return ifrm.contentWindow ? ifrm.contentWindow : (ifrm.contentDocument.document ? ifrm.contentDocument.document : ifrm.contentDocument);
|
||||
}
|
||||
|
||||
function loadFastCard() {
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_xpage_loadfastcard",
|
||||
categoryName: categoryName,
|
||||
publishTimeFormat: publishTimeFormat
|
||||
},
|
||||
success: function (responseObject) {
|
||||
var cardData = responseObject.data.data;
|
||||
if (cardData.length == 0) {
|
||||
$(".nocontent").show();
|
||||
$("#cardList").hide();
|
||||
} else {
|
||||
$(".nocontent").hide();
|
||||
$("#cardList").show();
|
||||
}
|
||||
if (showType == "list") {
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < cardData.length; i++) {
|
||||
var deleteHtml = "";
|
||||
if (showStyle == "singlecolumn") {
|
||||
if (isManager == "true") {
|
||||
deleteHtml = "<div class='fastcard-del' style='cursor:pointer;position:absolute;right:30%;width:60px;height:30px;background-color:#E8574E;line-height:30px;color:#ffffff' onclick=\"deleteFastCard('" + data[i].id + "')\">移除</div>";
|
||||
}
|
||||
listHtml += "<ul class=\"kms-list-row kms-row\" style='background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 10px no-repeat;height:30px;border-bottom: 0px solid #e6e6e6;' cardid = \"" + cardData[i].cardId + "\" orderIdx = \"" + i + "\" rowid=\"" + cardData[i].id + "\">" +
|
||||
deleteHtml +
|
||||
"<li style=\"height:30px;\" class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style=\"margin-left:15px;font-size:13px;padding-top:0px;height:30px;line-height:30px;\">" + cardData[i].cardName + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"height:30px;\">";
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='阅读' style=\"display:inline-block;color:#888888;width:32px;font-size:12px;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + cardData[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='评论' style=\"display:inline-block;color:#888888;width:32px;font-size:12px;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + cardData[i].commentCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
if (cardData[i].publishUsername == "") {
|
||||
listHtml += "<div class=\"cardright\" style='color:#888888;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>未知</div>";
|
||||
} else {
|
||||
if (reBytes(cardData[i].publishUsername) > 8) {
|
||||
listHtml += "<div class=\"cardright\" awsui-qtip = \" " + cardData[i].publishUsername + "\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + cardData[i].publishUsername + "</div>";
|
||||
} else {
|
||||
listHtml += "<div class=\"cardright\" style='color:#888888;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + cardData[i].publishUsername + "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1) {
|
||||
var dateWidth = "85px";
|
||||
if (cardData[i].publishTime.length >= 16) {
|
||||
} else if (cardData[i].publishTime.length == 10) {
|
||||
dateWidth = "65px";
|
||||
} else if (cardData[i].publishTime.length == 5) {
|
||||
dateWidth = "32px";
|
||||
} else if (cardData[i].publishTime.length == 4) {
|
||||
dateWidth = "30px";
|
||||
}
|
||||
listHtml += "<div style=\"width:" + dateWidth + "; color:#888888;font-size:12px;display:inline-block;margin-right:2px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + cardData[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
} else {
|
||||
if (isManager == "true") {
|
||||
deleteHtml = "<div class='fastcard-del' style='cursor:pointer;position:absolute;right:30%;width:60px;height:60px;background-color:#E8574E;line-height:60px;color:#ffffff' onclick=\"deleteFastCard('" + cardData[i].id + "')\">移除</div>";
|
||||
}
|
||||
listHtml += "<ul class=\"kms-list-row kms-row\" style='background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 15px no-repeat;' cardid = \"" + cardData[i].cardId + "\" orderIdx = \"" + i + "\" rowid=\"" + cardData[i].id + "\">" +
|
||||
deleteHtml +
|
||||
"<li style='' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style='margin-left:15px;font-size:13px;'>" + cardData[i].cardName + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\" style='margin-left:15px'>阅读:" + cardData[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\">评论:" + cardData[i].commentCount + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"\">";
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + cardData[i].publishUsername + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1 && showIndex.indexOf("publishUser") == -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + cardData[i].publishTime + "</div>";
|
||||
} else if (showIndex.indexOf("publishTime") > -1) {
|
||||
listHtml += "<div class=\"cardright\" >" + cardData[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
}
|
||||
}
|
||||
$("#cardList").html(listHtml);
|
||||
} else if (showType == "icon") {
|
||||
var directoryHtml = "";
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < cardData.length; i++) {
|
||||
var newName = reNewName(cardData[i].cardName);
|
||||
var fileIcon = cardData[i].fileIcon;
|
||||
var fileIconfont = "";
|
||||
var fileColor = "#5483f4";
|
||||
for (var j = 0; j < fileIconArr.length; j++) {
|
||||
if (fileIconArr[j].fileIcon == fileIcon) {
|
||||
fileIconfont = fileIconArr[j].iconfont;
|
||||
fileColor = fileIconArr[j].color;
|
||||
}
|
||||
}
|
||||
var deleteHtml = "";
|
||||
if (isManager == "true") {
|
||||
deleteHtml = "<div class=\"awsui-iconfont fastcard-del\" style=\"display:none;position: absolute; right: 0px; z-index: 5; cursor:pointer;color:#E8574E\" onclick=\"deleteFastCard('" + cardData[i].id + "')\" awsui-qtip=\"移除\"></div>";
|
||||
}
|
||||
var awsuiqtip = cardData[i].cardName;
|
||||
if (newName.indexOf("...") == -1) {
|
||||
awsuiqtip = "";
|
||||
}
|
||||
listHtml += "<div class='kms-icon-row kms-row' cardid = \"" + cardData[i].cardId + "\" rowid=\"" + cardData[i].id + "\" orderIdx = \"" + i + "\" style=\"border:solid 1px #ffffff;margin:4px 5px;position:relative;display:inline-block;width:100px;height:104px;\">" +
|
||||
deleteHtml +
|
||||
"<table height=\"100%\" width=\"100%\" class='carditem'>" +
|
||||
"<tr height='59px'>" +
|
||||
"<td valign=\"middle\" align='center'><div class=\"awsui-iconfont\" style=\"cursor:pointer;display:inline-block;font-size:45px;color:" + fileColor + "\">" + fileIconfont + "</div></td>" +
|
||||
"<tr height='38px'>" +
|
||||
"<td valign=\"top\" align='center'><div awsui-qtip = \"" + awsuiqtip + "\" style=\"font-size:12px;cursor:pointer;max-height:34px;overflow:hidden\">" + newName + "</div></td>" +
|
||||
"</tr>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</div>";
|
||||
}
|
||||
$("#cardList").html(listHtml);
|
||||
}
|
||||
bindCardDetailEvent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addFastCard(categoryName, cardIds) {
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_xpage_savexpagefastcard",
|
||||
categoryName: categoryName,
|
||||
cardIds: cardIds
|
||||
},
|
||||
success: function (responseObject) {
|
||||
loadFastCard();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteFastCard(id) {
|
||||
var options = {
|
||||
title: "",
|
||||
content: "确定移除该知识?",
|
||||
onConfirm: function () {
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_xpage_deletexpagefastcard",
|
||||
id: id
|
||||
},
|
||||
success: function (responseObject) {
|
||||
$(".kms-row[rowid='" + id + "']").remove();
|
||||
if ($(".kms-row").length == 0) {
|
||||
$(".nocontent").show();
|
||||
$("#cardList").hide();
|
||||
} else {
|
||||
$("#cardList").show();
|
||||
}
|
||||
for (var j = 0; j < $('#cardList').find('.kms-row').length; j++) {
|
||||
var nav_area_t = $('#cardList').find('.kms-row').eq(j);
|
||||
nav_area_t.attr('orderIdx', j);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onClose: function () {
|
||||
}
|
||||
};
|
||||
$.confirm(options);
|
||||
}
|
||||
|
||||
function saveOrderIndex(data) {
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_xpage_savefastcardorder",
|
||||
data: awsui.encode(data)
|
||||
},
|
||||
success: function (responseObject) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reBytes(str) {
|
||||
var num = str.length;
|
||||
for (var i = 0; i < num; i++) {
|
||||
if (str.charCodeAt(i) > 255) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function reNewName(name) {
|
||||
var newName = name;
|
||||
if (reBytes(name) > 28) {
|
||||
var index = 0;
|
||||
var num = 0;
|
||||
for (var i = 0; i < name.length; i++) {
|
||||
num++;
|
||||
if (name.charCodeAt(i) > 255) {
|
||||
num++;
|
||||
}
|
||||
if (num >= 28) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
newName = name.substring(0, index) + "...";
|
||||
}
|
||||
return newName;
|
||||
}
|
||||
|
||||
function bindCardDetailEvent() {
|
||||
$(".kms-row").find(".cardname").off("click").on("click", function () {
|
||||
//侧边栏
|
||||
var width = "700px";
|
||||
var id = $(this).parent().parent().attr("cardid");
|
||||
var url = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_browse_card_page&cardId=" + id + "&isPage=true";
|
||||
var topwindow = window.top;
|
||||
if (!topwindow) {
|
||||
topwindow = window;
|
||||
}
|
||||
$("html", topwindow.document).css("overflow", "hidden");
|
||||
topwindow.$.openSidebar({
|
||||
url: url,
|
||||
title: "",
|
||||
closeText: "收起",
|
||||
width: width,
|
||||
isMode: false,
|
||||
iframeId: "kmsbrowsecard",
|
||||
onClose: function () {
|
||||
$("html", topwindow.document).css("overflow", "");
|
||||
}
|
||||
});
|
||||
});
|
||||
$(".kms-row").find(".carditem").off("click").on("click", function () {
|
||||
//侧边栏
|
||||
var width = "700px";
|
||||
var id = $(this).parent().attr("cardid");
|
||||
var url = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_browse_card_page&cardId=" + id + "&isPage=true";
|
||||
$("html", top.window.document).css("overflow", "hidden");
|
||||
window.top.$.openSidebar({
|
||||
url: url,
|
||||
title: "",
|
||||
closeText: "收起",
|
||||
width: width,
|
||||
isMode: false,
|
||||
iframeId: "kmsbrowsecard",
|
||||
onClose: function () {
|
||||
$("html", top.window.document).css("overflow", "");
|
||||
}
|
||||
});
|
||||
});
|
||||
if (showType == "icon") {
|
||||
$(".kms-row").each(function (index, element) {
|
||||
var target = $(element);
|
||||
target.mouseenter(function () {
|
||||
target.css("border", "solid 1px #e6e6e6");
|
||||
}).mouseleave(function (e) {
|
||||
target.css("border", "solid 1px #ffffff");
|
||||
pauseEvent(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var moveArea = {};
|
||||
moveArea['edit'] = false; // 编辑状态,默认为false
|
||||
moveArea.dragItem = {};
|
||||
|
||||
function bindMoveEvent(move_area_panel) {
|
||||
// 准备拖曳
|
||||
var dragStart = function (e, obj) {
|
||||
if ($(e.target).hasClass("fastcard-del")) {
|
||||
return;
|
||||
}
|
||||
// clone一个,填充到功能菜单容器中,为了可以在分页中进行移动
|
||||
moveArea.dragItem = move_area_panel.clone();
|
||||
moveArea.dragItem.moveable = true; // 移动模式
|
||||
// 鼠标和选择块的pageX、pageY的差距
|
||||
moveArea.dragItem.original_offsetTop = e.pageY - $(obj).offset().top;
|
||||
moveArea.dragItem.original_offsetLeft = e.pageX - $(obj).offset().left;
|
||||
var move_panel = $('.move_panel');
|
||||
move_panel.append(moveArea.dragItem);
|
||||
moveArea.dragItem.css('cursor', 'move').css('opacity', 0.6).css('z-index', 999)
|
||||
.css('width', $(obj).width() - 2).css('height', $(obj).height() - 2).css('position', 'absolute')
|
||||
.offset({
|
||||
'top': $(obj).offset().top + 1,
|
||||
'left': $(obj).offset().left + 1
|
||||
}).css("border", "1px dashed gray");
|
||||
// 将当前区域改为虚线框,并移除里面的内容
|
||||
move_area_panel.addClass('temp');
|
||||
move_area_panel.children().remove();
|
||||
moveArea['originalId'] = move_area_panel.attr('rowid'); // 拖曳的源
|
||||
}
|
||||
$(move_area_panel).mousedown(function (e) {
|
||||
dragStart(e, this);
|
||||
e.stopPropagation(); // 阻止事件冒泡
|
||||
});
|
||||
$(".move_panel").mousemove(function (e) {
|
||||
if (!moveArea.dragItem.moveable) return false;
|
||||
// 判断移动位置
|
||||
var cur_nav_area_collection = $('.move_panel').find('#cardList');
|
||||
var nav_area_collection = cur_nav_area_collection; // 面板容器
|
||||
// 是否移动到面板容器外
|
||||
var drag_width_middle = moveArea.dragItem.offset().left + moveArea.dragItem.width() / 2; // 移动块的左右的中间线
|
||||
var drag_height_middle = moveArea.dragItem.offset().top + moveArea.dragItem.height() / 2; // 移动块的上下的中间线
|
||||
var collection_left = $(nav_area_collection).offset().left;
|
||||
var collection_right = $(nav_area_collection).offset().left + $(nav_area_collection).width();
|
||||
var collection_top = $(nav_area_collection).offset().top;
|
||||
var collection_bottom = $(nav_area_collection).offset().top + $(nav_area_collection).height();
|
||||
if (drag_width_middle <= collection_left && moveArea['curPage'] != 1) { // 移除容器(往左移)
|
||||
isOutCollection = false;
|
||||
return false;
|
||||
} else if (drag_width_middle >= collection_right && moveArea['curPage'] != moveArea['pages']) { // 移出容器(往右移)
|
||||
isOutCollection = false;
|
||||
return false;
|
||||
} else if (drag_height_middle <= collection_top || drag_height_middle >= collection_bottom) { // 移除容器(上下)
|
||||
isOutCollection = false;
|
||||
return false;
|
||||
}
|
||||
isOutCollection = false;
|
||||
moveAreaPosition(e); // 移动块位置
|
||||
var nav_area_panel_list = nav_area_collection.children();
|
||||
var len = nav_area_panel_list.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var obj = nav_area_panel_list.get(i);
|
||||
var obj_left = $(obj).offset().left;
|
||||
var obj_right = $(obj).offset().left + $(obj).width();
|
||||
var obj_top = $(obj).offset().top;
|
||||
var obj_bottom = $(obj).offset().top + $(obj).height();
|
||||
if (drag_width_middle >= obj_left && drag_width_middle <= obj_right && drag_height_middle >= obj_top && drag_height_middle <= obj_bottom && $(obj).attr('rowid') != move_area_panel.attr('rowid')) { // 移动到目标位置
|
||||
if (moveArea['targetItem'] != undefined && moveArea['targetId'] != $(obj).attr('rowid')) {
|
||||
moveArea['targetId'] = $(obj).attr('rowid'); // 拖曳的目标
|
||||
moveArea['targetItem'] = obj;
|
||||
// 根据移动位置将功能菜单块重新排版
|
||||
var nav_area_panel_temp = $('.move_panel').find('.kms-row.temp');
|
||||
var orderIdx_original = nav_area_panel_temp.attr('orderIdx') - 0;
|
||||
var orderIdx_target = $(obj).attr('orderIdx') - 0;
|
||||
if (orderIdx_original > orderIdx_target) { // 从后往前移,移动到目标位置的前面
|
||||
$(obj).before(nav_area_panel_temp);
|
||||
} else { // 从前往后移,移动到目标位置的后面
|
||||
$(obj).after(nav_area_panel_temp);
|
||||
}
|
||||
// ## 根据排列位置重新计算序号
|
||||
var startIdx = orderIdx_original < orderIdx_target ? orderIdx_original : orderIdx_target;
|
||||
var endIdx = orderIdx_original > orderIdx_target ? orderIdx_original : orderIdx_target;
|
||||
console.log("orderIdx_original:" + orderIdx_original);
|
||||
console.log("orderIdx_target:" + orderIdx_target);
|
||||
for (var j = startIdx; j <= endIdx; j++) {
|
||||
var nav_area_t = $('#cardList').find('.kms-row').eq(j);
|
||||
nav_area_t.attr('orderIdx', j);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
moveArea['targetId'] = $(obj).attr('rowid'); // 拖曳的目标
|
||||
moveArea['targetItem'] = obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).mouseup(function (e) {
|
||||
if (moveArea.dragItem.moveable) {
|
||||
moveArea.dragItem.moveable = false; // 取消移动模式
|
||||
var move_area = $('.move_panel').children('.kms-row');
|
||||
$('.move_panel').find('.kms-row.temp').append(move_area.children()).removeClass('temp');
|
||||
move_area.remove();
|
||||
var data = [];
|
||||
$('#cardList').find('.kms-row').each(function () {
|
||||
var obj = {};
|
||||
obj.ID = $(this).attr("rowid");
|
||||
obj.ORDERINDEX = $(this).attr("orderIdx");
|
||||
data.push(obj);
|
||||
});
|
||||
saveOrderIndex(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 移动块位置
|
||||
var moveAreaPosition = function (e) {
|
||||
moveArea.dragItem.offset({
|
||||
top: e.pageY - moveArea.dragItem.original_offsetTop,
|
||||
left: e.pageX - moveArea.dragItem.original_offsetLeft
|
||||
});
|
||||
};
|
||||
|
||||
function pauseEvent(e) {
|
||||
if (e.stopPropagation) e.stopPropagation();
|
||||
if (e.preventDefault) e.preventDefault();
|
||||
e.cancelBubble = true;
|
||||
e.returnValue = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -0,0 +1,159 @@
|
||||
var cardTree;
|
||||
$(document).ready(function () {
|
||||
initTree();
|
||||
//initSousuo(); // 搜索相关
|
||||
});
|
||||
|
||||
function initSousuo() { // 初始化搜索框
|
||||
$("#buttonedit").width($(window).width() - 50);
|
||||
$("#buttonedit").buttonedit({
|
||||
iconCls: "forms-icon search",
|
||||
onClick: function () { // 单击事件
|
||||
searchDictByName();
|
||||
}
|
||||
});
|
||||
// 回车事件
|
||||
$('#buttonedit').keydown(function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
searchDictByName();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function searchDictByName() { // 执行搜索
|
||||
var condition = $("#buttonedit").val().trim();
|
||||
var comid = $("#comId").val();
|
||||
if (condition == "") {
|
||||
return;
|
||||
}
|
||||
$.simpleAlert("正在搜索.....", "loading");
|
||||
var p = {
|
||||
type: "POST",
|
||||
url: "./jd",
|
||||
data: {
|
||||
sid: $("#sid").val(),
|
||||
condition: condition,
|
||||
comid: comid,
|
||||
authority: $("#authority").val(),
|
||||
cmd: 'com.hrpaas.apps.pa_department_search'
|
||||
},
|
||||
dataType: "json",
|
||||
alert: false,
|
||||
success: function (r) {
|
||||
$.simpleAlert("close");
|
||||
if (r.result == "ok") {
|
||||
$("#dictionaryTree").hide();
|
||||
$("#back").show();
|
||||
var departmentArray = r.data.array;
|
||||
getHtml(departmentArray);
|
||||
}
|
||||
}
|
||||
};
|
||||
awsui.ajax.request(p);
|
||||
}
|
||||
|
||||
function getHtml(departmentArray) { // 构造table
|
||||
$(".searchCont").show();
|
||||
$("#cardTree").hide();
|
||||
if (departmentArray.length == 0) {
|
||||
$("#searcontent").html("<tr><td colspan='4' style='text-align:center'>" + 无数据 + "</td></tr>");
|
||||
return;
|
||||
}
|
||||
var html = "";
|
||||
var index = 0;
|
||||
for (var i = 0; i < departmentArray.length; i++) {
|
||||
index = i + 1;
|
||||
var o = departmentArray[i];
|
||||
var click = "onclick='selectThisVal(this)'";
|
||||
html += "<tr class='hov' " + click + " name='" + o["name"] + "' id='" + o.id + "'>";
|
||||
html += "<td align='center'>" + index + "</td>";
|
||||
html += "<td>" + o.name + "</td>";
|
||||
html += "<td>" + o.path + "</td>";
|
||||
html += "</tr>";
|
||||
}
|
||||
$("#searcontent").html(html);
|
||||
}
|
||||
|
||||
function selectThisVal(tr) { // 行选择事件
|
||||
$("tr.current").removeClass("current");
|
||||
$("#buttonedit").val($(tr).attr("name"));
|
||||
$(tr).addClass("current");
|
||||
}
|
||||
|
||||
function getVal() { // 回填数值
|
||||
if ($("tr.current").length == 0) {
|
||||
$.simpleAlert("请选择部门节点", "info", 1000, {model: true});
|
||||
return;
|
||||
} else {
|
||||
var tr = $("tr.current");
|
||||
parent.$("#DEPTID").val(tr.attr("id"));
|
||||
parent.$("#DEPT").val(tr.attr("name"));
|
||||
parent.FrmDialog.close();
|
||||
}
|
||||
}
|
||||
|
||||
function backToTree() { // 返回到结构树
|
||||
$("#back").hide();
|
||||
$(".searchCont").hide();
|
||||
$("#cardTree").show();
|
||||
}
|
||||
|
||||
function initTree() {
|
||||
awsui.ajax.request({
|
||||
url: "./w",
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
loading: true,
|
||||
data: {
|
||||
type: "dimension",
|
||||
pid: "",
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_xpage_getcardtreedata"
|
||||
},
|
||||
success: function (data) {
|
||||
var setting = {
|
||||
dblClickToExpand: true,
|
||||
autoHeight: true,
|
||||
checkbox: true,
|
||||
event: {
|
||||
beforeExpand: mouseUp
|
||||
},
|
||||
dataModel: {
|
||||
data: data
|
||||
}
|
||||
};
|
||||
cardTree = awsui.tree.init($("#cardTree"), setting);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkedNodes() {
|
||||
var nodes = cardTree.getCheckedNodes();
|
||||
if (nodes == null || nodes.length == 0) {
|
||||
$.simpleAlert("请选择知识");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getCheckedCard() {
|
||||
var nodes = cardTree.getCheckedNodes();
|
||||
return nodes;
|
||||
}
|
||||
|
||||
function mouseUp(treeNode) {
|
||||
var id = treeNode.id;
|
||||
var dataModel = {
|
||||
url: "./w?sid=" + sid,
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
params: {
|
||||
type: treeNode.type,
|
||||
pid: treeNode.id,
|
||||
hasPerm: treeNode.hasPerm,
|
||||
cmd: 'com.actionsoft.apps.kms_xpage_getcardtreedata'
|
||||
}
|
||||
};
|
||||
var childNode = cardTree.getData(dataModel);
|
||||
cardTree.buildChilren(eval(childNode), treeNode);
|
||||
}
|
||||
@ -0,0 +1,590 @@
|
||||
var fileIconArr = [
|
||||
{"fileIcon": "docx", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "doc", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "pptx", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "ppt", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "xlsx", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "xls", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "txt", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "pdf", "iconfont": "", "color": "#cf4a4b"},
|
||||
{"fileIcon": "html", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "htm", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "png", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "gif", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "jpg", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "jpeg", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "bmp", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "zip", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "rar", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "exe", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "tar", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "tz", "iconfont": "", "color": "#acacac"},
|
||||
{"fileIcon": "avi", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "mp4", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "mp3", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "psd", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "svg", "iconfont": "", "color": "#4999d7"},
|
||||
{"fileIcon": "eps", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "ai", "iconfont": "", "color": "#ef7b40"},
|
||||
{"fileIcon": "apk", "iconfont": "", "color": "#3ab56b"},
|
||||
{"fileIcon": "unknown", "iconfont": "", "color": "#5483f4"}
|
||||
];
|
||||
$(document).ready(function () {
|
||||
if (data.length == 0 && directory.length == 0) {
|
||||
$(".nocontent").show();
|
||||
}
|
||||
if (!("true" == ifShowDirectory) && showType == "list") {
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (showStyle == "singlecolumn") {
|
||||
listHtml += "<ul class=\"kms-list-row card kms-row\" style='height:30px;border-bottom: 0px solid #e6e6e6;background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 10px no-repeat;' rowid=\"" + data[i].cardId + "\">" +
|
||||
/*"<div class=\"awsui-iconfont\" style=\"position:absolute;left:0px;top:15px;display:inline-block;font-size:25px;color:#5483f4\"></div>" +*/
|
||||
"<li style='height:30px;' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style=\"margin-left:15px;font-size:13px;padding-top:0px;height:30px;line-height:30px;\">" + data[i].cardName + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"height:30px;font-size:12px;\">";
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='阅读' style=\"color:#888888;width:32px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='评论' style=\"color:#888888;width:32px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].commentCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
if (reBytes(data[i].publishUsername) > 8) {
|
||||
listHtml += "<div class=\"cardright\" awsui-qtip = \" " + data[i].publishUsername + "\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + data[i].publishUsername + "</div>";
|
||||
} else {
|
||||
listHtml += "<div class=\"cardright\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + data[i].publishUsername + "</div>";
|
||||
}
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1) {
|
||||
var dateWidth = "85px";
|
||||
if (data[i].publishTime.length >= 16) {
|
||||
} else if (data[i].publishTime.length == 10) {
|
||||
dateWidth = "65px";
|
||||
} else if (data[i].publishTime.length == 5) {
|
||||
dateWidth = "32px";
|
||||
} else if (data[i].publishTime.length == 4) {
|
||||
dateWidth = "30px";
|
||||
}
|
||||
listHtml += "<div style=\"width:" + dateWidth + "; color:#888888;font-size:12px;display:inline-block;margin-right:2px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
} else {
|
||||
listHtml += "<ul class=\"kms-list-row card kms-row\" style='background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 15px no-repeat;' rowid=\"" + data[i].cardId + "\">" +
|
||||
/*"<div class=\"awsui-iconfont\" style=\"position:absolute;left:0px;top:15px;display:inline-block;font-size:25px;color:#5483f4\"></div>" +*/
|
||||
"<li style='' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style='margin-left:15px;font-size:13px'>" + data[i].cardName + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\" style='margin-left:15px;'>阅读:" + data[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\">评论:" + data[i].commentCount + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"\">";
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + data[i].publishUsername + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1 && showIndex.indexOf("publishUser") == -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + data[i].publishTime + "</div>";
|
||||
} else if (showIndex.indexOf("publishTime") > -1) {
|
||||
listHtml += "<div class=\"cardright\" >" + data[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
}
|
||||
}
|
||||
$("#cardList").html(listHtml);
|
||||
} else if (!("true" == ifShowDirectory) && showType == "icon") {
|
||||
var directoryHtml = "";
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var newName = reNewName(data[i].cardName);
|
||||
var fileIcon = data[i].fileIcon;
|
||||
var fileIconfont = "";
|
||||
var fileColor = "#5483f4";
|
||||
for (var j = 0; j < fileIconArr.length; j++) {
|
||||
if (fileIconArr[j].fileIcon == fileIcon) {
|
||||
fileIconfont = fileIconArr[j].iconfont;
|
||||
fileColor = fileIconArr[j].color;
|
||||
}
|
||||
}
|
||||
var awsuiqtip = data[i].cardName;
|
||||
if (newName.indexOf("...") == -1) {
|
||||
awsuiqtip = "";
|
||||
}
|
||||
listHtml += "<div class='kms-row' rowid=\"" + data[i].cardId + "\" style=\"border:solid 1px #ffffff;cursor:pointer;margin:4px 5px;position:relative;display:inline-block;width:100px;height:104px;\">" +
|
||||
"<table height=\"100%\" width=\"100%\" class='cardItem'>" +
|
||||
"<tr height='59px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div class=\"awsui-iconfont\" style=\"display:inline-block;font-size:45px;color:" + fileColor + "\">" + fileIconfont + "</div></td>" +
|
||||
"</tr>" +
|
||||
"<tr height='38px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div awsui-qtip='" + awsuiqtip + "' style=\"font-size:12px;max-height:34px;overflow:hidden\">" + newName + "</div></td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</div>";
|
||||
}
|
||||
$("#cardList").html(listHtml);
|
||||
} else if ("true" == ifShowDirectory && showType == "list") {
|
||||
var directoryHtml = "";
|
||||
for (var i = 0; i < directory.length; i++) {
|
||||
var dirname = directory[i].name;
|
||||
var dirId = directory[i].id;
|
||||
var dirPerm = directory[i].hasPerm;
|
||||
var $directory = $("<ul class=\"kms-list-row dimension\" rowid=\"" + directory[i].id + "\" ></ul>");
|
||||
$directory.attr("dirname", dirname);
|
||||
$directory.attr("dirId", dirId);
|
||||
$directory.attr("dirPerm", dirPerm);
|
||||
$directory.on("click", function () {
|
||||
getList($(this).attr("dirname"), $(this).attr("dirId"), $(this).attr("dirPerm"), true, this);
|
||||
});
|
||||
$directory.append("<li class=\"w100 leftalign\" style='cursor:pointer' rowid=\"obj_c8422fe63e300001baa0e0501a30196c\"><div class=\"dimensionname\" hasPerm = '" + directory[i].hasPerm + "' >" + directory[i].name + "</div></li>");
|
||||
$("#cardList").append($directory);
|
||||
}
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (showStyle == "singlecolumn") {
|
||||
listHtml += "<ul class=\"kms-list-row card kms-row\" style='height:30px;border-bottom: 0px solid #e6e6e6;background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 10px no-repeat;' rowid=\"" + data[i].cardId + "\">" +
|
||||
/*"<div class=\"awsui-iconfont\" style=\"position:absolute;left:0px;top:15px;display:inline-block;font-size:25px;color:#5483f4\"></div>" +*/
|
||||
"<li style='height:30px;' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style=\"margin-left:15px;font-size:13px;padding-top:0px;height:30px;line-height:30px;\">" + data[i].cardName + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"height:30px;\">";
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='阅读' style=\"color:#888888;width:32px;font-size:12px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='评论' style=\"color:#888888;width:32px;font-size:12px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].commentCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
if (reBytes(data[i].publishUsername) > 8) {
|
||||
listHtml += "<div class=\"cardright\" awsui-qtip = \" " + data[i].publishUsername + "\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + data[i].publishUsername + "</div>";
|
||||
} else {
|
||||
listHtml += "<div class=\"cardright\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + data[i].publishUsername + "</div>";
|
||||
}
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1) {
|
||||
var dateWidth = "85px";
|
||||
if (data[i].publishTime.length >= 16) {
|
||||
} else if (data[i].publishTime.length == 10) {
|
||||
dateWidth = "65px";
|
||||
} else if (data[i].publishTime.length == 5) {
|
||||
dateWidth = "32px";
|
||||
} else if (data[i].publishTime.length == 4) {
|
||||
dateWidth = "30px";
|
||||
}
|
||||
listHtml += "<div style=\"width:" + dateWidth + "; color:#888888;font-size:12px;display:inline-block;margin-right:2px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + data[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
} else {
|
||||
listHtml += "<ul class=\"kms-list-row card kms-row\" style='background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 15px no-repeat;' rowid=\"" + data[i].cardId + "\">" +
|
||||
/*"<div class=\"awsui-iconfont\" style=\"position:absolute;left:0px;top:15px;display:inline-block;font-size:25px;color:#5483f4\"></div>" +*/
|
||||
"<li style='' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style='margin-left:15px;font-size:13px;'>" + data[i].cardName + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\" style='margin-left:15px;'>阅读:" + data[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\">评论:" + data[i].commentCount + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"\">";
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + data[i].publishUsername + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1 && showIndex.indexOf("publishUser") == -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + data[i].publishTime + "</div>";
|
||||
} else if (showIndex.indexOf("publishTime") > -1) {
|
||||
listHtml += "<div class=\"cardright\" >" + data[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
}
|
||||
}
|
||||
$("#cardList").append(listHtml);
|
||||
}
|
||||
else if ("true" == ifShowDirectory && showType == "icon") {
|
||||
var directoryHtml = "";
|
||||
for (var i = 0; i < directory.length; i++) {
|
||||
var newName = reNewName(directory[i].name);
|
||||
var awsuiqtip = directory[i].name;
|
||||
if (newName.indexOf("...") == -1) {
|
||||
awsuiqtip = "";
|
||||
}
|
||||
var dirname = directory[i].name;
|
||||
var dirId = directory[i].id;
|
||||
var dirPerm = directory[i].hasPerm;
|
||||
var $directory = $("<div style=\"border:solid 1px #ffffff;margin:4px 5px;position:relative;display:inline-block;width:100px;height:104px;cursor:pointer\" rowid=\"" + directory[i].id + "\" ></div>");
|
||||
$directory.attr("dirname", dirname);
|
||||
$directory.attr("dirId", dirId);
|
||||
$directory.attr("dirPerm", dirPerm);
|
||||
$directory.on("click", function () {
|
||||
getList($(this).attr("dirname"), $(this).attr("dirId"), $(this).attr("dirPerm"), true, this);
|
||||
});
|
||||
$directory.append(
|
||||
"<table height=\"100%\" width=\"100%\" >" +
|
||||
"<tr height='59px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div class=\"awsui-iconfont\" style=\"display:inline-block;font-size:45px;color:#5483f4\"></div></td>" +
|
||||
"</tr>" +
|
||||
"<tr height='38px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div awsui-qtip='" + awsuiqtip + "' style=\" font-size:12px;max-height:34px;overflow:hidden\">" + newName + "</div></td>" +
|
||||
"</tr>" +
|
||||
"</table>"
|
||||
);
|
||||
$("#cardList").append($directory);
|
||||
}
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var newName = reNewName(data[i].cardName);
|
||||
var awsuiqtip = data[i].cardName;
|
||||
if (newName.indexOf("...") == -1) {
|
||||
awsuiqtip = "";
|
||||
}
|
||||
var fileIcon = data[i].fileIcon;
|
||||
var fileIconfont = "";
|
||||
var fileColor = "#5483f4";
|
||||
for (var j = 0; j < fileIconArr.length; j++) {
|
||||
if (fileIconArr[j].fileIcon == fileIcon) {
|
||||
fileIconfont = fileIconArr[j].iconfont;
|
||||
fileColor = fileIconArr[j].color;
|
||||
}
|
||||
}
|
||||
listHtml += "<div class='kms-row' style=\"border:solid 1px #ffffff;margin:4px 5px;position:relative;display:inline-block;width:100px;height:104px;cursor:pointer\" rowid='" + data[i].cardId + "'>" +
|
||||
"<table height=\"100%\" width=\"100%\" class='cardItem'>" +
|
||||
"<tr height='59px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div class=\"awsui-iconfont\" style=\"display:inline-block;font-size:45px;color:" + fileColor + "\">" + fileIconfont + "</div></td>" +
|
||||
"</tr>" +
|
||||
"<tr height='38px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div awsui-qtip = \"" + awsuiqtip + "\" style=\"font-size:12px;max-height:34px;overflow:hidden\">" + newName + "</div></td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</div>";
|
||||
}
|
||||
$("#cardList").append(listHtml);
|
||||
}
|
||||
bindCardDetailEvent();
|
||||
}
|
||||
);
|
||||
|
||||
function getList(directoryName, directoryId, hasPerm, isFirst, obj) {
|
||||
$.simpleAlert("正在加载...", "loading");
|
||||
if (isFirst) {
|
||||
var $rootFilePath = $("<span style=\"display:inline-block;margin-top:10px;cursor:pointer\" class='file-path_item firstdir' parentid='" + rootDirectoryId + "' style='cursor:pointer' ></span>");
|
||||
$rootFilePath.on("click", function () {
|
||||
backFilesList(awsui.encode(rootDirectoryName), rootDirectoryId, rootHasPerm);
|
||||
});
|
||||
$rootFilePath.append("<span class='file-path_item_inner'>列表</span>" +
|
||||
"<span class=\"awsui-iconfont file-path_item_separator\" style=\"display:inline-block;font-size:13px;color:#666666\"></span>");
|
||||
$("#directoryPath").append($rootFilePath);
|
||||
}
|
||||
getListByDirectory(directoryName, directoryId, hasPerm, function () {
|
||||
$(".file-path_item").removeClass("currentpath");
|
||||
//增加路径
|
||||
var $curFilePath = $("<span style=\"display:inline-block;margin-top:10px;cursor:pointer\" class='file-path_item currentpath' parentid='" + directoryId + "' style='cursor:pointer' ></span>");
|
||||
$curFilePath.on("click", function () {
|
||||
backFilesList(awsui.encode(directoryName), directoryId, hasPerm);
|
||||
});
|
||||
$curFilePath.append("<span class='file-path_item_inner'>" + directoryName + "</span>" +
|
||||
"<span class=\"awsui-iconfont file-path_item_separator\" style=\"display:inline-block;font-size:13px;color:#666666\"></span>");
|
||||
$("#directoryPath").append($curFilePath);
|
||||
$("#directoryPath .file-path_item_separator").show();
|
||||
$("#directoryPath .currentpath .file-path_item_separator").hide();
|
||||
});
|
||||
}
|
||||
|
||||
function getListByDirectory(directoryName, directoryId, hasPerm, callback) {
|
||||
awsui.ajax.request({
|
||||
url: "./jd",
|
||||
method: "POST",
|
||||
data: {
|
||||
sid: sid,
|
||||
cmd: "com.actionsoft.apps.kms_xpage_getcardbydirctory",
|
||||
directoryId: directoryId,
|
||||
sortIndx: sortIndx,
|
||||
hasPerm: hasPerm,
|
||||
publishTimeFormat: publishTimeFormat
|
||||
},
|
||||
success: function (responseObject) {
|
||||
$("#cardList").html("");
|
||||
var directoryList = responseObject.data.directory;
|
||||
var cardData = responseObject.data.data;
|
||||
if ("true" == ifShowDirectory && showType == "list") {
|
||||
var directoryHtml = "";
|
||||
for (var i = 0; i < directoryList.length; i++) {
|
||||
var dirname = directoryList[i].name;
|
||||
var dirId = directoryList[i].id;
|
||||
var dirPerm = directoryList[i].hasPerm;
|
||||
var $directory = $("<ul class=\"kms-list-row dimension\" rowid=\"" + directoryList[i].id + "\" ></ul>");
|
||||
$directory.attr("dirname", dirname);
|
||||
$directory.attr("dirId", dirId);
|
||||
$directory.attr("dirPerm", dirPerm);
|
||||
if (directoryId == rootDirectoryId) {
|
||||
$directory.on("click", function () {
|
||||
getList($(this).attr("dirname"), $(this).attr("dirId"), $(this).attr("dirPerm"), true, this);
|
||||
});
|
||||
} else {
|
||||
$directory.on("click", function () {
|
||||
getList($(this).attr("dirname"), $(this).attr("dirId"), $(this).attr("dirPerm"), false, this);
|
||||
});
|
||||
}
|
||||
$directory.append("<li class=\"w100 leftalign\" style='cursor:pointer' rowid=\"obj_c8422fe63e300001baa0e0501a30196c\"><div class=\"dimensionname\" hasPerm = '" + directoryList[i].hasPerm + "' >" + directoryList[i].name + "</div></li>");
|
||||
$("#cardList").append($directory);
|
||||
}
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < cardData.length; i++) {
|
||||
if (showStyle == "singlecolumn") {
|
||||
listHtml += "<ul class=\"kms-list-row card kms-row\" style='height:30px;border-bottom: 0px solid #e6e6e6;background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 10px no-repeat;' rowid=\"" + cardData[i].cardId + "\">" +
|
||||
/*"<div class=\"awsui-iconfont\" style=\"position:absolute;left:0px;top:15px;display:inline-block;font-size:25px;color:#5483f4\"></div>" +*/
|
||||
"<li style='height:30px;' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style=\"margin-left:15px;font-size:13px;padding-top:0px;height:30px;line-height:30px;\">" + cardData[i].cardName + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"height:30px;\">";
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='阅读' style=\"color:#888888;width:32px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + cardData[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"\" awsui-qtip='评论' style=\"color:#888888;width:32px;display:inline-block;margin-right:5px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + cardData[i].commentCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
if (reBytes(cardData[i].publishUsername) > 8) {
|
||||
listHtml += "<div class=\"cardright\" awsui-qtip = \" " + cardData[i].publishUsername + "\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + cardData[i].publishUsername + "</div>";
|
||||
} else {
|
||||
listHtml += "<div class=\"cardright\" style='font-size:12px;width:50px;display:inline-block;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + cardData[i].publishUsername + "</div>";
|
||||
}
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1) {
|
||||
var dateWidth = "85px";
|
||||
if (cardData[i].publishTime.length >= 16) {
|
||||
} else if (cardData[i].publishTime.length == 10) {
|
||||
dateWidth = "65px";
|
||||
} else if (cardData[i].publishTime.length == 5) {
|
||||
dateWidth = "32px";
|
||||
} else if (cardData[i].publishTime.length == 4) {
|
||||
dateWidth = "30px";
|
||||
}
|
||||
listHtml += "<div style=\"width:" + dateWidth + "; color:#888888;font-size:12px;display:inline-block;margin-right:2px;height:30px;line-height:30px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">" + cardData[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
} else {
|
||||
listHtml += "<ul class=\"kms-list-row card kms-row\" style='background: url(\"../apps/com.actionsoft.apps.addons.xpages/img/list_icon_27.png\") left 15px no-repeat;' rowid=\"" + cardData[i].cardId + "\">" +
|
||||
/*"<div class=\"awsui-iconfont\" style=\"position:absolute;left:0px;top:15px;display:inline-block;font-size:25px;color:#5483f4\"></div>" +*/
|
||||
"<li style='' class=\"w70 leftalign\" >";
|
||||
if (showIndex.indexOf("cardName") > -1) {
|
||||
listHtml += "<div class=\"cardname\" style='margin-left:15px;font-size:13px;'>" + cardData[i].cardName + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("readCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\" style='margin-left:15px;'>阅读:" + cardData[i].readCount + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("commentCount") > -1) {
|
||||
listHtml += "<div class=\"readcount\">评论:" + cardData[i].commentCount + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "<li class=\"w30 rightalign\" style=\"\">";
|
||||
if (showIndex.indexOf("publishUser") > -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + cardData[i].publishUsername + "</div>";
|
||||
}
|
||||
if (showIndex.indexOf("publishTime") > -1 && showIndex.indexOf("publishUser") == -1) {
|
||||
listHtml += "<div class=\"cardright\" style='padding-top: 9px;'>" + cardData[i].publishTime + "</div>";
|
||||
} else if (showIndex.indexOf("publishTime") > -1) {
|
||||
listHtml += "<div class=\"cardright\" >" + cardData[i].publishTime + "</div>";
|
||||
}
|
||||
listHtml += "</li>";
|
||||
listHtml += "</ul>";
|
||||
}
|
||||
}
|
||||
$("#cardList").append(listHtml);
|
||||
} else if ("true" == ifShowDirectory && showType == "icon") {
|
||||
var directoryHtml = "";
|
||||
for (var i = 0; i < directoryList.length; i++) {
|
||||
var newName = reNewName(directoryList[i].name);
|
||||
var awsuiqtip = directoryList[i].name;
|
||||
if (newName.indexOf("...") == -1) {
|
||||
awsuiqtip = "";
|
||||
}
|
||||
var dirname = directoryList[i].name;
|
||||
var dirId = directoryList[i].id;
|
||||
var dirPerm = directoryList[i].hasPerm;
|
||||
var $directory = $("<div style=\"border:solid 1px #ffffff;margin:4px 5px;position:relative;display:inline-block;width:100px;height:104px;cursor:pointer\" rowid=\"" + directoryList[i].id + "\" ></div>");
|
||||
$directory.attr("dirname", dirname);
|
||||
$directory.attr("dirId", dirId);
|
||||
$directory.attr("dirPerm", dirPerm);
|
||||
if (directoryId == rootDirectoryId) {
|
||||
$directory.on("click", function () {
|
||||
getList($(this).attr("dirname"), $(this).attr("dirId"), $(this).attr("dirPerm"), true, this);
|
||||
});
|
||||
} else {
|
||||
$directory.on("click", function () {
|
||||
getList($(this).attr("dirname"), $(this).attr("dirId"), $(this).attr("dirPerm"), false, this);
|
||||
});
|
||||
}
|
||||
$directory.append(
|
||||
"<table height=\"100%\" width=\"100%\" >" +
|
||||
"<tr height='59px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div class=\"awsui-iconfont\" style=\"display:inline-block;font-size:45px;color:#5483f4\"></div></td>" +
|
||||
"</tr>" +
|
||||
"<tr height='38px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div awsui-qtip='" + awsuiqtip + "' style=\" font-size:12px;max-height:34px;overflow:hidden\">" + newName + "</div></td>" +
|
||||
"</tr>" +
|
||||
"</table>"
|
||||
);
|
||||
$("#cardList").append($directory);
|
||||
}
|
||||
var listHtml = "";
|
||||
for (var i = 0; i < cardData.length; i++) {
|
||||
var newName = reNewName(cardData[i].cardName);
|
||||
var awsuiqtip = cardData[i].cardName;
|
||||
if (newName.indexOf("...") == -1) {
|
||||
awsuiqtip = "";
|
||||
}
|
||||
var fileIcon = cardData[i].fileIcon;
|
||||
var fileIconfont = "";
|
||||
var fileColor = "#5483f4";
|
||||
for (var j = 0; j < fileIconArr.length; j++) {
|
||||
if (fileIconArr[j].fileIcon == fileIcon) {
|
||||
fileIconfont = fileIconArr[j].iconfont;
|
||||
fileColor = fileIconArr[j].color;
|
||||
}
|
||||
}
|
||||
listHtml += "<div class='kms-row' style=\"border:solid 1px #ffffff;margin:4px 5px;position:relative;display:inline-block;width:100px;height:104px; cursor:pointer\" rowid=\"" + cardData[i].cardId + "\">" +
|
||||
"<table height=\"100%\" width=\"100%\" class='cardItem'>" +
|
||||
"<tr height='59px'>" +
|
||||
"<td valign=\"middle\" align=\"center\"><div class=\"awsui-iconfont\" style=\"display:inline-block;font-size:45px;color:" + fileColor + "\">" + fileIconfont + "</div></td>" +
|
||||
"</tr>" +
|
||||
"<tr height='38px'>" +
|
||||
"<td valign=\"top\" align='center'><div awsui-qtip = \"" + awsuiqtip + "\" style=\"font-size:12px;max-height:40px;overflow:hidden\">" + newName + "</div></td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</div>";
|
||||
}
|
||||
$("#cardList").append(listHtml);
|
||||
}
|
||||
if (typeof(callback) == "function") {
|
||||
callback();
|
||||
}
|
||||
$.simpleAlert("close");
|
||||
bindCardDetailEvent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function backFilesList(directoryName, directoryId, hasPerm) {
|
||||
directoryName = awsui.decode(directoryName);
|
||||
if ($(".file-path_item[parentid = " + directoryId + "]").hasClass("currentpath")) {
|
||||
return;
|
||||
}
|
||||
getListByDirectory(directoryName, directoryId, hasPerm, function () {
|
||||
//获取当前点击的目录,删除后面的目录\n");
|
||||
$(".file-path_item[parentid = " + directoryId + "]").nextAll().remove();
|
||||
$(".file-path_item[parentid = " + directoryId + "]").addClass("currentpath");
|
||||
$("#directoryPath .file-path_item_separator").show();
|
||||
$("#directoryPath .currentpath .file-path_item_separator").hide();
|
||||
if (directoryId == rootDirectoryId) {//列表
|
||||
$("#directoryPath").html("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reBytes(str) {
|
||||
var num = str.length;
|
||||
for (var i = 0; i < num; i++) {
|
||||
if (str.charCodeAt(i) > 255) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function reNewName(name) {
|
||||
var newName = name;
|
||||
if (reBytes(name) > 28) {
|
||||
var index = 0;
|
||||
var num = 0;
|
||||
for (var i = 0; i < name.length; i++) {
|
||||
num++;
|
||||
if (name.charCodeAt(i) > 255) {
|
||||
num++;
|
||||
}
|
||||
if (num >= 28) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
newName = name.substring(0, index) + "...";
|
||||
}
|
||||
return newName;
|
||||
}
|
||||
|
||||
function bindCardDetailEvent() {
|
||||
$(".kms-row").find(".cardname").off("click").on("click", function () {
|
||||
//侧边栏
|
||||
var width = "700px";
|
||||
var id = $(this).parent().parent().attr("rowid");
|
||||
var url = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_browse_card_page&cardId=" + id + "&isPage=true";
|
||||
var topwindow = window.top;
|
||||
if (!topwindow) {
|
||||
topwindow = window;
|
||||
}
|
||||
$("html", topwindow.document).css("overflow", "hidden");
|
||||
topwindow.$.openSidebar({
|
||||
url: url,
|
||||
title: "",
|
||||
closeText: "收起",
|
||||
width: width,
|
||||
isMode: false,
|
||||
iframeId: "kmsbrowsecard",
|
||||
onClose: function () {
|
||||
$("html", topwindow.document).css("overflow", "");
|
||||
}
|
||||
});
|
||||
});
|
||||
$(".kms-row").find(".cardItem").off("click").on("click", function () {
|
||||
//侧边栏
|
||||
var width = "700px";
|
||||
var id = $(this).parent().attr("rowid");
|
||||
var url = "./w?sid=" + sid + "&cmd=com.actionsoft.apps.kms_knwl_center_browse_card_page&cardId=" + id + "&isPage=true";
|
||||
$("html", top.window.document).css("overflow", "hidden");
|
||||
window.top.$.openSidebar({
|
||||
url: url,
|
||||
title: "",
|
||||
closeText: "收起",
|
||||
width: width,
|
||||
isMode: false,
|
||||
iframeId: "kmsbrowsecard",
|
||||
onClose: function () {
|
||||
$("html", top.window.document).css("overflow", "");
|
||||
}
|
||||
});
|
||||
});
|
||||
if (showType == "icon") {
|
||||
$(".kms-row").each(function (index, element) {
|
||||
var target = $(element);
|
||||
target.mouseenter(function () {
|
||||
target.css("border", "solid 1px #e6e6e6");
|
||||
}).mouseleave(function (e) {
|
||||
target.css("border", "solid 1px #ffffff");
|
||||
pauseEvent(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function pauseEvent(e) {
|
||||
if (e.stopPropagation) e.stopPropagation();
|
||||
if (e.preventDefault) e.preventDefault();
|
||||
e.cancelBubble = true;
|
||||
e.returnValue = false;
|
||||
return false;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user