infopark_fiona7 0.30.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +3 -0
  3. data/Rakefile +21 -0
  4. data/app/assets/images/fiona7-logo.png +0 -0
  5. data/app/assets/images/fiona7-marker.png +0 -0
  6. data/app/assets/javascripts/fiona7.js +284 -0
  7. data/app/assets/stylesheets/fiona7-login.css.scss +15 -0
  8. data/app/assets/stylesheets/fiona7.css.scss +83 -0
  9. data/app/controllers/fiona7/blobs_controller.rb +35 -0
  10. data/app/controllers/fiona7/default_scrivito_cms_controller.rb +16 -0
  11. data/app/controllers/fiona7/release_controller.rb +24 -0
  12. data/app/controllers/fiona7/sessions_controller.rb +49 -0
  13. data/app/controllers/fiona7_login_page_controller.rb +27 -0
  14. data/app/helpers/fiona7_login_helper.rb +18 -0
  15. data/app/helpers/fiona7_override_helper.rb +47 -0
  16. data/app/models/fiona7/edited_obj.rb +15 -0
  17. data/app/models/fiona7/internal_released_obj.rb +18 -0
  18. data/app/models/fiona7/released_obj.rb +18 -0
  19. data/app/models/fiona7/write_obj.rb +63 -0
  20. data/app/models/fiona7_login_page.rb +5 -0
  21. data/app/models/x_container.rb +5 -0
  22. data/app/models/x_generic.rb +5 -0
  23. data/app/models/x_image.rb +5 -0
  24. data/app/views/fiona7_login_page/index.html.erb +14 -0
  25. data/app/views/layouts/fiona7_login_page_layout.html.erb +23 -0
  26. data/config/locales/login.yml +19 -0
  27. data/config/locales/permissions.yml +7 -0
  28. data/config/routes.rb +9 -0
  29. data/lib/fiona7/assert.rb +17 -0
  30. data/lib/fiona7/builder/batch_widget_writer.rb +107 -0
  31. data/lib/fiona7/builder/obj_builder.rb +297 -0
  32. data/lib/fiona7/builder/obj_class_builder.rb +111 -0
  33. data/lib/fiona7/builder/obj_class_updater.rb +69 -0
  34. data/lib/fiona7/builder/obj_updater.rb +25 -0
  35. data/lib/fiona7/builder/widget_builder.rb +13 -0
  36. data/lib/fiona7/builder/widget_building.rb +35 -0
  37. data/lib/fiona7/builder/widget_updater.rb +13 -0
  38. data/lib/fiona7/controllers/content_service/obj_controller.rb +125 -0
  39. data/lib/fiona7/controllers/content_service/workspace_controller.rb +19 -0
  40. data/lib/fiona7/controllers/rest_api/blob_controller.rb +11 -0
  41. data/lib/fiona7/controllers/rest_api/obj_class_controller.rb +39 -0
  42. data/lib/fiona7/controllers/rest_api/obj_controller.rb +175 -0
  43. data/lib/fiona7/controllers/rest_api/workspace_controller.rb +58 -0
  44. data/lib/fiona7/engine.rb +138 -0
  45. data/lib/fiona7/fiona_connector_patches/basic_obj.rb +9 -0
  46. data/lib/fiona7/initializer.rb +78 -0
  47. data/lib/fiona7/json/obj_class_decorator.rb +45 -0
  48. data/lib/fiona7/json/obj_decorator.rb +153 -0
  49. data/lib/fiona7/json/typeless_obj_decorator.rb +30 -0
  50. data/lib/fiona7/json/widget_decorator.rb +18 -0
  51. data/lib/fiona7/link_converter/fiona_to_scrivito.rb +37 -0
  52. data/lib/fiona7/link_converter/scrivito_to_fiona.rb +42 -0
  53. data/lib/fiona7/mode_switch.rb +7 -0
  54. data/lib/fiona7/mode_switch/abstract_mode_switch.rb +19 -0
  55. data/lib/fiona7/mode_switch/cms_routes.rb +33 -0
  56. data/lib/fiona7/mode_switch/cms_routes/fiona_connector.rb +17 -0
  57. data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk.rb +20 -0
  58. data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk_slave.rb +20 -0
  59. data/lib/fiona7/mode_switch/composite.rb +33 -0
  60. data/lib/fiona7/mode_switch/constants.rb +86 -0
  61. data/lib/fiona7/mode_switch/views.rb +37 -0
  62. data/lib/fiona7/naive_search_engine.rb +111 -0
  63. data/lib/fiona7/recursive_link_resolver.rb +93 -0
  64. data/lib/fiona7/routers/content_service.rb +19 -0
  65. data/lib/fiona7/routers/rest_api.rb +135 -0
  66. data/lib/fiona7/routing_monkey_patch.rb +33 -0
  67. data/lib/fiona7/scrivito_patches/attribute_content.rb +19 -0
  68. data/lib/fiona7/scrivito_patches/basic_obj.rb +92 -0
  69. data/lib/fiona7/scrivito_patches/basic_widget.rb +14 -0
  70. data/lib/fiona7/scrivito_patches/binary.rb +55 -0
  71. data/lib/fiona7/scrivito_patches/client_config.rb +19 -0
  72. data/lib/fiona7/scrivito_patches/cms_dispatch_controller.rb +31 -0
  73. data/lib/fiona7/scrivito_patches/cms_rest_api.rb +11 -0
  74. data/lib/fiona7/scrivito_patches/cms_routing.rb +66 -0
  75. data/lib/fiona7/scrivito_patches/controller_actions.rb +14 -0
  76. data/lib/fiona7/scrivito_patches/link_parser.rb +22 -0
  77. data/lib/fiona7/scrivito_patches/migrator.rb +13 -0
  78. data/lib/fiona7/scrivito_patches/obj_class.rb +16 -0
  79. data/lib/fiona7/scrivito_patches/type_computer.rb +25 -0
  80. data/lib/fiona7/scrivito_patches/workspace.rb +12 -0
  81. data/lib/fiona7/scrivito_user.rb +44 -0
  82. data/lib/fiona7/search_engine.rb +20 -0
  83. data/lib/fiona7/type_register.rb +140 -0
  84. data/lib/fiona7/type_register_mixin.rb +9 -0
  85. data/lib/fiona7/version.rb +3 -0
  86. data/lib/fiona7/version_helper.rb +84 -0
  87. data/lib/fiona7/widget_resolver.rb +37 -0
  88. data/lib/fiona7/workspace.rb +76 -0
  89. data/lib/infopark_fiona7.rb +4 -0
  90. data/lib/tasks/fiona7_tasks.rake +13 -0
  91. metadata +216 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ee92fe9da448344b8be0944ed1433aae5db7c05
