refinerycms-6hoursdaily-photo-gallery 0.0.4.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/Gemfile +27 -0
  2. data/LICENSE.md +8 -0
  3. data/README.md +224 -0
  4. data/app/assets/images/refinery/photo_gallery/admin/chosen-sprite.png +0 -0
  5. data/app/assets/images/refinery/photo_gallery/admin/icons/album.png +0 -0
  6. data/app/assets/images/refinery/photo_gallery/admin/icons/album_add.png +0 -0
  7. data/app/assets/images/refinery/photo_gallery/admin/icons/album_edit.png +0 -0
  8. data/app/assets/images/refinery/photo_gallery/admin/icons/cog.png +0 -0
  9. data/app/assets/images/refinery/photo_gallery/admin/icons/down.gif +0 -0
  10. data/app/assets/images/refinery/photo_gallery/admin/icons/folder.png +0 -0
  11. data/app/assets/images/refinery/photo_gallery/admin/icons/folder_add.png +0 -0
  12. data/app/assets/images/refinery/photo_gallery/admin/icons/folder_edit.png +0 -0
  13. data/app/assets/images/refinery/photo_gallery/admin/icons/loading.gif +0 -0
  14. data/app/assets/images/refinery/photo_gallery/admin/icons/page_copy.png +0 -0
  15. data/app/assets/images/refinery/photo_gallery/admin/icons/photo.png +0 -0
  16. data/app/assets/images/refinery/photo_gallery/admin/icons/photo_add.png +0 -0
  17. data/app/assets/images/refinery/photo_gallery/admin/icons/photo_edit.png +0 -0
  18. data/app/assets/images/refinery/photo_gallery/admin/icons/up.gif +0 -0
  19. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/backgrounds.gif +0 -0
  20. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/buttons-disabled.png +0 -0
  21. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/buttons.png +0 -0
  22. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/delete.gif +0 -0
  23. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/done.gif +0 -0
  24. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/error.gif +0 -0
  25. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/throbber.gif +0 -0
  26. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/transp50.png +0 -0
  27. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.ui.plupload/plupload-bw.png +0 -0
  28. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.ui.plupload/plupload.png +0 -0
  29. data/app/assets/images/refinery/photo_gallery/admin/rss-feed.png +0 -0
  30. data/app/assets/images/refinery/photo_gallery/fancybox/blank.gif +0 -0
  31. data/app/assets/images/refinery/photo_gallery/fancybox/fancybox_loading.gif +0 -0
  32. data/app/assets/images/refinery/photo_gallery/fancybox/fancybox_sprite.png +0 -0
  33. data/app/assets/images/refinery/photo_gallery/fancybox/helpers/fancybox_buttons.png +0 -0
  34. data/app/assets/javascripts/refinery/photo_gallery/admin/jquery.chosen.min.js +10 -0
  35. data/app/assets/javascripts/refinery/photo_gallery/admin/photo_gallery.js +28 -0
  36. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/changelog.txt +218 -0
  37. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/cs.js +14 -0
  38. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/da.js +12 -0
  39. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/de.js +24 -0
  40. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/el.js +14 -0
  41. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/es.js +25 -0
  42. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/et.js +33 -0
  43. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fi.js +33 -0
  44. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fr-ca.js +35 -0
  45. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fr.js +25 -0
  46. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/hr.js +25 -0
  47. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/hu.js +33 -0
  48. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/it.js +24 -0
  49. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ja.js +37 -0
  50. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ko.js +36 -0
  51. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/lv.js +33 -0
  52. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/nl.js +21 -0
  53. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/pl.js +24 -0
  54. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/pt-br.js +35 -0
  55. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ro.js +24 -0
  56. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ru.js +21 -0
  57. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sk.js +37 -0
  58. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sr.js +14 -0
  59. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sv.js +12 -0
  60. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/jquery.plupload.queue.js +195 -0
  61. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/jquery.ui.plupload.js +383 -0
  62. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/license.txt +339 -0
  63. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.browserplus.js +1 -0
  64. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.flash.js +226 -0
  65. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.flash.swf +0 -0
  66. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.full.js +2525 -0
  67. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.full.js.default +2525 -0
  68. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.gears.js +1 -0
  69. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html4.js +1 -0
  70. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html5.js +765 -0
  71. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html5.js.default +765 -0
  72. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.js +618 -0
  73. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.silverlight.js +1 -0
  74. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.silverlight.xap +0 -0
  75. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/readme.md +46 -0
  76. data/app/assets/javascripts/refinery/photo_gallery/fancybox/CHANGELOG.md +68 -0
  77. data/app/assets/javascripts/refinery/photo_gallery/fancybox/README.md +212 -0
  78. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-buttons.js +115 -0
  79. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-media.js +85 -0
  80. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-thumbs.js +157 -0
  81. data/app/assets/javascripts/refinery/photo_gallery/fancybox/jquery.fancybox.js +1463 -0
  82. data/app/assets/javascripts/refinery/photo_gallery/fancybox/jquery.fancybox.pack.js +35 -0
  83. data/app/assets/javascripts/refinery/photo_gallery/fancybox/lib/jquery.mousewheel-3.0.6.pack.js +13 -0
  84. data/app/assets/stylesheets/refinery/photo_gallery/admin/chosen.css.scss +396 -0
  85. data/app/assets/stylesheets/refinery/photo_gallery/admin/photo_gallery.css.scss +109 -0
  86. data/app/assets/stylesheets/refinery/photo_gallery/admin/plupload/jquery.plupload.queue.css.scss +177 -0
  87. data/app/assets/stylesheets/refinery/photo_gallery/admin/plupload/jquery.ui.plupload.css.scss +147 -0
  88. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-buttons.css.scss +85 -0
  89. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-thumbs.css +54 -0
  90. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/jquery.fancybox.css.scss +234 -0
  91. data/app/controllers/refinery/photo_gallery/admin/albums_controller.rb +23 -0
  92. data/app/controllers/refinery/photo_gallery/admin/collections_controller.rb +10 -0
  93. data/app/controllers/refinery/photo_gallery/admin/photos_controller.rb +67 -0
  94. data/app/controllers/refinery/photo_gallery/albums_controller.rb +23 -0
  95. data/app/controllers/refinery/photo_gallery/collections_controller.rb +28 -0
  96. data/app/helpers/refinery/photo_gallery/admin/photos_helper.rb +10 -0
  97. data/app/helpers/refinery/photo_gallery/albums_helper.rb +11 -0
  98. data/app/helpers/refinery/photo_gallery/photo_gallery_helper.rb +113 -0
  99. data/app/middleware/refinery/photo_gallery/admin/flash_session_cookie_middleware.rb +27 -0
  100. data/app/models/refinery/photo_gallery/album.rb +63 -0
  101. data/app/models/refinery/photo_gallery/collection.rb +29 -0
  102. data/app/models/refinery/photo_gallery/collection_album.rb +8 -0
  103. data/app/models/refinery/photo_gallery/photo.rb +63 -0
  104. data/app/uploaders/refinery/photo_gallery/admin/file_uploader.rb +122 -0
  105. data/app/views/refinery/photo_gallery/admin/_submenu.html.erb +44 -0
  106. data/app/views/refinery/photo_gallery/admin/albums/_album.html.erb +31 -0
  107. data/app/views/refinery/photo_gallery/admin/albums/_form.html.erb +78 -0
  108. data/app/views/refinery/photo_gallery/admin/albums/_sortable_list.html.erb +7 -0
  109. data/app/views/refinery/photo_gallery/admin/albums/edit.html.erb +2 -0
  110. data/app/views/refinery/photo_gallery/admin/albums/index.html.erb +28 -0
  111. data/app/views/refinery/photo_gallery/admin/albums/new.html.erb +2 -0
  112. data/app/views/refinery/photo_gallery/admin/collections/_collection.html.erb +23 -0
  113. data/app/views/refinery/photo_gallery/admin/collections/_form.html.erb +32 -0
  114. data/app/views/refinery/photo_gallery/admin/collections/_sortable_list.html.erb +7 -0
  115. data/app/views/refinery/photo_gallery/admin/collections/edit.html.erb +2 -0
  116. data/app/views/refinery/photo_gallery/admin/collections/index.html.erb +28 -0
  117. data/app/views/refinery/photo_gallery/admin/collections/new.html.erb +2 -0
  118. data/app/views/refinery/photo_gallery/admin/collections/test.html.erb +39 -0
  119. data/app/views/refinery/photo_gallery/admin/photos/_destroy.js.erb +15 -0
  120. data/app/views/refinery/photo_gallery/admin/photos/_form.html.erb +7 -0
  121. data/app/views/refinery/photo_gallery/admin/photos/_form_actions.html.erb +6 -0
  122. data/app/views/refinery/photo_gallery/admin/photos/_form_fields.html.erb +31 -0
  123. data/app/views/refinery/photo_gallery/admin/photos/_form_fields_actions.html.erb +15 -0
  124. data/app/views/refinery/photo_gallery/admin/photos/edit_multiple.html.erb +9 -0
  125. data/app/views/refinery/photo_gallery/admin/photos/upload.html.erb +87 -0
  126. data/app/views/refinery/photo_gallery/albums/show.html.erb +49 -0
  127. data/app/views/refinery/photo_gallery/collections/index.html.erb +13 -0
  128. data/app/views/refinery/photo_gallery/collections/show.html.erb +33 -0
  129. data/app/views/refinery/photo_gallery/shared/_layout.html.erb +22 -0
  130. data/app/views/refinery/photo_gallery/shared/_submenu.html.erb +5 -0
  131. data/config/initializers/carrierwave.rb +5 -0
  132. data/config/initializers/form_builder.rb +26 -0
  133. data/config/initializers/refinery/core.rb +10 -0
  134. data/config/initializers/s3.rb +11 -0
  135. data/config/initializers/session_store.rb +10 -0
  136. data/config/locales/en.yml +95 -0
  137. data/config/locales/sk.yml +94 -0
  138. data/config/routes.rb +37 -0
  139. data/db/migrate/20120804063842_create_albums.rb +18 -0
  140. data/db/migrate/20120805131321_create_collections.rb +14 -0
  141. data/db/migrate/20120805131547_create_collection_albums.rb +12 -0
  142. data/db/migrate/20120805165238_create_photos.rb +19 -0
  143. data/db/migrate/20120805222125_add_indexes.rb +24 -0
  144. data/db/seeds.rb +21 -0
  145. data/lib/generators/refinery/photo_gallery_generator.rb +25 -0
  146. data/lib/generators/refinery/templates/config/initializers/refinery/photo_gallery.rb.erb +40 -0
  147. data/lib/refinery/photo_gallery/configuration.rb +33 -0
  148. data/lib/refinery/photo_gallery/engine.rb +33 -0
  149. data/lib/refinery/photo_gallery/version.rb +17 -0
  150. data/lib/refinery/photo_gallery.rb +30 -0
  151. data/lib/refinerycms-photo-gallery.rb +1 -0
  152. data/refinerycms-6hoursdaily-photo-gallery.gemspec +38 -0
  153. data/screenshots/01_collections#index.png +0 -0
  154. data/screenshots/02_albums#create.png +0 -0
  155. data/screenshots/03_photos#upload.png +0 -0
  156. data/screenshots/04_photos#upload- chooser.png +0 -0
  157. data/screenshots/05_photo#upoad-queue.png +0 -0
  158. data/screenshots/06_photos#upload-uploading.png +0 -0
  159. data/screenshots/07_photos#upload-uploading_2.png +0 -0
  160. data/screenshots/08_photos#edit_multiple.png +0 -0
  161. data/screenshots/09_albums#index.png +0 -0
  162. data/screenshots/10_albums_EXIF_reading.png +0 -0
  163. data/screenshots/11_frontend_show.png +0 -0
  164. data/screenshots/12_show_photo_using_fancybox.png +0 -0
  165. metadata +353 -0
