alchemy_cms 2.2.rc13 → 2.2.rc14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/Rakefile +3 -0
  2. data/alchemy_cms.gemspec +1 -0
  3. data/app/assets/javascripts/alchemy/alchemy.base.js +95 -94
  4. data/app/assets/javascripts/alchemy/alchemy.buttons.js +15 -11
  5. data/app/assets/javascripts/alchemy/alchemy.datepicker.js +18 -18
  6. data/app/assets/javascripts/alchemy/alchemy.dirty.js +20 -20
  7. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +50 -44
  8. data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +15 -12
  9. data/app/assets/javascripts/alchemy/alchemy.elements_window.js +47 -43
  10. data/app/assets/javascripts/alchemy/alchemy.file_progress.js +27 -17
  11. data/app/assets/javascripts/alchemy/alchemy.growler.js +19 -15
  12. data/app/assets/javascripts/alchemy/alchemy.html5.js +1 -2
  13. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +10 -11
  14. data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +6 -6
  15. data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +4 -6
  16. data/app/assets/javascripts/alchemy/alchemy.menubar.js +16 -20
  17. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +18 -16
  18. data/app/assets/javascripts/alchemy/alchemy.preview.js +30 -30
  19. data/app/assets/javascripts/alchemy/alchemy.preview_window.js +50 -42
  20. data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +11 -11
  21. data/app/assets/javascripts/alchemy/alchemy.swf_upload.js +83 -86
  22. data/app/assets/javascripts/alchemy/alchemy.uploader.js +106 -112
  23. data/app/assets/javascripts/alchemy/alchemy.windows.js +158 -130
  24. data/app/assets/stylesheets/alchemy/base.css.scss +7 -1
  25. data/app/assets/stylesheets/alchemy/buttons.css.scss +31 -25
  26. data/app/assets/stylesheets/alchemy/elements.css.scss +4 -0
  27. data/app/controllers/alchemy/admin/base_controller.rb +5 -1
  28. data/app/helpers/alchemy/admin/base_helper.rb +21 -13
  29. data/app/helpers/alchemy/admin/contents_helper.rb +52 -11
  30. data/app/helpers/alchemy/admin/elements_helper.rb +0 -1
  31. data/app/helpers/alchemy/admin/essences_helper.rb +5 -5
  32. data/app/helpers/alchemy/essences_helper.rb +1 -0
  33. data/app/models/alchemy/content.rb +102 -91
  34. data/app/models/alchemy/essence_boolean.rb +8 -0
  35. data/app/models/alchemy/essence_select.rb +7 -0
  36. data/app/sweepers/alchemy/content_sweeper.rb +2 -4
  37. data/app/views/alchemy/admin/clipboard/clear.js.erb +3 -2
  38. data/app/views/alchemy/admin/clipboard/index.html.erb +2 -2
  39. data/app/views/alchemy/admin/contents/create.js.erb +2 -0
  40. data/app/views/alchemy/admin/contents/destroy.js.coffee +4 -0
  41. data/app/views/alchemy/admin/contents/new.html.erb +1 -1
  42. data/app/views/alchemy/admin/elements/_element_foot.html.erb +3 -2
  43. data/app/views/alchemy/admin/elements/create.js.coffee +31 -0
  44. data/app/views/alchemy/admin/elements/fold.js.coffee +37 -0
  45. data/app/views/alchemy/admin/essence_pictures/assign.js.coffee +15 -0
  46. data/app/views/alchemy/admin/essence_pictures/destroy.js.coffee +19 -0
  47. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +12 -2
  48. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
  49. data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
  50. data/app/views/alchemy/admin/pages/destroy.js.coffee +19 -0
  51. data/app/views/alchemy/admin/pages/edit.html.erb +5 -5
  52. data/app/views/alchemy/admin/pages/update.js.coffee +36 -0
  53. data/app/views/alchemy/admin/resources/_form.html.erb +12 -1
  54. data/app/views/alchemy/admin/resources/_resource.html.erb +6 -3
  55. data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
  56. data/app/views/alchemy/admin/trash/clear.js.coffee +4 -0
  57. data/app/views/alchemy/admin/trash/index.html.erb +4 -4
  58. data/app/views/alchemy/elements/_article_editor.html.erb +4 -2
  59. data/app/views/alchemy/elements/_article_view.html.erb +7 -7
  60. data/app/views/alchemy/elements/_download_editor.html.erb +4 -1
  61. data/app/views/alchemy/elements/_download_view.html.erb +7 -3
  62. data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +1 -0
  63. data/app/views/alchemy/elements/_image_mosaic_view.html.erb +11 -9
  64. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +14 -0
  65. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -0
  66. data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
  67. data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
  68. data/app/views/alchemy/essences/_essence_html_editor.html.erb +1 -1
  69. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +1 -1
  70. data/app/views/alchemy/essences/_essence_select_editor.html.erb +35 -0
  71. data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -0
  72. data/app/views/alchemy/essences/_essence_text_editor.html.erb +29 -77
  73. data/app/views/alchemy/essences/_essence_text_view.html.erb +2 -2
  74. data/config/alchemy/elements.yml +72 -44
  75. data/config/locales/alchemy.de.yml +46 -45
  76. data/config/locales/alchemy.en.yml +90 -89
  77. data/db/migrate/20120608085509_create_alchemy_essence_selects.rb +11 -0
  78. data/db/migrate/20120611221734_create_alchemy_essence_booleans.rb +11 -0
  79. data/lib/alchemy/authentication_helpers.rb +3 -7
  80. data/lib/alchemy/engine.rb +3 -4
  81. data/lib/alchemy/essence.rb +24 -16
  82. data/lib/alchemy/resource.rb +22 -3
  83. data/lib/alchemy/resources_helper.rb +8 -0
  84. data/lib/alchemy/seeder.rb +26 -1
  85. data/lib/alchemy/upgrader.rb +70 -1
  86. data/lib/alchemy/version.rb +1 -1
  87. data/lib/alchemy_cms.rb +1 -0
  88. data/spec/controllers/admin/clipboard_controller_spec.rb +16 -4
  89. data/spec/controllers/admin/contents_controller_spec.rb +21 -4
  90. data/spec/dummy/app/models/event.rb +1 -1
  91. data/spec/dummy/db/schema.rb +18 -1
  92. data/spec/helpers/admin/contents_helper_spec.rb +3 -2
  93. data/spec/models/clipboard_spec.rb +14 -3
  94. data/spec/models/essence_boolean_spec.rb +15 -0
  95. data/spec/models/essence_select_spec.rb +15 -0
  96. data/spec/models/resource_spec.rb +113 -0
  97. metadata +40 -12
  98. data/app/views/alchemy/admin/contents/destroy.js.erb +0 -7
  99. data/app/views/alchemy/admin/elements/create.js.erb +0 -36
  100. data/app/views/alchemy/admin/elements/fold.js.erb +0 -41
  101. data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -16
  102. data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +0 -20
  103. data/app/views/alchemy/admin/pages/destroy.js.erb +0 -12
  104. data/app/views/alchemy/admin/pages/update.js.erb +0 -40
  105. data/app/views/alchemy/admin/trash/clear.js.erb +0 -3
  106. data/spec/dummy/app/models/.gitkeep +0 -0
