rails_kindeditor_upyun 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +6 -0
- data/README.md +523 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/kindeditor.js +1 -0
- data/app/controllers/kindeditor/assets_controller.rb +126 -0
- data/app/uploaders/kindeditor/asset_uploader.rb +91 -0
- data/app/uploaders/kindeditor/file_uploader.rb +10 -0
- data/app/uploaders/kindeditor/flash_uploader.rb +10 -0
- data/app/uploaders/kindeditor/image_uploader.rb +10 -0
- data/app/uploaders/kindeditor/media_uploader.rb +10 -0
- data/config/routes.rb +6 -0
- data/lib/generators/rails_kindeditor/install/USAGE +10 -0
- data/lib/generators/rails_kindeditor/install/install_generator.rb +23 -0
- data/lib/generators/rails_kindeditor/install/templates/application.js +17 -0
- data/lib/generators/rails_kindeditor/install/templates/rails_kindeditor.rb +29 -0
- data/lib/generators/rails_kindeditor/migration/USAGE +14 -0
- data/lib/generators/rails_kindeditor/migration/migration_generator.rb +36 -0
- data/lib/generators/rails_kindeditor/migration/templates/migration/migration.rb +17 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/asset.rb +14 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/file.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/flash.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/image.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/media.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb +27 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/file.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/flash.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/image.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/media.rb +3 -0
- data/lib/rails_kindeditor.rb +61 -0
- data/lib/rails_kindeditor/active_record.rb +14 -0
- data/lib/rails_kindeditor/engine.rb +34 -0
- data/lib/rails_kindeditor/formtastic.rb +12 -0
- data/lib/rails_kindeditor/helper.rb +96 -0
- data/lib/rails_kindeditor/simple_form.rb +11 -0
- data/lib/rails_kindeditor/version.rb +4 -0
- data/lib/tasks/assets.rake +9 -0
- data/rails_kindeditor.gemspec +25 -0
- data/screenshots/rails_kindeditor.png +0 -0
- data/screenshots/simple_mode.png +0 -0
- data/vendor/assets/javascripts/kindeditor/kindeditor.js +5963 -0
- data/vendor/assets/javascripts/kindeditor/lang/ar.js +233 -0
- data/vendor/assets/javascripts/kindeditor/lang/en.js +232 -0
- data/vendor/assets/javascripts/kindeditor/lang/ko.js +237 -0
- data/vendor/assets/javascripts/kindeditor/lang/zh_CN.js +237 -0
- data/vendor/assets/javascripts/kindeditor/lang/zh_TW.js +235 -0
- data/vendor/assets/javascripts/kindeditor/plugins/anchor/anchor.js +46 -0
- data/vendor/assets/javascripts/kindeditor/plugins/autoheight/autoheight.js +54 -0
- data/vendor/assets/javascripts/kindeditor/plugins/baidumap/baidumap.js +93 -0
- data/vendor/assets/javascripts/kindeditor/plugins/baidumap/index.html +83 -0
- data/vendor/assets/javascripts/kindeditor/plugins/baidumap/map.html +43 -0
- data/vendor/assets/javascripts/kindeditor/plugins/clearhtml/clearhtml.js +29 -0
- data/vendor/assets/javascripts/kindeditor/plugins/code/code.js +62 -0
- data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.css +13 -0
- data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.js +28 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/emoticons.js +129 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/0.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/1.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/10.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/100.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/101.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/102.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/103.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/104.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/105.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/106.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/107.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/108.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/109.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/11.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/110.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/111.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/112.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/113.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/114.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/115.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/116.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/117.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/118.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/119.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/12.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/120.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/121.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/122.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/123.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/124.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/125.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/126.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/127.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/128.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/129.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/13.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/130.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/131.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/132.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/133.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/134.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/14.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/15.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/16.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/17.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/18.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/19.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/2.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/20.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/21.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/22.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/23.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/24.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/25.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/26.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/27.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/28.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/29.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/3.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/30.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/31.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/32.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/33.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/34.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/35.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/36.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/37.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/38.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/39.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/4.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/40.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/41.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/42.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/43.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/44.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/45.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/46.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/47.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/48.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/49.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/5.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/50.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/51.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/52.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/53.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/54.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/55.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/56.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/57.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/58.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/59.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/6.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/60.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/61.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/62.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/63.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/64.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/65.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/66.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/67.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/68.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/69.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/7.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/70.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/71.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/72.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/73.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/74.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/75.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/76.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/77.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/78.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/79.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/8.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/80.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/81.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/82.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/83.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/84.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/85.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/86.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/87.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/88.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/89.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/9.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/90.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/91.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/92.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/93.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/94.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/95.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/96.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/97.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/98.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/99.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/emoticons/images/static.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/filemanager.js +189 -0
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-16.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-64.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-16.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-64.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/go-up.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/flash/flash.js +161 -0
- data/vendor/assets/javascripts/kindeditor/plugins/image/image.js +328 -0
- data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_left.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_right.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/image/images/align_top.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/image/images/refresh.png +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/insertfile/insertfile.js +144 -0
- data/vendor/assets/javascripts/kindeditor/plugins/lineheight/lineheight.js +38 -0
- data/vendor/assets/javascripts/kindeditor/plugins/link/link.js +66 -0
- data/vendor/assets/javascripts/kindeditor/plugins/map/map.html +57 -0
- data/vendor/assets/javascripts/kindeditor/plugins/map/map.js +137 -0
- data/vendor/assets/javascripts/kindeditor/plugins/media/media.js +170 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/image.png +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-en.png +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-zh_CN.png +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/swfupload.swf +0 -0
- data/vendor/assets/javascripts/kindeditor/plugins/multiimage/multiimage.js +1384 -0
- data/vendor/assets/javascripts/kindeditor/plugins/pagebreak/pagebreak.js +27 -0
- data/vendor/assets/javascripts/kindeditor/plugins/plainpaste/plainpaste.js +41 -0
- data/vendor/assets/javascripts/kindeditor/plugins/preview/preview.js +31 -0
- data/vendor/assets/javascripts/kindeditor/plugins/quickformat/quickformat.js +81 -0
- data/vendor/assets/javascripts/kindeditor/plugins/table/table.js +712 -0
- data/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html +14 -0
- data/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html +42 -0
- data/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html +36 -0
- data/vendor/assets/javascripts/kindeditor/plugins/template/template.js +58 -0
- data/vendor/assets/javascripts/kindeditor/plugins/wordpaste/wordpaste.js +51 -0
- data/vendor/assets/javascripts/kindeditor/themes/common/anchor.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/common/blank.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/common/flash.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/common/loading.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/common/media.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/common/rm.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/default/background.png +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/default/default.css +1149 -0
- data/vendor/assets/javascripts/kindeditor/themes/default/default.png +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/qq/editor.gif +0 -0
- data/vendor/assets/javascripts/kindeditor/themes/qq/qq.css +143 -0
- data/vendor/assets/javascripts/kindeditor/themes/simple/simple.css +100 -0
- metadata +322 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,189 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('filemanager', function(K) {
|
11
|
+
var self = this, name = 'filemanager',
|
12
|
+
fileManagerJson = K.undef(self.fileManagerJson, self.basePath + 'php/file_manager_json.php'),
|
13
|
+
imgPath = self.pluginsPath + name + '/images/',
|
14
|
+
lang = self.lang(name + '.');
|
15
|
+
function makeFileTitle(filename, filesize, datetime) {
|
16
|
+
return filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')';
|
17
|
+
}
|
18
|
+
function bindTitle(el, data) {
|
19
|
+
if (data.is_dir) {
|
20
|
+
el.attr('title', data.filename);
|
21
|
+
} else {
|
22
|
+
el.attr('title', makeFileTitle(data.filename, data.filesize, data.datetime));
|
23
|
+
}
|
24
|
+
}
|
25
|
+
self.plugin.filemanagerDialog = function(options) {
|
26
|
+
var width = K.undef(options.width, 650),
|
27
|
+
height = K.undef(options.height, 510),
|
28
|
+
dirName = K.undef(options.dirName, ''),
|
29
|
+
viewType = K.undef(options.viewType, 'VIEW').toUpperCase(), // "LIST" or "VIEW"
|
30
|
+
clickFn = options.clickFn;
|
31
|
+
var html = [
|
32
|
+
'<div style="padding:10px 20px;">',
|
33
|
+
// header start
|
34
|
+
'<div class="ke-plugin-filemanager-header">',
|
35
|
+
// left start
|
36
|
+
'<div class="ke-left">',
|
37
|
+
'<img class="ke-inline-block" name="moveupImg" src="' + imgPath + 'go-up.gif" width="16" height="16" border="0" alt="" /> ',
|
38
|
+
'<a class="ke-inline-block" name="moveupLink" href="javascript:;">' + lang.moveup + '</a>',
|
39
|
+
'</div>',
|
40
|
+
// right start
|
41
|
+
'<div class="ke-right">',
|
42
|
+
lang.viewType + ' <select class="ke-inline-block" name="viewType">',
|
43
|
+
'<option value="VIEW">' + lang.viewImage + '</option>',
|
44
|
+
'<option value="LIST">' + lang.listImage + '</option>',
|
45
|
+
'</select> ',
|
46
|
+
lang.orderType + ' <select class="ke-inline-block" name="orderType">',
|
47
|
+
'<option value="NAME">' + lang.fileName + '</option>',
|
48
|
+
'<option value="SIZE">' + lang.fileSize + '</option>',
|
49
|
+
'<option value="TYPE">' + lang.fileType + '</option>',
|
50
|
+
'</select>',
|
51
|
+
'</div>',
|
52
|
+
'<div class="ke-clearfix"></div>',
|
53
|
+
'</div>',
|
54
|
+
// body start
|
55
|
+
'<div class="ke-plugin-filemanager-body"></div>',
|
56
|
+
'</div>'
|
57
|
+
].join('');
|
58
|
+
var dialog = self.createDialog({
|
59
|
+
name : name,
|
60
|
+
width : width,
|
61
|
+
height : height,
|
62
|
+
title : self.lang(name),
|
63
|
+
body : html
|
64
|
+
}),
|
65
|
+
div = dialog.div,
|
66
|
+
bodyDiv = K('.ke-plugin-filemanager-body', div),
|
67
|
+
moveupImg = K('[name="moveupImg"]', div),
|
68
|
+
moveupLink = K('[name="moveupLink"]', div),
|
69
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
70
|
+
viewTypeBox = K('[name="viewType"]', div),
|
71
|
+
orderTypeBox = K('[name="orderType"]', div);
|
72
|
+
function reloadPage(path, order, func) {
|
73
|
+
var param = 'path=' + path + '&order=' + order + '&dir=' + dirName;
|
74
|
+
dialog.showLoading(self.lang('ajaxLoading'));
|
75
|
+
K.ajax(K.addParam(fileManagerJson, param + '&' + new Date().getTime()), function(data) {
|
76
|
+
dialog.hideLoading();
|
77
|
+
func(data);
|
78
|
+
});
|
79
|
+
}
|
80
|
+
var elList = [];
|
81
|
+
function bindEvent(el, result, data, createFunc) {
|
82
|
+
var fileUrl = K.formatUrl(result.current_url + data.filename, 'absolute'),
|
83
|
+
dirPath = encodeURIComponent(result.current_dir_path + data.filename + '/');
|
84
|
+
if (data.is_dir) {
|
85
|
+
el.click(function(e) {
|
86
|
+
reloadPage(dirPath, orderTypeBox.val(), createFunc);
|
87
|
+
});
|
88
|
+
} else if (data.is_photo) {
|
89
|
+
el.click(function(e) {
|
90
|
+
clickFn.call(this, fileUrl, data.filename);
|
91
|
+
});
|
92
|
+
} else {
|
93
|
+
el.click(function(e) {
|
94
|
+
clickFn.call(this, fileUrl, data.filename);
|
95
|
+
});
|
96
|
+
}
|
97
|
+
elList.push(el);
|
98
|
+
}
|
99
|
+
function createCommon(result, createFunc) {
|
100
|
+
// remove events
|
101
|
+
K.each(elList, function() {
|
102
|
+
this.unbind();
|
103
|
+
});
|
104
|
+
moveupLink.unbind();
|
105
|
+
viewTypeBox.unbind();
|
106
|
+
orderTypeBox.unbind();
|
107
|
+
// add events
|
108
|
+
if (result.current_dir_path) {
|
109
|
+
moveupLink.click(function(e) {
|
110
|
+
reloadPage(result.moveup_dir_path, orderTypeBox.val(), createFunc);
|
111
|
+
});
|
112
|
+
}
|
113
|
+
function changeFunc() {
|
114
|
+
if (viewTypeBox.val() == 'VIEW') {
|
115
|
+
reloadPage(result.current_dir_path, orderTypeBox.val(), createView);
|
116
|
+
} else {
|
117
|
+
reloadPage(result.current_dir_path, orderTypeBox.val(), createList);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
viewTypeBox.change(changeFunc);
|
121
|
+
orderTypeBox.change(changeFunc);
|
122
|
+
bodyDiv.html('');
|
123
|
+
}
|
124
|
+
function createList(result) {
|
125
|
+
createCommon(result, createList);
|
126
|
+
var table = document.createElement('table');
|
127
|
+
table.className = 'ke-table';
|
128
|
+
table.cellPadding = 0;
|
129
|
+
table.cellSpacing = 0;
|
130
|
+
table.border = 0;
|
131
|
+
bodyDiv.append(table);
|
132
|
+
var fileList = result.file_list;
|
133
|
+
for (var i = 0, len = fileList.length; i < len; i++) {
|
134
|
+
var data = fileList[i], row = K(table.insertRow(i));
|
135
|
+
row.mouseover(function(e) {
|
136
|
+
K(this).addClass('ke-on');
|
137
|
+
})
|
138
|
+
.mouseout(function(e) {
|
139
|
+
K(this).removeClass('ke-on');
|
140
|
+
});
|
141
|
+
var iconUrl = imgPath + (data.is_dir ? 'folder-16.gif' : 'file-16.gif'),
|
142
|
+
img = K('<img src="' + iconUrl + '" width="16" height="16" alt="' + data.filename + '" align="absmiddle" />'),
|
143
|
+
cell0 = K(row[0].insertCell(0)).addClass('ke-cell ke-name').append(img).append(document.createTextNode(' ' + data.filename));
|
144
|
+
if (!data.is_dir || data.has_file) {
|
145
|
+
row.css('cursor', 'pointer');
|
146
|
+
cell0.attr('title', data.filename);
|
147
|
+
bindEvent(cell0, result, data, createList);
|
148
|
+
} else {
|
149
|
+
cell0.attr('title', lang.emptyFolder);
|
150
|
+
}
|
151
|
+
K(row[0].insertCell(1)).addClass('ke-cell ke-size').html(data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB');
|
152
|
+
K(row[0].insertCell(2)).addClass('ke-cell ke-datetime').html(data.datetime);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
function createView(result) {
|
156
|
+
createCommon(result, createView);
|
157
|
+
var fileList = result.file_list;
|
158
|
+
for (var i = 0, len = fileList.length; i < len; i++) {
|
159
|
+
var data = fileList[i],
|
160
|
+
div = K('<div class="ke-inline-block ke-item"></div>');
|
161
|
+
bodyDiv.append(div);
|
162
|
+
var photoDiv = K('<div class="ke-inline-block ke-photo"></div>')
|
163
|
+
.mouseover(function(e) {
|
164
|
+
K(this).addClass('ke-on');
|
165
|
+
})
|
166
|
+
.mouseout(function(e) {
|
167
|
+
K(this).removeClass('ke-on');
|
168
|
+
});
|
169
|
+
div.append(photoDiv);
|
170
|
+
var fileUrl = result.current_url + data.filename,
|
171
|
+
iconUrl = data.is_dir ? imgPath + 'folder-64.gif' : (data.is_photo ? fileUrl : imgPath + 'file-64.gif');
|
172
|
+
var img = K('<img src="' + iconUrl + '" width="80" height="80" alt="' + data.filename + '" />');
|
173
|
+
if (!data.is_dir || data.has_file) {
|
174
|
+
photoDiv.css('cursor', 'pointer');
|
175
|
+
bindTitle(photoDiv, data);
|
176
|
+
bindEvent(photoDiv, result, data, createView);
|
177
|
+
} else {
|
178
|
+
photoDiv.attr('title', lang.emptyFolder);
|
179
|
+
}
|
180
|
+
photoDiv.append(img);
|
181
|
+
div.append('<div class="ke-name" title="' + data.filename + '">' + data.filename + '</div>');
|
182
|
+
}
|
183
|
+
}
|
184
|
+
viewTypeBox.val(viewType);
|
185
|
+
reloadPage('', orderTypeBox.val(), viewType == 'VIEW' ? createView : createList);
|
186
|
+
return dialog;
|
187
|
+
}
|
188
|
+
|
189
|
+
});
|
Binary file
|
Binary file
|
@@ -0,0 +1,161 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('flash', function(K) {
|
11
|
+
var self = this, name = 'flash', lang = self.lang(name + '.'),
|
12
|
+
allowFlashUpload = K.undef(self.allowFlashUpload, true),
|
13
|
+
allowFileManager = K.undef(self.allowFileManager, false),
|
14
|
+
formatUploadUrl = K.undef(self.formatUploadUrl, true),
|
15
|
+
extraParams = K.undef(self.extraFileUploadParams, {}),
|
16
|
+
filePostName = K.undef(self.filePostName, 'imgFile'),
|
17
|
+
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
|
18
|
+
self.plugin.flash = {
|
19
|
+
edit : function() {
|
20
|
+
var html = [
|
21
|
+
'<div style="padding:20px;">',
|
22
|
+
//url
|
23
|
+
'<div class="ke-dialog-row">',
|
24
|
+
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
|
25
|
+
'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> ',
|
26
|
+
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> ',
|
27
|
+
'<span class="ke-button-common ke-button-outer">',
|
28
|
+
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
|
29
|
+
'</span>',
|
30
|
+
'</div>',
|
31
|
+
//width
|
32
|
+
'<div class="ke-dialog-row">',
|
33
|
+
'<label for="keWidth" style="width:60px;">' + lang.width + '</label>',
|
34
|
+
'<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" /> ',
|
35
|
+
'</div>',
|
36
|
+
//height
|
37
|
+
'<div class="ke-dialog-row">',
|
38
|
+
'<label for="keHeight" style="width:60px;">' + lang.height + '</label>',
|
39
|
+
'<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" /> ',
|
40
|
+
'</div>',
|
41
|
+
'</div>'
|
42
|
+
].join('');
|
43
|
+
var dialog = self.createDialog({
|
44
|
+
name : name,
|
45
|
+
width : 450,
|
46
|
+
title : self.lang(name),
|
47
|
+
body : html,
|
48
|
+
yesBtn : {
|
49
|
+
name : self.lang('yes'),
|
50
|
+
click : function(e) {
|
51
|
+
var url = K.trim(urlBox.val()),
|
52
|
+
width = widthBox.val(),
|
53
|
+
height = heightBox.val();
|
54
|
+
if (url == 'http://' || K.invalidUrl(url)) {
|
55
|
+
alert(self.lang('invalidUrl'));
|
56
|
+
urlBox[0].focus();
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
if (!/^\d*$/.test(width)) {
|
60
|
+
alert(self.lang('invalidWidth'));
|
61
|
+
widthBox[0].focus();
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
if (!/^\d*$/.test(height)) {
|
65
|
+
alert(self.lang('invalidHeight'));
|
66
|
+
heightBox[0].focus();
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
var html = K.mediaImg(self.themesPath + 'common/blank.gif', {
|
70
|
+
src : url,
|
71
|
+
type : K.mediaType('.swf'),
|
72
|
+
width : width,
|
73
|
+
height : height,
|
74
|
+
quality : 'high'
|
75
|
+
});
|
76
|
+
self.insertHtml(html).hideDialog().focus();
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}),
|
80
|
+
div = dialog.div,
|
81
|
+
urlBox = K('[name="url"]', div),
|
82
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
83
|
+
widthBox = K('[name="width"]', div),
|
84
|
+
heightBox = K('[name="height"]', div);
|
85
|
+
urlBox.val('http://');
|
86
|
+
|
87
|
+
if (allowFlashUpload) {
|
88
|
+
var uploadbutton = K.uploadbutton({
|
89
|
+
button : K('.ke-upload-button', div)[0],
|
90
|
+
fieldName : filePostName,
|
91
|
+
extraParams : extraParams,
|
92
|
+
url : K.addParam(uploadJson, 'dir=flash'),
|
93
|
+
afterUpload : function(data) {
|
94
|
+
dialog.hideLoading();
|
95
|
+
if (data.error === 0) {
|
96
|
+
var url = data.url;
|
97
|
+
if (formatUploadUrl) {
|
98
|
+
url = K.formatUrl(url, 'absolute');
|
99
|
+
}
|
100
|
+
urlBox.val(url);
|
101
|
+
if (self.afterUpload) {
|
102
|
+
self.afterUpload.call(self, url, data, name);
|
103
|
+
}
|
104
|
+
alert(self.lang('uploadSuccess'));
|
105
|
+
} else {
|
106
|
+
alert(data.message);
|
107
|
+
}
|
108
|
+
},
|
109
|
+
afterError : function(html) {
|
110
|
+
dialog.hideLoading();
|
111
|
+
self.errorDialog(html);
|
112
|
+
}
|
113
|
+
});
|
114
|
+
uploadbutton.fileBox.change(function(e) {
|
115
|
+
dialog.showLoading(self.lang('uploadLoading'));
|
116
|
+
uploadbutton.submit();
|
117
|
+
});
|
118
|
+
} else {
|
119
|
+
K('.ke-upload-button', div).hide();
|
120
|
+
}
|
121
|
+
|
122
|
+
if (allowFileManager) {
|
123
|
+
viewServerBtn.click(function(e) {
|
124
|
+
self.loadPlugin('filemanager', function() {
|
125
|
+
self.plugin.filemanagerDialog({
|
126
|
+
viewType : 'LIST',
|
127
|
+
dirName : 'flash',
|
128
|
+
clickFn : function(url, title) {
|
129
|
+
if (self.dialogs.length > 1) {
|
130
|
+
K('[name="url"]', div).val(url);
|
131
|
+
if (self.afterSelectFile) {
|
132
|
+
self.afterSelectFile.call(self, url);
|
133
|
+
}
|
134
|
+
self.hideDialog();
|
135
|
+
}
|
136
|
+
}
|
137
|
+
});
|
138
|
+
});
|
139
|
+
});
|
140
|
+
} else {
|
141
|
+
viewServerBtn.hide();
|
142
|
+
}
|
143
|
+
|
144
|
+
var img = self.plugin.getSelectedFlash();
|
145
|
+
if (img) {
|
146
|
+
var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
|
147
|
+
urlBox.val(attrs.src);
|
148
|
+
widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
|
149
|
+
heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
|
150
|
+
}
|
151
|
+
urlBox[0].focus();
|
152
|
+
urlBox[0].select();
|
153
|
+
},
|
154
|
+
'delete' : function() {
|
155
|
+
self.plugin.getSelectedFlash().remove();
|
156
|
+
// [IE] 删除图片后立即点击图片按钮出错
|
157
|
+
self.addBookmark();
|
158
|
+
}
|
159
|
+
};
|
160
|
+
self.clickToolbar(name, self.plugin.flash.edit);
|
161
|
+
});
|