ckeditor 3.5.4 → 3.6.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/Gemfile +23 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +96 -97
  4. data/Rakefile +16 -33
  5. data/app/controllers/ckeditor/attachment_files_controller.rb +4 -4
  6. data/app/controllers/ckeditor/base_controller.rb +15 -42
  7. data/app/controllers/ckeditor/pictures_controller.rb +3 -3
  8. data/app/views/ckeditor/attachment_files/index.html.erb +13 -51
  9. data/app/views/ckeditor/pictures/index.html.erb +14 -52
  10. data/app/views/ckeditor/shared/_asset.html.erb +19 -0
  11. data/app/views/ckeditor/shared/_asset_tmpl.html.erb +21 -0
  12. data/app/views/layouts/ckeditor.html.erb +16 -23
  13. data/config/locales/en.ckeditor.yml +3 -7
  14. data/config/locales/ru.ckeditor.yml +4 -8
  15. data/config/locales/uk.ckeditor.yml +4 -8
  16. data/config/routes.rb +3 -3
  17. data/lib/ckeditor.rb +30 -79
  18. data/lib/ckeditor/engine.rb +14 -13
  19. data/lib/ckeditor/helpers/controllers.rb +30 -0
  20. data/lib/ckeditor/helpers/form_builder.rb +11 -0
  21. data/lib/ckeditor/helpers/form_helper.rb +25 -0
  22. data/lib/ckeditor/helpers/view_helper.rb +19 -0
  23. data/lib/ckeditor/http.rb +81 -0
  24. data/lib/ckeditor/orm/active_record.rb +91 -0
  25. data/lib/ckeditor/utils.rb +51 -70
  26. data/lib/ckeditor/version.rb +2 -7
  27. data/lib/generators/ckeditor/install_generator.rb +62 -0
  28. data/lib/generators/ckeditor/models_generator.rb +51 -0
  29. data/lib/generators/ckeditor/templates/ckeditor.rb +18 -0
  30. data/lib/generators/ckeditor/templates/ckeditor/config.js +52 -0
  31. data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_add.jpg +0 -0
  32. data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_add.png +0 -0
  33. data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_del.png +0 -0
  34. data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_more.gif +0 -0
  35. data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/preloader.gif +0 -0
  36. data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/ckfnothumb.gif +0 -0
  37. data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/mp3.gif +0 -0
  38. data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/pdf.gif +0 -0
  39. data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/rar.gif +0 -0
  40. data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/swf.gif +0 -0
  41. data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/xls.gif +0 -0
  42. data/lib/generators/ckeditor/templates/ckeditor/filebrowser/javascripts/application.js +222 -0
  43. data/lib/generators/ckeditor/templates/ckeditor/filebrowser/stylesheets/uploader.css +112 -0
  44. data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/attachment/dialogs/attachment.js +0 -0
  45. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/images/attachment.png +0 -0
  46. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/lang/en.js +0 -0
  47. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/lang/ru.js +0 -0
  48. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/lang/uk.js +0 -0
  49. data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/attachment/plugin.js +0 -0
  50. data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/embed/dialogs/embed.js +0 -0
  51. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/images/embed.png +0 -0
  52. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/lang/en.js +0 -0
  53. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/lang/ru.js +0 -0
  54. data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/lang/uk.js +0 -0
  55. data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/embed/plugin.js +0 -0
  56. data/lib/generators/ckeditor/templates/models/active_record/asset.rb +7 -0
  57. data/lib/generators/ckeditor/templates/models/active_record/attachment_file.rb +15 -0
  58. data/lib/generators/ckeditor/{migration/templates/models/paperclip → templates/models/active_record}/migration.rb +3 -8
  59. data/lib/generators/ckeditor/templates/models/active_record/picture.rb +13 -0
  60. data/test/ckeditor_test.rb +13 -0
  61. data/test/controllers/attachment_files_controller_test.rb +52 -0
  62. data/test/controllers/pictures_controller_test.rb +52 -0
  63. data/test/dummy/Rakefile +7 -0
  64. data/test/dummy/app/controllers/application_controller.rb +4 -0
  65. data/test/dummy/app/controllers/posts_controller.rb +83 -0
  66. data/test/dummy/app/helpers/application_helper.rb +2 -0
  67. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  68. data/test/dummy/app/models/ckeditor/asset.rb +7 -0
  69. data/test/dummy/app/models/ckeditor/attachment_file.rb +15 -0
  70. data/test/dummy/app/models/ckeditor/picture.rb +13 -0
  71. data/test/dummy/app/models/post.rb +3 -0
  72. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  73. data/test/dummy/app/views/posts/_form.html.erb +30 -0
  74. data/test/dummy/app/views/posts/edit.html.erb +6 -0
  75. data/test/dummy/app/views/posts/index.html.erb +27 -0
  76. data/test/dummy/app/views/posts/new.html.erb +5 -0
  77. data/test/dummy/app/views/posts/show.html.erb +5 -0
  78. data/test/dummy/config.ru +4 -0
  79. data/test/dummy/config/application.rb +46 -0
  80. data/test/dummy/config/boot.rb +10 -0
  81. data/test/dummy/config/database.yml +34 -0
  82. data/test/dummy/config/environment.rb +5 -0
  83. data/test/dummy/config/environments/development.rb +26 -0
  84. data/test/dummy/config/environments/production.rb +49 -0
  85. data/test/dummy/config/environments/test.rb +35 -0
  86. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  87. data/test/dummy/config/initializers/ckeditor.rb +18 -0
  88. data/test/dummy/config/initializers/inflections.rb +10 -0
  89. data/test/dummy/config/initializers/mime_types.rb +5 -0
  90. data/test/dummy/config/initializers/secret_token.rb +7 -0
  91. data/test/dummy/config/initializers/session_store.rb +8 -0
  92. data/test/dummy/config/locales/en.yml +5 -0
  93. data/test/dummy/config/routes.rb +4 -0
  94. data/test/dummy/db/migrate/20110623120047_create_posts.rb +14 -0
  95. data/test/dummy/db/migrate/20110705195648_create_ckeditor_assets.rb +26 -0
  96. data/test/dummy/db/schema.rb +36 -0
  97. data/test/dummy/log/development.log +818 -0
  98. data/test/dummy/log/production.log +0 -0
  99. data/test/dummy/log/server.log +0 -0
  100. data/test/dummy/log/test.log +5398 -0
  101. data/test/dummy/public/404.html +26 -0
  102. data/test/dummy/public/422.html +26 -0
  103. data/test/dummy/public/500.html +26 -0
  104. data/test/dummy/public/favicon.ico +0 -0
  105. data/test/dummy/public/javascripts/application.js +2 -0
  106. data/test/dummy/public/javascripts/controls.js +965 -0
  107. data/test/dummy/public/javascripts/dragdrop.js +974 -0
  108. data/test/dummy/public/javascripts/effects.js +1123 -0
  109. data/test/dummy/public/javascripts/prototype.js +6001 -0
  110. data/test/dummy/public/javascripts/rails.js +191 -0
  111. data/test/dummy/public/stylesheets/scaffold.css +56 -0
  112. data/test/dummy/script/rails +6 -0
  113. data/test/dummy/test/fixtures/files/rails.png +0 -0
  114. data/test/dummy/test/fixtures/files/rails.tar.gz +0 -0
  115. data/test/generators/install_generator_test.rb +18 -0
  116. data/test/generators/models_generator_test.rb +21 -0
  117. data/test/integration/navigation_test.rb +7 -0
  118. data/test/integration/posts_test.rb +41 -0
  119. data/test/routes_test.rb +47 -0
  120. data/test/support/integration_case.rb +5 -0
  121. data/test/test_helper.rb +28 -0
  122. data/test/tmp/app/models/ckeditor/asset.rb +7 -0
  123. data/test/tmp/app/models/ckeditor/attachment_file.rb +15 -0
  124. data/test/tmp/app/models/ckeditor/picture.rb +13 -0
  125. data/test/tmp/db/migrate/20110711170413_create_ckeditor_assets.rb +26 -0
  126. metadata +220 -99
  127. data/CHANGELOG +0 -15
  128. data/app/helpers/ckeditor/base_helper.rb +0 -21
  129. data/app/views/ckeditor/_asset.html.erb +0 -20
  130. data/app/views/ckeditor/_swfupload.html.erb +0 -73
  131. data/lib/ckeditor/form_builder.rb +0 -22
  132. data/lib/ckeditor/middleware.rb +0 -18
  133. data/lib/ckeditor/view_helper.rb +0 -92
  134. data/lib/generators/ckeditor/base/USAGE +0 -9
  135. data/lib/generators/ckeditor/base/base_generator.rb +0 -41
  136. data/lib/generators/ckeditor/base/templates/ckeditor.rb +0 -54
  137. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/dialogs/attachment.js +0 -384
  138. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/plugin.js +0 -44
  139. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/dialogs/embed.js +0 -65
  140. data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/plugin.js +0 -43
  141. data/lib/generators/ckeditor/base/templates/ckeditor/config.js +0 -43
  142. data/lib/generators/ckeditor/base/templates/ckeditor/css/ckfinder.css +0 -316
  143. data/lib/generators/ckeditor/base/templates/ckeditor/css/fck_dialog.css +0 -119
  144. data/lib/generators/ckeditor/base/templates/ckeditor/css/fck_editor.css +0 -448
  145. data/lib/generators/ckeditor/base/templates/ckeditor/css/swfupload.css +0 -94
  146. data/lib/generators/ckeditor/base/templates/ckeditor/images/add.gif +0 -0
  147. data/lib/generators/ckeditor/base/templates/ckeditor/images/cancelbutton.gif +0 -0
  148. data/lib/generators/ckeditor/base/templates/ckeditor/images/doc.gif +0 -0
  149. data/lib/generators/ckeditor/base/templates/ckeditor/images/refresh.gif +0 -0
  150. data/lib/generators/ckeditor/base/templates/ckeditor/images/select_files.png +0 -0
  151. data/lib/generators/ckeditor/base/templates/ckeditor/images/spacer.gif +0 -0
  152. data/lib/generators/ckeditor/base/templates/ckeditor/images/toolbar.start.gif +0 -0
  153. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/images/attachment.png +0 -0
  154. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/en.js +0 -10
  155. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/ru.js +0 -10
  156. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/uk.js +0 -10
  157. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/images/embed.png +0 -0
  158. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/en.js +0 -9
  159. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/ru.js +0 -9
  160. data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/uk.js +0 -9
  161. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/fileprogress.js +0 -266
  162. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/handlers.js +0 -181
  163. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/jquery-1.5.1.min.js +0 -16
  164. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/querystring.js +0 -40
  165. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/rails.js +0 -158
  166. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.js +0 -1
  167. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.queue.js +0 -1
  168. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swf +0 -0
  169. data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swfobject.js +0 -111
  170. data/lib/generators/ckeditor/migration/USAGE +0 -12
  171. data/lib/generators/ckeditor/migration/migration_generator.rb +0 -46
  172. data/lib/generators/ckeditor/migration/templates/models/attachment_fu/asset.rb +0 -32
  173. data/lib/generators/ckeditor/migration/templates/models/attachment_fu/attachment_file.rb +0 -24
  174. data/lib/generators/ckeditor/migration/templates/models/attachment_fu/migration.rb +0 -30
  175. data/lib/generators/ckeditor/migration/templates/models/attachment_fu/picture.rb +0 -25
  176. data/lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb +0 -97
  177. data/lib/generators/ckeditor/migration/templates/models/paperclip/attachment_file.rb +0 -40
  178. data/lib/generators/ckeditor/migration/templates/models/paperclip/picture.rb +0 -23
  179. data/lib/tasks/ckeditor_tasks.rake +0 -3