@@ -1,37 +1,37 @@
1
1
  // This object provides dynamically generated Rails routes in Javascript.
2
2
  // A little bit hacky, but the best solution so far. ^_^
3
3
  <% self.class.send(:include, Alchemy::Engine.routes.url_helpers) %>
4
+
4
5
  if (typeof(Alchemy) === 'undefined') {
5
6
  var Alchemy = {};
6
7
  }
7
8
 
8
- (function ($) {
9
+ (function($) {
9
10
 
10
11
  var routes = {};
11
12
  $.extend(Alchemy, routes);
12
13
 
13
14
  Alchemy.routes = {
14
15
 
15
- admin_picture_path:function (id) {
16
+ admin_picture_path: function(id) {
16
17
  return '<%= admin_picture_path(:id => 1) %>'.replace(/1/, id);
17
18
  },
18
19
 
19
- admin_trash_path:function (page_id) {
20
+ admin_trash_path: function(page_id) {
20
21
  var url = '<%= admin_trash_path %>';
21
- if (page_id)
22
- url += '?page_id=' + page_id;
22
+ if (page_id) url += '?page_id=' + page_id;
23
23
  return url;
24
24
  },
25
25
 
26
- fold_admin_element_path:function (id) {
26
+ fold_admin_element_path: function(id) {
27
27
  return '<%= fold_admin_element_path(:id => 1) %>'.replace(/1/, id);
28
28
  },
29
29
 
30
- list_admin_elements_path:'<%= list_admin_elements_path %>',
31
- order_admin_contents_path:'<%= order_admin_contents_path %>',
32
- order_admin_elements_path:'<%= order_admin_elements_path %>',
33
- order_admin_pages_path:'<%= order_admin_pages_path %>',
34
- link_admin_pages_path:'<%= link_admin_pages_path %>'
30
+ list_admin_elements_path: '<%= list_admin_elements_path %>',
31
+ order_admin_contents_path: '<%= order_admin_contents_path %>',
32
+ order_admin_elements_path: '<%= order_admin_elements_path %>',
33
+ order_admin_pages_path: '<%= order_admin_pages_path %>',
34
+ link_admin_pages_path: '<%= link_admin_pages_path %>'
35
35
 
36
36
  }
37
37
 
@@ -6,13 +6,13 @@ if (typeof(Alchemy) === 'undefined') {
6
6
  var Alchemy = {};
7
7
  }
8
8
 
9
- (function ($) {
9
+ (function($) {
10
10
 
11
11
  $.extend(Alchemy, {
12
12
 
13
- SWFUpload:{
13
+ SWFUpload: {
14
14
 
15
- fileQueued:function (file) {
15
+ fileQueued: function(file) {
16
16
  try {
17
17
  var self = Alchemy.SWFUpload;
18
18
  var progress = new Alchemy.FileProgress(file);
@@ -24,32 +24,29 @@ if (typeof(Alchemy) === 'undefined') {
24
24
  }
25
25
  },
26
26
 
27
- fileDialogComplete:function (numFilesSelected, numFilesQueued) {
27
+ fileDialogComplete: function(numFilesSelected, numFilesQueued) {
28
28
  try {
29
29
  if (numFilesSelected > 0) {
30
30
  $('#swf_upload_container .button').show();
31
31
  $('#choose_alternative_uploader').hide();
32
- }
33
- /* I want auto start the upload and I can do that here */
32
+ } /* I want auto start the upload and I can do that here */
34
33
  this.startUpload();
35
34
  } catch (ex) {
36
35
  this.debug(ex);
37
36
  }
38
37
  },
39
38
 
40
- uploadStart:function (file) {
39
+ uploadStart: function(file) {
41
40
  try {
42
41
  var self = Alchemy.SWFUpload;
43
42
  var progress = new Alchemy.FileProgress(file);
44
43
  progress.setStatus(self.getTranslation('uploading'));
45
44
  progress.toggleCancelButton(true, this);
46
- }
47
- catch (ex) {
48
- }
45
+ } catch (ex) {}
49
46
  return true;
50
47
  },
51
48
 
52
- uploadProgress:function (file, bytesLoaded, bytesTotal) {
49
+ uploadProgress: function(file, bytesLoaded, bytesTotal) {
53
50
  try {
54
51
  var self = Alchemy.SWFUpload;
55
52
  var progress = new Alchemy.FileProgress(file);
@@ -60,7 +57,7 @@ if (typeof(Alchemy) === 'undefined') {
60
57
  }
61
58
  },
62
59
 
63
- uploadSuccess:function (file, serverData) {
60
+ uploadSuccess: function(file, serverData) {
64
61
  eval(serverData);
65
62
  try {
66
63
  var self = Alchemy.SWFUpload;
@@ -73,66 +70,66 @@ if (typeof(Alchemy) === 'undefined') {
73
70
  }
74
71
  },
75
72
 
76
- uploadError:function (file, errorCode, message) {
73
+ uploadError: function(file, errorCode, message) {
77
74
  try {
78
75
  var self = Alchemy.SWFUpload;
79
76
  var progress = new Alchemy.FileProgress(file);
80
77
  progress.toggleCancelButton(false);
81
78
  switch (errorCode) {
82
- case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
83
- progress.setStatus("Upload Error: " + message);
84
- progress.setError();
85
- this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
86
- break;
87
- case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
88
- progress.setStatus(self.getTranslation("upload_failed"));
89
- progress.setError();
90
- this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
91
- break;
92
- case SWFUpload.UPLOAD_ERROR.IO_ERROR:
93
- progress.setStatus("Server (IO) Error");
94
- progress.setError();
95
- this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
96
- break;
97
- case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
98
- progress.setStatus("Security Error");
99
- progress.setError();
100
- this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
101
- break;
102
- case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
103
- progress.setStatus(self.getTranslation("upload_limit_exceeded"));
104
- progress.setError();
105
- this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
106
- break;
107
- case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
108
- progress.setStatus(self.getTranslation('validation_failed'));
109
- progress.setError();
110
- this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
111
- break;
112
- case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
113
- // If there aren't any files left (they were all cancelled) disable the cancel button
114
- if (this.getStats().files_queued === 0) {
115
- self.hideQueueCancelButton();
116
- }
117
- progress.setStatus(self.getTranslation("cancelled"));
118
- progress.setCancelled();
119
- break;
120
- case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
121
- progress.setStatus(self.getTranslation('stopped'));
122
- progress.setCancelled();
123
- break;
124
- default:
125
- progress.setStatus("Unhandled Error: " + errorCode);
126
- progress.setError();
127
- this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
128
- break;
79
+ case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
80
+ progress.setStatus("Upload Error: " + message);
81
+ progress.setError();
82
+ this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
83
+ break;
84
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
85
+ progress.setStatus(self.getTranslation("upload_failed"));
86
+ progress.setError();
87
+ this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
88
+ break;
89
+ case SWFUpload.UPLOAD_ERROR.IO_ERROR:
90
+ progress.setStatus("Server (IO) Error");
91
+ progress.setError();
92
+ this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
93
+ break;
94
+ case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
95
+ progress.setStatus("Security Error");
96
+ progress.setError();
97
+ this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
98
+ break;
99
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
100
+ progress.setStatus(self.getTranslation("upload_limit_exceeded"));
101
+ progress.setError();
102
+ this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
103
+ break;
104
+ case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
105
+ progress.setStatus(self.getTranslation('validation_failed'));
106
+ progress.setError();
107
+ this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
108
+ break;
109
+ case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
110
+ // If there aren't any files left (they were all cancelled) disable the cancel button
111
+ if (this.getStats().files_queued === 0) {
112
+ self.hideQueueCancelButton();
113
+ }
114
+ progress.setStatus(self.getTranslation("cancelled"));
115
+ progress.setCancelled();
116
+ break;
117
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
118
+ progress.setStatus(self.getTranslation('stopped'));
119
+ progress.setCancelled();
120
+ break;
121
+ default:
122
+ progress.setStatus("Unhandled Error: " + errorCode);
123
+ progress.setError();
124
+ this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
125
+ break;
129
126
  }
130
127
  } catch (ex) {
131
128
  this.debug(ex);
132
129
  }
133
130
  },
134
131
 
135
- fileQueueError:function (file, errorCode, message) {
132
+ fileQueueError: function(file, errorCode, message) {
136
133
  try {
137
134
  if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
138
135
  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.")));
@@ -143,37 +140,37 @@ if (typeof(Alchemy) === 'undefined') {
143
140
  progress.setError();
144
141
  progress.toggleCancelButton(false);
145
142
  switch (errorCode) {
146
- case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
147
- progress.setStatus(self.getTranslation("file_too_big"));
148
- this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
149
- break;
150
- case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
151
- progress.setStatus(self.getTranslation("zero_byte_file"));
152
- this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
153
- break;
154
- case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
155
- progress.setStatus(self.getTranslation("invalid_file"));
156
- this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
157
- break;
158
- default:
159
- if (file !== null) {
160
- progress.setStatus(self.getTranslation("unknown_error"));
161
- }
162
- this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
163
- break;
143
+ case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
144
+ progress.setStatus(self.getTranslation("file_too_big"));
145
+ this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
146
+ break;
147
+ case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
148
+ progress.setStatus(self.getTranslation("zero_byte_file"));
149
+ this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
150
+ break;
151
+ case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
152
+ progress.setStatus(self.getTranslation("invalid_file"));
153
+ this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
154
+ break;
155
+ default:
156
+ if (file !== null) {
157
+ progress.setStatus(self.getTranslation("unknown_error"));
158
+ }
159
+ this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
160
+ break;
164
161
  }
165
162
  } catch (ex) {
166
163
  this.debug(ex);
167
164
  }
168
165
  },
169
166
 
170
- uploadComplete:function (file) {
167
+ uploadComplete: function(file) {
171
168
  if (this.getStats().files_queued === 0) {
172
169
  Alchemy.SWFUpload.hideQueueCancelButton();
173
170
  }
174
171
  },
175
172
 
176
- queueComplete:function (numFilesUploaded) {
173
+ queueComplete: function(numFilesUploaded) {
177
174
  var $status = $("#upload_info");
178
175
  if (Alchemy.Uploader.locale == 'en') {
179
176
  $status.text(numFilesUploaded + " file" + (numFilesUploaded === 1 ? "" : "s") + " uploaded.");
@@ -182,17 +179,17 @@ if (typeof(Alchemy) === 'undefined') {
182
179
  }
183
180
  $('#upload_info_container').show();
184
181
  Alchemy.SWFUpload.hideQueueCancelButton();
185
- setTimeout(function () {
182
+ setTimeout(function() {
186
183
  Alchemy.closeCurrentWindow();
187
184
  }, 3500);
188
185
  },
189
186
 
190
- hideQueueCancelButton:function () {
187
+ hideQueueCancelButton: function() {
191
188
  $('#swf_upload_container .button').hide();
192
189
  $('#swf_upload_container .cloned-button').remove();
193
190
  },
194
191
 
195
- getTranslation:function (id) {
192
+ getTranslation: function(id) {
196
193
  return Alchemy.Uploader.t(id);
197
194
  }
198
195
 
@@ -201,10 +198,10 @@ if (typeof(Alchemy) === 'undefined') {
201
198
  });
202
199
 
203
200
  // Show/Hide the cancel button and bind click event.
204
- Alchemy.FileProgress.prototype.toggleCancelButton = function (show, swfUploadInstance) {
201
+ Alchemy.FileProgress.prototype.toggleCancelButton = function(show, swfUploadInstance) {
205
202
  show ? this.$fileProgressCancel.show() : this.$fileProgressCancel.hide();
206
203
  if (swfUploadInstance) {
207
- this.$fileProgressCancel.click(function (e) {
204
+ this.$fileProgressCancel.click(function(e) {
208
205
  e.preventDefault();
209
206
  swfUploadInstance.cancelUpload(this.fileID);
210
207
  return false;
@@ -19,37 +19,31 @@ Alchemy.Uploader = {
19
19
  //return false;
20
20
  },
21
21
 
22
- init:function (settings) {
22
+ init: function(settings) {
23
23
  var self = Alchemy.Uploader;
24
24
 
25
25
  function initHTML5Uploader() {
26
26
  $("#dropbox, #multiple").html5Uploader({
27
- name:"Filedata",
28
- postUrl:settings.upload_url,
29
- postParams:settings.post_params,
30
- onSuccess:function (event, file, responseText, successfullyUploadedFiles) {
27
+ name: "Filedata",
28
+ postUrl: settings.upload_url,
29
+ postParams: settings.post_params,
30
+ onSuccess: function(event, file, responseText, successfullyUploadedFiles) {
31
31
  eval(responseText);
32
32
  var progress = new Alchemy.FileProgress(file);
33
33
  $('#upload_info').text(self.t('success_notice').replace('x', successfullyUploadedFiles));
34
34
  progress.setStatus(self.t('complete'));
35
35
  progress.setComplete();
36
36
  },
37
- onDragEnter:function (dropbox, event) {
38
- $(dropbox)
39
- .addClass('dragover')
40
- .text(self.t('drop_files_notice'));
37
+ onDragEnter: function(dropbox, event) {
38
+ $(dropbox).addClass('dragover').text(self.t('drop_files_notice'));
41
39
  },
42
- onDragLeave:function (dropbox, event) {
43
- $(dropbox)
44
- .removeClass('dragover')
45
- .text(self.t('drag_files_notice'));
40
+ onDragLeave: function(dropbox, event) {
41
+ $(dropbox).removeClass('dragover').text(self.t('drag_files_notice'));
46
42
  },
47
- onDrop:function (dropbox, event) {
48
- $(dropbox)
49
- .removeClass('dragover')
50
- .text(self.t('drag_files_notice'));
43
+ onDrop: function(dropbox, event) {
44
+ $(dropbox).removeClass('dragover').text(self.t('drag_files_notice'));
51
45
  },
52
- onQueueStart:function (files) {
46
+ onQueueStart: function(files) {
53
47
  var $status = $("#upload_info");
54
48
  if (Alchemy.Uploader.locale == 'en') {
55
49
  $status.text(files + " file" + (files === 1 ? "" : "s") + " queued.");
@@ -61,7 +55,7 @@ Alchemy.Uploader = {
61
55
  $('#multiple').hide();
62
56
  $('#cancelHTML5Queue').show();
63
57
  },
64
- onQueueComplete:function (files, status) {
58
+ onQueueComplete: function(files, status) {
65
59
  var $status = $("#upload_info");
66
60
  if (Alchemy.Uploader.locale == 'en') {
67
61
  $status.text(files + " file" + (files === 1 ? "" : "s") + " uploaded.");
@@ -72,19 +66,19 @@ Alchemy.Uploader = {
72
66
  $('#multiple').show().parents('form').get(0).reset();
73
67
  $('#cancelHTML5Queue').hide();
74
68
  if (status === 200) {
75
- window.setTimeout(function () {
69
+ window.setTimeout(function() {
76
70
  Alchemy.closeCurrentWindow();
77
71
  }, 3500);
78
72
  }
79
73
  },
80
- onClientLoadStart:function (event, file) {
74
+ onClientLoadStart: function(event, file) {
81
75
  var progress = new Alchemy.FileProgress(file);
82
76
  progress.setStatus(self.t('pending'));
83
77
  },
84
- onServerLoadStart:function (event, file) {
78
+ onServerLoadStart: function(event, file) {
85
79
  var progress = new Alchemy.FileProgress(file);
86
80
  progress.setStatus(self.t('uploading'));
87
- progress.$fileProgressCancel.show().on('click', function (e) {
81
+ progress.$fileProgressCancel.show().on('click', function(e) {
88
82
  e.preventDefault();
89
83
  $().html5Uploader('cancel', file.id);
90
84
  progress.setStatus(self.t('cancelled'));
@@ -92,19 +86,19 @@ Alchemy.Uploader = {
92
86
  return false;
93
87
  });
94
88
  },
95
- onServerProgress:function (event, file) {
89
+ onServerProgress: function(event, file) {
96
90
  var progress = new Alchemy.FileProgress(file);
97
91
  var percentUploaded = (event.loaded / event.total) * 100;
98
92
  progress.setProgress(percentUploaded);
99
93
  progress.setStatus(self.t('uploading') + SWFUpload.speed.formatPercent(percentUploaded));
100
94
  },
101
- onServerError:function (e, file, errorMessage) {
95
+ onServerError: function(e, file, errorMessage) {
102
96
  Alchemy.debug(e);
103
97
  var progress = new Alchemy.FileProgress(file);
104
98
  progress.setError();
105
99
  progress.setStatus(errorMessage);
106
100
  },
107
- onQueueCancelled:function (queuedFiles) {
101
+ onQueueCancelled: function(queuedFiles) {
108
102
  for (var i = queuedFiles.length - 1; i >= 0; i--) {
109
103
  var progress = new Alchemy.FileProgress(queuedFiles[i]);
110
104
  progress.setStatus(self.t('cancelled'));
@@ -118,42 +112,42 @@ Alchemy.Uploader = {
118
112
  function initFlashUploader() {
119
113
  try {
120
114
  var swfu = new SWFUpload({
121
- flash_url:"/assets/swfupload/swfupload.swf",
122
- flash9_url:"/assets/swfupload/swfupload.swf",
123
- upload_url:settings.upload_url,
124
- post_params:settings.post_params,
125
- file_size_limit:settings.file_size_limit + ' MB',
126
- file_types:settings.file_types,
127
- file_types_description:settings.file_types_description,
128
- file_upload_limit:settings.file_upload_limit,
129
- file_queue_limit:0,
130
- custom_settings:{
131
- language:settings.locale
115
+ flash_url: "/assets/swfupload/swfupload.swf",
116
+ flash9_url: "/assets/swfupload/swfupload.swf",
117
+ upload_url: settings.upload_url,
118
+ post_params: settings.post_params,
119
+ file_size_limit: settings.file_size_limit + ' MB',
120
+ file_types: settings.file_types,
121
+ file_types_description: settings.file_types_description,
122
+ file_upload_limit: settings.file_upload_limit,
123
+ file_queue_limit: 0,
124
+ custom_settings: {
125
+ language: settings.locale
132
126
  },
133
- debug:false,
134
- button_image_url:"/assets/alchemy/swfupload/browse_button.png",
135
- button_width:"120",
136
- button_height:"25",
137
- button_placeholder_id:"spanButtonPlaceHolder",
138
- button_text:"<span class='swfButtonText'>" + self.t('browse') + "</span>",
139
- button_text_style:'.swfButtonText {font-size: 11px; font-family: "Lucida Grande", Arial, sans-serif; text-align: center; color: #333333; height: 25px; padding-left: 8px; padding-right: 8px; padding-bottom: 3px; padding-top: 5px}',
140
- button_text_left_padding:0,
141
- button_text_top_padding:4,
142
- swfupload_load_failed_handler:function () {
127
+ debug: false,
128
+ button_image_url: "/assets/alchemy/swfupload/browse_button.png",
129
+ button_width: "120",
130
+ button_height: "25",
131
+ button_placeholder_id: "spanButtonPlaceHolder",
132
+ button_text: "<span class='swfButtonText'>" + self.t('browse') + "</span>",
133
+ button_text_style: '.swfButtonText {font-size: 11px; font-family: "Lucida Grande", Arial, sans-serif; text-align: center; color: #333333; height: 25px; padding-left: 8px; padding-right: 8px; padding-bottom: 3px; padding-top: 5px}',
134
+ button_text_left_padding: 0,
135
+ button_text_top_padding: 4,
136
+ swfupload_load_failed_handler: function() {
143
137
  $('#swf_upload_container').hide();
144
138
  $('#choose_alternative_uploader').hide();
145
139
  $('#switch_to_flash_uploader').hide();
146
140
  $('#swfUploadFlashError').show();
147
141
  $('#alternativeUpload').show();
148
142
  },
149
- file_queued_handler:Alchemy.SWFUpload.fileQueued,
150
- file_queue_error_handler:Alchemy.SWFUpload.fileQueueError,
151
- file_dialog_complete_handler:Alchemy.SWFUpload.fileDialogComplete,
152
- upload_start_handler:Alchemy.SWFUpload.uploadStart,
153
- upload_progress_handler:Alchemy.SWFUpload.uploadProgress,
154
- upload_error_handler:Alchemy.SWFUpload.uploadError,
155
- upload_success_handler:Alchemy.SWFUpload.uploadSuccess,
156
- queue_complete_handler:Alchemy.SWFUpload.queueComplete
143
+ file_queued_handler: Alchemy.SWFUpload.fileQueued,
144
+ file_queue_error_handler: Alchemy.SWFUpload.fileQueueError,
145
+ file_dialog_complete_handler: Alchemy.SWFUpload.fileDialogComplete,
146
+ upload_start_handler: Alchemy.SWFUpload.uploadStart,
147
+ upload_progress_handler: Alchemy.SWFUpload.uploadProgress,
148
+ upload_error_handler: Alchemy.SWFUpload.uploadError,
149
+ upload_success_handler: Alchemy.SWFUpload.uploadSuccess,
150
+ queue_complete_handler: Alchemy.SWFUpload.queueComplete
157
151
  });
158
152
  swfu.window_mode = "opaque";
159
153
  } catch (err) {
@@ -172,7 +166,7 @@ Alchemy.Uploader = {
172
166
  $('#explain_step3').hide();
173
167
  $('#explain_drag_n_drop').show();
174
168
  initHTML5Uploader(settings);
175
- $('#cancelHTML5Queue').on('click', function (e) {
169
+ $('#cancelHTML5Queue').on('click', function(e) {
176
170
  e.preventDefault();
177
171
  $().html5Uploader('cancelQueue');
178
172
  return false;
@@ -187,82 +181,82 @@ Alchemy.Uploader = {
187
181
 
188
182
  },
189
183
 
190
- translation:{
191
- 'browse':{
192
- 'de':'durchsuchen',
193
- 'en':'browse'
184
+ translation: {
185
+ 'browse': {
186
+ 'de': 'durchsuchen',
187
+ 'en': 'browse'
194
188
  },
195
- 'pending':{
196
- 'de':'Wartend...',
197
- 'en':'Pending...'
189
+ 'pending': {
190
+ 'de': 'Wartend...',
191
+ 'en': 'Pending...'
198
192
  },
199
- 'uploading':{
200
- 'de':'Ladend...',
201
- 'en':'Uploading...'
193
+ 'uploading': {
194
+ 'de': 'Ladend...',
195
+ 'en': 'Uploading...'
202
196
  },
203
- 'remaining':{
204
- 'de':' verbleibend.',
205
- 'en':' remaining.'
197
+ 'remaining': {
198
+ 'de': ' verbleibend.',
199
+ 'en': ' remaining.'
206
200
  },
207
- 'complete':{
208
- 'de':'Abgeschlossen',
209
- 'en':"Complete"
201
+ 'complete': {
202
+ 'de': 'Abgeschlossen',
203
+ 'en': "Complete"
210
204
  },
211
- 'cancelled':{
212
- 'de':'Abgebrochen',
213
- 'en':'Cancelled'
205
+ 'cancelled': {
206
+ 'de': 'Abgebrochen',
207
+ 'en': 'Cancelled'
214
208
  },
215
- 'stopped':{
216
- 'de':'Gestoppt',
217
- 'en':'Stopped'
209
+ 'stopped': {
210
+ 'de': 'Gestoppt',
211
+ 'en': 'Stopped'
218
212
  },
219
- 'upload_failed':{
220
- 'de':'Fehlgeschlagen!',
221
- 'en':'Upload Failed!'
213
+ 'upload_failed': {
214
+ 'de': 'Fehlgeschlagen!',
215
+ 'en': 'Upload Failed!'
222
216
  },
223
- 'file_too_big':{
224
- 'de':'Datei ist zu groß!',
225
- 'en':'File is too big!'
217
+ 'file_too_big': {
218
+ 'de': 'Datei ist zu groß!',
219
+ 'en': 'File is too big!'
226
220
  },
227
- 'upload_limit_exceeded':{
228
- 'de':'Maximales Dateilimit erreicht.',
229
- 'en':'Upload limit exceeded.'
221
+ 'upload_limit_exceeded': {
222
+ 'de': 'Maximales Dateilimit erreicht.',
223
+ 'en': 'Upload limit exceeded.'
230
224
  },
231
- 'validation_failed':{
232
- 'de':'Validierung fehlgeschlagen. Ladevorgang angehalten.',
233
- 'en':"Failed Validation. Upload skipped."
225
+ 'validation_failed': {
226
+ 'de': 'Validierung fehlgeschlagen. Ladevorgang angehalten.',
227
+ 'en': "Failed Validation. Upload skipped."
234
228
  },
235
- 'zero_byte_file':{
236
- 'de':'Datei hat keinen Inhalt!',
237
- 'en':'Cannot upload Zero Byte files!'
229
+ 'zero_byte_file': {
230
+ 'de': 'Datei hat keinen Inhalt!',
231
+ 'en': 'Cannot upload Zero Byte files!'
238
232
  },
239
- 'invalid_file':{
240
- 'de':'Ungültiger Dateityp!',
241
- 'en':'Invalid File Type!'
233
+ 'invalid_file': {
234
+ 'de': 'Ungültiger Dateityp!',
235
+ 'en': 'Invalid File Type!'
242
236
  },
243
- 'unknown_error':{
244
- 'de':'Unbekannter Fehler!',
245
- 'en':'Unhandled Error!'
237
+ 'unknown_error': {
238
+ 'de': 'Unbekannter Fehler!',
239
+ 'en': 'Unhandled Error!'
246
240
  },
247
- 'drag_files_notice':{
248
- 'de':'Oder ziehen Sie die Dateien hier rauf',
249
- 'en':'Or drag files over here'
241
+ 'drag_files_notice': {
242
+ 'de': 'Oder ziehen Sie die Dateien hier rauf',
243
+ 'en': 'Or drag files over here'
250
244
  },
251
- 'drop_files_notice':{
252
- 'de':'Lassen Sie die Dateien nun los',
253
- 'en':'Now drop the files'
245
+ 'drop_files_notice': {
246
+ 'de': 'Lassen Sie die Dateien nun los',
247
+ 'en': 'Now drop the files'
254
248
  },
255
- 'queued_files_notice':{
256
- 'de':'x Dateien in der Warteschlange.',
257
- 'en':'Queued x files.'
249
+ 'queued_files_notice': {
250
+ 'de': 'x Dateien in der Warteschlange.',
251
+ 'en': 'Queued x files.'
258
252
  },
259
- 'success_notice':{
260
- 'de':'x Dateien hochgeladen.',
261
- 'en':'Uploaded x files.'
253
+ 'success_notice': {
254
+ 'de': 'x Dateien hochgeladen.',
255
+ 'en': 'Uploaded x files.'
262
256
  }
263
257
  },
264
258
 
265
- t:function (id) {
259
+ t: function(id) {
266
260
  try {
267
261
  var self = Alchemy.Uploader;
268
262
  var translation = self.translation[id];