4
+ data.tar.gz: 18cba178b8ce3d227dedaf0c9d250f7eabf862c3
5
+ SHA512:
6
+ metadata.gz: 236f98252dc3aa4473ff6b8bd3687e89f74cbf19a4f5509f135f4145923d33af3c965fd8ebab0d075ddda39e4b0d6f284f1012660f3cd624334c341ce57dcde2
7
+ data.tar.gz: bf19ea64402cc9d338ea9df6bc1d2e4ab151ed9c3550aace2ab8901ea76aec2ffe939eb1759b1e8a47a8ac4541202b664eb639238f134b4d800cd1c9efca223d
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Fiona 7
2
+
3
+ This gem enables the scrivito interface for classic Fiona installations.
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Fiona7'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
Binary file
Binary file
@@ -0,0 +1,284 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require scrivito_sdk
4
+ //= require scrivito_editors
5
+
6
+ /* obj.js, patch create & upload */
7
+ (function() {
8
+ var format_date = function(date) {
9
+ return date.getUTCFullYear().toString() +
10
+ format_date_number(date.getUTCMonth() + 1) + // Month numbers are starting at 0.
11
+ format_date_number(date.getUTCDate()) +
12
+ format_date_number(date.getUTCHours()) +
13
+ format_date_number(date.getUTCMinutes()) +
14
+ format_date_number(date.getUTCSeconds());
15
+ };
16
+
17
+ var format_date_number = function(number) {
18
+ var string = number.toString();
19
+ return string.length === 1 ? '0' + string : string;
20
+ };
21
+
22
+ var convert_attributes = function(data) {
23
+ var collected_promises = _.map(data, function(value, field_name) {
24
+ if (value instanceof Date) {
25
+ return $.Deferred().resolve([field_name, format_date(value)]);
26
+ } else if (value instanceof window.File) {
27
+ return $.Deferred().resolve([field_name, value]);
28
+ return scrivito.blob.create(value).then(function(value) {
29
+ return [field_name, value];
30
+ });
31
+ } else {
32
+ return $.Deferred().resolve([field_name, value]);
33
+ }
34
+ });
35
+
36
+ return $.when.apply(this, collected_promises).then(function() {
37
+ return _.object(arguments);
38
+ });
39
+ };
40
+
41
+ var convert_widget_pool = function(widget_pool) {
42
+ if(widget_pool) {
43
+ var conversion_promises = _.map(widget_pool, function(attributes, widget_id) {
44
+ return convert_attributes(attributes).then(function(attributes) {
45
+ return [widget_id, attributes];
46
+ });
47
+ });
48
+
49
+ return $.when.apply(this, conversion_promises).then(function() {
50
+ return _.object(arguments);
51
+ });
52
+ } else {
53
+ return $.Deferred().resolve(widget_pool);
54
+ }
55
+ };
56
+
57
+ var prepare_attributes = function(data) {
58
+ return convert_widget_pool(data._widget_pool).then(function(widget_pool) {
59
+ return convert_attributes(data).then(function(attributes) {
60
+ attributes._widget_pool = widget_pool;
61
+ return attributes;
62
+ });
63
+ });
64
+ };
65
+
66
+ scrivito.obj.create_original = scrivito.obj.create;
67
+ scrivito.obj.create = function (data) {
68
+ var blob;
69
+
70
+ if (data['blob']) {
71
+ blob = data['blob'];
72
+ delete data['blob'];
73
+ }
74
+ return prepare_attributes(data).then(function(attributes) {
75
+ var fd, defer, url, base_url = window.location.protocol + '//' + window.location.host + '/__scrivito/';
76
+ url = base_url + 'objs';
77
+
78
+ fd = new FormData();
79
+
80
+ $.each(attributes, function (key, value) {
81
+ if (typeof value !== 'undefined') {
82
+ fd.append('obj[' + key + ']', value);
83
+ }
84
+ });
85
+
86
+ if (typeof blob !== 'undefined') {
87
+ fd.append('obj[blob]', blob);
88
+ }
89
+
90
+ defer = $.Deferred();
91
+
92
+ $.ajax({
93
+ url: url,
94
+ type: 'POST',
95
+ data: fd,
96
+ processData: false,
97
+ contentType: false
98
+ })
99
+ .error(function (xhr, text, error) {
100
+ scrivito.alert(text);
101
+ defer.reject(text);
102
+ })
103
+ .success(function (new_data) {
104
+ defer.resolve(scrivito.obj.create_instance_from_server_data(new_data));
105
+ });
106
+
107
+ return defer.promise();
108
+ });
109
+ };
110
+
111
+ }());
112
+
113
+ (function() {
114
+
115
+ }());
116
+
117
+ (function() {
118
+ var original_create_instance = scrivito.child_list_element.create_instance;
119
+
120
+ /* patch the create page command to not create incomprehensible paths */
121
+ scrivito.child_list_element.create_instance = function(cms_element) {
122
+ var ret = original_create_instance.call(this, cms_element);
123
+ if (typeof ret === "object") {
124
+ ret.create_child = function(obj_class) {
125
+ var path = (cms_element.path() + '/' + obj_class).replace(/\/\//g, "/");
126
+
127
+ return scrivito.obj.create({
128
+ _path: path,
129
+ _obj_class: obj_class
130
+ });
131
+ };
132
+ }
133
+ return ret;
134
+ };
135
+
136
+ /* patch the revert command to allow reverts on rtc workspace*/
137
+ scrivito.revert_obj_command = function(obj, translations_namespace) {
138
+ if (!translations_namespace) {
139
+ translations_namespace = 'commands.revert_obj';
140
+ }
141
+
142
+ return scrivito.command.create_instance({
143
+ id: 'revert_obj',
144
+ title: scrivito.t(translations_namespace + '.title'),
145
+ icon: '&#xf032;',
146
+
147
+ present: function() {
148
+ return scrivito.editing_context.selected_workspace.is_editable() && obj && !obj.is_deleted();
149
+ },
150
+
151
+ disabled: function() {
152
+ /* here patched: */
153
+ /*
154
+ if (scrivito.editing_context.selected_workspace.is_rtc()) {
155
+ return scrivito.t(translations_namespace + '.rtc_workspace');
156
+ }
157
+ */
158
+ if (!obj.modification()) {
159
+ return scrivito.t(translations_namespace + '.not_modified_obj');
160
+ }
161
+ if (obj.is_new()) {
162
+ return scrivito.t(translations_namespace + '.new_obj');
163
+ }
164
+ },
165
+
166
+ update: function() {
167
+ return obj.update_modification();
168
+ },
169
+
170
+ execute: function() {
171
+ return scrivito.confirmation_dialog({
172
+ title: scrivito.t(translations_namespace + '.dialog.title'),
173
+ description: scrivito.t('commands.revert_obj.dialog.description'),
174
+ icon: '&#xf032;',
175
+ color: 'red',
176
+ confirm_button_text: scrivito.t('commands.revert_obj.dialog.confirm'),
177
+ confirm_button_color: 'red'
178
+ }).then(function() {
179
+ return scrivito.with_saving_overlay(obj.revert().then(function() {
180
+ scrivito.reload();
181
+ }));
182
+ });
183
+ }
184
+ });
185
+ };
186
+
187
+ $.i18n().load({
188
+ 'commands.release_obj.title': 'Seite freigeben',
189
+ 'commands.release_obj.not_modified_obj': 'Diese Seite wurde nicht geändert. Daher gibt es nichts zu freigeben.',
190
+ 'commands.release_obj.dialog.title': 'Wirklich Änderungen an dieser Seite veröffentlichen?',
191
+ 'commands.release_obj.dialog.description': 'Eine Arbeitsversion zu veröffentlichen ist endgültig. Dieser Vorgang kann nicht rückgängig gemacht werden.',
192
+ 'commands.release_obj.dialog.confirm': 'Freigeben',
193
+ 'commands.release_obj.failed': 'Freigabe fehlgeschlagen'
194
+ }, 'de');
195
+
196
+ $.i18n().load({
197
+ 'commands.release_obj.title': 'Release page',
198
+ 'commands.release_obj.not_modified_obj': 'This resource has not been modified. Therefore, nothing can be released.',
199
+ 'commands.release_obj.dialog.title': 'Really release this page?',
200
+ 'commands.release_obj.dialog.description': 'Releasing an edited page is final. This operation cannot be reverted.',
201
+ 'commands.release_obj.dialog.confirm': 'Release',
202
+ 'commands.release_obj.failed': 'Release failed'
203
+ }, 'en');
204
+
205
+ var open_confirmation_dialog = function() {
206
+ return scrivito.confirmation_dialog({
207
+ title: scrivito.t('commands.release_obj.dialog.title'),
208
+ description: scrivito.t('commands.release_obj.dialog.description'),
209
+ icon: '&#xf064;',
210
+ color: 'green',
211
+ confirm_button_text: scrivito.t('commands.release_obj.dialog.confirm'),
212
+ confirm_button_color: 'green'
213
+ });
214
+ };
215
+
216
+ /* implement release command */
217
+ scrivito.release_obj_command = function(obj, translations_namespace) {
218
+ if (!translations_namespace) {
219
+ translations_namespace = 'commands.release_obj';
220
+ }
221
+
222
+ return scrivito.command.create_instance({
223
+ id: 'release_obj',
224
+ title: scrivito.t(translations_namespace + '.title'),
225
+ icon: '&#xf064;',
226
+
227
+ present: function() {
228
+ return scrivito.editing_context.selected_workspace.is_editable() && obj && !obj.is_deleted();
229
+ },
230
+
231
+ disabled: function() {
232
+ if (!obj.modification()) {
233
+ return scrivito.t(translations_namespace + '.not_modified_obj');
234
+ }
235
+ },
236
+
237
+ execute: function() {
238
+ /* TODO: implement permission check */
239
+ open_confirmation_dialog().done(function() {
240
+ scrivito.with_saving_overlay(scrivito.ajax('PUT', 'objs/' + obj.id() + '/release').then(function() {
241
+ scrivito.reload();
242
+ }).fail(function(error) {
243
+ scrivito.alert_dialog(scrivito.t(translations_namespace + '.failed'));
244
+ }));
245
+ });
246
+ }
247
+ });
248
+ };
249
+
250
+ /* patch the obj menu */
251
+ scrivito.current_page_menu.init = function() {
252
+ if (scrivito.obj.current_page) {
253
+ scrivito.menu_bar.register_item_renderer(function(menu_bar) {
254
+ var current_page = scrivito.obj.current_page;
255
+ scrivito.obj_menu.create(menu_bar.find('#scrivito_current_page_menu'), current_page, [
256
+ scrivito.obj_details_command(current_page),
257
+ scrivito.save_obj_to_clipboard_command(current_page),
258
+ scrivito.release_obj_command(current_page),
259
+ scrivito.delete_obj_command(current_page),
260
+ scrivito.revert_obj_command(current_page),
261
+ //scrivito.restore_obj_command(current_page),
262
+ //scrivito.mark_resolved_obj_command(current_page),
263
+ scrivito.duplicate_obj_command(current_page)
264
+ ]);
265
+ });
266
+ }
267
+ };
268
+
269
+ /* enforce permissions */
270
+ var originalGuiStart = scrivito.gui.start;
271
+ scrivito.gui.start = function () {
272
+ originalGuiStart.call(this, arguments);
273
+ if (scrivito.in_editable_view()) {
274
+ if (!scrivito.user_permissions.can('write_obj')) {
275
+ $('.switch_to_view_mode').click();
276
+ }
277
+ } else {
278
+ if (!scrivito.user_permissions.can('write_obj')) {
279
+ $('.scrivito_viewmode_editing').remove();
280
+ }
281
+ }
282
+ };
283
+
284
+ }());
@@ -0,0 +1,15 @@
1
+ .container {
2
+ font-family: 'Helvetica', sans-serif;
3
+ label {
4
+ display: block;
5
+ margin: 10px 0;
6
+ }
7
+ form, input {
8
+ width: 100%
9
+ }
10
+ button {
11
+ margin: 10px 0;
12
+ }
13
+ width: 400px;
14
+ margin: 0 auto;
15
+ }
@@ -0,0 +1,83 @@
1
+ /*
2
+ *= require scrivito
3
+ *= require scrivito_editors
4
+ */
5
+ /* here goes logo */
6
+ body > div.scrivito_topbar > div > div.scrivito_button_bar.scrivito_app.scrivito_no_hover {
7
+ width: 170px !important;
8
+ }
9
+ body > div.scrivito_topbar > div > div.scrivito_button_bar.scrivito_app.scrivito_no_hover .scrivito_logo {
10
+ background-image: asset-url('fiona7-logo.png') !important;
11
+ height: 43px !important;
12
+ width: 163px !important;
13
+ top: 0px;
14
+ left: 0px;
15
+ }
16
+ /* colors */
17
+ body.scrivito_widget_dragging_active[data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class],
18
+ body.scrivito_widget_dragging_active[data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class] *[data-scrivito-field-type="widget"],
19
+ [data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class]:hover,
20
+ [data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class]:hover *[data-scrivito-field-type="widget"] {
21
+ -webkit-box-shadow:0 0 0 2px #6ca4d9 !important;
22
+ box-shadow:0 0 0 2px #6ca4d9 !important;
23
+ }
24
+
25
+ /* highlight cms fields on hover */
26
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="string"]:hover,
27
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="text"]:hover,
28
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="html"]:hover,
29
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="reference"]:hover,
30
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="referencelist"]:hover,
31
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="linklist"]:hover,
32
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="enum"]:hover,
33
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="multienum"]:hover,
34
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="date"]:hover {
35
+ outline: 2px dotted #6ca4d9 !important;
36
+ }
37
+ /* scrivito_editing_marker edit colors */
38
+ .scrivito_editing_marker {background: #6ca4d9 !important; background:rgba(108, 164, 217, .5) !important;}
39
+ .scrivito_editing_marker:hover,
40
+ .scrivito_editing_marker:active { background: #6ca4d9 !important; background: rgba(108, 164, 217, 1) !important; }
41
+
42
+ [data-scrivito-display-mode="editing"] [data-scrivito-private-child-list-path]:hover > .scrivito_editing_marker,
43
+ [data-scrivito-display-mode="editing"] [data-scrivito-widget-obj-class]:hover > .scrivito_editing_marker {
44
+ background: #6ca4d9 !important; background: rgba(108, 164, 217, 1) !important;
45
+ }
46
+ .scrivito_editing_marker_title {
47
+ background: #6ca4d9 !important; background: rgba(108, 164, 217, 1) !important;
48
+ /* prevent breaking of titles */
49
+ font-size: 11px !important;
50
+ padding: 5px 10px !important;
51
+ }
52
+ .scrivito_editing_marker .scrivito_icon {
53
+ font-size: 0 !important;
54
+ width: 24px !important;
55
+ height: 24px !important;
56
+ background-image: asset-url('fiona7-marker.png') !important;
57
+ display: inline-block !important;
58
+ }
59
+ .scrivito_editing_marker {
60
+ padding: 0 !important;
61
+ }
62
+ .scrivito_input_new_ws_name, #scrivito_delete_workspace, #scrivito_rename_workspace, #scrivito_create_workspace, #scrivito_rebase_workspace, #scrivito_workspace_settings {
63
+ display: none !important;
64
+ }
65
+
66
+ .scrivito_editing_widget_visualization .scrivito_icon {
67
+ line-height: 118px !important;
68
+ }
69
+
70
+ /* for removing edit toggle */
71
+ .scrivito_viewmodes_wrapper {
72
+ text-align: center !important;
73
+ }
74
+ .scrivito_viewmodes {
75
+ width: auto !important;
76
+ display: inline-block !important;
77
+ }
78
+ .scrivito_viewmodes.scrivito_viewmode_diff_active .scrivito_viewmode_pill,
79
+ .scrivito_viewmodes.scrivito_viewmode_deleted_active .scrivito_viewmode_pill,
80
+ .scrivito_viewmodes.scrivito_viewmode_added_active .scrivito_viewmode_pill {
81
+ left: auto !important;
82
+ right: 0px !important;
83
+ }
@@ -0,0 +1,35 @@
1
+ module Fiona7
2
+ class BlobsController < ActionController::Base
3
+ # required for ensure_object_is_permitted
4
+ cattr_accessor :current_user_proc
5
+ self.current_user_proc = proc { nil }
6
+
7
+ include RailsConnector::CmsAccessible
8
+ before_filter :load_object
9
+ before_filter :ensure_object_is_active
10
+ before_filter :ensure_object_is_permitted
11
+ before_filter :set_google_expire_header
12
+
13
+ def show
14
+ if @obj.binary?
15
+ deliver_file
16
+ else
17
+ head :bad_request
18
+ end
19
+ end
20
+
21
+ protected
22
+ def load_object
23
+ obj_id = params[:id].to_i
24
+ @obj = InternalReleasedObj.find(obj_id)
25
+ rescue ActiveRecord::RecordNotFound
26
+ head :not_found
27
+ return false
28
+ end
29
+
30
+ def current_user
31
+ self.class.current_user_proc.try(:call, self)
32
+ end
33
+ end
34
+ end
35
+