kindeditor 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +65 -0
  3. data/Rakefile +20 -0
  4. data/VERSION +1 -0
  5. data/init.rb +2 -0
  6. data/install.rb +1 -0
  7. data/kindeditor.gemspec +234 -0
  8. data/lib/generators/USAGE +8 -0
  9. data/lib/generators/kindeditor/install_generator.rb +56 -0
  10. data/lib/generators/kindeditor/templates/README +20 -0
  11. data/lib/generators/kindeditor/templates/app/controllers/kindeditor_controller.rb +39 -0
  12. data/lib/generators/kindeditor/templates/app/models/kindeditor_image.rb +13 -0
  13. data/lib/generators/kindeditor/templates/create_kindeditor_images.rb +15 -0
  14. data/lib/generators/kindeditor/templates/kindeditor/kindeditor-min.js +168 -0
  15. data/lib/generators/kindeditor/templates/kindeditor/kindeditor.js +4442 -0
  16. data/lib/generators/kindeditor/templates/kindeditor/kindeditor_config.js +5 -0
  17. data/lib/generators/kindeditor/templates/kindeditor/license.txt +1 -0
  18. data/lib/generators/kindeditor/templates/kindeditor/plugins/about.html +53 -0
  19. data/lib/generators/kindeditor/templates/kindeditor/plugins/advtable/advtable.html +233 -0
  20. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/0.gif +0 -0
  21. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/1.gif +0 -0
  22. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/10.gif +0 -0
  23. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/100.gif +0 -0
  24. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/101.gif +0 -0
  25. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/102.gif +0 -0
  26. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/103.gif +0 -0
  27. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/104.gif +0 -0
  28. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/105.gif +0 -0
  29. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/106.gif +0 -0
  30. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/107.gif +0 -0
  31. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/108.gif +0 -0
  32. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/109.gif +0 -0
  33. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/11.gif +0 -0
  34. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/110.gif +0 -0
  35. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/111.gif +0 -0
  36. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/112.gif +0 -0
  37. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/113.gif +0 -0
  38. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/114.gif +0 -0
  39. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/115.gif +0 -0
  40. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/116.gif +0 -0
  41. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/117.gif +0 -0
  42. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/118.gif +0 -0
  43. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/119.gif +0 -0
  44. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/12.gif +0 -0
  45. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/120.gif +0 -0
  46. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/121.gif +0 -0
  47. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/122.gif +0 -0
  48. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/123.gif +0 -0
  49. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/124.gif +0 -0
  50. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/125.gif +0 -0
  51. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/126.gif +0 -0
  52. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/127.gif +0 -0
  53. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/128.gif +0 -0
  54. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/129.gif +0 -0
  55. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/13.gif +0 -0
  56. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/130.gif +0 -0
  57. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/131.gif +0 -0
  58. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/132.gif +0 -0
  59. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/133.gif +0 -0
  60. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/134.gif +0 -0
  61. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/14.gif +0 -0
  62. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/15.gif +0 -0
  63. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/16.gif +0 -0
  64. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/17.gif +0 -0
  65. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/18.gif +0 -0
  66. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/19.gif +0 -0
  67. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/2.gif +0 -0
  68. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/20.gif +0 -0
  69. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/21.gif +0 -0
  70. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/22.gif +0 -0
  71. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/23.gif +0 -0
  72. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/24.gif +0 -0
  73. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/25.gif +0 -0
  74. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/26.gif +0 -0
  75. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/27.gif +0 -0
  76. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/28.gif +0 -0
  77. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/29.gif +0 -0
  78. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/3.gif +0 -0
  79. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/30.gif +0 -0
  80. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/31.gif +0 -0
  81. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/32.gif +0 -0
  82. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/33.gif +0 -0
  83. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/34.gif +0 -0
  84. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/35.gif +0 -0
  85. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/36.gif +0 -0
  86. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/37.gif +0 -0
  87. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/38.gif +0 -0
  88. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/39.gif +0 -0
  89. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/4.gif +0 -0
  90. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/40.gif +0 -0
  91. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/41.gif +0 -0
  92. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/42.gif +0 -0
  93. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/43.gif +0 -0
  94. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/44.gif +0 -0
  95. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/45.gif +0 -0
  96. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/46.gif +0 -0
  97. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/47.gif +0 -0
  98. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/48.gif +0 -0
  99. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/49.gif +0 -0
  100. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/5.gif +0 -0
  101. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/50.gif +0 -0
  102. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/51.gif +0 -0
  103. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/52.gif +0 -0
  104. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/53.gif +0 -0
  105. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/54.gif +0 -0
  106. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/55.gif +0 -0
  107. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/56.gif +0 -0
  108. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/57.gif +0 -0
  109. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/58.gif +0 -0
  110. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/59.gif +0 -0
  111. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/6.gif +0 -0
  112. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/60.gif +0 -0
  113. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/61.gif +0 -0
  114. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/62.gif +0 -0
  115. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/63.gif +0 -0
  116. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/64.gif +0 -0
  117. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/65.gif +0 -0
  118. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/66.gif +0 -0
  119. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/67.gif +0 -0
  120. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/68.gif +0 -0
  121. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/69.gif +0 -0
  122. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/7.gif +0 -0
  123. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/70.gif +0 -0
  124. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/71.gif +0 -0
  125. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/72.gif +0 -0
  126. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/73.gif +0 -0
  127. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/74.gif +0 -0
  128. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/75.gif +0 -0
  129. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/76.gif +0 -0
  130. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/77.gif +0 -0
  131. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/78.gif +0 -0
  132. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/79.gif +0 -0
  133. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/8.gif +0 -0
  134. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/80.gif +0 -0
  135. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/81.gif +0 -0
  136. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/82.gif +0 -0
  137. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/83.gif +0 -0
  138. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/84.gif +0 -0
  139. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/85.gif +0 -0
  140. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/86.gif +0 -0
  141. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/87.gif +0 -0
  142. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/88.gif +0 -0
  143. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/89.gif +0 -0
  144. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/9.gif +0 -0
  145. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/90.gif +0 -0
  146. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/91.gif +0 -0
  147. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/92.gif +0 -0
  148. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/93.gif +0 -0
  149. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/94.gif +0 -0
  150. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/95.gif +0 -0
  151. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/96.gif +0 -0
  152. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/97.gif +0 -0
  153. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/98.gif +0 -0
  154. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/99.gif +0 -0
  155. data/lib/generators/kindeditor/templates/kindeditor/plugins/emoticons/qq.gif +0 -0
  156. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/file_manager.css +64 -0
  157. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/file_manager.html +29 -0
  158. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/file_manager.js +220 -0
  159. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/images/file-16.gif +0 -0
  160. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/images/file-64.gif +0 -0
  161. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/images/folder-16.gif +0 -0
  162. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/images/folder-64.gif +0 -0
  163. data/lib/generators/kindeditor/templates/kindeditor/plugins/file_manager/images/go-up.gif +0 -0
  164. data/lib/generators/kindeditor/templates/kindeditor/plugins/flash.html +72 -0
  165. data/lib/generators/kindeditor/templates/kindeditor/plugins/image/image.html +268 -0
  166. data/lib/generators/kindeditor/templates/kindeditor/plugins/image/images/align_left.gif +0 -0
  167. data/lib/generators/kindeditor/templates/kindeditor/plugins/image/images/align_right.gif +0 -0
  168. data/lib/generators/kindeditor/templates/kindeditor/plugins/image/images/align_top.gif +0 -0
  169. data/lib/generators/kindeditor/templates/kindeditor/plugins/image/images/refresh.gif +0 -0
  170. data/lib/generators/kindeditor/templates/kindeditor/plugins/link/link.html +86 -0
  171. data/lib/generators/kindeditor/templates/kindeditor/plugins/media.html +76 -0
  172. data/lib/generators/kindeditor/templates/kindeditor/plugins/plainpaste.html +43 -0
  173. data/lib/generators/kindeditor/templates/kindeditor/plugins/wordpaste.html +50 -0
  174. data/lib/generators/kindeditor/templates/kindeditor/skins/common/blank.gif +0 -0
  175. data/lib/generators/kindeditor/templates/kindeditor/skins/common/editor.css +47 -0
  176. data/lib/generators/kindeditor/templates/kindeditor/skins/common/flash.gif +0 -0
  177. data/lib/generators/kindeditor/templates/kindeditor/skins/common/loading.gif +0 -0
  178. data/lib/generators/kindeditor/templates/kindeditor/skins/common/media.gif +0 -0
  179. data/lib/generators/kindeditor/templates/kindeditor/skins/common/rm.gif +0 -0
  180. data/lib/generators/kindeditor/templates/kindeditor/skins/default.css +918 -0
  181. data/lib/generators/kindeditor/templates/kindeditor/skins/default/default.gif +0 -0
  182. data/lib/generators/kindeditor/templates/mongoid/kindeditor_image.rb +21 -0
  183. data/lib/kindeditor.rb +9 -0
  184. data/pkg/kindeditor-0.0.1.gem +0 -0
  185. data/pkg/kinkdeditor-0.0.1.gem +0 -0
  186. data/spec/generators/install_generaor_spec.rb +9 -0
  187. data/spec/kindeditor_spec.rb +7 -0
  188. data/spec/spec.opts +1 -0
  189. data/spec/spec_helper.rb +11 -0
  190. data/uninstall.rb +1 -0
  191. metadata +269 -0