@@ -1,94 +0,0 @@
1
- .progressWrapper {
2
- width: 357px;
3
- overflow: hidden;
4
- }
5
-
6
- .progressContainer {
7
- margin: 5px;
8
- padding: 4px;
9
- border: solid 1px #E8E8E8;
10
- background-color: #F7F7F7;
11
- overflow: hidden;
12
- }
13
- /* Message */
14
- .message {
15
- margin: 1em 0;
16
- padding: 10px 20px;
17
- border: solid 1px #FFDD99;
18
- background-color: #FFFFCC;
19
- overflow: hidden;
20
- }
21
- /* Error */
22
- .red {
23
- border: solid 1px #B50000;
24
- background-color: #FFEBEB;
25
- }
26
-
27
- /* Current */
28
- .green {
29
- border: solid 1px #DDF0DD;
30
- background-color: #EBFFEB;
31
- }
32
-
33
- /* Complete */
34
- .blue {
35
- border: solid 1px #CEE2F2;
36
- background-color: #F0F5FF;
37
- }
38
- .progressName {
39
- font-size: 8pt;
40
- font-weight: 700;
41
- color: #555;
42
- width: 323px;
43
- height: 14px;
44
- text-align: left;
45
- white-space: nowrap;
46
- overflow: hidden;
47
- }
48
-
49
- .progressBarInProgress,
50
- .progressBarComplete,
51
- .progressBarError {
52
- font-size: 0;
53
- width: 0%;
54
- height: 2px;
55
- background-color: blue;
56
- margin-top: 2px;
57
- }
58
-
59
- .progressBarComplete {
60
- width: 100%;
61
- background-color: green;
62
- visibility: hidden;
63
- }
64
-
65
- .progressBarError {
66
- width: 100%;
67
- background-color: red;
68
- visibility: hidden;
69
- }
70
-
71
- .progressBarStatus {
72
- margin-top: 2px;
73
- width: 337px;
74
- font-size: 7pt;
75
- font-family: Arial;
76
- text-align: left;
77
- white-space: nowrap;
78
- }
79
-
80
- a.progressCancel {
81
- font-size: 0;
82
- display: block;
83
- height: 14px;
84
- width: 14px;
85
- background-image: url(/javascripts/ckeditor/images/cancelbutton.gif);
86
- background-repeat: no-repeat;
87
- background-position: -14px 0px;
88
- float: right;
89
- }
90
-
91
- a.progressCancel:hover {
92
- background-position: 0px 0px;
93
- }
94
-
@@ -1,10 +0,0 @@
1
- CKEDITOR.plugins.setLang('attachment', 'en',
2
- {
3
- attachment :
4
- {
5
- title : "Insert attachment",
6
- url: "URL",
7
- name: "Title",
8
- button : "Insert attachment"
9
- }
10
- });
@@ -1,10 +0,0 @@
1
- CKEDITOR.plugins.setLang('attachment', 'ru',
2
- {
3
- attachment :
4
- {
5
- title : "Включить вложения",
6
- url: "URL",
7
- name: "Название",
8
- button : "Вставить"
9
- }
10
- });
@@ -1,10 +0,0 @@
1
- CKEDITOR.plugins.setLang('attachment', 'uk',
2
- {
3
- attachment :
4
- {
5
- title : "Вставити файл",
6
- url: "URL",
7
- name: "Назва",
8
- button : "Вставити"
9
- }
10
- });
@@ -1,9 +0,0 @@
1
- CKEDITOR.plugins.setLang('embed', 'en',
2
- {
3
- embed :
4
- {
5
- title : "Paste embed",
6
- button : "Paste embed",
7
- pasteMsg : "Please, paste embed-code from Youtube, Myspace, Flickr and others sources into rectangle, using the keyboard (Ctrl + V), and click OK."
8
- }
9
- });
@@ -1,9 +0,0 @@
1
- CKEDITOR.plugins.setLang('embed', 'ru',
2
- {
3
- embed :
4
- {
5
- title : "Вставить embed",
6
- button : "Вставить embed",
7
- pasteMsg : "Пожалуйста, вставьте embed-код с Youtube, Myspace, Flickr и других ресурсов в прямоугольник, используя сочетание клавиш (Ctrl+V), и нажмите OK."
8
- }
9
- });
@@ -1,9 +0,0 @@
1
- CKEDITOR.plugins.setLang('embed', 'uk',
2
- {
3
- embed :
4
- {
5
- title : "Вставити embed",
6
- button : "Вставити embed",
7
- pasteMsg : "Будь ласка, вставте embed-код з Youtube, Myspace, Flickr та інших ресурсів в прямокутник, використовуючи (Ctrl+V), та нажміть OK."
8
- }
9
- });
@@ -1,266 +0,0 @@
1
- /* ******************************************
2
- * FileProgress Object
3
- * Control object for displaying file info
4
- * ****************************************** */
5
-
6
- function FileThumb(element_id) {
7
- this.element = $('#' + element_id);
8
- this.init();
9
- }
10
-
11
- FileThumb.prototype.init = function(){
12
- this.element.find('div.FCKThumb').each(function(){
13
- FileThumb.observe(this);
14
- });
15
- }
16
-
17
- FileThumb.observe = function(element){
18
- var element = $(element);
19
-
20
- element.unbind('mouseover');
21
- element.unbind('mouseout');
22
- element.unbind('click');
23
-
24
- element.bind('mouseover', function(){ $(this).addClass('FCKSelectedBox') } );
25
- element.bind('mouseout', function(){ $(this).removeClass('FCKSelectedBox') } );
26
- element.find('div.FCKAsset').bind('click', function(){ setUrl( $(this).find('img.image').attr('alt') ); return false; } );
27
- }
28
-
29
- function ToolBar(element_id){
30
- this.container = document.getElementById(element_id);
31
- this.buttons = new Array();
32
-
33
- this.table = null;
34
- }
35
-
36
- ToolBar.prototype.clear = function(){
37
- this.buttons = new Array();
38
- }
39
-
40
- ToolBar.prototype.init = function(){
41
- this.table = document.createElement('table');
42
- this.table.appendChild(document.createElement("TBODY"));
43
- this.table.border = 0;
44
- this.table.setAttribute('cellspacing', 0);
45
- this.table.setAttribute('cellpadding', 0);
46
- this.table.className = "TB_Toolbar";
47
-
48
- var row = this.table.tBodies[0].insertRow(0);
49
- var cell = row.insertCell(row.cells.length);
50
-
51
- div = document.createElement('div');
52
- div.className = 'TB_Start';
53
- div.innerHTML = " "
54
- cell.appendChild(div);
55
-
56
- this.init_buttons(row);
57
-
58
- this.container.appendChild(this.table);
59
- }
60
-
61
- ToolBar.prototype.init_buttons = function(row){
62
-
63
- for(var i = 0; i < this.buttons.length; i++)
64
- {
65
- var cell = row.insertCell(row.cells.length);
66
- this.buttons[i].init();
67
- cell.appendChild(this.buttons[i].element);
68
- }
69
- }
70
-
71
- function Button(title, text, image){
72
- this.title = title;
73
- this.text = text;
74
- this.image = image;
75
-
76
- this.callback = function(){};
77
- this.element = null;
78
- }
79
-
80
- Button.prototype.init = function(){
81
- this.element = document.createElement('div');
82
- this.element.title = this.title;
83
- this.element.className = "TB_Button";
84
-
85
- table = document.createElement('table');
86
- table.appendChild(document.createElement("TBODY"));
87
- table.border = 0;
88
- table.setAttribute('cellspacing', 0);
89
- table.setAttribute('cellpadding', 0);
90
-
91
- var row = table.tBodies[0].insertRow(0);
92
- var cell = row.insertCell(row.cells.length);
93
-
94
- image = document.createElement('img');
95
- image.src = '/javascripts/ckeditor/images/' + this.image;
96
- image.className = 'TB_Button_Image';
97
-
98
- cell.appendChild(image);
99
-
100
- var cell = row.insertCell(row.cells.length);
101
- cell.className = 'TB_Button_Text';
102
- cell.innerHTML = this.text;
103
- row.appendChild(cell);
104
-
105
- var cell = row.insertCell(row.cells.length);
106
- image = document.createElement('img');
107
- image.src = '/javascripts/ckeditor/images/spacer.gif';
108
- image.className = 'TB_Button_Padding';
109
- cell.appendChild(image);
110
-
111
- this.element.appendChild(table);
112
-
113
- this.element.onclick = this.callback;
114
- this.element.onmouseover = function addButtonHover() { this.className = "TB_Button_Off_Over"; }
115
- this.element.onmouseout = function removeButtonHover() { this.className = "TB_Button"; }
116
- }
117
-
118
- function FileProgress(file, targetID) {
119
- this.fileProgressID = "divFileProgress";
120
-
121
- this.fileProgressWrapper = document.getElementById(this.fileProgressID);
122
- if (!this.fileProgressWrapper) {
123
- this.fileProgressWrapper = document.createElement("div");
124
- this.fileProgressWrapper.className = "progressWrapper";
125
- this.fileProgressWrapper.id = this.fileProgressID;
126
-
127
- this.fileProgressElement = document.createElement("div");
128
- this.fileProgressElement.className = "progressContainer";
129
-
130
- var progressCancel = document.createElement("a");
131
- progressCancel.className = "progressCancel";
132
- progressCancel.href = "#";
133
- progressCancel.style.visibility = "hidden";
134
- progressCancel.appendChild(document.createTextNode(" "));
135
-
136
- var progressText = document.createElement("div");
137
- progressText.className = "progressName";
138
- progressText.appendChild(document.createTextNode(file.name));
139
-
140
- var progressBar = document.createElement("div");
141
- progressBar.className = "progressBarInProgress";
142
-
143
- var progressStatus = document.createElement("div");
144
- progressStatus.className = "progressBarStatus";
145
- progressStatus.innerHTML = "&nbsp;";
146
-
147
- this.fileProgressElement.appendChild(progressCancel);
148
- this.fileProgressElement.appendChild(progressText);
149
- this.fileProgressElement.appendChild(progressStatus);
150
- this.fileProgressElement.appendChild(progressBar);
151
-
152
- this.fileProgressWrapper.appendChild(this.fileProgressElement);
153
-
154
- document.getElementById(targetID).appendChild(this.fileProgressWrapper);
155
- //fadeIn(this.fileProgressWrapper, 0);
156
-
157
- } else {
158
- this.fileProgressElement = this.fileProgressWrapper.firstChild;
159
- this.fileProgressElement.childNodes[1].firstChild.nodeValue = file.name;
160
- }
161
-
162
- this.height = this.fileProgressWrapper.offsetHeight;
163
-
164
- }
165
- FileProgress.prototype.setProgress = function (percentage) {
166
- this.fileProgressElement.className = "progressContainer green";
167
- this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
168
- this.fileProgressElement.childNodes[3].style.width = percentage + "%";
169
- };
170
- FileProgress.prototype.setComplete = function () {
171
- this.fileProgressElement.className = "progressContainer blue";
172
- this.fileProgressElement.childNodes[3].className = "progressBarComplete";
173
- this.fileProgressElement.childNodes[3].style.width = "";
174
-
175
- };
176
- FileProgress.prototype.setError = function () {
177
- this.fileProgressElement.className = "progressContainer red";
178
- this.fileProgressElement.childNodes[3].className = "progressBarError";
179
- this.fileProgressElement.childNodes[3].style.width = "";
180
-
181
- };
182
- FileProgress.prototype.setCancelled = function () {
183
- this.fileProgressElement.className = "progressContainer";
184
- this.fileProgressElement.childNodes[3].className = "progressBarError";
185
- this.fileProgressElement.childNodes[3].style.width = "";
186
-
187
- };
188
- FileProgress.prototype.setStatus = function (status) {
189
- this.fileProgressElement.childNodes[2].innerHTML = status;
190
- };
191
-
192
- FileProgress.prototype.toggleCancel = function (show, swfuploadInstance) {
193
- this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
194
- if (swfuploadInstance) {
195
- var fileID = this.fileProgressID;
196
- this.fileProgressElement.childNodes[0].onclick = function () {
197
- swfuploadInstance.cancelUpload(fileID);
198
- return false;
199
- };
200
- }
201
- };
202
-
203
- FileProgress.prototype.createThumbnail = function(serverData) {
204
- var object = jQuery.parseJSON(serverData);
205
- var container = document.getElementById('container');
206
- var asset = (typeof(object.asset) == 'undefined') ? object : object.asset;
207
-
208
- var image_src = null;
209
- var image_alt = null;
210
- var file_size = null;
211
- var file_name = null;
212
- var file_date = null;
213
-
214
- if (typeof asset == 'undefined')
215
- return;
216
-
217
- image_alt = asset.url;
218
- file_size = asset.size;
219
- file_name = asset.filename;
220
- file_date = asset.format_created_at;
221
-
222
- image_src = asset.url_thumb;
223
- image_alt = asset.url_content;
224
-
225
- var thumb = document.createElement('DIV');
226
- thumb.className = 'FCKThumb';
227
-
228
- var div = document.createElement('DIV');
229
- div.className = 'FCKAsset';
230
-
231
- var table = document.createElement('TABLE');
232
- table.appendChild(document.createElement("TBODY"));
233
- table.border = 0;
234
- table.setAttribute('cellspacing', 0);
235
- table.setAttribute('cellpadding', 0);
236
- table.setAttribute('width', 100);
237
- table.setAttribute('height', 100);
238
-
239
- var row = table.tBodies[0].insertRow(0);
240
- var cell = row.insertCell(row.cells.length);
241
- cell.setAttribute('align', 'center');
242
- cell.setAttribute('valign', 'middle');
243
-
244
- cell.innerHTML = "<img src='" + image_src + "' alt='" + image_alt + "' title='" + file_name + "' class='image' onerror=\"this.src='/javascripts/ckeditor/images/ckfnothumb.gif'\" />"
245
-
246
- var div_name = document.createElement('DIV');
247
- div_name.className = "FCKFileName";
248
- div_name.innerHTML = file_name;
249
-
250
- var div_date = document.createElement('DIV');
251
- div_date.className = "FCKFileDate";
252
- div_date.innerHTML = file_date;
253
-
254
- var div_size = document.createElement('DIV');
255
- div_size.className = "FCKFileSize";
256
- div_size.innerHTML = file_size;
257
-
258
- div.appendChild(table);
259
- div.appendChild(div_name);
260
- div.appendChild(div_date);
261
- div.appendChild(div_size);
262
- thumb.appendChild(div);
263
-
264
- container.appendChild(thumb);
265
- FileThumb.observe(thumb);
266
- };
@@ -1,181 +0,0 @@
1
- function setUrl(url)
2
- {
3
- CKEDITOR.tools.callFunction(CKEditorFuncNum, url);
4
- window.close();
5
- }
6
-
7
- function uploadButton(button)
8
- {
9
- $('#fj').toggle();
10
- }
11
-
12
- function uploadStart(file) {
13
- try {
14
- /* I don't want to do any file validation or anything, I'll just update the UI and
15
- return true to indicate that the upload should start.
16
- It's important to update the UI here because in Linux no uploadProgress events are called. The best
17
- we can do is say we are uploading.
18
- */
19
- var progress = new FileProgress(file, this.customSettings.progressTarget);
20
- progress.setStatus("Loading...");
21
- progress.setProgress(0);
22
- //progress.toggleCancel(true, this);
23
- }
24
- catch (ex) {}
25
-
26
- return true;
27
- }
28
-
29
- function fileQueued(file) {
30
- try {
31
- var progress = new FileProgress(file, this.customSettings.progressTarget);
32
- progress.setStatus("Preparing...");
33
- progress.setProgress(0);
34
- progress.toggleCancel(true, this);
35
-
36
- var e = document.getElementById('divFileProgressContainer');
37
- e.style.display = '';
38
- } catch (ex) {
39
- this.debug(ex);
40
- }
41
-
42
- }
43
-
44
- function fileQueueError(file, errorCode, message) {
45
- try {
46
- if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
47
- alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
48
- return;
49
- }
50
-
51
- var progress = new FileProgress(file, this.customSettings.progressTarget);
52
- progress.setError();
53
- progress.toggleCancel(false);
54
-
55
- switch (errorCode) {
56
- case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
57
- progress.setStatus("File is too big.");
58
- this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
59
- break;
60
- case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
61
- progress.setStatus("Cannot upload Zero Byte files.");
62
- this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
63
- break;
64
- case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
65
- progress.setStatus("Invalid File Type.");
66
- this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
67
- break;
68
- default:
69
- if (file !== null) {
70
- progress.setStatus("Unhandled Error");
71
- }
72
- this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
73
- break;
74
- }
75
- } catch (ex) {
76
- this.debug(ex);
77
- }
78
- }
79
-
80
- function fileDialogComplete(numFilesSelected, numFilesQueued) {
81
- try {
82
- if (numFilesSelected > 0) {
83
- //document.getElementById(this.customSettings.cancelButtonId).disabled = false;
84
- }
85
-
86
- this.startUpload();
87
- } catch (ex) {
88
- this.debug(ex);
89
- }
90
- }
91
-
92
- function uploadProgress(file, bytesLoaded) {
93
-
94
- try {
95
- var percent = Math.ceil((bytesLoaded / file.size) * 100);
96
-
97
- var progress = new FileProgress(file, this.customSettings.upload_target);
98
- progress.setProgress(percent);
99
- if (percent === 100) {
100
- progress.setStatus("Create thumbnail...");
101
- progress.toggleCancel(false, this);
102
- } else {
103
- progress.setStatus("Loading...");
104
- progress.toggleCancel(true, this);
105
- }
106
- } catch (ex) {
107
- this.debug(ex);
108
- }
109
- }
110
-
111
- function uploadSuccess(file, serverData) {
112
- try {
113
- var progress = new FileProgress(file, this.customSettings.progressTarget);
114
- progress.setComplete();
115
- progress.setStatus("Completed.");
116
- progress.toggleCancel(false);
117
-
118
- progress.createThumbnail(serverData);
119
-
120
- } catch (ex) {
121
- this.debug(ex);
122
- }
123
- }
124
-
125
- function uploadComplete(file) {
126
- try {
127
- /* I want the next upload to continue automatically so I'll call startUpload here */
128
- if (this.getStats().files_queued > 0) {
129
- //this.startUpload();
130
- } else {
131
- var progress = new FileProgress(file, this.customSettings.upload_target);
132
- progress.setComplete();
133
- progress.setStatus("All pictures are successfully processed.");
134
- progress.toggleCancel(false);
135
- }
136
- } catch (ex) {
137
- this.debug(ex);
138
- }
139
- }
140
-
141
- function uploadError(file, errorCode, message) {
142
- var progress;
143
- try {
144
- switch (errorCode) {
145
- case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
146
- try {
147
- progress = new FileProgress(file, this.customSettings.upload_target);
148
- progress.setCancelled();
149
- progress.setStatus("Canceled");
150
- progress.toggleCancel(false);
151
- }
152
- catch (ex1) {
153
- this.debug(ex1);
154
- }
155
- break;
156
- case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
157
- try {
158
- progress = new FileProgress(file, this.customSettings.upload_target);
159
- progress.setCancelled();
160
- progress.setStatus("Stoped");
161
- progress.toggleCancel(true);
162
- }
163
- catch (ex2) {
164
- this.debug(ex2);
165
- }
166
- case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
167
- break;
168
- default:
169
- alert(message);
170
- break;
171
- }
172
- } catch (ex3) {
173
- this.debug(ex3);
174
- }
175
- }
176
-
177
- // This event comes from the Queue Plugin
178
- function queueComplete(numFilesUploaded) {
179
- var e = document.getElementById('divFileProgressContainer');
180
- e.style.display = 'none';
181
- }