define(
"/js/desktop.util",
[
"js/common.tools",
"js/util",
"js/lib/ztree/js/ztree",
"js/lib/contextMenu/jquery-contextMenu",
"js/lib/artDialog/jquery-artDialog",
"js/lib/picasa/picasa" /*,
"desktop/taskTap",
"desktop/core,
"tpl/copyright.html",
"desktop/rightMenu",
"desktop/fileSelect",
"desktop/ui",
"desktop/path",
"desktop/pathOperate",
"desktop/pathOpen"*/,
],
function (e) {
;(template = Handlebars),
(Config = {
BodyContent: ".bodymain",
FileBoxSelector: ".fileContiner",
FileBoxClass: ".fileContiner .file",
FileBoxClassName: "file",
FileBoxTittleClass: ".fileContiner .title",
SelectClass: ".fileContiner .select",
SelectClassName: "select",
TypeFolderClass: "folderBox",
TypeFileClass: "fileBox",
HoverClassName: "hover",
FileOrderAttr: "number",
pageApp: "desktop",
navbar: "navbar",
AnimateTime: 200,
}),
(Global = {
fileListAll: "",
fileListNum: 0,
fileRowNum: 0,
frameLeftWidth: 200,
treeSpaceWide: 10,
topbar_height: 40,
ctrlKey: !1,
shiftKey: !1,
fileListSelect: "",
fileListSelectNum: "",
isIE: !-[1],
isDragSelect: !1,
historyStatus: {
back: 1,
next: 0,
},
}),
(TaskTap = e("desktop/taskTap")),
(core = e("desktop/core")),
(rightMenu = e("desktop/rightMenu")),
(fileSelect = e("desktop/fileSelect")),
(ui = e("desktop/ui")),
(ui.path = e("desktop/path")),
(fileLight = fileSelect.fileLight),
$(document).ready(function () {
$("title").text("桌面 - " + (AUTH.site ? AUTH.site.name : "") + "")
$("#favicon").attr("href", "/images/" + (AUTH.site ? AUTH.site.domain : "") + ".favicon.ico?t=" + new Date().getTime())
;(function () {
$(function () {
function getNow() {
var now = new Date()
return {
hours: now.getHours() + now.getMinutes() / 60,
minutes: (now.getMinutes() * 12) / 60 + (now.getSeconds() * 12) / 3600,
seconds: (now.getSeconds() * 12) / 60,
time: now,
}
}
function pad(number, length) {
// Create an array of the remaining length +1 and join it with 0's
return new Array((length || 2) + 1 - String(number).length).join(0) + number
}
var now = getNow()
// Create the chart
$("#rightwin .oclock").highcharts(
{
chart: {
type: "gauge",
plotBackgroundColor: null,
plotBackgroundImage: null,
backgroundColor: "rgba(0,0,0,0)",
plotBorderWidth: 0,
plotShadow: false,
height: 200,
},
credits: {
enabled: false,
},
title: {
text: "",
},
pane: {
background: [
{
// default background
},
{
backgroundColor: Highcharts.svg
? {
radialGradient: {
cx: 0.5,
cy: -0.4,
r: 1.9,
},
stops: [
[0.5, "rgba(255, 255, 255, 0.2)"],
[0.5, "rgba(200, 200, 200, 0.2)"],
],
}
: null,
},
],
},
yAxis: {
labels: {
distance: -20,
},
min: 0,
max: 12,
lineWidth: 0,
showFirstLabel: false,
minorTickInterval: "auto",
minorTickWidth: 1,
minorTickLength: 5,
minorTickPosition: "inside",
minorGridLineWidth: 0,
minorTickColor: "#666",
tickInterval: 1,
tickWidth: 2,
tickPosition: "inside",
tickLength: 10,
tickColor: "#666",
title: {
text: "",
style: {
color: "#BBB",
fontWeight: "normal",
fontSize: "8px",
lineHeight: "10px",
},
y: 10,
},
},
tooltip: {
enabled: false,
},
series: [
{
data: [
{
id: "hour",
y: now.hours,
dial: {
radius: "60%",
baseWidth: 4,
baseLength: "95%",
rearLength: 0,
},
},
{
id: "minute",
y: now.minutes,
dial: {
baseLength: "95%",
rearLength: 0,
},
},
{
id: "second",
y: now.seconds,
dial: {
radius: "100%",
baseWidth: 1,
rearLength: "20%",
},
},
],
animation: false,
dataLabels: {
enabled: false,
},
},
],
},
// Move
function (chart) {
setInterval(function () {
var hour = chart.get("hour"),
minute = chart.get("minute"),
second = chart.get("second"),
now = getNow(),
// run animation unless we're wrapping around from 59 to 0
animation =
now.seconds == 0
? false
: {
easing: "easeOutElastic",
}
// Cache the tooltip text
chart.tooltipText = pad(Math.floor(now.hours), 2) + ":" + pad(Math.floor(now.minutes * 5), 2) + ":" + pad(now.seconds * 5, 2)
hour.update(now.hours, true, animation)
minute.update(now.minutes, true, animation)
second.update(now.seconds, true, animation)
$("#rightwin .systime .time").html(now.time.format("HH:mm:ss"))
$("#rightwin .systime .day").html(now.time.format("yyyy年MM月dd日,星期E"))
$("#rightwin .systime .time").html(now.time.format("HH:mm:ss"))
$(".taskbar_right .datebox").html(now.time.format("HH:mm yyyy/MM/dd"))
}, 1000)
}
)
})
// Extend jQuery with some easing (copied from jQuery UI)
$.extend($.easing, {
easeOutElastic: function (x, t, b, c, d) {
var s = 1.70158
var p = 0
var a = c
if (t == 0) return b
if ((t /= d) == 1) return b + c
if (!p) p = d * 0.3
if (a < Math.abs(c)) {
a = c
var s = p / 4
} else var s = (p / (2 * Math.PI)) * Math.asin(c / a)
return a * Math.pow(2, -10 * t) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) + c + b
},
})
})(),
ui.init(),
TaskTap.init(),
core.update(),
fileSelect.init(),
rightMenu.initDesktop(),
e.async("js/lib/webuploader/webuploader-min", function () {
core.upload_init()
}),
$(".bodymain").click(function () {
$("#menuwin").hide(), $("#menuwin .search input").val(""), $("#rightwin").hide()
}),
$(".start").click(function () {
"block" == $("#menuwin").css("display") ? $("#menuwin").css("display", "none") : $("#menuwin").css("display", "block")
}),
$("#menuwin li[class!=search]").click(function () {
$("#menuwin").css("display", "none")
}),
$(".taskbar_right .datebox").click(function () {
"block" == $("#rightwin").css("display") ? $("#rightwin").css("display", "none") : $("#rightwin").css("display", "block")
}),
$("#toFullscreenBtn").click(function () {
ui.toFullScreen()
})
;(function () {
if (!AUTH.company) {
return
}
if (AUTH.company.orgType != 1) {
$(".copyright").hide()
} else {
$(".copyright").click(function () {
core.copyright()
})
}
})(),
$(".tab_hide_all").click(function () {
if (0 != art.dialog.list.length) {
$(this).toggleClass("this")
var e = !$(this).hasClass("this")
$.each(art.dialog.list, function (a, t) {
t.display(e)
})
}
}),
$("#menuwin .logout-btn").click(function () {
$.dialog({
id: "dialog_path_logout",
fixed: !0,
icon: "question",
title: "退出登录",
width: 300,
padding: 40,
lock: !0,
background: "#000",
opacity: 0.3,
content: "您确定要退出登录吗?",
ok: function () {
ui.logout()
},
cancel: !0,
})
}),
(function () {
//只有企业才提示
if (AUTH.company.orgType != 1) {
return
}
var playerObj,
isInit = false
var play = function () {
if (isInit == false) {
$(".taskbar_right .volume .sound").jmp3()
playerObj = $(".taskbar_right .volume .sound").jmp3({
backcolor: "000000",
forecolor: "00ff00",
width: 0,
autoplay: "true",
repeat: "true",
filepath: "/images/soundplayer/ring.mp3",
playerpath: "/images/soundplayer/mp3player.swf",
showdownload: "false",
})
isInit = true
}
}
//停止
var stop = function () {
if (playerObj != null) {
playerObj = null
delete playerObj
}
var obj = document.getElementById("mymp3")
if (obj != null) {
obj = null
delete obj
}
$(".taskbar_right .volume .sound").empty()
isInit = false
}
var reload = function () {
var host = "http://" + eval("(" + AUTH.site.config + ")").platform["01200007"] + "." + AUTH.site.domain
ajax({
url: host + "/web/sys/altips/getCount.json",
dataType: "jsonp",
success: function (r) {
var box = art.dialog.list["sys_altips"]
if (box) {
box.refresh()
}
stop()
if (r.data <= 0) {
return
}
$(".taskbar_right .alertbox .badge").html(r.data)
$(".taskbar_right .alertbox")
.attr("title", "您有" + r.data + "条告警信息")
.show()
$(".taskbar_right .volume")
.show()
.toggle(
function () {
$(".volume-on", $(this)).hide()
$(".volume-off", $(this)).show()
stop()
},
function () {
$(".volume-on", $(this)).show()
$(".volume-off", $(this)).hide()
play()
}
)
if ($(".volume-on").is(":visible")) {
play()
}
$(".taskbar_right .alertbox").click(function () {
core.openIE(host + "/sys/altips.html?auth_cid=" + cid, {
id: "sys_altips",
title: "告警信息",
width: 1000,
height: 600,
})
})
if (window.ringBadgeTimer == undefined) {
window.ringBadgeTimer = setInterval(function () {
$(".taskbar_right .alertbox .badge").stop().fadeOut(100).fadeIn(200)
}, 800)
}
},
})
}
reload()
setInterval(reload, 1000 * 60 * 5)
})(),
(function () {
//只有企业才加载设备监测插件
if (AUTH.company.orgType != 1) {
return
}
core.plugin({
id: "monitor_state",
url: "/plugin/monitor_state/preview.html?auth_cid=" + cid,
title: "监测点状态",
width: 160,
height: 135,
})
})()
//加载天气插件
;(function () {
var topLine = 170
if (AUTH.company.orgType != 1) {
topLine = 0
}
core.plugin({
id: "weather",
url: "/plugin/weather/index.html?auth_cid=" + cid,
title: "天气",
width: 133,
height: 195,
top: topLine,
right: 37,
})
})()
;(function () {
//只有企业才提示用电概况
if (AUTH.company.orgType != 1) {
return
}
core.openApp({ icon: "electricity_situation.png", fullable: 0, width: 1200, categoryId: 0, state: 1, type: 3, resize: 1, id: 73, content: "[100]", free: 1, title: "用电概况", height: 600, border: 0, reopen: 1 })
})()
;(function () {
//只有gov才提示用电概况
// if (AUTH.company.id == 9370 || AUTH.company.id == 9370) {
// //原尺寸
// core.openApp({ icon: "bigscreen.png", fullable: 1, width: "100%", categoryId: 29, state: 1, type: 3, resize: 1, id: 146, content: "[1552]", free: 1, title: "大屏展示", height: "100%", border: 0, reopen: 1 }, true) //80
// //全屏
// //core.openApp({"icon":"bigscreen.png","fullable":1,"width":'100%',"categoryId":29,"state":1,"type":3,"resize":1,"id":146,"content":"[1552]","free":1,"title":"大屏展示","height":h,"border":0,"reopen":1},true);
// }
return
})()
})
}
),
define("desktop/taskTap", [], function () {
var e = {},
a = "",
t = 160,
i = function () {
$(".task_tab .tab")
.die("mouseenter")
.live("mouseenter", function (e) {
$(this).hasClass("this") || $(this).addClass("hover"), stopPP(e)
})
.die("click")
.live("click", function (e) {
var a = $(this).attr("id"),
t = art.dialog.list[a],
i = $("." + a)
"hidden" == i.css("visibility") ? t.display(!0) : i.hasClass("aui_state_focus") ? t.display(!1) : t.zIndex(), stopPP(e)
})
.die("mouseleave")
.live("mouseleave", function () {
$(this).removeClass("hover")
})
.die("dblclick")
.live("dblclick", function () {})
},
n = function () {
var e,
a,
i,
n,
s = !1,
o = !1,
r = 0,
l = 0,
c = 0,
d = 0,
p = 0,
u = 0
$(".task_tab .tab")
.die("mousedown")
.live("mousedown", function (a) {
return (
(e = $(this)),
(o = !0),
this.setCapture && this.setCapture(),
$(document).mousemove(function (e) {
f(e)
}),
$(document).one("mouseup", function (e) {
return v(e), this.releaseCapture && this.releaseCapture(), stopPP(e), !1
}),
stopPP(a),
!1
)
})
var h = function (t) {
;(s = !0),
(r = t.pageX),
($tab_parent = $(".task_tab")),
(a = $(".task_tab .tab")),
$(".tasktab-dragging").remove(),
(i = e.clone().addClass("tasktab-dragging").prependTo("body")),
(d = $sizeInt(a.css("margin-right"))),
(p = $tab_parent.width()),
(u = $tab_parent.get(0).getBoundingClientRect().left),
(u += $(window).scrollLeft()),
(l = e.get(0).getBoundingClientRect().left),
(c = $sizeInt(a.css("width")))
var n = e.get(0).getBoundingClientRect().top - $sizeInt(e.css("margin-top")),
o = t.clientX - r + l
$("body").prepend("
"),
i.css({
width: c + "px",
top: n,
left: o,
}),
e.css("opacity", 0)
},
f = function (t) {
if (o) {
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty(), 0 == s && h(t)
var n = t.clientX - r + l
u > n ||
n > u + p - c ||
(i.css("left", n),
a.each(function () {
var a = $(this).get(0).getBoundingClientRect().left
if (n > a && a + c / 2 + d > n) {
if (e.attr("id") == $(this).attr("id")) return
m($(this).attr("id"), "left")
}
if (n > a - c / 2 + d && a > n) {
if (e.attr("id") == $(this).attr("id")) return
m($(this).attr("id"), "right")
}
}))
}
},
m = function (i, s) {
if (!e.is(":animated") || n != i) {
;(n = i), e.stop(!0, !0), $(".insertTemp").remove(), (a = $(".task_tab .tab"))
var o = e.width(),
r = $(".task_tab #" + i),
l = e
.clone(!0)
.insertAfter(e)
.css({
"margin-right": "0px",
border: "none",
})
.addClass("insertTemp")
"left" == s ? e.after(r).css("width", "0px") : (e.before(r).css("width", "0px"), r.before(l)),
e.animate(
{
width: o + "px",
},
t
),
l.animate(
{
width: "0px",
},
t,
function () {
$(this).remove(), (a = $(".task_tab .tab"))
}
)
}
},
v = function () {
;(o = !1),
(s = !1),
(startTime = 0),
$(".dragMaskView").remove(),
void 0 != i &&
((l = e.get(0).getBoundingClientRect().left),
i.animate(
{
left: l + "px",
},
t,
function () {
e.css("opacity", 1), $(this).remove()
}
))
}
},
s = function (e) {
var a = 110,
i = a,
n = a + 12,
s = $(".task_tab .tab"),
o = $(".task_tab .tabs").width() - 10,
r = s.length,
l = Math.floor(o / n)
switch ((r > l && (i = Math.floor(o / r) - 12), e)) {
case "add":
$(".task_tab .tabs .this")
.css("width", "0")
.animate(
{
width: i + "px",
},
t
)
case "close":
s.animate(
{
width: i + "px",
},
t
)
break
case "resize":
s.css("width", i + "px")
break
default:
}
},
addToTaskBar = function (id, icon) {
//如果是插件,任务栏不添加
if (id.match("^plugin")) {
return
}
$(".task_tab").removeClass("hidden")
var i = icon.replace(/<[^>]+>/g, ""),
n = '
' + icon + "
"
$(n).insertBefore(".task_tab .last"),
s("add"),
(e[id] = {
id: id,
name: name,
})
},
r = function (e) {
$(".task_tab .this").removeClass("this"), $(".task_tab #" + e).addClass("this"), (a = e)
},
l = function (a) {
delete e[a],
$(".task_tab #" + a).animate(
{
width: 0,
},
t,
function () {
$(".task_tab #" + a).remove(), s("close"), 0 == $(".tabs .tab").length && "desktop" != Config.pageApp && $(".task_tab").addClass("hidden")
}
)
}
return {
add: addToTaskBar,
focus: r,
close: l,
init: function () {
var e = '
'
t.find(".item").length > 0 ? $(s).insertBefore(t.find(".item:eq(0)")) : t.append(s)
var o,
r,
l,
c = 0,
d = $("#" + n),
p = $("#" + n + " .state").text(LNG.download_ready),
u = $('
')
.appendTo("#" + n)
.find(".progress-bar")
$("#" + n + " .remove").bind("click", function () {
$.get("explorer/index.html?explorer/serverDownload&type=remove&uuid=" + n),
$(this)
.parent()
.parent()
.slideUp(function () {
$(this).remove(), ui.f5()
})
}),
ajax({
url: "explorer/index.html?explorer/serverDownload&type=download&save_path=" + e + "&url=" + urlEncode2(i) + "&uuid=" + n,
dataType: "json",
error: function (e, a, t) {
core.ajaxError(e, a, t), clearInterval(o), (o = !1), clearTimeout(r), (o = !1), u.parent().remove(), p.addClass("error").text(LNG.download_error)
},
success: function (e) {
clearInterval(o),
(o = !1),
clearTimeout(r),
(o = !1),
e.code
? (ui.f5_callback(function () {
ui.path.setSelectByFilename(e.info)
}),
p.text(LNG.download_success),
$("#" + n + " .info .title").html(e.info))
: p.addClass("error").text(LNG.error),
u.parent().remove()
},
})
var h = function () {
ajax({
url: "explorer/index.html?explorer/serverDownload&type=percent&uuid=" + n,
dataType: "json",
success: function (e) {
var a = "",
t = e.data
if (o) {
if (!e.code) return p.text(LNG.loading), void 0
if (t) {
if (((t.size = parseFloat(t.size)), (t.time = parseFloat(t.time)), l)) {
var i = (t.size - l.size) / (t.time - l.time)
if (c > 0.2 * i) {
var n = c
;(c = i), (i = n)
} else c = i
a = core.file_size(i) + "/s"
}
if (0 == t.length) d.find(".progress-bar").css("width", "100%").text(LNG.loading)
else {
var s = 100 * (t.size / t.length)
d.find(".progress-bar").css("width", s + "%"), p.text(parseInt(s) + "%(" + a + ")")
}
d.find(".size").text(core.file_size(t.length)), (l = t)
}
}
},
})
}
r = setTimeout(function () {
h(),
(o = setInterval(function () {
h()
}, 1e3))
}, 100)
},
file_size: function (e) {
if (0 == e) return "0B"
e = parseFloat(e)
var a = {
GB: 1073741824,
MB: 1048576,
KB: 1024,
"B ": 0,
}
for (var t in a) if (e >= a[t]) return (e / a[t]).toFixed(1) + t
return "0B"
},
upload_check: function (e) {
return (
void 0 == e && (e = "explorer:fileUpload"),
!G.is_root && AUTH.hasOwnProperty(e) && 1 != AUTH[e]
? (core.tips.tips(LNG.no_permission, !1), void 0)
: "*recycle*/" == G.this_path || "*share*/" == G.this_path || "*share*/" == G.this_path || (G.json_data && "writeable" != G.json_data.path_type)
? (core.tips.tips(LNG.no_permission_write, !1), !1)
: !0
)
},
upload: function () {
G.upload_path = G.this_path
var e = urlDecode(G.upload_path)
if ((uploader.option("server", "explorer/index.html?explorer/fileUpload&path=" + urlEncode(G.upload_path)), 30 >= e.length ? e : "..." + e.substr(e.length - 30), 0 != $(".dialog_file_upload").length)) return $.dialog.list.dialog_file_upload.display(!0), void 0
var a = require(".tpl/upload.html"),
t = template.compile(a),
i = WebUploader.Base.formatSize(G.upload_max)
$.dialog({
padding: 5,
resize: !0,
ico: core.ico("up"),
id: "dialog_file_upload",
fixed: !0,
title: LNG.upload_muti,
content: t({
LNG: LNG,
maxsize: i,
}),
close: function () {
$.each(uploader.getFiles(), function (e, a) {
uploader.skipFile(a), uploader.removeFile(a)
})
},
}),
$(".file_upload .tips").tooltip({
placement: "bottom",
}),
$(".file_upload .top_nav a.menu")
.unbind("click")
.bind("click", function () {
$(this).hasClass("tab_upload")
? ($(".file_upload .tab_upload").addClass("this"), $(".file_upload .tab_download").removeClass("this"), $(".file_upload .upload_box").removeClass("hidden"), $(".file_upload .download_box").addClass("hidden"))
: ($(".file_upload .tab_upload").removeClass("this"), $(".file_upload .tab_download").addClass("this"), $(".file_upload .upload_box").addClass("hidden"), $(".file_upload .download_box").removeClass("hidden"))
}),
$(".file_upload .download_box button")
.unbind("click")
.bind("click", function () {
core.server_dwonload(G.upload_path)
}),
uploader.addButton({
id: "#picker",
})
},
upload_init: function () {
var e = "#thelist",
a = !0
$.browser.msie && (a = !1)
var t = 10485760
t >= G.upload_max && (t = 0.8 * G.upload_max),
(uploader = WebUploader.create({
swf: G.static_path + "js/lib/webuploader/Uploader.swf",
dnd: "body",
threads: 2,
compress: !1,
resize: !1,
prepareNextFile: !0,
duplicate: !0,
chunked: a,
chunkRetry: 3,
chunkSize: t,
})),
$("#uploader .success")
.die("click")
.live("click", function () {
var e = $(this).find("span.title").attr("title")
"explorer" == Config.pageApp
? ui.path.list(core.pathFather(e), "tips", function () {
ui.path.setSelectByFilename(core.pathThis(e))
})
: core.explorer(core.pathFather(e))
}),
$("#uploader .open")
.die("click")
.live("click", function (e) {
var a = $(this).find("span.title").attr("title")
ui.pathOpen.open(a), stopPP(e)
}),
$(".upload_box_clear")
.die("click")
.live("click", function () {
$("#thelist .success,#thelist .error").each(function () {
$(this).slideUp(300, function () {
$(this).remove()
})
})
}),
$(".upload_box_setting")
.die("click")
.live("click", function () {
$(".upload_box_config").toggleClass("hidden")
}),
$("#uploader .remove")
.die("click")
.live("click", function (e) {
var a = $(this).parent().parent().attr("id")
uploader.skipFile(a),
uploader.removeFile(a, !0),
$(this)
.parent()
.parent()
.slideUp(function () {
$(this).remove()
}),
stopPP(e)
})
var i = 0,
n = 0,
s = "0B/s",
o = function (e, a) {
var t = e.size * a,
i = 3
e.speed === void 0
? (e.speed = [
[time() - 500, 0],
[time(), t],
])
: i >= e.speed.length
? e.speed.push([time(), t])
: ((e.speed = e.speed.slice(1, i)), e.speed.push([time(), t]))
var n = e.speed[e.speed.length - 1],
o = e.speed[0],
r = (n[1] - o[1]) / ((n[0] - o[0]) / 1e3)
return (r = core.file_size(r) + "/s"), (s = r), r
},
r = []
uploader
.on("uploadBeforeSend", function (e, a) {
var t = urlEncode(e.file.fullPath)
;(void 0 == t || "undefined" == t) && (t = ""), (a.fullPath = t)
})
.on("fileQueued", function (a) {
if (!core.upload_check()) return uploader.skipFile(a), uploader.removeFile(a), void 0
var t,
n = $(e),
t = a.fullPath
;(a.finished = !1), (void 0 == t || "undefined" == t) && (t = a.name), i++, $(e).find(".item").length > 0 && (n = $(e).find(".item:eq(0)"))
var s =
'
").appendTo("body")
}
},
o = function () {
var t = null,
i = null,
n = null
$(Config.BodyContent)
.unbind("mousedown")
.live("mousedown", function (e) {
return ui.isEdit()
? !0
: a || 1 != e.which
? !0
: (s(e),
this.setCapture && this.setCapture(),
$(document)
.unbind("mousemove")
.mousemove(function (e) {
o(e)
}),
$(document).one("mouseup", function (e) {
r(e), (Global.isDragSelect = !0), this.releaseCapture && this.releaseCapture()
}),
stopPP(e),
!1)
})
var s = function (a) {
$(a.target).parent().hasClass(Config.FileBoxClassName) ||
$(a.target).parent().parent().hasClass(Config.FileBoxClassName) ||
$(a.target).hasClass("fix") ||
(rightMenu.hidden(),
a.ctrlKey || a.shiftKey || d.clear(),
0 == $(a.target).hasClass("ico") && (0 == $("#selContainer").length && ($('').appendTo(Config.FileBoxSelector), (n = $("#selContainer"))), (t = a.pageX), (i = a.pageY - Global.topbar_height), (e = !0)))
},
o = function (a) {
if (!e) return !0
"none" == n.css("display") && n.css("display", "")
var s = a.pageX,
o = a.pageY - Global.topbar_height
n.css({
left: Math.min(s, t),
top: Math.min(o, i),
width: Math.abs(s - t),
height: Math.abs(o - i),
})
for (var r = n.offset().left, l = n.offset().top - Global.topbar_height, c = n.width(), p = n.height(), u = Global.fileListNum, h = 0; u > h; h++) {
var f = Global.fileListAll[h],
m = $(Global.fileListAll[h]),
v = f.offsetWidth + f.offsetLeft,
_ = f.offsetHeight + f.offsetTop
if (v > r && _ > l && r + c > f.offsetLeft && l + p > f.offsetTop) {
if (!m.hasClass("selectDragTemp")) {
if (m.hasClass("selectToggleClass")) continue
if (m.hasClass(Config.SelectClassName)) {
m.removeClass(Config.SelectClassName).addClass("selectToggleClass"), d.resumeMenu(m)
continue
}
m.addClass("selectDragTemp")
}
} else m.removeClass("selectDragTemp"), m.hasClass("selectToggleClass") && m.addClass(Config.SelectClassName).removeClass("selectToggleClass")
}
},
r = function () {
return e ? (n.css("display", "none"), $(".selectDragTemp").addClass(Config.SelectClassName).removeClass("selectDragTemp"), $(".selectToggleClass").removeClass("selectToggleClass"), d.select(), (e = !1), (t = null), (i = null), void 0) : !1
}
},
r = function (e) {
var a = 0,
t = Global.fileListSelect
Global.fileListSelectNum
var i = Global.fileListNum,
n = function () {
var n = Global.fileRowNum
if (1 == Global.fileListSelectNum) {
var s = parseInt(t.attr(Config.FileOrderAttr))
switch (e) {
case "up":
a = 0 >= s ? s : s - 1
break
case "left":
a = n > s ? 0 : s - n
break
case "down":
a = s >= i - 1 ? s : s + 1
break
case "right":
a = s + n >= i - 1 ? i - 1 : s + n
break
default:
}
} else if (Global.fileListSelectNum > 1) {
var o = parseInt(t.first().attr(Config.FileOrderAttr)),
r = parseInt(t.last().attr(Config.FileOrderAttr))
switch (e) {
case "up":
a = a = 0 >= o ? o : o - 1
break
case "left":
break
case "down":
a = r >= i ? r : r + 1
break
case "right":
a = r + n >= i ? r : r + n
break
default:
}
}
}
return n(), Global.fileListAll.eq(a)
},
l = function (e) {
var a
switch (e) {
case "home":
a = Global.fileListAll.first()
break
case "end":
a = Global.fileListAll.last()
break
case "left":
case "up":
case "right":
case "down":
a = r(e)
break
case "all":
a = Global.fileListAll
break
default:
}
d.clear(), a.addClass(Config.SelectClassName), d.select()
},
c = function (e, a) {
d.clear()
for (var t = e; a >= t; t++) $(Global.fileListAll[t]).addClass(Config.SelectClassName)
d.select()
},
d = {
init: function () {
var e = $(Config.FileBoxClass)
e.each(function (e) {
$(this).attr(Config.FileOrderAttr, e)
}),
(Global.fileListSelect = ""),
(Global.fileListAll = e),
(Global.fileListNum = e.length),
(Global.fileListSelectNum = 0)
},
select: function () {
var e = $(Config.SelectClass)
;(Global.fileListSelect = e), (Global.fileListSelectNum = e.length), e.length > 1 && d.setMenu(e)
},
setInView: function () {},
name: function (e) {
return e.attr("data-name")
},
type: function (e) {
return e.find(".ico").attr("filetype")
},
setMenu: function (e) {
e.removeClass("menufile menufolder menuDefault").addClass("menuMore")
},
resumeMenu: function (e) {
var a = {
fileBox: "menufile",
folderBox: "menufolder",
systemBox: "menuDefault",
}
for (var t in a) e.hasClass(t) && e.removeClass("menuMore").addClass(a[t])
$(".menuRecycleButton").removeClass("menuDefault")
},
getAllName: function () {
var e = []
if (0 != Global.fileListSelectNum) {
var a = Global.fileListSelect
return (
a.each(function () {
e.push(d.name($(this)))
}),
e
)
}
},
clear: function () {
if (0 != Global.fileListSelectNum) {
var e = Global.fileListSelect
e.removeClass(Config.SelectClassName),
e.each(function () {
d.resumeMenu($(this))
}),
(Global.fileListSelect = ""),
(Global.fileListSelectNum = 0)
}
},
}
return {
init: i,
fileLight: d,
selectPos: l,
}
}),
define("desktop/ui", [], function () {
var e = new Picasa()
PicasaOpen = !1
var a = function () {
fileLight.init(), ui.setStyle(), (PicasaOpen = !1), e.initData()
},
t = function (e, a) {
var a = "down" == a ? -1 : 1
return function (t, i) {
return (t = t[e]), (i = i[e]), i > t ? -1 * a : t > i ? 1 * a : void 0
}
},
i = function (e, a) {
0 != e && ((G.sort_field = e), $(".menu_set_sort").removeClass("selected"), $(".set_sort_" + e).addClass("selected")),
0 != a && ((G.sort_order = a), $(".menu_set_desc").removeClass("selected"), $(".set_sort_" + a).addClass("selected")),
r(!1, !0),
ajax({
url: "index.html?setting/set&k=list_sort_field,list_sort_order&v=" + G.sort_field + "," + G.sort_order,
})
},
n = function () {
var e = 91
;(Global.ctrlKey = !1),
$(document)
.keydown(function (a) {
if ("none" != $("#PicasaView").css("display")) return !0
if (ui.isEdit()) return !0
if (rightMenu.isDisplay()) return !0
var t = !1
if (Global.ctrlKey || a.keyCode == e || a.ctrlKey)
switch (((t = !0), (Global.ctrlKey = !0), a.keyCode)) {
case 8:
ui.path.remove(), (t = !0)
break
case 65:
fileSelect.selectPos("all")
break
case 67:
ui.path.copy()
break
case 88:
ui.path.cute()
break
case 83:
break
case 86:
ui.path.past()
break
case 70:
core.search($(".header-right input").val(), G.this_path)
break
default:
t = !1
}
else if (a.shiftKey) Global.shiftKey = !0
else
switch (a.keyCode) {
case 8:
t = !0
break
case 35:
fileSelect.selectPos("end")
break
case 36:
fileSelect.selectPos("home")
break
case 37:
fileSelect.selectPos("left"), (t = !0)
break
case 38:
fileSelect.selectPos("up")
break
case 39:
fileSelect.selectPos("right"), (t = !0)
break
case 40:
fileSelect.selectPos("down")
break
case 13:
ui.path.open(), (t = !1)
break
case 46:
ui.path.remove(), (t = !0)
break
case 113:
ui.path.rname(), (t = !0)
break
default:
t = !1
}
return t && (stopPP(a), (a.keyCode = 0), (a.returnValue = !1)), !0
})
.keyup(function (a) {
a.shiftKey && (Global.shiftKey = !1), (a.keyCode != e && a.ctrlKey) || (Global.ctrlKey = !1)
})
},
autoIconArr = function () {
var marginBottom = 10,
marginLeft = 10,
iconWidth = 85,
iconHeight = 100,
marginRight = 10,
winHeight = $(document).height() - 50,
maxColNum = Math.floor((winHeight - marginBottom) / (iconHeight + marginRight)),
colNum = 0,
rowNum = 0,
left = 0,
top = 0
$(".fileContiner .file").css("position", "absolute"),
$(".fileContiner .file").each(function (index) {
;(colNum = index % maxColNum),
(rowNum = Math.floor(index / maxColNum)),
(left = marginLeft + (iconWidth + marginRight) * rowNum),
(top = marginBottom + (iconHeight + marginRight) * colNum),
$(this).css({
left: left,
top: top,
})
//console.log(left + "," + top);
})
}
;(this._hover_title = function (e) {
return (
void 0 == e.size_friendly && (e.size_friendly = "0B"),
' data-name="' + e.title + '" title="' + LNG.name + ":" + e.title + "
" /*LNG.size + ":" + e.size_friendly + "
" + LNG.permission + ":" + e.mode + "
" + LNG.modify_time + ":" + e.mtime + */ + LNG.app_desc + ":" + e.description + '" '
)
}),
(this._getFolderBox = function (e) {
var a = "
"
return (a += ""), (a += "
")
}),
(this._getFileBox = function (e) {
var a = ""
if (e.icon == null || e.icon == undefined || e.icon == "") {
e.icon = "oexe.png"
}
if (void 0 != e.icon) {
var t = e.icon
;-1 == e.icon.search(G.static_path) && "http" != e.icon.substring(0, 4) && (t = "" + "/" + "images/app/" + e.icon)
var i = JSON.stringify(e) /*urlEncode(json_encode(e))*/,
n = e.title //.replace(".oexe", "");
;(a = "
"),
"app_link" == e.type
? ((a += 0 == e.content.search("ui.path.open") ? "'))
: (a += ""),
(a += "
" + n + "
")
} /*else if (inArray(core.filetype.image, e.ext)) {
var s = core.path2url(G.this_path + e.name),
o = "index.html?explorer/image&path=" + urlEncode(G.this_path + e.name);
a += "
",
a += "",
a += "
" + e.title + "
"
}*/ else (a += "
"), (a += ""), (a += "
" + e.title + "
")
return a
})
var appendToUI = function (e) {
var i = "",
n = G.json_data.folderlist,
o = G.json_data.filelist
;(n = "size" == G.sort_field || "ext" == G.sort_field ? n.sort(t("title", G.sort_order)) : n.sort(t(G.sort_field, G.sort_order))), (o = o.sort(t(G.sort_field, G.sort_order))), (G.json_data.folderlist = n), (G.json_data.filelist = o)
for (var r = "", l = "", c = 0; o.length > c; c++) r += this._getFileBox(o[c])
for (var c = 0; n.length > c; c++) l += this._getFolderBox(n[c])
i += "up" == G.sort_order ? l + r : r + l
var d = ""
$(".systemBox").each(function () {
d += $(this).get(0).outerHTML
}),
(i = d + i),
(i += ""),
e ? $(Config.FileBoxSelector).hide().html(i).fadeIn(Config.AnimateTime) : $(Config.FileBoxSelector).html(i),
a(),
autoIconArr()
},
appendToStartMenu = function (d) {
$("#menuwin #programs .apps").empty()
var d = G.json_data.filelist
for (var o in d) {
if (d[o].title == undefined) {
continue
}
var i = $('')
var a = $('" + '' + d[o].title + "")
.click(function () {
core.openApp(eval("(" + $(this).attr("data-app") + ")"))
})
.appendTo(i)
$("#menuwin #programs .apps").append(i)
}
},
r = function (e, a, t) {
$(".fileContiner").hide()
if ((void 0 == e && (e = !0), void 0 == a && (a = !1), e))
ajax({
url: "/web/desktop/my/app/getList.json",
dataType: "json",
error: function (e) {
core.tips.tips(e.msg)
},
success: function (e) {
$(".init_loading").fadeOut(450).addClass("pop_fadeout")
$(".fileContiner").fadeIn()
if (e.status == 1) {
if (e.data == null || e.data.length == 0) {
return
}
return (
(G.json_data = {
folderlist: [],
filelist: e.data,
}),
formattime(),
appendToUI(a),
appendToStartMenu(a),
"function" == typeof t && t(e),
void 0
)
} else {
return core.tips.tips(e.msg), $(Config.FileBoxSelector).html(""), !1
}
},
})
// ajax({
// url: "/datas/explorer/pathListRecycle.jsonp?type=desktop&path=*recycle*/",
// dataType: "json",
// error: core.ajaxError,
// success: function(e) {
// if (!e.code) return ! 1;
// var a = "" + "images/recycle_full.png";
// if (0 == e.data.folderlist.length && 0 == e.data.filelist.length) var a = "" + "images/recycle.png";
// $(".menuRecycleButton .ico").css("background-image", 'url("' + a + '")')
// }
// });
else {
var i = fileLight.getAllName()
o(a), ui.path.setSelectByFilename(i)
}
},
l = function (e) {
r(!0, !1, e)
},
formattime = function () {
for (var e = 0; G.json_data.filelist.length > e; e++)
(G.json_data.filelist[e].atime = date(LNG.time_type, G.json_data.filelist[e].atime)), (G.json_data.filelist[e].ctime = date(LNG.time_type, G.json_data.filelist[e].ctime)), (G.json_data.filelist[e].mtime = date(LNG.time_type, G.json_data.filelist[e].mtime))
for (var e = 0; G.json_data.folderlist.length > e; e++)
(G.json_data.folderlist[e].atime = date(LNG.time_type, G.json_data.folderlist[e].atime)), (G.json_data.folderlist[e].ctime = date(LNG.time_type, G.json_data.folderlist[e].ctime)), (G.json_data.folderlist[e].mtime = date(LNG.time_type, G.json_data.folderlist[e].mtime))
}
return {
autoIconArr: autoIconArr,
f5: r,
f5_callback: l,
picasa: e,
setListSort: i,
sort_list: autoIconArr,
logout: function () {
MaskView.tips("正在注销用户信息,请稍候...")
ajax({
url: "/system/logout.json",
success: function (data) {
if (data.data.loginHost) {
window.location = data.data.loginHost
MaskView.tips("注销成功")
}
MaskView.close()
},
})
},
toFullScreen: function () {
//打开或关闭全屏模式
var n = document.documentElement
n.requestFullscreen ? n.requestFullscreen() : n.mozRequestFullScreen ? n.mozRequestFullScreen() : n.webkitRequestFullscreen ? n.webkitRequestFullscreen() : n.msRequestFullscreen && n.msRequestFullscreen()
},
init: function () {
var p = template.compile($("#desktop-template").html())
$("#desktop-box").html(p({ G: G, LNG: LNG, AUTH: AUTH, data: {} }))
$(".desktop .start").css({
background: 'rgba(0, 0, 0, .5) url("' + "/images/desktop/" + (AUTH.site ? AUTH.site.domain : "") + ".start.png" + '") center no-repeat',
})
$("#menuwin #logo .icon").css({
background: 'rgba(0, 0, 0, .5) url("' + "/images/desktop/" + (AUTH.site ? AUTH.site.domain : "") + ".start.png" + '") no-repeat',
"background-size": "cover",
})
var cid = $.query.get("auth_cid")
$("#toClassicBtn").attr("href", "/classic.html" + (cid ? "?auth_cid=" + cid : ""))
// toFullScreen();
var cid = $.query.get("auth_cid")
if (!(cid == null || cid == "") && G.is_root != 1) {
$("#desktop-box .fileContiner").empty()
}
$(".hidden").removeClass("hidden"),
autoIconArr(),
l(),
n(),
$(window).bind("resize", function () {
ui.setStyle(), 0 != PicasaOpen && e.setFrameResize(), autoIconArr()
}),
$("html")
.die("click")
.live("click", function () {
rightMenu.hidden(), Global.isIE && Global.isDragSelect
}),
Mousetrap.bind(["ctrl+s", "command+s"], function (e) {
e.preventDefault(), FrameCall.top("OpenopenEditor", "Editor.save", "")
})
var a,
t = 0,
i = "",
o = 200
Mousetrap.bind(
[
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
"`",
"~",
"!",
"@",
"#",
"$",
"%",
"^",
"&",
"*",
"(",
")",
"-",
"_",
"=",
"+",
"[",
"{",
"]",
"}",
"|",
"/",
"?",
".",
">",
",",
"<",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
],
function (e) {
var n = String.fromCharCode(e.charCode)
return 0 == t
? ((t = time()),
(i = n),
(a = setTimeout(function () {
ui.path.setSelectByChar(i), (t = 0)
}, o)),
void 0)
: n == i.substr(-1)
? (ui.path.setSelectByChar(i), (t = 0), void 0)
: (o > time() - t &&
((t = time()),
(i += n),
clearTimeout(a),
(a = setTimeout(function () {
ui.path.setSelectByChar(i), (t = 0)
}, o))),
void 0)
}
),
Mousetrap.bind(["f5"], function (e) {
stopPP(e), ui.f5(!0, !0)
}),
Mousetrap.bind(["ctrl+u", "command+u"], function (e) {
stopPP(e), core.upload()
}),
Mousetrap.bind(["ctrl+e", "command+e"], function (e) {
stopPP(e), ui.path.openEditor()
}),
Mousetrap.bind(["alt+i", "alt+i"], function (e) {
stopPP(e), ui.path.info()
}),
Mousetrap.bind(["alt+n", "alt+n"], function (e) {
stopPP(e), ui.path.newFile()
}),
Mousetrap.bind(["alt+m", "alt+m"], function (e) {
stopPP(e), ui.path.newFolder()
}),
(PicasaOpen = !1),
e.init(".picasaImage"),
e.initData()
},
getMyApps: function () {
return G.json_data ? G.json_data : { filelist: [] }
},
setTheme: function (e) {
core.setSkin(e, "desktop.css"), FrameCall.top("OpenopenEditor", "Editor.setTheme", '"' + e + '"'), FrameCall.top("Opensetting_mode", "Setting.setThemeSelf", '"' + e + '"'), FrameCall.father("ui.setTheme", '"' + e + '"')
},
setWall: function (e) {
$(".wallbackground")
.attr("src", e)
.one("load", function () {
$(".desktop").css("background-image", "url(" + e + ")")
})
},
isEdit: function () {
var e = $(document.activeElement).get(0)
if (e) return (e = e.tagName), "INPUT" == e || "TEXTAREA" == e ? !0 : !1
},
setStyle: function () {
Global.fileRowNum = (function () {
var e = $(Config.FileBoxSelector).width(),
a = $sizeInt($(Config.FileBoxClass).css("width")) + $sizeInt($(Config.FileBoxClass).css("border-left-width")) + $sizeInt($(Config.FileBoxClass).css("border-right-width")) + $sizeInt($(Config.FileBoxClass).css("margin-right"))
return parseInt(e / a)
})()
},
}
}),
define(
"desktop/path",
[
/*"desktop/pathOperate", "desktop/pathOpen"*/
],
function (e) {
var a = e("desktop/pathOperate"),
t = e("desktop/pathOpen"),
n = void 0
ui.pathOpen = t
var s = function (e, a, t) {
if (void 0 != e) {
if ("explorer" != Config.pageApp) return core.explorer(e), void 0
if (e == G.this_path) return void 0 != a && "" != a && core.tips.tips(LNG.path_is_current, "info"), void 0
if (((G.this_path = e.replace(/\\/g, "/")), (G.this_path = e.replace(/\/+/g, "/")), "/" != G.this_path.substr(G.this_path.length - 1) && (G.this_path += "/"), $(".dialog_file_upload").length > 0)) {
var i = "hidden" == $(".dialog_file_upload").css("visibility")
core.upload(), i && $(".dialog_file_upload").css("visibility", "hidden")
}
ui.f5_callback(function () {
"function" == typeof t && t()
})
}
},
o = function (e, a) {
var t,
i,
n = 0,
s = G.json_data.folderlist,
o = G.json_data.filelist
if (("desktop" == Config.pageApp && (n = $(".menuDefault").length), "folder" == a)) {
for (t = 0; s.length > t && !(s[t].name >= e); t++);
return "up" == G.sort_order ? t + n : o.length + t + n
}
if ("file" == a) {
for (i = 0; o.length > i && !(o[i].name >= e); i++);
return "down" == G.sort_order ? i + n : s.length + i + n
}
return -1
},
r = function (e) {
void 0 != e &&
("string" == typeof e && (e = [e]),
fileLight.clear(),
$(".fileContiner .file").each(function (a) {
var t = fileLight.name($(this))
;-1 != $.inArray(t, e) && $(Global.fileListAll).eq(a).addClass(Config.SelectClassName)
}),
fileLight.select(),
fileLight.setInView())
},
l = function (e) {
if ("" != e) {
if (((e = e.toLowerCase()), void 0 == n || G.this_path != n.path || e != n.key)) {
var a = []
$(".fileContiner .file").each(function () {
var t = fileLight.name($(this))
t && e == t.substring(0, e.length).toLowerCase() && a.push(t)
}),
(n = {
key: e,
path: G.this_path,
index: 0,
list: a,
})
}
0 != n.list.length && (r(n.list[n.index++]), n.index == n.list.length && (n.index = 0))
}
},
c = function (e) {
return "" == e
? (fileLight.clear(), void 0)
: (fileLight.clear(),
$(".fileContiner .file").each(function (a) {
var t = fileLight.name($(this))
;-1 != t.toLowerCase().indexOf(e) && $(Global.fileListAll).eq(a).addClass(Config.SelectClassName)
}),
fileLight.select(),
fileLight.setInView(),
void 0)
},
d = function (e, a, t) {
var n = e.length
for (i = 0; n > i; i++) if (e[i][a] == t) return e[i]
},
p = function (e) {
var a = "",
t = 0
return null != G.json_data.filelist && ((a = d(G.json_data.filelist, "name", e)), null != a && (t = 1)), null != G.json_data.folderlist && ((a = d(G.json_data.folderlist, "name", e)), null != a && (t = 1)), t
},
u = function (e, a) {
var t,
i = 0
if (void 0 == a) {
if (!p(e)) return e
for (t = e + "(0)"; p(t); ) i++, (t = e + "(" + i + ")")
return t
}
if (!p(e + "." + a)) return e + "." + a
for (t = e + "(0)." + a; p(t); ) i++, (t = e + "(" + i + ")." + a)
return t
},
h = function () {
ajax({
dataType: "json",
url: "index.html?explorer/historyBack",
beforeSend: function () {
$(".tools-left .msg").stop(!0, !0).fadeIn(100)
},
error: core.ajaxError,
success: function (e) {
return (
$(".tools-left .msg").fadeOut(100),
e.code ? ((e = e.data), (G.this_path = e.thispath), (G.json_data = e.list), (Global.historyStatus = e.history_status), ui.f5(!1, !0), ui.header.updateHistoryStatus(), ui.header.addressSet(), void 0) : (core.tips.tips(e), $(Config.FileBoxSelector).html(""), !1)
)
},
})
},
f = function () {
ajax({
dataType: "json",
url: "index.html?explorer/historyNext",
beforeSend: function () {
$(".tools-left .msg").stop(!0, !0).fadeIn(100)
},
error: core.ajaxError,
success: function (e) {
return (
$(".tools-left .msg").fadeOut(100),
e.code ? ((e = e.data), (G.this_path = e.thispath), (G.json_data = e.list), (Global.historyStatus = e.history_status), ui.f5(!1, !0), ui.header.updateHistoryStatus(), ui.header.addressSet(), void 0) : (core.tips.tips(e), $(Config.FileBoxSelector).html(""), !1)
)
},
})
},
m = function (e) {
fileLight.clear(), void 0 == e && (e = "txt")
var t = "newfile",
t = u(t, e),
i = o(t, "file")
i = 0 == i ? -1 : i - 1
var n =
'
'
;-1 == i ? $(Config.FileBoxSelector).html(n + $(Config.FileBoxSelector).html()) : $(n).insertAfter(Config.FileBoxSelector + " .file:eq(" + i + ")"), "desktop" == Config.pageApp && ui.sort_list()
var s = $(".newfile"),
l = s.get(0),
c = t.length - e.length - 1
if (Global.isIE) {
var d = l.createTextRange()
d.moveEnd("character", -l.value.length), d.moveEnd("character", c), d.moveStart("character", 0), d.select()
} else l.setSelectionRange(0, c)
s.focus(),
s.unbind("keydown").keydown(function (e) {
return (
(13 == e.keyCode || 27 == e.keyCode) &&
(stopPP(e),
e.preventDefault(),
(filename = s.attr("value")),
p(filename)
? ($("#makefile").remove(), core.tips.tips(LNG.path_exists, "warning"))
: a.newFile(G.this_path + filename, function () {
ui.f5_callback(function () {
r(filename)
})
})),
!0
)
}),
s.unbind("blur").blur(function () {
;(filename = s.attr("value")),
p(filename)
? ($("#makefile").remove(), core.tips.tips(LNG.path_exists, "warning"), _newFile(e))
: a.newFile(G.this_path + filename, function () {
ui.f5_callback(function () {
r(filename)
})
})
})
},
v = function () {
fileLight.clear()
var e = LNG.newfolder,
e = u(e),
t = o(e, "folder")
t = 0 == t ? -1 : t - 1
var i = '
'
;(i += ''),
(i += '
'),
(i += '
'),
-1 == t ? $(Config.FileBoxSelector).html(i + $(Config.FileBoxSelector).html()) : $(i).insertAfter(Config.FileBoxSelector + " .file:eq(" + t + ")"),
"desktop" == Config.pageApp && ui.sort_list(),
$(".newfile").select(),
$(".newfile").focus(),
$(".newfile")
.unbind("keydown")
.keydown(function (e) {
if (13 == e.keyCode || 27 == e.keyCode) {
stopPP(e), e.preventDefault()
var t = $(".newfile").attr("value")
p(t)
? ($("#makefile").remove(), core.tips.tips(LNG.path_exists, "warning"))
: a.newFolder(G.this_path + t, function () {
"explorer" == Config.pageApp && ui.tree.checkIfChange(G.this_path),
ui.f5_callback(function () {
r(t)
})
})
}
}),
$(".newfile")
.unbind("blur")
.blur(function () {
;(filename = $(".newfile").attr("value")),
p(filename)
? ($("#makefile").remove(), core.tips.tips(LNG.path_exists, "warning"), _newFolder())
: a.newFolder(G.this_path + filename, function () {
"explorer" == Config.pageApp && ui.tree.checkIfChange(G.this_path),
ui.f5_callback(function () {
r(filename)
})
})
})
},
_ = function () {
var e = "",
t = "",
i = Global.fileListSelect,
n = fileLight.name(i),
s = fileLight.type(i)
if (1 == i.length) {
if (i.hasClass("menuSharePath")) return ui.path.share_edit(), void 0
;(s = "folder" == s ? "folder" : s),
$(i)
.find(".title")
.html("
")
var o = $("#pathRenameTextarea"),
l = o.get(0)
if ("folder" == s) o.select()
else {
var c = n.length - s.length - 1
if (Global.isIE) {
var d = l.createTextRange()
d.moveEnd("character", -l.value.length), d.moveEnd("character", c), d.moveStart("character", 0), d.select()
} else l.setSelectionRange(0, c)
}
o.unbind("focus").focus(),
o.keydown(function (l) {
if (13 == l.keyCode) {
l.preventDefault(), stopPP(l), (e = o.attr("value")), "oexe" == s && (e += ".oexe")
var c = e
e != n
? ((t = urlEncode(G.this_path + n)),
(e = urlEncode(G.this_path + e)),
a.rname(t, e, function () {
"explorer" == Config.pageApp && ui.tree.checkIfChange(G.this_path),
ui.f5_callback(function () {
r(c)
})
}))
: ("oexe" == s && (n = n.replace(".oexe", "")), $(i).find(".title").html(n))
}
27 == l.keyCode && ("oexe" == s && (n = n.replace(".oexe", "")), $(i).find(".title").html(n))
}),
o.unbind("blur").blur(function () {
;(e = $("#pathRenameTextarea").attr("value")), "oexe" == s && (e += ".oexe")
var o = e
e != n
? ((t = urlEncode(G.this_path + n)),
(e = urlEncode(G.this_path + e)),
a.rname(t, e, function () {
"explorer" == Config.pageApp && ui.tree.checkIfChange(G.this_path),
ui.f5_callback(function () {
r(o)
})
}))
: ("oexe" == s && (n = n.replace(".oexe", "")), $(i).find(".title").html(n))
})
}
},
g = function () {
ui.f5(), "explorer" == Config.pageApp && ui.tree.checkIfChange(G.this_path)
},
y = function (e) {
if (e) {
var a = []
return 0 == Global.fileListSelect.length
? a
: (Global.fileListSelect.each(function () {
var e = G.this_path + fileLight.name($(this)),
app = eval("(" + $(this).attr("data-app") + ")")
// t = "folder" == fileLight.type($(this)) ? "folder": "file";
// "*share*/" == G.this_path && (e = $(this).attr("data-path"), t = "share"),
a.push(app)
}),
a)
}
if (1 != Global.fileListSelectNum)
return {
path: "",
type: "",
}
var t = Global.fileListSelect,
i = G.this_path + fileLight.name(t),
n = fileLight.type(t)
return (
"*share*/" == G.this_path && ((i = t.attr("data-path")), (n = "share")),
{
path: i,
type: n,
}
)
}
// return {};
return {
appEdit: function (e) {
if (e) a.appEdit(0, 0, "add")
else {
var t = Global.fileListSelect.attr("data-app"),
i = json_decode(urlDecode(t))
;(i.path = G.this_path + fileLight.name(Global.fileListSelect)), a.appEdit(i)
}
},
appList: function () {
a.appList(y().path)
},
appInstall: function () {
a.appInstall(y().path)
},
openEditor: function () {
t.openEditor(y().path)
},
openIE: function () {
t.openIE(y().path)
},
open: function (e) {
if (0 != y().path.length) {
if ("*recycle*/" == G.this_path) return ui.path.info(), void 0
if ("*share*/" == G.this_path) return ui.path.share_open_window(), void 0
if (void 0 != e) return t.open(e), void 0
var a = y(),
i = Global.fileListSelect
if (inArray(core.filetype.image, a.type)) {
if (!core.authCheck("explorer:fileDownload", LNG.no_permission_download)) return
return "icon" == G.list_type || "desktop" == Config.pageApp ? ui.picasa.play($(i).find(".ico")) : ui.picasa.play($(i)), void 0
}
if ("oexe" == a.type) {
var n = i.attr("data-app")
a.path = json_decode(urlDecode(n))
}
t.open(a.path, a.type)
}
},
// play: function() {
// if (! (1 > Global.fileListSelectNum)) {
// var e = [];
// Global.fileListSelect.each(function() {
// var a = fileLight.type($(this));
// if (inArray(core.filetype.music, a) || inArray(core.filetype.movie, a)) {
// var t = core.path2url(G.this_path + fileLight.name($(this)));
// e.push(t)
// }
// }),
// t.play(e, "music")
// }
// },
pathOperate: a,
// share: function() {
// a.share(y())
// },
// setBackground: function() {
// a.setBackground(y().path)
// },
// createLink: function() {
// a.createLink(y().path, y().type,
// function(e) {
// ui.f5_callback(function() {
// r(e.info)
// })
// })
// },
// createProject: function() {
// a.createProject(y().path,
// function(e) {
// ui.f5_callback(function() {
// r(e.info)
// })
// })
// },
// download: function() {
// var e = y(!0);
// 1 == e.length && "file" == e[0].type ? t.download(y().path) : a.zipDownload(e)
// },
// share_edit: function() {
// var e = y().path,
// t = G.json_data.share_list[e];
// a.share_box(t)
// },
// share_open_window: function() {
// var e = y().path,
// a = G.json_data.share_list[e],
// t = a.type;
// "folder" == a.type && (t = 1 == a.code_read ? "code_read": "folder");
// var i = "index.html?share/" + t + "&user=" + G.user_name + "&sid=" + a.sid;
// window.open(i)
// },
// share_open_path: function() {
// var e = y().path,
// a = G.json_data.share_list[e],
// t = core.pathFather(a.path),
// i = core.pathThis(a.path);
// ui.path.list(t, "",
// function() {
// r(i)
// })
// },
// recycle_clear: function() {
// $.dialog({
// id: "dialog_path_remove",
// fixed: !0,
// icon: "question",
// title: LNG.remove_title,
// padding: 40,
// lock: !0,
// background: "#000",
// opacity: .2,
// content: LNG.recycle_clear_info,
// ok: function() {
// ajax({
// url: "index.html?explorer/pathDeleteRecycle",
// beforeSend: function() {
// core.tips.loading()
// },
// error: core.ajaxError,
// success: function(e) {
// core.tips.close(e),
// ui.f5(),
// FrameCall.father("ui.f5", "1,1"),
// "function" == typeof callback && callback(e)
// }
// })
// },
// cancel: !0
// })
// },
// explorer: function() {
// core.explorer(y().path)
// },
// explorerNew: function() {
// window.open("index.html?/explorer&path=" + y().path)
// },
// openProject: function() {
// core.explorerCode(y().path)
// },
// search: function() {
// core.search("", y().path)
// },
// fav: function() {
// a.fav(y().path)
// },
remove: function () {
a.remove(y(!0), g), fileLight.clear()
},
// copy: function() {
// a.copy(y(!0))
// },
// cute: function() {
// a.cute(y(!0), ui.f5)
// },
// zip: function() {
// a.zip(y(!0),
// function(e) {
// ui.f5_callback(function() {
// r(e.info)
// })
// })
// },
// unZip: function() {
// a.unZip(y().path, ui.f5)
// },
// cuteDrag: function(e) {
// a.cuteDrag(y(!0), e, g)
// },
// copyDrag: function(e, t) {
// a.copyDrag(y(!0), e,
// function(e) {
// fileLight.clear(),
// "explorer" == Config.pageApp && ui.tree.checkIfChange(G.this_path),
// ui.f5_callback(function() {
// t && e.data && r(e.data)
// })
// })
// },
// info: function() {
// if ("share" == y().type) {
// var e = y().path,
// t = G.json_data.share_list[e],
// i = t.path;
// a.info([{
// path: i,
// type: t.type
// }])
// } else a.info(y(!0))
// },
// past: function() {
// fileLight.clear(),
// a.past(G.this_path,
// function(e) {
// "explorer" == Config.pageApp && ui.tree.checkIfChange(G.this_path),
// ui.f5_callback(function() {
// r(e)
// })
// })
// },
// back: h,
// next: f,
// list: s,
// newFile: m,
// newFolder: v,
// rname: _
// setSearchByStr: c,
// setSelectByChar: l,
// setSelectByFilename: r,
// clipboard: a.clipboard
}
}
),
define("desktop/pathOperate", [], function (e) {
var a = {}
;(a.file_info = e("tpl/fileinfo/file_info.html")), (a.path_info = e("tpl/fileinfo/path_info.html")), (a.path_info_more = e("tpl/fileinfo/path_info_more.html"))
var t = ["/", "\\", ":", "*", "?", '"', "<", ">", "|"],
i = function (e) {
var a = function (e, a) {
for (var t = a.length, i = 0; t > i; i++) if (e.indexOf(a[i]) > 0) return !0
return !1
}
return a(e, t) ? (core.tips.tips(LNG.path_not_allow + ':/ : * ? " < > |', !1), !1) : !0
},
n = function (e) {
for (var a = "list=[", t = 0; e.length > t; t++) (a += '{"type":"' + e[t].type + '","path":"' + urlEncode2(e[t].path) + '"}'), e.length - 1 > t && (a += ",")
return a + "]"
},
s = function (e, a) {
if (e) {
var t = core.pathThis(e)
return i(t)
? (ajax({
dataType: "json",
url: "index.html?explorer/mkfile&path=" + urlEncode2(e),
beforeSend: function () {
core.tips.loading()
},
error: core.ajaxError,
success: function (e) {
core.tips.close(e), "function" == typeof a && a(e)
},
}),
void 0)
: ("function" == typeof a && a(), void 0)
}
},
o = function (e, a) {
if (e) {
var t = core.pathThis(e)
return i(t)
? (ajax({
dataType: "json",
url: "index.html?explorer/mkdir&path=" + urlEncode2(e),
beforeSend: function () {
core.tips.loading()
},
error: core.ajaxError,
success: function (e) {
core.tips.close(e), "function" == typeof a && a(e)
},
}),
void 0)
: ("function" == typeof a && a(), void 0)
}
},
r = function (e, a, t) {
return e && a && e != a
? i(core.pathThis(a)) /*ajax({
type: "POST",
dataType: "json",
url: "index.html?explorer/pathRname",
data: "path=" + urlEncode(e) + "&rname_to=" + urlEncode(a),
beforeSend: function() {
core.tips.loading()
},
error: core.ajaxError,
success: function(e) {*/
? //core.tips.close(e),
"function" == typeof t && t(e)
: /*}
}),void 0*/ ("function" == typeof t && t(), void 0)
: void 0
},
l = function (e, a) {
if (!(1 > e.length)) {
var t = e[0].title,
i = LNG.remove_title,
s = t + " " + LNG.remove_info,
o = "index.html?explorer/pathDelete"
"*recycle*/" == G.this_path && ((s = LNG.recycle_remove + "?"), (o = "index.html?explorer/pathDeleteRecycle"), (i = LNG.recycle_remove)),
"share" == e[0].type && ((s = LNG.share_remove_tips), (o = "index.html?userShare/del"), (i = LNG.share_remove)),
e.length > 1 && (s += ' ... ' + e.length + ""),
$.dialog({
id: "dialog_path_remove",
fixed: !0,
icon: "question",
title: i,
width: 300,
padding: 40,
lock: !0,
background: "#000",
opacity: 0.3,
content: s,
ok: function () {
ajax({
url: "/web/desktop/my/app/remove.json",
type: "POST",
dataType: "json",
data: { id: e[0].id },
beforeSend: function () {
core.tips.loading()
},
error: core.ajaxError,
success: function (t) {
if (t.status != 1) {
core.tips.close(t.msg)
return
}
$("[data-id=app_" + e[0].id + "]").fadeOut(function () {
$(this).remove()
ui.autoIconArr()
})
core.tips.close("删除成功")
// if (core.tips.close(t), FrameCall.father("ui.f5", "1,1"), "share" == e[0].type) {
// var i = art.dialog.list.share_dialog;
// void 0 != i && i.close(),
// $(".jiathis_style").appendTo(".global_share")
// }
// "function" == typeof a && a(t)
},
})
},
cancel: !0,
})
}
},
c = function (e) {
1 > e.length ||
ajax({
url: "index.html?explorer/pathCopy",
type: "POST",
dataType: "json",
data: n(e),
error: core.ajaxError,
success: function (e) {
core.tips.tips(e)
},
})
},
u = function (a) {
var t = e("tpl/share.html"),
i = template.compile(t),
n = i({
LNG: LNG,
})
$.dialog({
id: "share_dialog",
simple: !0,
resize: !1,
width: 425,
title: LNG.share,
padding: "0",
fixed: !0,
content: n,
cancel: function () {
$(".jiathis_style").appendTo(".global_share")
},
})
var s = "zh_CN" == G.lang ? "ch" : "en"
$("#share_time").datetimepicker({
format: "Y/m/d",
formatDate: "Y/m/d",
timepicker: !1,
lang: s,
}),
$("#share_time")
.unbind("blur")
.bind("blur", function (e) {
stopPP(e)
})
var o = function (e) {
if (($(".share_setting_more").addClass("hidden"), void 0 == e))
$(".share_has_url").addClass("hidden"),
$(".share_action .share_remove_button").addClass("hidden"),
$(".content_info input[name=sid]").val(""),
$(".content_info input[name=type]").val(""),
$(".content_info input[name=name]").val(""),
$(".content_info input[name=path]").val(""),
$(".content_info input[name=time_to]").val(""),
$(".content_info input[name=share_password]").val(""),
$(".share_view_info").addClass("hidden")
else {
;(a = e),
$(".content_info input[name=sid]").val(e.sid),
$(".content_info input[name=type]").val(e.type),
$(".content_info input[name=name]").val(e.name),
$(".content_info input[name=path]").val(e.path),
$(".content_info input[name=time_to]").val(e.time_to),
$(".content_info input[name=share_password]").val(e.share_password),
$(".share_view_info").removeClass("hidden"),
e.num_download === void 0 && (e.num_download = 0),
e.num_view === void 0 && (e.num_view = 0)
var t = LNG.share_view_num + e.num_view + " " + LNG.share_download_num + e.num_download
$(".share_view_info").html(t),
"1" == e.code_read ? $(".content_info input[name=code_read]").attr("checked", "checked") : $(".content_info input[name=code_read]").removeAttr("checked"),
"1" == e.not_download ? $(".content_info input[name=not_download]").attr("checked", "checked") : $(".content_info input[name=not_download]").removeAttr("checked"),
$(".share_has_url").removeClass("hidden"),
"file" == e.type ? $(".label_code_read").addClass("hidden") : $(".label_code_read").removeClass("hidden")
var i = e.type
"folder" == e.type && (i = 1 == e.code_read ? "code_read" : "folder")
var n = G.app_host + "index.html?share/" + i + "&user=" + G.user_name + "&sid=" + e.sid
$(".content_info .share_url").val(n),
("" != e.time_to || "" != e.share_password || "1" == e.code_read || "1" == e.not_download) && $(".share_setting_more").removeClass("hidden"),
$(".share_remove_button").removeClass("hidden"),
$(".share_create_button").text(LNG.share_save),
(jiathis_config = {
url: n,
summary: e.name,
title: "share to ##",
shortUrl: !1,
hideMore: !1,
}),
$(".jiathis_style").appendTo(".share_jiathis_box")
}
},
r = function () {
$(".share_action .share_remove_button")
.unbind("click")
.click(function () {
ui.pathOperate.remove([
{
type: "share",
path: a.sid,
},
]),
"*share*/" == G.this_path && ui.f5()
}),
$(".content_info .share_more")
.unbind("click")
.click(function () {
$(".share_setting_more").toggleClass("hidden")
}),
$(".share_action .share_create_button")
.unbind("click")
.click(function () {
var e = ""
$(".share_dialog .content_info input[name]").each(function () {
var a = urlEncode($(this).val())
"checkbox" == $(this).attr("type") && (a = $(this).attr("checked") ? "1" : ""), (e += "&" + $(this).attr("name") + "=" + a)
}),
ajax({
url: "index.html?userShare/set",
data: e,
type: "POST",
dataType: "json",
beforeSend: function () {
$(".share_create_button").addClass("disabled")
},
error: function () {
core.tips.tips(LNG.error, !1)
},
success: function (e) {
$(".share_create_button").removeClass("disabled"), e.code ? (o(e.data), $(".share_create_button").text(LNG.share_save), "*share*/" == G.this_path && ui.f5(), core.tips.tips(LNG.success, !0)) : core.tips.tips(e)
},
})
}),
$(".content_info .open_window")
.unbind("click")
.bind("click", function () {
window.open($("input.share_url").val())
})
var e = $("input.share_url"),
t = e.get(0)
e.unbind("hover click").bind("hover click", function () {
$(this).focus()
var a = e.val().length
if (Global.isIE) {
var i = t.createTextRange()
i.moveEnd("character", -t.value.length), i.moveEnd("character", a), i.moveStart("character", 0), i.select()
} else t.setSelectionRange(0, a)
})
}
o(a), r()
},
h = function (e) {
if (!(1 > e.length)) {
var a = core.path2url(e)
FrameCall.father("ui.setWall", '"' + a + '"'),
ajax({
url: "index.html?setting/set&k=wall&v=" + urlEncode(a),
type: "json",
success: function (e) {
core.tips.tips(e)
},
})
}
},
f = function (e, a, t) {
if (!(1 > e.length)) {
var i,
n = core.pathThis(e),
s = core.pathFather(e)
i = "folder" == a ? "ui.path.list('" + urlEncode(e) + "');" : "ui.path.open('" + urlEncode(e) + "');"
var o = urlEncode2(s + n + ".oexe")
ajax({
url: "index.html?explorer/mkfile&path=" + o,
type: "POST",
dataType: "json",
data: 'content={"type":"app_link","content":"' + i + '","icon":"app_s2.png"}',
success: function (e) {
e.code && "function" == typeof t && t(e)
},
})
}
},
reloadTree = function (e, pbox) {
var setValues = function (treeId) {
var nodes = $.fn.zTree.getZTreeObj(treeId).getCheckedNodes(true)
var ids = [],
names = []
for (var i = 0; i < nodes.length; i++) {
ids.push(nodes[i].id)
names.push(nodes[i].name)
}
e.attr({ "data-id": ids.join(","), data: JSON.stringify(ids) }).val(names.join(","))
},
getValues = function () {
var ids = e.attr("data-id")
return ids ? ids.split(",") : []
},
click = function (event, treeId, node) {
var treeObj = $.fn.zTree.getZTreeObj(treeId)
treeObj.checkNode(node, !node.checked, false)
setValues(treeId)
},
check = function (event, treeId, node) {
setValues(treeId)
},
dftCheck = function (treeId) {
var ids = getValues()
for (var c in ids) {
try {
var treeObj = $.fn.zTree.getZTreeObj(treeId)
var node = treeObj.getNodeByParam("id", ids[c])
if (null == node) {
continue
}
treeObj.checkNode(node, true, false)
} catch (e) {
console.log(e)
}
}
$.fn.zTree.getZTreeObj(treeId).expandAll(true)
setValues(treeId)
pbox.attr({ loaded: true })
},
rootPid = 0,
setting = {
check: {
chkStyle: "checkbox",
chkboxType: { Y: "", N: "" },
enable: true,
},
view: {
dblClickExpand: false,
},
data: {
simpleData: {
enable: true,
pIdKey: "parentId",
rootPid: 0,
},
},
async: {
enable: true,
url: "/web/menu/getAll.json",
dataFilter: function (id, pnode, r) {
var rdata = []
var data = r.data.rows
if (data) {
// rdata[0] = {id:rootPid,parentId:rootPid,name:"根节点",xpath:"/",open:true};
for (var i = 0; i < data.length; i++) {
data[i].name = data[i].name
data[i].url = null
rdata.push(data[i])
}
}
return rdata
},
},
callback: {
//事件处理回调函数
onClick: click,
onCheck: check,
onAsyncSuccess: function (event, treeId, treeNode, msg) {
dftCheck(treeId)
},
},
}
if (pbox.attr("loaded")) {
dftCheck(pbox.attr("id"))
return
}
!pbox.is(":visible") && $.fn.zTree.init(pbox, setting)
},
reloadSite = function (parent, pbox) {
if (pbox.attr("loaded")) {
return
}
var uuid = parent.attr("uuid")
var ids = parent.attr("data-id").split(",")
var names = []
pbox.empty()
ajax({
url: "/web/site/getAll.json",
success: function (d) {
if (!d.data.rows) {
return
}
var d = d.data.rows
for (var i = 0; i < d.length; i++) {
var chk = false
for (var j = 0; j < ids.length; j++) {
if (d[i].id == ids[j]) {
names.push(d[i].name)
chk = true
}
}
pbox.append(
'
' + '' + '" + "
"
)
}
parent.val(names.join(","))
pbox.attr("loaded", true)
$("input[type=checkbox]", pbox).change(function () {
var i = []
var n = []
$("input[type=checkbox]:checked", pbox).each(function () {
i.push($(this).val())
n.push($(this).attr("data-text"))
})
parent.val(n.join(","))
parent.attr("data-id", i.join(","))
})
},
})
},
reloadRole = function (parent, pbox) {
if (pbox.attr("loaded")) {
return
}
var uuid = parent.attr("uuid")
var ids = parent.attr("data-id").split(",")
var names = []
pbox.empty()
ajax({
url: "/web/role/getAll.json",
success: function (d) {
if (d.status != 1) {
return
}
var d = d.data.rows
for (var i = 0; i < d.length; i++) {
if (d[i].id == 1) {
continue
}
var chk = false
for (var j = 0; j < ids.length; j++) {
if (d[i].id == ids[j]) {
names.push(d[i].name)
chk = true
}
}
pbox.append(
'
' + '' + '" + "
"
)
}
parent.val(names.join(","))
pbox.attr("loaded", true)
$("input[type=checkbox]", pbox).change(function () {
var i = []
var n = []
$("input[type=checkbox]:checked", pbox).each(function () {
i.push($(this).val())
n.push($(this).attr("data-text"))
})
parent.val(n.join(","))
parent.attr("data-id", i.join(","))
})
},
})
},
toggleTree = function (e) {
var parent = $("[appcontent=type_3]", e),
poffset = parent.offset(),
ptree = parent.next("[id^=menu_select_tree]").eq(0)
ptree.css({
position: "fixed",
padding: "8px",
width: parent.width() + "px",
left: poffset.left + "px",
top: poffset.top - 1 + parent.outerHeight() + "px",
"z-index": 999,
})
reloadTree(parent, ptree)
ptree.stop().slideToggle("fast")
},
toggleSite = function (e) {
var parent = $("[name=siteIds]", e),
poffset = parent.offset(),
pbox = parent.next(".siteIdSelector").eq(0)
pbox.css({
border: "1px solid #ccc",
background: "#fff",
//position: "fixed",
padding: "8px",
width: parent.width() + "px",
left: poffset.left + "px",
top: poffset.top - 1 + parent.outerHeight() + "px",
"z-index": 999,
})
reloadSite(parent, pbox)
pbox.stop().slideToggle("fast")
},
toggleRole = function (e) {
var parent = $("[name=roleIds]", e),
poffset = parent.offset(),
pbox = parent.next(".roleSelector").eq(0)
pbox.css({
border: "1px solid #ccc",
background: "#fff",
//position: "fixed",
padding: "8px",
width: parent.width() + "px",
left: poffset.left + "px",
top: poffset.top - 1 + parent.outerHeight() + "px",
"z-index": 999,
})
reloadRole(parent, pbox)
pbox.stop().slideToggle("fast")
},
getAppData = function (e) {
var a = {}
return (
e.find("input[type=text],textarea").each(function () {
var e = $(this).attr("name")
if (e == "siteIds" || e == "roleIds") {
return
}
a[e] = $(this).val()
}),
e.find("input[type=checkbox]").each(function () {
var e = $(this).attr("name")
a[e] = "checked" == $(this).attr("checked") ? 1 : 0
}),
e.find("input[type=radio]").each(function () {
var e = $(this).attr("name")
if ("checked" == $(this).attr("checked")) {
a[e] = $(this).val()
return false
}
}),
(a.content = a.type == 3 ? e.find("[appcontent=type_3]").attr("data") : e.find("[appcontent=type_" + a.type + "]").val()),
(a.categoryId = e.find("[name=categoryId]").val()),
(a.siteIds = e.find("[name=siteIds]").attr("data-id")),
(a.roleIds = e.find("[name=roleIds]").attr("data-id")),
(a.icon = e.find("[name=icon]").val()),
a.icon == "" ? "oexe.png" : a.icon,
a
)
},
bindEvent = function (e) {
e
.find("[appcontent=type_3]")
.live("click", function () {
toggleTree(e)
})
.live("keypress", function () {
return false
}),
e
.find("[name=siteIds]")
.live("click", function () {
toggleSite(e)
})
.live("keypress", function () {
return false
}),
e
.find("[name=roleIds]")
.live("click", function () {
toggleRole(e)
})
.live("keypress", function () {
return false
})
e.find(".type input").change(function () {
var a = $(this).attr("apptype")
e.find("[data-type]").addClass("hidden"), e.find("[data-type=" + a + "]").removeClass("hidden"), e.find("[appcontent]").addClass("hidden"), e.find("[appcontent=" + a + "]").removeClass("hidden"), e.find("[id^=menu_select_tree_]").hide()
})
},
openAppEdit = function (obj, t, add_or_edit) {
var box,
url,
content,
title = add_or_edit == "add" ? LNG.app_create : LNG.app_edit,
boxId = UUID(),
pageContent,
staticPath = "" + "/images/"
ajax({
url: "app_edit.html",
async: !1,
success: function (cc) {
pageContent = cc
},
})
ajax({
url: "/web/app/category/getAll.json",
dataType: "json",
async: !1,
success: function (t) {
var cc = $(pageContent)
var cate = t.data.rows
for (var i in cate) {
if (cate[i].id != undefined) {
cc.find("#category").append('")
}
}
cc.find("#category").append('")
pageContent = cc.prop("outerHTML")
},
})
var tmpl = template.compile(pageContent),
content = tmpl({
LNG: LNG,
iconPath: staticPath,
uuid: boxId,
data: obj,
})
$.dialog({
fixed: !0,
width: 450,
id: boxId,
padding: 15,
title: title,
content: content,
button: [
{
name: LNG.preview,
callback: function () {
var e = getAppData(box)
return core.openApp(e), !1
},
},
{
name: LNG.button_save,
focus: !0,
callback: function () {
var e = getAppData(box)
if (add_or_edit == "edit") {
e.id = obj.id
}
ajax({
url: add_or_edit == "add" ? "/web/app/add.json" : "/web/app/modify.json",
type: "POST",
dataType: "json",
data: e,
beforeSend: function () {
core.tips.loading()
},
error: core.ajaxError,
success: function (e) {
core.tips.close(LNG.success)
if (e.status == 1)
if ("edit" == add_or_edit || "add" == add_or_edit) {
FrameCall.top("Openapp_store", "App.reload", '""')
} else "function" == typeof t ? t() : ui.f5()
},
})
},
},
],
})
;(box = $("." + boxId)),
box.find("[appcontent]").addClass("hidden"),
box.find("[appcontent=type_" + $(box.find("input[name=type]:checked")).val() + "]").removeClass("hidden"),
box.find("input[name=border]").attr("checked", obj.border == 1),
box.find("input[name=resize]").attr("checked", obj.resize == 1),
box.find("input[name=reopen]").attr("checked", obj.reopen == 1),
box.find("input[name=fullable]").attr("checked", obj.fullable == 1),
box.find("input[name=width]").attr("value", add_or_edit == "add" ? 800 : obj.width),
box.find("input[name=height]").attr("value", add_or_edit == "add" ? 600 : obj.height),
box.find("input[name=icon]").attr("value", obj.icon == "" ? "oexe.png" : obj.icon),
box.find("input[name=type]").each(function () {
var i = box.find("[appcontent=" + $(this).attr("apptype") + "]")
if (obj.type == 3 && obj.content) {
var cdata = eval("(" + obj.content + ")")
var is = []
for (var j = 0; j < cdata.length; j++) {
if (cdata[j] == null || cdata[j] == 0) {
continue
}
is.push(cdata[j])
}
i.attr("data-id", is.join(","))
} else {
i.val(obj.content)
}
})
var ptree = $("[appcontent=type_3]", box),
treebox = ptree.next("[id^=menu_select_tree]").eq(0)
reloadTree(ptree, treebox)
var psite = $("[name=siteIds]", box),
sitebox = psite.next(".siteIdSelector").eq(0)
reloadSite(psite, sitebox)
var ptype = $("[name=roleIds]", box),
typebox = ptype.next(".roleSelector").eq(0)
reloadRole(ptype, typebox)
bindEvent(box)
},
z = function () {
core.appStore()
},
E = function (e) {
;(e && 4 > e.length && "http" != e.substring(0, 4)) ||
ajax({
url: "index.html?get_url_title&url=" + e,
dataType: "json",
beforeSend: function () {
core.tips.loading()
},
success: function (a) {
var t = a.data
core.tips.close(a)
var i = {
content: "window.open('" + e + "');",
desc: "",
group: "others",
type: "app",
icon: "internet.png",
name: t,
resize: 1,
simple: 0,
height: "",
width: "",
},
n = urlEncode2(G.this_path + t)
;(e = "index.html?user_app&action=add&path=" + n),
ajax({
url: e,
type: "POST",
dataType: "json",
data: "data=" + urlEncode2(json_encode(i)),
success: function (e) {
core.tips.close(e), e.code && ui.f5()
},
})
},
})
}
return {
appEdit: openAppEdit,
appList: z,
appAddURL: E,
setBackground: h,
createLink: f,
newFile: s,
newFolder: o,
rname: r,
copy: c,
remove: l,
}
}),
define("desktop/pathOpen", [], function (e) {
var a = function (e, a) {
if (void 0 != e) {
if ((void 0 == a && (a = core.pathExt(e)), (a = a.toLowerCase()), "folder" == a)) return "explorer" == Config.pageApp ? ui.path.list(e + "/") : core.explorer(e), void 0
if ("oexe" != a) {
if (core.authCheck("explorer:fileDownload", LNG.no_permission_download)) {
if ("swf" == a) {
var n = core.path2url(e)
return s(n, core.ico("swf"), core.pathThis(e)), void 0
}
if ("pdf" == a) {
if (Config.isIE) return i(e), void 0
var c = "pdf" + UUID(),
n = core.path2url(e),
d = '