@@ -0,0 +1,64 @@
1
+ body {
2
+ font-size:12px;
3
+ font-family: "sans serif",tahoma,verdana,helvetica;
4
+ margin: 0;
5
+ padding: 0;
6
+ background-color:#F0F0EE;
7
+ overflow: hidden;
8
+ }
9
+ td {
10
+ font-size:12px;
11
+ }
12
+ .top {
13
+ background-color:#F0F0EE;
14
+ }
15
+ .file-view {
16
+ overflow: scroll;
17
+ background-color:#FFFFFF;
18
+ width: 500px;
19
+ height: 370px;
20
+ }
21
+ .file-view-area {
22
+ float:left;
23
+ border: 1px solid #FFFFFF;
24
+ margin: 5px;
25
+ }
26
+ .file-view-area .photo {
27
+ width: 100px;
28
+ height: 100px;
29
+ margin: 3px;
30
+ }
31
+ .file-view-area .name {
32
+ margin: 2px;
33
+ text-align: center;
34
+ overflow: hidden;
35
+ width: 100px;
36
+ height: 16px;
37
+ }
38
+ .selected {
39
+ border: 1px solid #888888;
40
+ background-color: #F0F0EE;
41
+ }
42
+ .noselected {
43
+ border: 1px solid #DDDDDD;
44
+ background-color: #FFFFFF;
45
+ }
46
+ .file-list {
47
+ overflow: scroll;
48
+ background-color:#FFFFFF;
49
+ width: 500px;
50
+ height: 370px;
51
+ }
52
+ .file-list-table {
53
+ width: 95%;
54
+ }
55
+ .file-list-table .name {
56
+ width: 55%;
57
+ }
58
+ .file-list-table .size {
59
+ width: 15%;
60
+ }
61
+ .file-list-table .datetime {
62
+ width: 30%;
63
+ text-align: center;
64
+ }
@@ -0,0 +1,29 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>File Manager</title>
6
+ <link type="text/css" rel="stylesheet" href="./file_manager.css" />
7
+ <script type="text/javascript" charset="utf-8" src="./file_manager.js"></script>
8
+ </head>
9
+ <body>
10
+ <table class="top" border="0" cellpadding="0" cellspacing="0" width="100%">
11
+ <tr>
12
+ <td>
13
+ <img id="moveupImg" src="./images/go-up.gif" width="16" height="16" border="0" alt="" align="absmiddle" />
14
+ <a id="moveup" href="javascript:;"><span id="lang.moveup"></span></a>
15
+ </td>
16
+ <td align="right">
17
+ <span id="lang.viewType"></span><select id="viewType" name="viewType"></select>
18
+ <span id="lang.orderType"></span><select id="orderType" name="orderType"></select>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td height="5"></td>
23
+ <td height="5"></td>
24
+ </tr>
25
+ </table>
26
+ <div id="listDiv" class="file-list"></div>
27
+ <div id="viewDiv" class="file-view"></div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,220 @@
1
+ var JSON_URL = '/kindeditor/images_list';
2
+
3
+ var KE = parent.KindEditor;
4
+ location.href.match(/\?id=([\w-]+)/i);
5
+ var id = RegExp.$1;
6
+ var fileManagerJson = (typeof KE.g[id].fileManagerJson == 'undefined') ? JSON_URL : KE.g[id].fileManagerJson;
7
+ var lang = KE.lang.plugins.file_manager;
8
+ KE.event.ready(function() {
9
+ var moveupImg = KE.$('moveupImg', document);
10
+ var moveupLink = KE.$('moveup', document);
11
+ var viewType = KE.$('viewType', document);
12
+ var orderType = KE.$('orderType', document);
13
+ var listTable = KE.$('listTable', document);
14
+ var viewTable = KE.$('viewTable', document);
15
+ var listDiv = KE.$('listDiv', document);
16
+ var viewDiv = KE.$('viewDiv', document);
17
+ moveupImg.alt = moveupImg.title = lang.moveup;
18
+ viewType.options[0] = new Option(lang.viewImage, 'VIEW');
19
+ viewType.options[1] = new Option(lang.listImage, 'LIST');
20
+ orderType.options[0] = new Option(lang.fileName, 'data_file_name');
21
+ orderType.options[1] = new Option(lang.fileSize, 'data_file_size');
22
+ orderType.options[2] = new Option(lang.fileType, 'data_content_type');
23
+ var changeType = function(type) {
24
+ if (type == 'VIEW') {
25
+ listDiv.style.display = 'none';
26
+ viewDiv.style.display = '';
27
+ } else {
28
+ listDiv.style.display = '';
29
+ viewDiv.style.display = 'none';
30
+ }
31
+ };
32
+ var insertLink = function(url) {
33
+ var stack = KE.g[id].dialogStack;
34
+ if (stack.length > 1) {
35
+ var parentDialog = stack[stack.length - 2];
36
+ var dialogDoc = KE.util.getIframeDoc(parentDialog.iframe);
37
+ KE.$('url', dialogDoc).value = url;
38
+ var currentDialog = stack[stack.length - 1];
39
+ currentDialog.hide();
40
+ return true;
41
+ } else {
42
+ return false;
43
+ }
44
+ }
45
+ var insertImage = function(url, title) {
46
+ if (!insertLink(url)) {
47
+ KE.util.insertHtml(id, '<img src="' + url + '" alt="' + title + '" border="0" />');
48
+ }
49
+ };
50
+ var insertFile = function(url, title) {
51
+ if (!insertLink(url)) {
52
+ KE.util.insertHtml(id, '<a href="' + url + '" target="_blank">' + title + '</a>');
53
+ }
54
+ };
55
+ var makeFileTitle = function (filename, filesize, datetime) {
56
+ var title = filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')';
57
+ return title;
58
+ };
59
+ var bindTitle = function (el, data) {
60
+ if (data.is_dir) {
61
+ el.title = data.filename;
62
+ } else {
63
+ el.title = makeFileTitle(data.filename, data.filesize, data.datetime);
64
+ }
65
+ };
66
+ var bindEvent = function (el, result, data, createFunc) {
67
+ var fileUrl = data.dir_path;
68
+ fileUrl = KE.format.getUrl(fileUrl, 'absolute');
69
+ if (data.is_dir) {
70
+ el.onclick = (function (url, path, title) {
71
+ return function () {
72
+ reloadPage(path, orderType.value, createFunc);
73
+ }
74
+ })(fileUrl, escape(result.current_dir_path + data.filename + '/'), data.filename);
75
+ } else if (data.is_photo) {
76
+ el.onclick = (function (url, title) {
77
+ return function () {
78
+ insertImage(url, title);
79
+ }
80
+ })(fileUrl, data.filename);
81
+ } else {
82
+ el.onclick = (function (url, title) {
83
+ return function () {
84
+ insertFile(url, title);
85
+ }
86
+ })(fileUrl, data.filename);
87
+ }
88
+ };
89
+ var createCommon = function(result, createFunc) {
90
+ if (result.current_dir_path) {
91
+ moveupLink.onclick = function () {
92
+ reloadPage(result.moveup_dir_path, orderType.value, createFunc);
93
+ };
94
+ } else {
95
+ moveupLink.onclick = null;
96
+ }
97
+ var onchangeFunc = function() {
98
+ changeType(viewType.value);
99
+ if (viewType.value == 'VIEW') reloadPage(result.current_dir_path, orderType.value, createView);
100
+ else reloadPage(result.current_dir_path, orderType.value, createList);
101
+ };
102
+ viewType.onchange = onchangeFunc;
103
+ orderType.onchange = onchangeFunc;
104
+ };
105
+ var createList = function(responseText) {
106
+ listDiv.innerHTML = '';
107
+ var result = KE.util.parseJson(responseText);
108
+ createCommon(result, createList);
109
+ var table = KE.$$('table', document);
110
+ table.className = 'file-list-table';
111
+ table.cellPadding = 0;
112
+ table.cellSpacing = 2;
113
+ table.border = 0;
114
+ listDiv.appendChild(table);
115
+ var fileList = result.file_list;
116
+ for (var i = 0, len = fileList.length; i < len; i++) {
117
+ var data = fileList[i];
118
+ var row = table.insertRow(i);
119
+ row.onmouseover = function () { this.className = 'selected'; };
120
+ row.onmouseout = function () { this.className = 'noselected'; };
121
+ var cell0 = row.insertCell(0);
122
+ cell0.className = 'name';
123
+ var iconName = data.is_dir ? 'folder-16.gif' : 'file-16.gif';
124
+ var img = KE.$$('img', document);
125
+ img.src = './images/' + iconName;
126
+ img.width = 16;
127
+ img.height = 16;
128
+ img.align = 'absmiddle';
129
+ img.alt = data.filename;
130
+ cell0.appendChild(img);
131
+ cell0.appendChild(document.createTextNode(' ' + data.filename));
132
+ if (!data.is_dir || data.has_file) {
133
+ row.style.cursor = 'pointer';
134
+ img.title = data.filename;
135
+ cell0.title = data.filename;
136
+ bindEvent(cell0, result, data, createList);
137
+ } else {
138
+ img.title = lang.emptyFolder;
139
+ cell0.title = lang.emptyFolder;
140
+ }
141
+ var cell1 = row.insertCell(1);
142
+ cell1.className = 'size';
143
+ cell1.innerHTML = data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB';
144
+ var cell2 = row.insertCell(2);
145
+ cell2.className = 'datetime';
146
+ cell2.innerHTML = data.datetime;
147
+ }
148
+ };
149
+ var createView = function(responseText) {
150
+ viewDiv.innerHTML = '';
151
+ var result = KE.util.parseJson(responseText);
152
+ createCommon(result, createView);
153
+ var fileList = result.file_list;
154
+
155
+ for (var i = 0, len = fileList.length; i < len; i++) {
156
+ var data = fileList[i];
157
+ var div = KE.$$('div', document);
158
+ div.className = 'file-view-area';
159
+ viewDiv.appendChild(div);
160
+ var tableObj = KE.util.createTable(document);
161
+ var table = tableObj.table;
162
+ table.className = 'photo noselected';
163
+ table.onmouseover = function () { this.className = 'photo selected'; };
164
+ table.onmouseout = function () { this.className = 'photo noselected'; };
165
+ var cell = tableObj.cell;
166
+ cell.valign = 'middle';
167
+ cell.align = 'center';
168
+ var fileUrl = data.dir_path;
169
+ //alert(fileUrl)
170
+ iconUrl = fileUrl;
171
+ // var fileUrl = result.current_url + data.filename;
172
+ // var iconUrl = data.is_dir ? './images/folder-64.gif' : (data.is_photo ? fileUrl : './images/file-64.gif');
173
+ var img = KE.$$('img', document);
174
+ img.src = iconUrl;
175
+ img.width = data.is_dir ? 64 : 80;
176
+ img.height = data.is_dir ? 64 : 80;
177
+ img.alt = data.filename;
178
+ if (!data.is_dir || data.has_file) {
179
+ table.style.cursor = 'pointer';
180
+ bindTitle(img, data);
181
+ bindTitle(table, data);
182
+ bindEvent(table, result, data, createView);
183
+ } else {
184
+ img.title = lang.emptyFolder;
185
+ table.title = lang.emptyFolder;
186
+ }
187
+ cell.appendChild(img);
188
+ div.appendChild(table);
189
+ var titleDiv = KE.$$('div', document);
190
+ titleDiv.className = 'name';
191
+ titleDiv.title = data.filename;
192
+ titleDiv.innerHTML = data.filename;
193
+ div.appendChild(titleDiv);
194
+ }
195
+ };
196
+ var httpRequest = function (param, func) {
197
+ KE.util.showLoadingPage(id);
198
+ var req = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
199
+ var url = fileManagerJson;
200
+ url += param;
201
+ url += (url.match(/\?/) ? "&" : "?") + (new Date()).getTime()
202
+ req.open('GET', url, true);
203
+ req.onreadystatechange = function () {
204
+ if (req.readyState == 4) {
205
+ if(req.status == 200) {
206
+ func(req.responseText);
207
+ KE.util.pluginLang('file_manager', document);
208
+ KE.util.hideLoadingPage(id);
209
+ }
210
+ }
211
+ };
212
+ req.send(null);
213
+ };
214
+ var reloadPage = function (path, order, func) {
215
+ httpRequest('?order=' + order, func);
216
+ };
217
+ changeType('VIEW');
218
+ viewType.value = 'VIEW';
219
+ reloadPage('', orderType.value, createView);
220
+ }, window, document);