rails_kindeditor 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/README.rdoc +34 -0
  4. data/Rakefile +2 -0
  5. data/app/controllers/kindeditor/assets_controller.rb +50 -0
  6. data/app/models/kindeditor/asset.rb +14 -0
  7. data/app/models/kindeditor/file.rb +4 -0
  8. data/app/models/kindeditor/image.rb +4 -0
  9. data/app/uploaders/kindeditor/file_uploader.rb +54 -0
  10. data/app/uploaders/kindeditor/image_uploader.rb +54 -0
  11. data/config/routes.rb +7 -0
  12. data/lib/generators/rails_kindeditor/install/USAGE +9 -0
  13. data/lib/generators/rails_kindeditor/install/install_generator.rb +11 -0
  14. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-init.js +7 -0
  15. data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor.js +4688 -0
  16. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/about.html +52 -0
  17. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/accessory.html +74 -0
  18. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/advtable.html +235 -0
  19. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/cell.html +201 -0
  20. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/0.gif +0 -0
  21. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/1.gif +0 -0
  22. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/10.gif +0 -0
  23. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/100.gif +0 -0
  24. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/101.gif +0 -0
  25. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/102.gif +0 -0
  26. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/103.gif +0 -0
  27. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/104.gif +0 -0
  28. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/105.gif +0 -0
  29. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/106.gif +0 -0
  30. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/107.gif +0 -0
  31. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/108.gif +0 -0
  32. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/109.gif +0 -0
  33. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/11.gif +0 -0
  34. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/110.gif +0 -0
  35. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/111.gif +0 -0
  36. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/112.gif +0 -0
  37. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/113.gif +0 -0
  38. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/114.gif +0 -0
  39. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/115.gif +0 -0
  40. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/116.gif +0 -0
  41. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/117.gif +0 -0
  42. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/118.gif +0 -0
  43. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/119.gif +0 -0
  44. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/12.gif +0 -0
  45. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/120.gif +0 -0
  46. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/121.gif +0 -0
  47. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/122.gif +0 -0
  48. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/123.gif +0 -0
  49. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/124.gif +0 -0
  50. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/125.gif +0 -0
  51. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/126.gif +0 -0
  52. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/127.gif +0 -0
  53. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/128.gif +0 -0
  54. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/129.gif +0 -0
  55. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/13.gif +0 -0
  56. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/130.gif +0 -0
  57. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/131.gif +0 -0
  58. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/132.gif +0 -0
  59. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/133.gif +0 -0
  60. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/134.gif +0 -0
  61. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/14.gif +0 -0
  62. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/15.gif +0 -0
  63. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/16.gif +0 -0
  64. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/17.gif +0 -0
  65. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/18.gif +0 -0
  66. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/19.gif +0 -0
  67. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/2.gif +0 -0
  68. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/20.gif +0 -0
  69. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/21.gif +0 -0
  70. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/22.gif +0 -0
  71. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/23.gif +0 -0
  72. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/24.gif +0 -0
  73. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/25.gif +0 -0
  74. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/26.gif +0 -0
  75. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/27.gif +0 -0
  76. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/28.gif +0 -0
  77. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/29.gif +0 -0
  78. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/3.gif +0 -0
  79. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/30.gif +0 -0
  80. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/31.gif +0 -0
  81. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/32.gif +0 -0
  82. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/33.gif +0 -0
  83. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/34.gif +0 -0
  84. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/35.gif +0 -0
  85. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/36.gif +0 -0
  86. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/37.gif +0 -0
  87. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/38.gif +0 -0
  88. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/39.gif +0 -0
  89. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/4.gif +0 -0
  90. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/40.gif +0 -0
  91. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/41.gif +0 -0
  92. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/42.gif +0 -0
  93. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/43.gif +0 -0
  94. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/44.gif +0 -0
  95. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/45.gif +0 -0
  96. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/46.gif +0 -0
  97. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/47.gif +0 -0
  98. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/48.gif +0 -0
  99. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/49.gif +0 -0
  100. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/5.gif +0 -0
  101. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/50.gif +0 -0
  102. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/51.gif +0 -0
  103. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/52.gif +0 -0
  104. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/53.gif +0 -0
  105. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/54.gif +0 -0
  106. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/55.gif +0 -0
  107. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/56.gif +0 -0
  108. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/57.gif +0 -0
  109. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/58.gif +0 -0
  110. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/59.gif +0 -0
  111. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/6.gif +0 -0
  112. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/60.gif +0 -0
  113. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/61.gif +0 -0
  114. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/62.gif +0 -0
  115. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/63.gif +0 -0
  116. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/64.gif +0 -0
  117. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/65.gif +0 -0
  118. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/66.gif +0 -0
  119. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/67.gif +0 -0
  120. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/68.gif +0 -0
  121. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/69.gif +0 -0
  122. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/7.gif +0 -0
  123. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/70.gif +0 -0
  124. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/71.gif +0 -0
  125. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/72.gif +0 -0
  126. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/73.gif +0 -0
  127. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/74.gif +0 -0
  128. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/75.gif +0 -0
  129. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/76.gif +0 -0
  130. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/77.gif +0 -0
  131. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/78.gif +0 -0
  132. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/79.gif +0 -0
  133. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/8.gif +0 -0
  134. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/80.gif +0 -0
  135. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/81.gif +0 -0
  136. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/82.gif +0 -0
  137. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/83.gif +0 -0
  138. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/84.gif +0 -0
  139. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/85.gif +0 -0
  140. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/86.gif +0 -0
  141. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/87.gif +0 -0
  142. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/88.gif +0 -0
  143. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/89.gif +0 -0
  144. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/9.gif +0 -0
  145. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/90.gif +0 -0
  146. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/91.gif +0 -0
  147. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/92.gif +0 -0
  148. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/93.gif +0 -0
  149. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/94.gif +0 -0
  150. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/95.gif +0 -0
  151. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/96.gif +0 -0
  152. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/97.gif +0 -0
  153. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/98.gif +0 -0
  154. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/99.gif +0 -0
  155. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/qq.gif +0 -0
  156. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.css +64 -0
  157. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.html +31 -0
  158. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.js +221 -0
  159. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/images/file-16.gif +0 -0
  160. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/images/file-64.gif +0 -0
  161. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/images/folder-16.gif +0 -0
  162. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/images/folder-64.gif +0 -0
  163. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/images/go-up.gif +0 -0
  164. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash.html +69 -0
  165. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.html +305 -0
  166. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/images/align_left.gif +0 -0
  167. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/images/align_right.gif +0 -0
  168. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/images/align_top.gif +0 -0
  169. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/images/refresh.gif +0 -0
  170. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.html +82 -0
  171. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media.html +73 -0
  172. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste.html +44 -0
  173. data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste.html +50 -0
  174. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/blank.gif +0 -0
  175. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/doc.gif +0 -0
  176. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/editor.css +47 -0
  177. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/flash.gif +0 -0
  178. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/loading.gif +0 -0
  179. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/media.gif +0 -0
  180. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/mp3.gif +0 -0
  181. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/pdf.gif +0 -0
  182. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/rar.gif +0 -0
  183. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/rm.gif +0 -0
  184. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/xls.gif +0 -0
  185. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/default/bg.gif +0 -0
  186. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/default/default.gif +0 -0
  187. data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/default.css +911 -0
  188. data/lib/generators/rails_kindeditor/migration/USAGE +13 -0
  189. data/lib/generators/rails_kindeditor/migration/migration_generator.rb +20 -0
  190. data/lib/generators/rails_kindeditor/migration/templates/migration/migration.rb +15 -0
  191. data/lib/rails_kindeditor/engine.rb +9 -0
  192. data/lib/rails_kindeditor/version.rb +3 -0
  193. data/lib/rails_kindeditor.rb +10 -0
  194. data/rails_kindeditor.gemspec +24 -0
  195. metadata +259 -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,31 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>File Manager</title>