@@ -0,0 +1,383 @@
1
+ (function (f, a, c, g, e) {
2
+ var h = {};
3
+
4
+ function b(i) {
5
+ return c.translate(i) || i
6
+ }
7
+
8
+ function d(i) {
9
+ i.html('<div class="plupload_wrapper"><div class="ui-widget-content plupload_container"><div class="plupload"><div class="ui-state-default ui-widget-header plupload_header"><div class="plupload_header_content"><div class="plupload_header_title">' + b("Select files") + '</div><div class="plupload_header_text">' + b("Add files to the upload queue and click the start button.") + '</div></div></div><div class="plupload_content"><table class="plupload_filelist"><tr class="ui-widget-header plupload_filelist_header"><td class="plupload_cell plupload_file_name">' + b("Filename") + '</td><td class="plupload_cell plupload_file_status">' + b("Status") + '</td><td class="plupload_cell plupload_file_size">' + b("Size") + '</td><td class="plupload_cell plupload_file_action">&nbsp;</td></tr></table><div class="plupload_scroll"><table class="plupload_filelist_content"></table></div><table class="plupload_filelist"><tr class="ui-widget-header ui-widget-content plupload_filelist_footer"><td class="plupload_cell plupload_file_name"><div class="plupload_buttons"><!-- Visible --><a class="plupload_button plupload_add">' + b("Add Files") + '</a>&nbsp;<a class="plupload_button plupload_start">' + b("Start Upload") + '</a>&nbsp;<a class="plupload_button plupload_stop plupload_hidden">' + b("Stop Upload") + '</a>&nbsp;</div><div class="plupload_started plupload_hidden"><!-- Hidden --><div class="plupload_progress plupload_right"><div class="plupload_progress_container"></div></div><div class="plupload_cell plupload_upload_status"></div><div class="plupload_clearer">&nbsp;</div></div></td><td class="plupload_file_status"><span class="plupload_total_status">0%</span></td><td class="plupload_file_size"><span class="plupload_total_file_size">0 kb</span></td><td class="plupload_file_action"></td></tr></table></div></div></div><input class="plupload_count" value="0" type="hidden"></div>')
10
+ }
11
+
12
+ g.widget("ui.plupload", {contents_bak:"", runtime:null, options:{browse_button_hover:"ui-state-hover", browse_button_active:"ui-state-active", dragdrop:true, multiple_queues:true, buttons:{browse:true, start:true, stop:true}, autostart:false, sortable:false, rename:false, max_file_count:0}, FILE_COUNT_ERROR:-9001, _create:function () {
13
+ var i = this, k, j;
14
+ k = this.element.attr("id");
15
+ if (!k) {
16
+ k = c.guid();
17
+ this.element.attr("id", k)
18
+ }
19
+ this.id = k;
20
+ this.contents_bak = this.element.html();
21
+ d(this.element);
22
+ this.container = g(".plupload_container", this.element).attr("id", k + "_container");
23
+ this.filelist = g(".plupload_filelist_content", this.container).attr({id:k + "_filelist", unselectable:"on"});
24
+ this.browse_button = g(".plupload_add", this.container).attr("id", k + "_browse");
25
+ this.start_button = g(".plupload_start", this.container).attr("id", k + "_start");
26
+ this.stop_button = g(".plupload_stop", this.container).attr("id", k + "_stop");
27
+ if (g.ui.button) {
28
+ this.browse_button.button({icons:{primary:"ui-icon-circle-plus"}});
29
+ this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"}, disabled:true});
30
+ this.stop_button.button({icons:{primary:"ui-icon-circle-close"}})
31
+ }
32
+ this.progressbar = g(".plupload_progress_container", this.container);
33
+ if (g.ui.progressbar) {
34
+ this.progressbar.progressbar()
35
+ }
36
+ this.counter = g(".plupload_count", this.element).attr({id:k + "_count", name:k + "_count"});
37
+ j = this.uploader = h[k] = new c.Uploader(g.extend({container:k, browse_button:k + "_browse"}, this.options));
38
+ j.bind("Error", function (l, m) {
39
+ if (m.code === c.INIT_ERROR) {
40
+ i.destroy()
41
+ }
42
+ });
43
+ j.bind("Init", function (l, m) {
44
+ if (!i.options.buttons.browse) {
45
+ i.browse_button.button("disable").hide();
46
+ l.disableBrowse(true)
47
+ }
48
+ if (!i.options.buttons.start) {
49
+ i.start_button.button("disable").hide()
50
+ }
51
+ if (!i.options.buttons.stop) {
52
+ i.stop_button.button("disable").hide()
53
+ }
54
+ if (!i.options.unique_names && i.options.rename) {
55
+ i._enableRenaming()
56
+ }
57
+ if (j.features.dragdrop && i.options.dragdrop) {
58
+ i._enableDragAndDrop()
59
+ }
60
+ i.container.attr("title", b("Using runtime: ") + (i.runtime = m.runtime));
61
+ i.start_button.click(function (n) {
62
+ if (!g(this).button("option", "disabled")) {
63
+ i.start()
64
+ }
65
+ n.preventDefault()
66
+ });
67
+ i.stop_button.click(function (n) {
68
+ i.stop();
69
+ n.preventDefault()
70
+ })
71
+ });
72
+ if (i.options.max_file_count) {
73
+ j.bind("FilesAdded", function (l, n) {
74
+ var o = [], m = n.length;
75
+ var p = l.files.length + m - i.options.max_file_count;
76
+ if (p > 0) {
77
+ o = n.splice(m - p, p);
78
+ l.trigger("Error", {code:i.FILE_COUNT_ERROR, message:b("File count error."), file:o})
79
+ }
80
+ })
81
+ }
82
+ j.init();
83
+ j.bind("FilesAdded", function (l, m) {
84
+ i._trigger("selected", null, {up:l, files:m});
85
+ if (i.options.autostart) {
86
+ setTimeout(function () {
87
+ i.start()
88
+ }, 10)
89
+ }
90
+ });
91
+ j.bind("FilesRemoved", function (l, m) {
92
+ i._trigger("removed", null, {up:l, files:m})
93
+ });
94
+ j.bind("QueueChanged", function () {
95
+ i._updateFileList()
96
+ });
97
+ j.bind("StateChanged", function () {
98
+ i._handleState()
99
+ });
100
+ j.bind("UploadFile", function (l, m) {
101
+ i._handleFileStatus(m)
102
+ });
103
+ j.bind("FileUploaded", function (l, m) {
104
+ i._handleFileStatus(m);
105
+ i._trigger("uploaded", null, {up:l, file:m})
106
+ });
107
+ j.bind("UploadProgress", function (l, m) {
108
+ g("#" + m.id).find(".plupload_file_status").html(m.percent + "%").end().find(".plupload_file_size").html(c.formatSize(m.size));
109
+ i._handleFileStatus(m);
110
+ i._updateTotalProgress();
111
+ i._trigger("progress", null, {up:l, file:m})
112
+ });
113
+ j.bind("UploadComplete", function (l, m) {
114
+ i._trigger("complete", null, {up:l, files:m})
115
+ });
116
+ j.bind("Error", function (l, p) {
117
+ var n = p.file, o, m;
118
+ if (n) {
119
+ o = "<strong>" + p.message + "</strong>";
120
+ m = p.details;
121
+ if (m) {
122
+ o += " <br /><i>" + p.details + "</i>"
123
+ } else {
124
+ switch (p.code) {
125
+ case c.FILE_EXTENSION_ERROR:
126
+ m = b("File: %s").replace("%s", n.name);
127
+ break;
128
+ case c.FILE_SIZE_ERROR:
129
+ m = b("File: %f, size: %s, max file size: %m").replace(/%([fsm])/g, function (r, q) {
130
+ switch (q) {
131
+ case"f":
132
+ return n.name;
133
+ case"s":
134
+ return n.size;
135
+ case"m":
136
+ return c.parseSize(i.options.max_file_size)
137
+ }
138
+ });
139
+ break;
140
+ case i.FILE_COUNT_ERROR:
141
+ m = b("Upload element accepts only %d file(s) at a time. Extra files were stripped.").replace("%d", i.options.max_file_count);
142
+ break;
143
+ case c.IMAGE_FORMAT_ERROR:
144
+ m = c.translate("Image format either wrong or not supported.");
145
+ break;
146
+ case c.IMAGE_MEMORY_ERROR:
147
+ m = c.translate("Runtime ran out of available memory.");
148
+ break;
149
+ case c.IMAGE_DIMENSIONS_ERROR:
150
+ m = c.translate("Resoultion out of boundaries! <b>%s</b> runtime supports images only up to %wx%hpx.").replace(/%([swh])/g, function (r, q) {
151
+ switch (q) {
152
+ case"s":
153
+ return l.runtime;
154
+ case"w":
155
+ return l.features.maxWidth;
156
+ case"h":
157
+ return l.features.maxHeight
158
+ }
159
+ });
160
+ break;
161
+ case c.HTTP_ERROR:
162
+ m = b("Upload URL might be wrong or doesn't exist");
163
+ break
164
+ }
165
+ o += " <br /><i>" + m + "</i>"
166
+ }
167
+ i.notify("error", o);
168
+ i._trigger("error", null, {up:l, file:n, error:o})
169
+ }
170
+ })
171
+ }, _setOption:function (j, k) {
172
+ var i = this;
173
+ if (j == "buttons" && typeof(k) == "object") {
174
+ k = g.extend(i.options.buttons, k);
175
+ if (!k.browse) {
176
+ i.browse_button.button("disable").hide();
177
+ up.disableBrowse(true)
178
+ } else {
179
+ i.browse_button.button("enable").show();
180
+ up.disableBrowse(false)
181
+ }
182
+ if (!k.start) {
183
+ i.start_button.button("disable").hide()
184
+ } else {
185
+ i.start_button.button("enable").show()
186
+ }
187
+ if (!k.stop) {
188
+ i.stop_button.button("disable").hide()
189
+ } else {
190
+ i.start_button.button("enable").show()
191
+ }
192
+ }
193
+ i.uploader.settings[j] = k
194
+ }, start:function () {
195
+ this.uploader.start();
196
+ this._trigger("start", null)
197
+ }, stop:function () {
198
+ this.uploader.stop();
199
+ this._trigger("stop", null)
200
+ }, getFile:function (j) {
201
+ var i;
202
+ if (typeof j === "number") {
203
+ i = this.uploader.files[j]
204
+ } else {
205
+ i = this.uploader.getFile(j)
206
+ }
207
+ return i
208
+ }, removeFile:function (j) {
209
+ var i = this.getFile(j);
210
+ if (i) {
211
+ this.uploader.removeFile(i)
212
+ }
213
+ }, clearQueue:function () {
214
+ this.uploader.splice()
215
+ }, getUploader:function () {
216
+ return this.uploader
217
+ }, refresh:function () {
218
+ this.uploader.refresh()
219
+ }, _handleState:function () {
220
+ var j = this, i = this.uploader;
221
+ if (i.state === c.STARTED) {
222
+ g(j.start_button).button("disable");
223
+ g([]).add(j.stop_button).add(".plupload_started").removeClass("plupload_hidden");
224
+ g(".plupload_upload_status", j.element).text(b("Uploaded %d/%d files").replace("%d/%d", i.total.uploaded + "/" + i.files.length));
225
+ g(".plupload_header_content", j.element).addClass("plupload_header_content_bw")
226
+ } else {
227
+ g([]).add(j.stop_button).add(".plupload_started").addClass("plupload_hidden");
228
+ if (j.options.multiple_queues) {
229
+ g(j.start_button).button("enable");
230
+ g(".plupload_header_content", j.element).removeClass("plupload_header_content_bw")
231
+ }
232
+ j._updateFileList()
233
+ }
234
+ }, _handleFileStatus:function (l) {
235
+ var n, j;
236
+ if (!g("#" + l.id).length) {
237
+ return
238
+ }
239
+ switch (l.status) {
240
+ case c.DONE:
241
+ n = "plupload_done";
242
+ j = "ui-icon ui-icon-circle-check";
243
+ break;
244
+ case c.FAILED:
245
+ n = "ui-state-error plupload_failed";
246
+ j = "ui-icon ui-icon-alert";
247
+ break;
248
+ case c.QUEUED:
249
+ n = "plupload_delete";
250
+ j = "ui-icon ui-icon-circle-minus";
251
+ break;
252
+ case c.UPLOADING:
253
+ n = "ui-state-highlight plupload_uploading";
254
+ j = "ui-icon ui-icon-circle-arrow-w";
255
+ var i = g(".plupload_scroll", this.container), m = i.scrollTop(), o = i.height(), k = g("#" + l.id).position().top + g("#" + l.id).height();
256
+ if (o < k) {
257
+ i.scrollTop(m + k - o)
258
+ }
259
+ break
260
+ }
261
+ n += " ui-state-default plupload_file";
262
+ g("#" + l.id).attr("class", n).find(".ui-icon").attr("class", j)
263
+ }, _updateTotalProgress:function () {
264
+ var i = this.uploader;
265
+ this.progressbar.progressbar("value", i.total.percent);
266
+ this.element.find(".plupload_total_status").html(i.total.percent + "%").end().find(".plupload_total_file_size").html(c.formatSize(i.total.size)).end().find(".plupload_upload_status").text(b("Uploaded %d/%d files").replace("%d/%d", i.total.uploaded + "/" + i.files.length))
267
+ }, _updateFileList:function () {
268
+ var k = this, j = this.uploader, m = this.filelist, l = 0, o, n = this.id + "_", i;
269
+ if (g.ui.sortable && this.options.sortable) {
270
+ g("tbody", m).sortable("destroy")
271
+ }
272
+ m.empty();
273
+ g.each(j.files, function (q, p) {
274
+ i = "";
275
+ o = n + l;
276
+ if (p.status === c.DONE) {
277
+ if (p.target_name) {
278
+ i += '<input type="hidden" name="' + o + '_tmpname" value="' + c.xmlEncode(p.target_name) + '" />'
279
+ }
280
+ i += '<input type="hidden" name="' + o + '_name" value="' + c.xmlEncode(p.name) + '" />';
281
+ i += '<input type="hidden" name="' + o + '_status" value="' + (p.status === c.DONE ? "done" : "failed") + '" />';
282
+ l++;
283
+ k.counter.val(l)
284
+ }
285
+ m.append('<tr class="ui-state-default plupload_file" id="' + p.id + '"><td class="plupload_cell plupload_file_name"><span>' + p.name + '</span></td><td class="plupload_cell plupload_file_status">' + p.percent + '%</td><td class="plupload_cell plupload_file_size">' + c.formatSize(p.size) + '</td><td class="plupload_cell plupload_file_action"><div class="ui-icon"></div>' + i + "</td></tr>");
286
+ k._handleFileStatus(p);
287
+ g("#" + p.id + ".plupload_delete .ui-icon, #" + p.id + ".plupload_done .ui-icon").click(function (r) {
288
+ g("#" + p.id).remove();
289
+ j.removeFile(p);
290
+ r.preventDefault()
291
+ });
292
+ k._trigger("updatelist", null, m)
293
+ });
294
+ if (j.total.queued === 0) {
295
+ g(".ui-button-text", k.browse_button).text(b("Add Files"))
296
+ } else {
297
+ g(".ui-button-text", k.browse_button).text(b("%d files queued").replace("%d", j.total.queued))
298
+ }
299
+ if (j.files.length === (j.total.uploaded + j.total.failed)) {
300
+ k.start_button.button("disable")
301
+ } else {
302
+ k.start_button.button("enable")
303
+ }
304
+ m[0].scrollTop = m[0].scrollHeight;
305
+ k._updateTotalProgress();
306
+ if (!j.files.length && j.features.dragdrop && j.settings.dragdrop) {
307
+ g("#" + o + "_filelist").append('<tr><td class="plupload_droptext">' + b("Drag files here.") + "</td></tr>")
308
+ } else {
309
+ if (k.options.sortable && g.ui.sortable) {
310
+ k._enableSortingList()
311
+ }
312
+ }
313
+ }, _enableRenaming:function () {
314
+ var i = this;
315
+ g(".plupload_delete .plupload_file_name span", this.filelist).live("click", function (o) {
316
+ var m = g(o.target), k, n, j, l = "";
317
+ k = i.uploader.getFile(m.parents("tr")[0].id);
318
+ j = k.name;
319
+ n = /^(.+)(\.[^.]+)$/.exec(j);
320
+ if (n) {
321
+ j = n[1];
322
+ l = n[2]
323
+ }
324
+ m.hide().after('<input class="plupload_file_rename" type="text" />');
325
+ m.next().val(j).focus().blur(
326
+ function () {
327
+ m.show().next().remove()
328
+ }).keydown(function (q) {
329
+ var p = g(this);
330
+ if (g.inArray(q.keyCode, [13, 27]) !== -1) {
331
+ q.preventDefault();
332
+ if (q.keyCode === 13) {
333
+ k.name = p.val() + l;
334
+ m.text(k.name)
335
+ }
336
+ p.blur()
337
+ }
338
+ })
339
+ })
340
+ }, _enableDragAndDrop:function () {
341
+ this.filelist.append('<tr><td class="plupload_droptext">' + b("Drag files here.") + "</td></tr>");
342
+ this.filelist.parent().attr("id", this.id + "_dropbox");
343
+ this.uploader.settings.drop_element = this.options.drop_element = this.id + "_dropbox"
344
+ }, _enableSortingList:function () {
345
+ var j, i = this;
346
+ if (g("tbody tr", this.filelist).length < 2) {
347
+ return
348
+ }
349
+ g("tbody", this.filelist).sortable({containment:"parent", items:".plupload_delete", helper:function (l, k) {
350
+ return k.clone(true).find("td:not(.plupload_file_name)").remove().end().css("width", "100%")
351
+ }, stop:function (p, o) {
352
+ var l, n, k, m = [];
353
+ g.each(g(this).sortable("toArray"), function (q, r) {
354
+ m[m.length] = i.uploader.getFile(r)
355
+ });
356
+ m.unshift(m.length);
357
+ m.unshift(0);
358
+ Array.prototype.splice.apply(i.uploader.files, m)
359
+ }})
360
+ }, notify:function (j, k) {
361
+ var i = g('<div class="plupload_message"><span class="plupload_message_close ui-icon ui-icon-circle-close" title="' + b("Close") + '"></span><p><span class="ui-icon"></span>' + k + "</p></div>");
362
+ i.addClass("ui-state-" + (j === "error" ? "error" : "highlight")).find("p .ui-icon").addClass("ui-icon-" + (j === "error" ? "alert" : "info")).end().find(".plupload_message_close").click(
363
+ function () {
364
+ i.remove()
365
+ }).end();
366
+ g(".plupload_header_content", this.container).append(i)
367
+ }, destroy:function () {
368
+ g(".plupload_button", this.element).unbind();
369
+ if (g.ui.button) {
370
+ g(".plupload_add, .plupload_start, .plupload_stop", this.container).button("destroy")
371
+ }
372
+ if (g.ui.progressbar) {
373
+ this.progressbar.progressbar("destroy")
374
+ }
375
+ if (g.ui.sortable && this.options.sortable) {
376
+ g("tbody", this.filelist).sortable("destroy")
377
+ }
378
+ this.uploader.destroy();
379
+ this.element.empty().html(this.contents_bak);
380
+ this.contents_bak = "";
381
+ g.Widget.prototype.destroy.apply(this)
382
+ }})
383
+ }(window, document, plupload, jQuery));