centaline-data-driven 1.2.65 → 1.2.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/centaline/dynamicDetail/src/dynamicPropertyDetailRET.vue +7 -3
- package/src/centaline/dynamicDetail/src/dynamicPropertySimpleDetailRET.vue +1 -1
- package/src/centaline/dynamicForm/src/dynamicFormListTable.vue +0 -2
- package/src/centaline/dynamicRichText/src/dynamicRichText.vue +14 -10
- package/src/centaline/loader/src/ctl/Detail.js +3 -1
- package/src/centaline/loader/src/ctl/FormList.js +0 -3
- package/wwwroot/static/centaline/centaline-data-driven.js +2 -2
- package/wwwroot/static/centaline/centaline-data-driven.js.map +1 -1
- package/static/UEditor/dialogs/anchor/anchor.html +0 -40
- package/static/UEditor/dialogs/attachment/attachment.css +0 -681
- package/static/UEditor/dialogs/attachment/attachment.html +0 -60
- package/static/UEditor/dialogs/attachment/attachment.js +0 -768
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_jpg.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
- package/static/UEditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
- package/static/UEditor/dialogs/attachment/images/alignicon.gif +0 -0
- package/static/UEditor/dialogs/attachment/images/alignicon.png +0 -0
- package/static/UEditor/dialogs/attachment/images/bg.png +0 -0
- package/static/UEditor/dialogs/attachment/images/file-icons.gif +0 -0
- package/static/UEditor/dialogs/attachment/images/file-icons.png +0 -0
- package/static/UEditor/dialogs/attachment/images/icons.gif +0 -0
- package/static/UEditor/dialogs/attachment/images/icons.png +0 -0
- package/static/UEditor/dialogs/attachment/images/image.png +0 -0
- package/static/UEditor/dialogs/attachment/images/progress.png +0 -0
- package/static/UEditor/dialogs/attachment/images/success.gif +0 -0
- package/static/UEditor/dialogs/attachment/images/success.png +0 -0
- package/static/UEditor/dialogs/background/background.css +0 -94
- package/static/UEditor/dialogs/background/background.html +0 -56
- package/static/UEditor/dialogs/background/background.js +0 -376
- package/static/UEditor/dialogs/background/images/bg.png +0 -0
- package/static/UEditor/dialogs/background/images/success.png +0 -0
- package/static/UEditor/dialogs/charts/chart.config.js +0 -65
- package/static/UEditor/dialogs/charts/charts.css +0 -165
- package/static/UEditor/dialogs/charts/charts.html +0 -89
- package/static/UEditor/dialogs/charts/charts.js +0 -519
- package/static/UEditor/dialogs/charts/images/charts0.png +0 -0
- package/static/UEditor/dialogs/charts/images/charts1.png +0 -0
- package/static/UEditor/dialogs/charts/images/charts2.png +0 -0
- package/static/UEditor/dialogs/charts/images/charts3.png +0 -0
- package/static/UEditor/dialogs/charts/images/charts4.png +0 -0
- package/static/UEditor/dialogs/charts/images/charts5.png +0 -0
- package/static/UEditor/dialogs/emotion/emotion.css +0 -43
- package/static/UEditor/dialogs/emotion/emotion.html +0 -54
- package/static/UEditor/dialogs/emotion/emotion.js +0 -186
- package/static/UEditor/dialogs/emotion/images/0.gif +0 -0
- package/static/UEditor/dialogs/emotion/images/bface.gif +0 -0
- package/static/UEditor/dialogs/emotion/images/cface.gif +0 -0
- package/static/UEditor/dialogs/emotion/images/fface.gif +0 -0
- package/static/UEditor/dialogs/emotion/images/jxface2.gif +0 -0
- package/static/UEditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
- package/static/UEditor/dialogs/emotion/images/tface.gif +0 -0
- package/static/UEditor/dialogs/emotion/images/wface.gif +0 -0
- package/static/UEditor/dialogs/emotion/images/yface.gif +0 -0
- package/static/UEditor/dialogs/gmap/gmap.html +0 -89
- package/static/UEditor/dialogs/help/help.css +0 -7
- package/static/UEditor/dialogs/help/help.html +0 -82
- package/static/UEditor/dialogs/help/help.js +0 -56
- package/static/UEditor/dialogs/image/image.css +0 -894
- package/static/UEditor/dialogs/image/image.html +0 -120
- package/static/UEditor/dialogs/image/image.js +0 -1156
- package/static/UEditor/dialogs/image/images/alignicon.jpg +0 -0
- package/static/UEditor/dialogs/image/images/bg.png +0 -0
- package/static/UEditor/dialogs/image/images/icons.gif +0 -0
- package/static/UEditor/dialogs/image/images/icons.png +0 -0
- package/static/UEditor/dialogs/image/images/image.png +0 -0
- package/static/UEditor/dialogs/image/images/progress.png +0 -0
- package/static/UEditor/dialogs/image/images/success.gif +0 -0
- package/static/UEditor/dialogs/image/images/success.png +0 -0
- package/static/UEditor/dialogs/insertframe/insertframe.html +0 -98
- package/static/UEditor/dialogs/internal.js +0 -81
- package/static/UEditor/dialogs/link/link.html +0 -126
- package/static/UEditor/dialogs/map/map.html +0 -135
- package/static/UEditor/dialogs/map/show.html +0 -118
- package/static/UEditor/dialogs/music/music.css +0 -30
- package/static/UEditor/dialogs/music/music.html +0 -32
- package/static/UEditor/dialogs/music/music.js +0 -192
- package/static/UEditor/dialogs/preview/preview.html +0 -40
- package/static/UEditor/dialogs/scrawl/images/addimg.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/brush.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/delimg.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/delimgH.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/empty.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/emptyH.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/eraser.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/redo.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/redoH.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/scale.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/scaleH.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/size.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/undo.png +0 -0
- package/static/UEditor/dialogs/scrawl/images/undoH.png +0 -0
- package/static/UEditor/dialogs/scrawl/scrawl.css +0 -72
- package/static/UEditor/dialogs/scrawl/scrawl.html +0 -95
- package/static/UEditor/dialogs/scrawl/scrawl.js +0 -671
- package/static/UEditor/dialogs/searchreplace/searchreplace.html +0 -102
- package/static/UEditor/dialogs/searchreplace/searchreplace.js +0 -164
- package/static/UEditor/dialogs/snapscreen/snapscreen.html +0 -58
- package/static/UEditor/dialogs/spechars/spechars.html +0 -21
- package/static/UEditor/dialogs/spechars/spechars.js +0 -57
- package/static/UEditor/dialogs/table/dragicon.png +0 -0
- package/static/UEditor/dialogs/table/edittable.css +0 -84
- package/static/UEditor/dialogs/table/edittable.html +0 -64
- package/static/UEditor/dialogs/table/edittable.js +0 -237
- package/static/UEditor/dialogs/table/edittd.html +0 -61
- package/static/UEditor/dialogs/table/edittip.html +0 -33
- package/static/UEditor/dialogs/template/config.js +0 -42
- package/static/UEditor/dialogs/template/images/bg.gif +0 -0
- package/static/UEditor/dialogs/template/images/pre0.png +0 -0
- package/static/UEditor/dialogs/template/images/pre1.png +0 -0
- package/static/UEditor/dialogs/template/images/pre2.png +0 -0
- package/static/UEditor/dialogs/template/images/pre3.png +0 -0
- package/static/UEditor/dialogs/template/images/pre4.png +0 -0
- package/static/UEditor/dialogs/template/template.css +0 -18
- package/static/UEditor/dialogs/template/template.html +0 -26
- package/static/UEditor/dialogs/template/template.js +0 -53
- package/static/UEditor/dialogs/video/images/bg.png +0 -0
- package/static/UEditor/dialogs/video/images/center_focus.jpg +0 -0
- package/static/UEditor/dialogs/video/images/file-icons.gif +0 -0
- package/static/UEditor/dialogs/video/images/file-icons.png +0 -0
- package/static/UEditor/dialogs/video/images/icons.gif +0 -0
- package/static/UEditor/dialogs/video/images/icons.png +0 -0
- package/static/UEditor/dialogs/video/images/image.png +0 -0
- package/static/UEditor/dialogs/video/images/left_focus.jpg +0 -0
- package/static/UEditor/dialogs/video/images/none_focus.jpg +0 -0
- package/static/UEditor/dialogs/video/images/progress.png +0 -0
- package/static/UEditor/dialogs/video/images/right_focus.jpg +0 -0
- package/static/UEditor/dialogs/video/images/success.gif +0 -0
- package/static/UEditor/dialogs/video/images/success.png +0 -0
- package/static/UEditor/dialogs/video/video.css +0 -635
- package/static/UEditor/dialogs/video/video.html +0 -86
- package/static/UEditor/dialogs/video/video.js +0 -797
- package/static/UEditor/dialogs/webapp/webapp.html +0 -53
- package/static/UEditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
- package/static/UEditor/dialogs/wordimage/imageUploader.swf +0 -0
- package/static/UEditor/dialogs/wordimage/tangram.js +0 -1495
- package/static/UEditor/dialogs/wordimage/wordimage.html +0 -110
- package/static/UEditor/dialogs/wordimage/wordimage.js +0 -157
- package/static/UEditor/index.html +0 -175
- package/static/UEditor/jsp/config.json +0 -94
- package/static/UEditor/jsp/controller.jsp +0 -14
- package/static/UEditor/jsp/lib/commons-codec-1.9.jar +0 -0
- package/static/UEditor/jsp/lib/commons-fileupload-1.3.1.jar +0 -0
- package/static/UEditor/jsp/lib/commons-io-2.4.jar +0 -0
- package/static/UEditor/jsp/lib/json.jar +0 -0
- package/static/UEditor/jsp/lib/ueditor-1.1.2.jar +0 -0
- package/static/UEditor/lang/en/en.js +0 -684
- package/static/UEditor/lang/en/images/addimage.png +0 -0
- package/static/UEditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
- package/static/UEditor/lang/en/images/alldeletebtnupskin.png +0 -0
- package/static/UEditor/lang/en/images/background.png +0 -0
- package/static/UEditor/lang/en/images/button.png +0 -0
- package/static/UEditor/lang/en/images/copy.png +0 -0
- package/static/UEditor/lang/en/images/deletedisable.png +0 -0
- package/static/UEditor/lang/en/images/deleteenable.png +0 -0
- package/static/UEditor/lang/en/images/listbackground.png +0 -0
- package/static/UEditor/lang/en/images/localimage.png +0 -0
- package/static/UEditor/lang/en/images/music.png +0 -0
- package/static/UEditor/lang/en/images/rotateleftdisable.png +0 -0
- package/static/UEditor/lang/en/images/rotateleftenable.png +0 -0
- package/static/UEditor/lang/en/images/rotaterightdisable.png +0 -0
- package/static/UEditor/lang/en/images/rotaterightenable.png +0 -0
- package/static/UEditor/lang/en/images/upload.png +0 -0
- package/static/UEditor/lang/zh-cn/images/copy.png +0 -0
- package/static/UEditor/lang/zh-cn/images/localimage.png +0 -0
- package/static/UEditor/lang/zh-cn/images/music.png +0 -0
- package/static/UEditor/lang/zh-cn/images/upload.png +0 -0
- package/static/UEditor/lang/zh-cn/zh-cn.js +0 -669
- package/static/UEditor/themes/default/css/ueditor.css +0 -1903
- package/static/UEditor/themes/default/css/ueditor.min.css +0 -8
- package/static/UEditor/themes/default/dialogbase.css +0 -100
- package/static/UEditor/themes/default/images/anchor.gif +0 -0
- package/static/UEditor/themes/default/images/arrow.png +0 -0
- package/static/UEditor/themes/default/images/arrow_down.png +0 -0
- package/static/UEditor/themes/default/images/arrow_up.png +0 -0
- package/static/UEditor/themes/default/images/button-bg.gif +0 -0
- package/static/UEditor/themes/default/images/cancelbutton.gif +0 -0
- package/static/UEditor/themes/default/images/charts.png +0 -0
- package/static/UEditor/themes/default/images/cursor_h.gif +0 -0
- package/static/UEditor/themes/default/images/cursor_h.png +0 -0
- package/static/UEditor/themes/default/images/cursor_v.gif +0 -0
- package/static/UEditor/themes/default/images/cursor_v.png +0 -0
- package/static/UEditor/themes/default/images/dialog-title-bg.png +0 -0
- package/static/UEditor/themes/default/images/filescan.png +0 -0
- package/static/UEditor/themes/default/images/highlighted.gif +0 -0
- package/static/UEditor/themes/default/images/icons-all.gif +0 -0
- package/static/UEditor/themes/default/images/icons.gif +0 -0
- package/static/UEditor/themes/default/images/icons.png +0 -0
- package/static/UEditor/themes/default/images/loaderror.png +0 -0
- package/static/UEditor/themes/default/images/loading.gif +0 -0
- package/static/UEditor/themes/default/images/lock.gif +0 -0
- package/static/UEditor/themes/default/images/neweditor-tab-bg.png +0 -0
- package/static/UEditor/themes/default/images/pagebreak.gif +0 -0
- package/static/UEditor/themes/default/images/scale.png +0 -0
- package/static/UEditor/themes/default/images/sortable.png +0 -0
- package/static/UEditor/themes/default/images/spacer.gif +0 -0
- package/static/UEditor/themes/default/images/sparator_v.png +0 -0
- package/static/UEditor/themes/default/images/table-cell-align.png +0 -0
- package/static/UEditor/themes/default/images/tangram-colorpicker.png +0 -0
- package/static/UEditor/themes/default/images/toolbar_bg.png +0 -0
- package/static/UEditor/themes/default/images/unhighlighted.gif +0 -0
- package/static/UEditor/themes/default/images/upload.png +0 -0
- package/static/UEditor/themes/default/images/videologo.gif +0 -0
- package/static/UEditor/themes/default/images/word.gif +0 -0
- package/static/UEditor/themes/default/images/wordpaste.png +0 -0
- package/static/UEditor/themes/iframe.css +0 -1
- package/static/UEditor/third-party/SyntaxHighlighter/shCore.js +0 -3655
- package/static/UEditor/third-party/SyntaxHighlighter/shCoreDefault.css +0 -1
- package/static/UEditor/third-party/codemirror/codemirror.css +0 -104
- package/static/UEditor/third-party/codemirror/codemirror.js +0 -3581
- package/static/UEditor/third-party/highcharts/adapters/mootools-adapter.js +0 -13
- package/static/UEditor/third-party/highcharts/adapters/mootools-adapter.src.js +0 -313
- package/static/UEditor/third-party/highcharts/adapters/prototype-adapter.js +0 -15
- package/static/UEditor/third-party/highcharts/adapters/prototype-adapter.src.js +0 -316
- package/static/UEditor/third-party/highcharts/adapters/standalone-framework.js +0 -17
- package/static/UEditor/third-party/highcharts/adapters/standalone-framework.src.js +0 -583
- package/static/UEditor/third-party/highcharts/highcharts-more.js +0 -50
- package/static/UEditor/third-party/highcharts/highcharts-more.src.js +0 -2430
- package/static/UEditor/third-party/highcharts/highcharts.js +0 -283
- package/static/UEditor/third-party/highcharts/highcharts.src.js +0 -16974
- package/static/UEditor/third-party/highcharts/modules/annotations.js +0 -7
- package/static/UEditor/third-party/highcharts/modules/annotations.src.js +0 -401
- package/static/UEditor/third-party/highcharts/modules/canvas-tools.js +0 -133
- package/static/UEditor/third-party/highcharts/modules/canvas-tools.src.js +0 -3113
- package/static/UEditor/third-party/highcharts/modules/data.js +0 -17
- package/static/UEditor/third-party/highcharts/modules/data.src.js +0 -582
- package/static/UEditor/third-party/highcharts/modules/drilldown.js +0 -11
- package/static/UEditor/third-party/highcharts/modules/drilldown.src.js +0 -447
- package/static/UEditor/third-party/highcharts/modules/exporting.js +0 -22
- package/static/UEditor/third-party/highcharts/modules/exporting.src.js +0 -709
- package/static/UEditor/third-party/highcharts/modules/funnel.js +0 -12
- package/static/UEditor/third-party/highcharts/modules/funnel.src.js +0 -289
- package/static/UEditor/third-party/highcharts/modules/heatmap.js +0 -1
- package/static/UEditor/third-party/highcharts/modules/heatmap.src.js +0 -53
- package/static/UEditor/third-party/highcharts/modules/map.js +0 -27
- package/static/UEditor/third-party/highcharts/modules/map.src.js +0 -1002
- package/static/UEditor/third-party/highcharts/modules/no-data-to-display.js +0 -12
- package/static/UEditor/third-party/highcharts/modules/no-data-to-display.src.js +0 -128
- package/static/UEditor/third-party/highcharts/themes/dark-blue.js +0 -254
- package/static/UEditor/third-party/highcharts/themes/dark-green.js +0 -255
- package/static/UEditor/third-party/highcharts/themes/gray.js +0 -257
- package/static/UEditor/third-party/highcharts/themes/grid.js +0 -103
- package/static/UEditor/third-party/highcharts/themes/skies.js +0 -89
- package/static/UEditor/third-party/jquery-1.10.2.js +0 -9789
- package/static/UEditor/third-party/jquery-1.10.2.min.js +0 -6
- package/static/UEditor/third-party/jquery-1.10.2.min.map +0 -1
- package/static/UEditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
- package/static/UEditor/third-party/video-js/font/vjs.eot +0 -0
- package/static/UEditor/third-party/video-js/font/vjs.svg +0 -65
- package/static/UEditor/third-party/video-js/font/vjs.ttf +0 -0
- package/static/UEditor/third-party/video-js/font/vjs.woff +0 -0
- package/static/UEditor/third-party/video-js/video-js.css +0 -766
- package/static/UEditor/third-party/video-js/video-js.min.css +0 -5
- package/static/UEditor/third-party/video-js/video-js.swf +0 -0
- package/static/UEditor/third-party/video-js/video.dev.js +0 -7106
- package/static/UEditor/third-party/video-js/video.js +0 -129
- package/static/UEditor/third-party/webuploader/Uploader.swf +0 -0
- package/static/UEditor/third-party/webuploader/webuploader.css +0 -28
- package/static/UEditor/third-party/webuploader/webuploader.custom.js +0 -5670
- package/static/UEditor/third-party/webuploader/webuploader.custom.min.js +0 -2
- package/static/UEditor/third-party/webuploader/webuploader.flashonly.js +0 -4176
- package/static/UEditor/third-party/webuploader/webuploader.flashonly.min.js +0 -2
- package/static/UEditor/third-party/webuploader/webuploader.html5only.js +0 -5559
- package/static/UEditor/third-party/webuploader/webuploader.html5only.min.js +0 -2
- package/static/UEditor/third-party/webuploader/webuploader.js +0 -6733
- package/static/UEditor/third-party/webuploader/webuploader.min.js +0 -2
- package/static/UEditor/third-party/webuploader/webuploader.withoutimage.js +0 -4593
- package/static/UEditor/third-party/webuploader/webuploader.withoutimage.min.js +0 -2
- package/static/UEditor/third-party/xss.min.js +0 -1
- package/static/UEditor/third-party/zeroclipboard/ZeroClipboard.js +0 -1256
- package/static/UEditor/third-party/zeroclipboard/ZeroClipboard.min.js +0 -9
- package/static/UEditor/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
- package/static/UEditor/ueditor.all.min.js +0 -29574
- package/static/UEditor/ueditor.config.js +0 -497
- package/static/UEditor/ueditor.parse.js +0 -1022
- package/static/UEditor/ueditor.parse.min.js +0 -7
|
@@ -1,768 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User: Jinqn
|
|
3
|
-
* Date: 14-04-08
|
|
4
|
-
* Time: 下午16:34
|
|
5
|
-
* 上传图片对话框逻辑代码,包括tab: 远程图片/上传图片/在线图片/搜索图片
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
(function () {
|
|
9
|
-
|
|
10
|
-
var uploadFile,
|
|
11
|
-
onlineFile;
|
|
12
|
-
|
|
13
|
-
window.onload = function () {
|
|
14
|
-
initTabs();
|
|
15
|
-
initButtons();
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/* 初始化tab标签 */
|
|
19
|
-
function initTabs() {
|
|
20
|
-
var tabs = $G('tabhead').children;
|
|
21
|
-
for (var i = 0; i < tabs.length; i++) {
|
|
22
|
-
domUtils.on(tabs[i], "click", function (e) {
|
|
23
|
-
var target = e.target || e.srcElement;
|
|
24
|
-
setTabFocus(target.getAttribute('data-content-id'));
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setTabFocus('upload');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/* 初始化tabbody */
|
|
32
|
-
function setTabFocus(id) {
|
|
33
|
-
if (!id) return;
|
|
34
|
-
var i, bodyId, tabs = $G('tabhead').children;
|
|
35
|
-
for (i = 0; i < tabs.length; i++) {
|
|
36
|
-
bodyId = tabs[i].getAttribute('data-content-id')
|
|
37
|
-
if (bodyId == id) {
|
|
38
|
-
domUtils.addClass(tabs[i], 'focus');
|
|
39
|
-
domUtils.addClass($G(bodyId), 'focus');
|
|
40
|
-
} else {
|
|
41
|
-
domUtils.removeClasses(tabs[i], 'focus');
|
|
42
|
-
domUtils.removeClasses($G(bodyId), 'focus');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
switch (id) {
|
|
46
|
-
case 'upload':
|
|
47
|
-
uploadFile = uploadFile || new UploadFile('queueList');
|
|
48
|
-
break;
|
|
49
|
-
case 'online':
|
|
50
|
-
onlineFile = onlineFile || new OnlineFile('fileList');
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* 初始化onok事件 */
|
|
56
|
-
function initButtons() {
|
|
57
|
-
|
|
58
|
-
dialog.onok = function () {
|
|
59
|
-
var list = [], id, tabs = $G('tabhead').children;
|
|
60
|
-
for (var i = 0; i < tabs.length; i++) {
|
|
61
|
-
if (domUtils.hasClass(tabs[i], 'focus')) {
|
|
62
|
-
id = tabs[i].getAttribute('data-content-id');
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
switch (id) {
|
|
68
|
-
case 'upload':
|
|
69
|
-
list = uploadFile.getInsertList();
|
|
70
|
-
var count = uploadFile.getQueueCount();
|
|
71
|
-
if (count) {
|
|
72
|
-
$('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
case 'online':
|
|
77
|
-
list = onlineFile.getInsertList();
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
editor.execCommand('insertfile', list);
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/* 上传附件 */
|
|
87
|
-
function UploadFile(target) {
|
|
88
|
-
this.$wrap = target.constructor == String ? $('#' + target) : $(target);
|
|
89
|
-
this.init();
|
|
90
|
-
}
|
|
91
|
-
UploadFile.prototype = {
|
|
92
|
-
init: function () {
|
|
93
|
-
this.fileList = [];
|
|
94
|
-
this.initContainer();
|
|
95
|
-
this.initUploader();
|
|
96
|
-
},
|
|
97
|
-
initContainer: function () {
|
|
98
|
-
this.$queue = this.$wrap.find('.filelist');
|
|
99
|
-
},
|
|
100
|
-
/* 初始化容器 */
|
|
101
|
-
initUploader: function () {
|
|
102
|
-
var _this = this,
|
|
103
|
-
$ = jQuery, // just in case. Make sure it's not an other libaray.
|
|
104
|
-
$wrap = _this.$wrap,
|
|
105
|
-
// 图片容器
|
|
106
|
-
$queue = $wrap.find('.filelist'),
|
|
107
|
-
// 状态栏,包括进度和控制按钮
|
|
108
|
-
$statusBar = $wrap.find('.statusBar'),
|
|
109
|
-
// 文件总体选择信息。
|
|
110
|
-
$info = $statusBar.find('.info'),
|
|
111
|
-
// 上传按钮
|
|
112
|
-
$upload = $wrap.find('.uploadBtn'),
|
|
113
|
-
// 上传按钮
|
|
114
|
-
$filePickerBtn = $wrap.find('.filePickerBtn'),
|
|
115
|
-
// 上传按钮
|
|
116
|
-
$filePickerBlock = $wrap.find('.filePickerBlock'),
|
|
117
|
-
// 没选择文件之前的内容。
|
|
118
|
-
$placeHolder = $wrap.find('.placeholder'),
|
|
119
|
-
// 总体进度条
|
|
120
|
-
$progress = $statusBar.find('.progress').hide(),
|
|
121
|
-
// 添加的文件数量
|
|
122
|
-
fileCount = 0,
|
|
123
|
-
// 添加的文件总大小
|
|
124
|
-
fileSize = 0,
|
|
125
|
-
// 优化retina, 在retina下这个值是2
|
|
126
|
-
ratio = window.devicePixelRatio || 1,
|
|
127
|
-
// 缩略图大小
|
|
128
|
-
thumbnailWidth = 113 * ratio,
|
|
129
|
-
thumbnailHeight = 113 * ratio,
|
|
130
|
-
// 可能有pedding, ready, uploading, confirm, done.
|
|
131
|
-
state = '',
|
|
132
|
-
// 所有文件的进度信息,key为file id
|
|
133
|
-
percentages = {},
|
|
134
|
-
supportTransition = (function () {
|
|
135
|
-
var s = document.createElement('p').style,
|
|
136
|
-
r = 'transition' in s ||
|
|
137
|
-
'WebkitTransition' in s ||
|
|
138
|
-
'MozTransition' in s ||
|
|
139
|
-
'msTransition' in s ||
|
|
140
|
-
'OTransition' in s;
|
|
141
|
-
s = null;
|
|
142
|
-
return r;
|
|
143
|
-
})(),
|
|
144
|
-
// WebUploader实例
|
|
145
|
-
uploader,
|
|
146
|
-
actionUrl = editor.getActionUrl(editor.getOpt('fileActionName')),
|
|
147
|
-
fileMaxSize = editor.getOpt('fileMaxSize'),
|
|
148
|
-
acceptExtensions = (editor.getOpt('fileAllowFiles') || []).join('').replace(/\./g, ',').replace(/^[,]/, '');;
|
|
149
|
-
|
|
150
|
-
if (!WebUploader.Uploader.support()) {
|
|
151
|
-
$('#filePickerReady').after($('<div>').html(lang.errorNotSupport)).hide();
|
|
152
|
-
return;
|
|
153
|
-
} else if (!editor.getOpt('fileActionName')) {
|
|
154
|
-
$('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
uploader = _this.uploader = WebUploader.create({
|
|
159
|
-
pick: {
|
|
160
|
-
id: '#filePickerReady',
|
|
161
|
-
label: lang.uploadSelectFile
|
|
162
|
-
},
|
|
163
|
-
swf: '../../third-party/webuploader/Uploader.swf',
|
|
164
|
-
server: actionUrl,
|
|
165
|
-
fileVal: editor.getOpt('fileFieldName'),
|
|
166
|
-
duplicate: true,
|
|
167
|
-
fileSingleSizeLimit: fileMaxSize,
|
|
168
|
-
compress: false
|
|
169
|
-
});
|
|
170
|
-
uploader.addButton({
|
|
171
|
-
id: '#filePickerBlock'
|
|
172
|
-
});
|
|
173
|
-
uploader.addButton({
|
|
174
|
-
id: '#filePickerBtn',
|
|
175
|
-
label: lang.uploadAddFile
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
setState('pedding');
|
|
179
|
-
|
|
180
|
-
// 当有文件添加进来时执行,负责view的创建
|
|
181
|
-
function addFile(file) {
|
|
182
|
-
var $li = $('<li id="' + file.id + '">' +
|
|
183
|
-
'<p class="title">' + file.name + '</p>' +
|
|
184
|
-
'<p class="imgWrap"></p>' +
|
|
185
|
-
'<p class="progress"><span></span></p>' +
|
|
186
|
-
'</li>'),
|
|
187
|
-
|
|
188
|
-
$btns = $('<div class="file-panel">' +
|
|
189
|
-
'<span class="cancel">' + lang.uploadDelete + '</span>' +
|
|
190
|
-
'<span class="rotateRight">' + lang.uploadTurnRight + '</span>' +
|
|
191
|
-
'<span class="rotateLeft">' + lang.uploadTurnLeft + '</span></div>').appendTo($li),
|
|
192
|
-
$prgress = $li.find('p.progress span'),
|
|
193
|
-
$wrap = $li.find('p.imgWrap'),
|
|
194
|
-
$info = $('<p class="error"></p>').hide().appendTo($li),
|
|
195
|
-
|
|
196
|
-
showError = function (code) {
|
|
197
|
-
switch (code) {
|
|
198
|
-
case 'exceed_size':
|
|
199
|
-
text = lang.errorExceedSize;
|
|
200
|
-
break;
|
|
201
|
-
case 'interrupt':
|
|
202
|
-
text = lang.errorInterrupt;
|
|
203
|
-
break;
|
|
204
|
-
case 'http':
|
|
205
|
-
text = lang.errorHttp;
|
|
206
|
-
break;
|
|
207
|
-
case 'not_allow_type':
|
|
208
|
-
text = lang.errorFileType;
|
|
209
|
-
break;
|
|
210
|
-
default:
|
|
211
|
-
text = lang.errorUploadRetry;
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
$info.text(text).show();
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
if (file.getStatus() === 'invalid') {
|
|
218
|
-
showError(file.statusText);
|
|
219
|
-
} else {
|
|
220
|
-
$wrap.text(lang.uploadPreview);
|
|
221
|
-
if ('|png|jpg|jpeg|bmp|gif|'.indexOf('|' + file.ext.toLowerCase() + '|') == -1) {
|
|
222
|
-
$wrap.empty().addClass('notimage').append('<i class="file-preview file-type-' + file.ext.toLowerCase() + '"></i>' +
|
|
223
|
-
'<span class="file-title" title="' + file.name + '">' + file.name + '</span>');
|
|
224
|
-
} else {
|
|
225
|
-
if (browser.ie && browser.version <= 7) {
|
|
226
|
-
$wrap.text(lang.uploadNoPreview);
|
|
227
|
-
} else {
|
|
228
|
-
uploader.makeThumb(file, function (error, src) {
|
|
229
|
-
if (error || !src) {
|
|
230
|
-
$wrap.text(lang.uploadNoPreview);
|
|
231
|
-
} else {
|
|
232
|
-
var $img = $('<img src="' + src + '">');
|
|
233
|
-
$wrap.empty().append($img);
|
|
234
|
-
$img.on('error', function () {
|
|
235
|
-
$wrap.text(lang.uploadNoPreview);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}, thumbnailWidth, thumbnailHeight);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
percentages[file.id] = [file.size, 0];
|
|
242
|
-
file.rotation = 0;
|
|
243
|
-
|
|
244
|
-
/* 检查文件格式 */
|
|
245
|
-
if (!file.ext || acceptExtensions.indexOf(file.ext.toLowerCase()) == -1) {
|
|
246
|
-
showError('not_allow_type');
|
|
247
|
-
uploader.removeFile(file);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
file.on('statuschange', function (cur, prev) {
|
|
252
|
-
if (prev === 'progress') {
|
|
253
|
-
$prgress.hide().width(0);
|
|
254
|
-
} else if (prev === 'queued') {
|
|
255
|
-
$li.off('mouseenter mouseleave');
|
|
256
|
-
$btns.remove();
|
|
257
|
-
}
|
|
258
|
-
// 成功
|
|
259
|
-
if (cur === 'error' || cur === 'invalid') {
|
|
260
|
-
showError(file.statusText);
|
|
261
|
-
percentages[file.id][1] = 1;
|
|
262
|
-
} else if (cur === 'interrupt') {
|
|
263
|
-
showError('interrupt');
|
|
264
|
-
} else if (cur === 'queued') {
|
|
265
|
-
percentages[file.id][1] = 0;
|
|
266
|
-
} else if (cur === 'progress') {
|
|
267
|
-
$info.hide();
|
|
268
|
-
$prgress.css('display', 'block');
|
|
269
|
-
} else if (cur === 'complete') {
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
$li.removeClass('state-' + prev).addClass('state-' + cur);
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
$li.on('mouseenter', function () {
|
|
276
|
-
$btns.stop().animate({ height: 30 });
|
|
277
|
-
});
|
|
278
|
-
$li.on('mouseleave', function () {
|
|
279
|
-
$btns.stop().animate({ height: 0 });
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
$btns.on('click', 'span', function () {
|
|
283
|
-
var index = $(this).index(),
|
|
284
|
-
deg;
|
|
285
|
-
|
|
286
|
-
switch (index) {
|
|
287
|
-
case 0:
|
|
288
|
-
uploader.removeFile(file);
|
|
289
|
-
return;
|
|
290
|
-
case 1:
|
|
291
|
-
file.rotation += 90;
|
|
292
|
-
break;
|
|
293
|
-
case 2:
|
|
294
|
-
file.rotation -= 90;
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (supportTransition) {
|
|
299
|
-
deg = 'rotate(' + file.rotation + 'deg)';
|
|
300
|
-
$wrap.css({
|
|
301
|
-
'-webkit-transform': deg,
|
|
302
|
-
'-mos-transform': deg,
|
|
303
|
-
'-o-transform': deg,
|
|
304
|
-
'transform': deg
|
|
305
|
-
});
|
|
306
|
-
} else {
|
|
307
|
-
$wrap.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + (~~((file.rotation / 90) % 4 + 4) % 4) + ')');
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
$li.insertBefore($filePickerBlock);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// 负责view的销毁
|
|
316
|
-
function removeFile(file) {
|
|
317
|
-
var $li = $('#' + file.id);
|
|
318
|
-
delete percentages[file.id];
|
|
319
|
-
updateTotalProgress();
|
|
320
|
-
$li.off().find('.file-panel').off().end().remove();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function updateTotalProgress() {
|
|
324
|
-
var loaded = 0,
|
|
325
|
-
total = 0,
|
|
326
|
-
spans = $progress.children(),
|
|
327
|
-
percent;
|
|
328
|
-
|
|
329
|
-
$.each(percentages, function (k, v) {
|
|
330
|
-
total += v[0];
|
|
331
|
-
loaded += v[0] * v[1];
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
percent = total ? loaded / total : 0;
|
|
335
|
-
|
|
336
|
-
spans.eq(0).text(Math.round(percent * 100) + '%');
|
|
337
|
-
spans.eq(1).css('width', Math.round(percent * 100) + '%');
|
|
338
|
-
updateStatus();
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
function setState(val, files) {
|
|
342
|
-
|
|
343
|
-
if (val != state) {
|
|
344
|
-
|
|
345
|
-
var stats = uploader.getStats();
|
|
346
|
-
|
|
347
|
-
$upload.removeClass('state-' + state);
|
|
348
|
-
$upload.addClass('state-' + val);
|
|
349
|
-
|
|
350
|
-
switch (val) {
|
|
351
|
-
|
|
352
|
-
/* 未选择文件 */
|
|
353
|
-
case 'pedding':
|
|
354
|
-
$queue.addClass('element-invisible');
|
|
355
|
-
$statusBar.addClass('element-invisible');
|
|
356
|
-
$placeHolder.removeClass('element-invisible');
|
|
357
|
-
$progress.hide(); $info.hide();
|
|
358
|
-
uploader.refresh();
|
|
359
|
-
break;
|
|
360
|
-
|
|
361
|
-
/* 可以开始上传 */
|
|
362
|
-
case 'ready':
|
|
363
|
-
$placeHolder.addClass('element-invisible');
|
|
364
|
-
$queue.removeClass('element-invisible');
|
|
365
|
-
$statusBar.removeClass('element-invisible');
|
|
366
|
-
$progress.hide(); $info.show();
|
|
367
|
-
$upload.text(lang.uploadStart);
|
|
368
|
-
uploader.refresh();
|
|
369
|
-
break;
|
|
370
|
-
|
|
371
|
-
/* 上传中 */
|
|
372
|
-
case 'uploading':
|
|
373
|
-
$progress.show(); $info.hide();
|
|
374
|
-
$upload.text(lang.uploadPause);
|
|
375
|
-
break;
|
|
376
|
-
|
|
377
|
-
/* 暂停上传 */
|
|
378
|
-
case 'paused':
|
|
379
|
-
$progress.show(); $info.hide();
|
|
380
|
-
$upload.text(lang.uploadContinue);
|
|
381
|
-
break;
|
|
382
|
-
|
|
383
|
-
case 'confirm':
|
|
384
|
-
$progress.show(); $info.hide();
|
|
385
|
-
$upload.text(lang.uploadStart);
|
|
386
|
-
|
|
387
|
-
stats = uploader.getStats();
|
|
388
|
-
if (stats.successNum && !stats.uploadFailNum) {
|
|
389
|
-
setState('finish');
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
break;
|
|
393
|
-
|
|
394
|
-
case 'finish':
|
|
395
|
-
$progress.hide(); $info.show();
|
|
396
|
-
if (stats.uploadFailNum) {
|
|
397
|
-
$upload.text(lang.uploadRetry);
|
|
398
|
-
} else {
|
|
399
|
-
$upload.text(lang.uploadStart);
|
|
400
|
-
}
|
|
401
|
-
break;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
state = val;
|
|
405
|
-
updateStatus();
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
if (!_this.getQueueCount()) {
|
|
410
|
-
$upload.addClass('disabled')
|
|
411
|
-
} else {
|
|
412
|
-
$upload.removeClass('disabled')
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function updateStatus() {
|
|
418
|
-
var text = '', stats;
|
|
419
|
-
|
|
420
|
-
if (state === 'ready') {
|
|
421
|
-
text = lang.updateStatusReady.replace('_', fileCount).replace('_KB', WebUploader.formatSize(fileSize));
|
|
422
|
-
} else if (state === 'confirm') {
|
|
423
|
-
stats = uploader.getStats();
|
|
424
|
-
if (stats.uploadFailNum) {
|
|
425
|
-
text = lang.updateStatusConfirm.replace('_', stats.successNum).replace('_', stats.successNum);
|
|
426
|
-
}
|
|
427
|
-
} else {
|
|
428
|
-
stats = uploader.getStats();
|
|
429
|
-
text = lang.updateStatusFinish.replace('_', fileCount).
|
|
430
|
-
replace('_KB', WebUploader.formatSize(fileSize)).
|
|
431
|
-
replace('_', stats.successNum);
|
|
432
|
-
|
|
433
|
-
if (stats.uploadFailNum) {
|
|
434
|
-
text += lang.updateStatusError.replace('_', stats.uploadFailNum);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
$info.html(text);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
uploader.on('fileQueued', function (file) {
|
|
442
|
-
fileCount++;
|
|
443
|
-
fileSize += file.size;
|
|
444
|
-
|
|
445
|
-
if (fileCount === 1) {
|
|
446
|
-
$placeHolder.addClass('element-invisible');
|
|
447
|
-
$statusBar.show();
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
addFile(file);
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
uploader.on('fileDequeued', function (file) {
|
|
454
|
-
fileCount--;
|
|
455
|
-
fileSize -= file.size;
|
|
456
|
-
|
|
457
|
-
removeFile(file);
|
|
458
|
-
updateTotalProgress();
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
uploader.on('filesQueued', function (file) {
|
|
462
|
-
if (!uploader.isInProgress() && (state == 'pedding' || state == 'finish' || state == 'confirm' || state == 'ready')) {
|
|
463
|
-
setState('ready');
|
|
464
|
-
}
|
|
465
|
-
updateTotalProgress();
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
uploader.on('all', function (type, files) {
|
|
469
|
-
switch (type) {
|
|
470
|
-
case 'uploadFinished':
|
|
471
|
-
setState('confirm', files);
|
|
472
|
-
break;
|
|
473
|
-
case 'startUpload':
|
|
474
|
-
/* 添加额外的GET参数 */
|
|
475
|
-
var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '',
|
|
476
|
-
url = utils.formatUrl(actionUrl + (actionUrl.indexOf('?') == -1 ? '?' : '&') + 'encode=utf-8&' + params);
|
|
477
|
-
uploader.option('server', url);
|
|
478
|
-
setState('uploading', files);
|
|
479
|
-
break;
|
|
480
|
-
case 'stopUpload':
|
|
481
|
-
setState('paused', files);
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
uploader.on('uploadBeforeSend', function (file, data, header) {
|
|
487
|
-
//这里可以通过data对象添加POST参数
|
|
488
|
-
header['X_Requested_With'] = 'XMLHttpRequest';
|
|
489
|
-
// HaoChuan9421
|
|
490
|
-
if (editor.options.headers && Object.prototype.toString.apply(editor.options.headers) === "[object Object]") {
|
|
491
|
-
for (var key in editor.options.headers) {
|
|
492
|
-
header[key] = editor.options.headers[key]
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
uploader.on('uploadProgress', function (file, percentage) {
|
|
498
|
-
var $li = $('#' + file.id),
|
|
499
|
-
$percent = $li.find('.progress span');
|
|
500
|
-
|
|
501
|
-
$percent.css('width', percentage * 100 + '%');
|
|
502
|
-
percentages[file.id][1] = percentage;
|
|
503
|
-
updateTotalProgress();
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
uploader.on('uploadSuccess', function (file, ret) {
|
|
507
|
-
var $file = $('#' + file.id);
|
|
508
|
-
try {
|
|
509
|
-
var responseText = (ret._raw || ret),
|
|
510
|
-
json = utils.str2json(responseText);
|
|
511
|
-
if (json.rtnCode == '200') {
|
|
512
|
-
_this.fileList.push(
|
|
513
|
-
{
|
|
514
|
-
original: json.content[0].fileName,
|
|
515
|
-
state: "SUCCESS",
|
|
516
|
-
title: json.content[0].fileName,
|
|
517
|
-
type: "."+json.content[0].fileExtension,
|
|
518
|
-
url: json.content[0].mediaUrl
|
|
519
|
-
}
|
|
520
|
-
);
|
|
521
|
-
$file.append('<span class="success"></span>');
|
|
522
|
-
} else {
|
|
523
|
-
$file.find('.error').text(json.rtnCode + json.rtnMsg).show();
|
|
524
|
-
}
|
|
525
|
-
} catch (e) {
|
|
526
|
-
$file.find('.error').text(lang.errorServerUpload).show();
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
uploader.on('uploadError', function (file, code) {
|
|
531
|
-
});
|
|
532
|
-
uploader.on('error', function (code, file) {
|
|
533
|
-
if (code == 'Q_TYPE_DENIED' || code == 'F_EXCEED_SIZE') {
|
|
534
|
-
addFile(file);
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
uploader.on('uploadComplete', function (file, ret) {
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
$upload.on('click', function () {
|
|
541
|
-
if ($(this).hasClass('disabled')) {
|
|
542
|
-
return false;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
if (state === 'ready') {
|
|
546
|
-
uploader.upload();
|
|
547
|
-
} else if (state === 'paused') {
|
|
548
|
-
uploader.upload();
|
|
549
|
-
} else if (state === 'uploading') {
|
|
550
|
-
uploader.stop();
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
-
$upload.addClass('state-' + state);
|
|
555
|
-
updateTotalProgress();
|
|
556
|
-
},
|
|
557
|
-
getQueueCount: function () {
|
|
558
|
-
var file, i, status, readyFile = 0, files = this.uploader.getFiles();
|
|
559
|
-
for (i = 0; file = files[i++];) {
|
|
560
|
-
status = file.getStatus();
|
|
561
|
-
if (status == 'queued' || status == 'uploading' || status == 'progress') readyFile++;
|
|
562
|
-
}
|
|
563
|
-
return readyFile;
|
|
564
|
-
},
|
|
565
|
-
getInsertList: function () {
|
|
566
|
-
var i, link, data, list = [],
|
|
567
|
-
prefix = editor.getOpt('fileUrlPrefix');
|
|
568
|
-
for (i = 0; i < this.fileList.length; i++) {
|
|
569
|
-
data = this.fileList[i];
|
|
570
|
-
link = data.url;
|
|
571
|
-
list.push({
|
|
572
|
-
title: data.original || link.substr(link.lastIndexOf('/') + 1),
|
|
573
|
-
url: prefix + link
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
return list;
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
/* 在线附件 */
|
|
582
|
-
function OnlineFile(target) {
|
|
583
|
-
this.container = utils.isString(target) ? document.getElementById(target) : target;
|
|
584
|
-
this.init();
|
|
585
|
-
}
|
|
586
|
-
OnlineFile.prototype = {
|
|
587
|
-
init: function () {
|
|
588
|
-
this.initContainer();
|
|
589
|
-
this.initEvents();
|
|
590
|
-
this.initData();
|
|
591
|
-
},
|
|
592
|
-
/* 初始化容器 */
|
|
593
|
-
initContainer: function () {
|
|
594
|
-
this.container.innerHTML = '';
|
|
595
|
-
this.list = document.createElement('ul');
|
|
596
|
-
this.clearFloat = document.createElement('li');
|
|
597
|
-
|
|
598
|
-
domUtils.addClass(this.list, 'list');
|
|
599
|
-
domUtils.addClass(this.clearFloat, 'clearFloat');
|
|
600
|
-
|
|
601
|
-
this.list.appendChild(this.clearFloat);
|
|
602
|
-
this.container.appendChild(this.list);
|
|
603
|
-
},
|
|
604
|
-
/* 初始化滚动事件,滚动到地步自动拉取数据 */
|
|
605
|
-
initEvents: function () {
|
|
606
|
-
var _this = this;
|
|
607
|
-
|
|
608
|
-
/* 滚动拉取图片 */
|
|
609
|
-
domUtils.on($G('fileList'), 'scroll', function (e) {
|
|
610
|
-
var panel = this;
|
|
611
|
-
if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
|
|
612
|
-
_this.getFileData();
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
/* 选中图片 */
|
|
616
|
-
domUtils.on(this.list, 'click', function (e) {
|
|
617
|
-
var target = e.target || e.srcElement,
|
|
618
|
-
li = target.parentNode;
|
|
619
|
-
|
|
620
|
-
if (li.tagName.toLowerCase() == 'li') {
|
|
621
|
-
if (domUtils.hasClass(li, 'selected')) {
|
|
622
|
-
domUtils.removeClasses(li, 'selected');
|
|
623
|
-
} else {
|
|
624
|
-
domUtils.addClass(li, 'selected');
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
},
|
|
629
|
-
/* 初始化第一次的数据 */
|
|
630
|
-
initData: function () {
|
|
631
|
-
|
|
632
|
-
/* 拉取数据需要使用的值 */
|
|
633
|
-
this.state = 0;
|
|
634
|
-
this.listSize = editor.getOpt('fileManagerListSize');
|
|
635
|
-
this.listIndex = 0;
|
|
636
|
-
this.listEnd = false;
|
|
637
|
-
|
|
638
|
-
/* 第一次拉取数据 */
|
|
639
|
-
this.getFileData();
|
|
640
|
-
},
|
|
641
|
-
/* 向后台拉取图片列表数据 */
|
|
642
|
-
getFileData: function () {
|
|
643
|
-
var _this = this;
|
|
644
|
-
|
|
645
|
-
if (!_this.listEnd && !this.isLoadingData) {
|
|
646
|
-
this.isLoadingData = true;
|
|
647
|
-
ajax.request(editor.getActionUrl(editor.getOpt('fileManagerActionName')), {
|
|
648
|
-
timeout: 100000,
|
|
649
|
-
data: utils.extend({
|
|
650
|
-
start: this.listIndex,
|
|
651
|
-
size: this.listSize
|
|
652
|
-
}, editor.queryCommandValue('serverparam')),
|
|
653
|
-
method: 'get',
|
|
654
|
-
onsuccess: function (r) {
|
|
655
|
-
try {
|
|
656
|
-
var json = eval('(' + r.responseText + ')');
|
|
657
|
-
if (json.state == 'SUCCESS') {
|
|
658
|
-
_this.pushData(json.list);
|
|
659
|
-
_this.listIndex = parseInt(json.start) + parseInt(json.list.length);
|
|
660
|
-
if (_this.listIndex >= json.total) {
|
|
661
|
-
_this.listEnd = true;
|
|
662
|
-
}
|
|
663
|
-
_this.isLoadingData = false;
|
|
664
|
-
}
|
|
665
|
-
} catch (e) {
|
|
666
|
-
if (r.responseText.indexOf('ue_separate_ue') != -1) {
|
|
667
|
-
var list = r.responseText.split(r.responseText);
|
|
668
|
-
_this.pushData(list);
|
|
669
|
-
_this.listIndex = parseInt(list.length);
|
|
670
|
-
_this.listEnd = true;
|
|
671
|
-
_this.isLoadingData = false;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
},
|
|
675
|
-
onerror: function () {
|
|
676
|
-
_this.isLoadingData = false;
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
},
|
|
681
|
-
/* 添加图片到列表界面上 */
|
|
682
|
-
pushData: function (list) {
|
|
683
|
-
var i, item, img, filetype, preview, icon, _this = this,
|
|
684
|
-
urlPrefix = editor.getOpt('fileManagerUrlPrefix');
|
|
685
|
-
for (i = 0; i < list.length; i++) {
|
|
686
|
-
if (list[i] && list[i].url) {
|
|
687
|
-
item = document.createElement('li');
|
|
688
|
-
icon = document.createElement('span');
|
|
689
|
-
filetype = list[i].url.substr(list[i].url.lastIndexOf('.') + 1);
|
|
690
|
-
|
|
691
|
-
if ("png|jpg|jpeg|gif|bmp".indexOf(filetype) != -1) {
|
|
692
|
-
preview = document.createElement('img');
|
|
693
|
-
domUtils.on(preview, 'load', (function (image) {
|
|
694
|
-
return function () {
|
|
695
|
-
_this.scale(image, image.parentNode.offsetWidth, image.parentNode.offsetHeight);
|
|
696
|
-
};
|
|
697
|
-
})(preview));
|
|
698
|
-
preview.width = 113;
|
|
699
|
-
preview.setAttribute('src', urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=' : '&noCache=') + (+new Date()).toString(36));
|
|
700
|
-
} else {
|
|
701
|
-
var ic = document.createElement('i'),
|
|
702
|
-
textSpan = document.createElement('span');
|
|
703
|
-
textSpan.innerHTML = list[i].url.substr(list[i].url.lastIndexOf('/') + 1);
|
|
704
|
-
preview = document.createElement('div');
|
|
705
|
-
preview.appendChild(ic);
|
|
706
|
-
preview.appendChild(textSpan);
|
|
707
|
-
domUtils.addClass(preview, 'file-wrapper');
|
|
708
|
-
domUtils.addClass(textSpan, 'file-title');
|
|
709
|
-
domUtils.addClass(ic, 'file-type-' + filetype);
|
|
710
|
-
domUtils.addClass(ic, 'file-preview');
|
|
711
|
-
}
|
|
712
|
-
domUtils.addClass(icon, 'icon');
|
|
713
|
-
item.setAttribute('data-url', urlPrefix + list[i].url);
|
|
714
|
-
if (list[i].original) {
|
|
715
|
-
item.setAttribute('data-title', list[i].original);
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
item.appendChild(preview);
|
|
719
|
-
item.appendChild(icon);
|
|
720
|
-
this.list.insertBefore(item, this.clearFloat);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
/* 改变图片大小 */
|
|
725
|
-
scale: function (img, w, h, type) {
|
|
726
|
-
var ow = img.width,
|
|
727
|
-
oh = img.height;
|
|
728
|
-
|
|
729
|
-
if (type == 'justify') {
|
|
730
|
-
if (ow >= oh) {
|
|
731
|
-
img.width = w;
|
|
732
|
-
img.height = h * oh / ow;
|
|
733
|
-
img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
|
|
734
|
-
} else {
|
|
735
|
-
img.width = w * ow / oh;
|
|
736
|
-
img.height = h;
|
|
737
|
-
img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
|
|
738
|
-
}
|
|
739
|
-
} else {
|
|
740
|
-
if (ow >= oh) {
|
|
741
|
-
img.width = w * ow / oh;
|
|
742
|
-
img.height = h;
|
|
743
|
-
img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
|
|
744
|
-
} else {
|
|
745
|
-
img.width = w;
|
|
746
|
-
img.height = h * oh / ow;
|
|
747
|
-
img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
getInsertList: function () {
|
|
752
|
-
var i, lis = this.list.children, list = [];
|
|
753
|
-
for (i = 0; i < lis.length; i++) {
|
|
754
|
-
if (domUtils.hasClass(lis[i], 'selected')) {
|
|
755
|
-
var url = lis[i].getAttribute('data-url');
|
|
756
|
-
var title = lis[i].getAttribute('data-title') || url.substr(url.lastIndexOf('/') + 1);
|
|
757
|
-
list.push({
|
|
758
|
-
title: title,
|
|
759
|
-
url: url
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
return list;
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
})();
|