6
+ <link href="../../skins/default.css" rel="stylesheet" />
7
+ <link href="./file_manager.css" rel="stylesheet" />
8
+ <script charset="utf-8" src="./file_manager.js"></script>
9
+ </head>
10
+ <body>
11
+ <table class="top" border="0" cellpadding="0" cellspacing="0" width="100%">
12
+ <tr>
13
+ <td>
14
+ <img class="ke-inline-block" id="moveupImg" src="./images/go-up.gif" width="16" height="16" border="0" alt="" />
15
+ <a class="ke-inline-block" id="moveup" href="javascript:;"><span id="lang.moveup"></span></a>
16
+ </td>
17
+ <td align="right">
18
+ <span id="lang.viewType"></span><select class="ke-inline-block" id="viewType" name="viewType"></select>
19
+ <span id="lang.orderType"></span><select class="ke-inline-block" id="orderType" name="orderType"></select>
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+ <td height="5"></td>
24
+ <td height="5"></td>
25
+ </tr>
26
+ </table>
27
+ <div id="listDiv" class="file-list"></div>
28
+ <div id="viewDiv" class="file-view"></div>
29
+ </body>
30
+ </html>
31
+
@@ -0,0 +1,221 @@
1
+ var JSON_URL = '/kindeditor/filemanager';
2
+
3
+ var KE = parent.KindEditor;
4
+ var id = KE.util.getParam(location.href, 'id');
5
+ var fileManagerJson = (typeof KE.g[id].fileManagerJson == 'undefined') ? JSON_URL : KE.g[id].fileManagerJson;
6
+ var lang = KE.lang.plugins.file_manager;
7
+ KE.event.ready(function() {
8
+ var moveupImg = KE.$('moveupImg', document);
9
+ var moveupLink = KE.$('moveup', document);
10
+ var viewType = KE.$('viewType', document);
11
+ var orderType = KE.$('orderType', document);
12
+ var listTable = KE.$('listTable', document);
13
+ var viewTable = KE.$('viewTable', document);
14
+ var listDiv = KE.$('listDiv', document);
15
+ var viewDiv = KE.$('viewDiv', document);
16
+ moveupImg.alt = moveupImg.title = lang.moveup;
17
+ viewType.options[0] = new Option(lang.viewImage, 'VIEW');
18
+ viewType.options[1] = new Option(lang.listImage, 'LIST');
19
+ orderType.options[0] = new Option(lang.fileName, 'NAME');
20
+ orderType.options[1] = new Option(lang.fileSize, 'SIZE');
21
+ orderType.options[2] = new Option(lang.fileType, 'TYPE');
22
+ var changeType = function(type) {
23
+ if (type == 'VIEW') {
24
+ listDiv.style.display = 'none';
25
+ viewDiv.style.display = '';
26
+ } else {
27
+ listDiv.style.display = '';
28
+ viewDiv.style.display = 'none';
29
+ }
30
+ };
31
+ var insertLink = function(url) {
32
+ var stack = KE.g[id].dialogStack;
33
+ if (stack.length > 1) {
34
+ var parentDialog = stack[stack.length - 2];
35
+ var dialogDoc = KE.util.getIframeDoc(parentDialog.iframe);
36
+ KE.$('url', dialogDoc).value = url;
37
+ var currentDialog = stack[stack.length - 1];
38
+ currentDialog.hide();
39
+ return true;
40
+ } else {
41
+ return false;
42
+ }
43
+ }
44
+ var insertImage = function(url, title) {
45
+ if (!insertLink(url)) {
46
+ KE.util.insertHtml(id, '<img src="' + url + '" alt="' + title + '" />');
47
+ }
48
+ };
49
+ var insertFile = function(url, title) {
50
+ if (!insertLink(url)) {
51
+ KE.util.insertHtml(id, '<a href="' + url + '" target="_blank">' + title + '</a>');
52
+ }
53
+ };
54
+ var makeFileTitle = function (filename, filesize, datetime) {
55
+ var title = filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')';
56
+ return title;
57
+ };
58
+ var bindTitle = function (el, data) {
59
+ if (data.is_dir) {
60
+ el.title = data.filename;
61
+ } else {
62
+ el.title = makeFileTitle(data.filename, data.filesize, data.datetime);
63
+ }
64
+ };
65
+ var bindEvent = function (el, result, data, createFunc) {
66
+ var fileUrl = result.current_url + data.filename;
67
+ fileUrl = KE.format.getUrl(fileUrl, 'absolute');
68
+ if (data.is_dir) {
69
+ el.onclick = (function (url, path, title) {
70
+ return function () {
71
+ reloadPage(path, orderType.value, createFunc);
72
+ }
73
+ })(data.filename, escape(result.current_dir_path + data.filename + '/'), data.filename);
74
+ } else if (data.is_photo) {
75
+ el.onclick = (function (url, title) {
76
+ return function () {
77
+ insertImage(url, title);
78
+ }
79
+ })(data.filename, data.filename);
80
+ } else {
81
+ el.onclick = (function (url, title) {
82
+ return function () {
83
+ insertFile(url, title);
84
+ }
85
+ })(data.filename, data.filename);
86
+ }
87
+ };
88
+ var createCommon = function(result, createFunc) {
89
+ if (result.current_dir_path) {
90
+ moveupLink.onclick = function () {
91
+ reloadPage(result.moveup_dir_path, orderType.value, createFunc);
92
+ };
93
+ } else {
94
+ moveupLink.onclick = null;
95
+ }
96
+ var onchangeFunc = function() {
97
+ changeType(viewType.value);
98
+ if (viewType.value == 'VIEW') reloadPage(result.current_dir_path, orderType.value, createView);
99
+ else reloadPage(result.current_dir_path, orderType.value, createList);
100
+ };
101
+ viewType.onchange = onchangeFunc;
102
+ orderType.onchange = onchangeFunc;
103
+ };
104
+ var createList = function(responseText) {
105
+ listDiv.innerHTML = '';
106
+ var result = KE.util.parseJson(responseText);
107
+ createCommon(result, createList);
108
+ var table = KE.$$('table', document);
109
+ table.className = 'file-list-table';
110
+ table.cellPadding = 0;
111
+ table.cellSpacing = 2;
112
+ table.border = 0;
113
+ listDiv.appendChild(table);
114
+ var fileList = result.file_list;
115
+ for (var i = 0, len = fileList.length; i < len; i++) {
116
+ var data = fileList[i];
117
+ var row = table.insertRow(i);
118
+ row.onmouseover = function () { this.className = 'selected'; };
119
+ row.onmouseout = function () { this.className = 'noselected'; };
120
+ var cell0 = row.insertCell(0);
121
+ cell0.className = 'name';
122
+ var iconName = data.is_dir ? 'folder-16.gif' : 'file-16.gif';
123
+ var img = KE.$$('img', document);
124
+ img.src = './images/' + iconName;
125
+ img.width = 16;
126
+ img.height = 16;
127
+ img.align = 'absmiddle';
128
+ img.alt = data.filename;
129
+ cell0.appendChild(img);
130
+ cell0.appendChild(document.createTextNode(' ' + data.filename));
131
+ if (!data.is_dir || data.has_file) {
132
+ row.style.cursor = 'pointer';
133
+ img.title = data.filename;
134
+ cell0.title = data.filename;
135
+ bindEvent(cell0, result, data, createList);
136
+ } else {
137
+ img.title = lang.emptyFolder;
138
+ cell0.title = lang.emptyFolder;
139
+ }
140
+ var cell1 = row.insertCell(1);
141
+ cell1.className = 'size';
142
+ cell1.innerHTML = data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB';
143
+ var cell2 = row.insertCell(2);
144
+ cell2.className = 'datetime';
145
+ cell2.innerHTML = data.datetime;
146
+ }
147
+ };
148
+ var createView = function(responseText) {
149
+ viewDiv.innerHTML = '';
150
+ var result = KE.util.parseJson(responseText);
151
+ createCommon(result, createView);
152
+ var fileList = result.file_list;
153
+ for (var i = 0, len = fileList.length; i < len; i++) {
154
+ var data = fileList[i];
155
+ var div = KE.$$('div', document);
156
+ div.className = 'file-view-area';
157
+ viewDiv.appendChild(div);
158
+ var tableObj = KE.util.createTable(document);
159
+ var table = tableObj.table;
160
+ table.className = 'photo noselected';
161
+ table.onmouseover = function () { this.className = 'photo selected'; };
162
+ table.onmouseout = function () { this.className = 'photo noselected'; };
163
+ var cell = tableObj.cell;
164
+ cell.valign = 'middle';
165
+ cell.align = 'center';
166
+ //var fileUrl = result.current_url + data.filename;
167
+ var fileUrl = data.filename;
168
+ //var iconUrl = data.is_dir ? './images/folder-64.gif' : (data.is_photo ? fileUrl : './images/file-64.gif');
169
+ var iconUrl = fileUrl;
170
+ var img = KE.$$('img', document);
171
+ img.src = data.filename;
172
+ img.width = data.is_dir ? 64 : 80;
173
+ img.height = data.is_dir ? 64 : 80;
174
+ img.alt = data.filename;
175
+ if (!data.is_dir || data.has_file) {
176
+ table.style.cursor = 'pointer';
177
+ bindTitle(img, data);
178
+ bindTitle(table, data);
179
+ bindEvent(table, result, data, createView);
180
+ } else {
181
+ img.title = lang.emptyFolder;
182
+ table.title = lang.emptyFolder;
183
+ }
184
+ cell.appendChild(img);
185
+ div.appendChild(table);
186
+ //var titleDiv = KE.$$('div', document);
187
+ //titleDiv.className = 'name';
188
+ //titleDiv.title = data.filename;
189
+ //titleDiv.innerHTML = data.filename;
190
+ //div.appendChild(titleDiv);
191
+ }
192
+ };
193
+ var httpRequest = function (param, func) {
194
+ KE.util.showLoadingPage(id);
195
+ var req = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
196
+ var url = fileManagerJson;
197
+ if (!url.match(/\?/)) {
198
+ url += '?';
199
+ param = param.substr(1);
200
+ }
201
+ url += param + '&' + (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('&path=' + path + '&order=' + order, func);
216
+ };
217
+ changeType('VIEW');
218
+ viewType.value = 'VIEW';
219
+ reloadPage('', orderType.value, createView);
220
+ }, window, document);
221
+