infopark_fiona7 1.6.1.1.1 → 1.6.1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/fiona7_ui.js +59 -36
- data/app/assets/javascripts/scrivito_patches/client/ajax.js +4 -0
- data/app/controllers/fiona7/release_controller.rb +3 -0
- data/app/controllers/fiona7/workflow_controller.rb +14 -0
- data/config/precedence_routes.rb +1 -0
- data/infopark_fiona7.gemspec +5 -5
- data/lib/fiona7/binary_files_cleaner.rb +29 -0
- data/lib/fiona7/builder/lazy_blob_copier.rb +3 -0
- data/lib/fiona7/builder/obj_updater.rb +1 -1
- data/lib/fiona7/complex_object.rb +15 -1
- data/lib/fiona7/scrivito_patches/binary.rb +19 -1
- data/lib/fiona7/scrivito_patches/page_config.rb +1 -1
- data/lib/fiona7/version.rb +1 -1
- data/lib/fiona7/widget_gc/sweep_strategies/revert_sweep.rb +1 -0
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b1c27d1b674276a829a3cb2fcb5320426af57b
|
4
|
+
data.tar.gz: 48a1c5073d802b1fe7af7cd8e376697efc1d1ffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba4897faefd1d314ba41862e9805ffb6ae001aa7f0094293230d5a775cd744febfe1f909d0afd249e68b68e202601d01e6d8b8e452d42566cdd5efbfa6eaf47f
|
7
|
+
data.tar.gz: 3586cdf2d048de46b7d8a220dcb72aec6e1e57cce85de06f2a69e061a380c286ad50d10538d8509214388425ed241100166d3be9b448b8e1be7a5a09f468e974
|
@@ -149,6 +149,32 @@
|
|
149
149
|
});
|
150
150
|
};
|
151
151
|
|
152
|
+
var enable_workflow_buttons = function(document, obj, buttons, source_frame){
|
153
|
+
// TODO: add special handling for scrivito_details_dialog and scrivito_inspector
|
154
|
+
var button;
|
155
|
+
|
156
|
+
// remove redundant buttons
|
157
|
+
$.each(actions, function (idx, action) {
|
158
|
+
if (buttons.indexOf(action) === -1) {
|
159
|
+
$('[data-fiona7-private-workflow-button="' + action + '"]', document).addClass('disabled').hide();
|
160
|
+
} else {
|
161
|
+
$('[data-fiona7-private-workflow-button="' + action + '"]', document).removeClass('disabled').show();
|
162
|
+
}
|
163
|
+
});
|
164
|
+
|
165
|
+
// conditionally enable release button
|
166
|
+
// find the release button
|
167
|
+
button = $('[data-fiona7-private-workflow-button="release"]', document);
|
168
|
+
if (obj.has_restriction() || ( buttons.length > 0 && buttons.indexOf("release") === -1) ) {
|
169
|
+
// release impossible
|
170
|
+
button.attr('disabled');
|
171
|
+
button.addClass('disabled');
|
172
|
+
} else if( obj.modification() || ( buttons.length > 0 && buttons.indexOf("release") !== -1) ) {
|
173
|
+
button.removeAttr('disabled');
|
174
|
+
button.removeClass('disabled');
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
152
178
|
scrivito.gui.on('document', function(cms_document) {
|
153
179
|
var page_config = (cms_document.page_config() || {})['current_page'] || {};
|
154
180
|
var obj = cms_document.page();
|
@@ -158,51 +184,40 @@
|
|
158
184
|
var source_frame = cms_document.browser_window();
|
159
185
|
|
160
186
|
if (source_frame.name !== 'scrivito_application') {
|
161
|
-
// TODO: add special handling for scrivito_details_dialog and scrivito_inspector
|
162
|
-
var button;
|
163
|
-
|
164
|
-
// enable workflow buttons
|
165
|
-
$.each(buttons, function (idx, action) {
|
166
|
-
// release is handled differently
|
167
|
-
if (action === 'release') {
|
168
|
-
return;
|
169
|
-
}
|
170
|
-
|
171
|
-
// find the workflow button
|
172
|
-
button = $('[data-fiona7-private-workflow-button="' + action + '"]', cms_document.browser_window().document);
|
173
|
-
|
174
|
-
// enable given workflow button
|
175
|
-
button.removeAttr('disabled');
|
176
|
-
button.removeClass('disabled');
|
177
|
-
button.click(function () {
|
178
|
-
workflowAction(action, obj.id(), reloadGivenWindow(source_frame));
|
179
|
-
});
|
180
|
-
|
181
|
-
});
|
182
|
-
|
183
187
|
// remove redundant buttons
|
184
188
|
$.each(actions, function (idx, action) {
|
185
|
-
|
186
|
-
|
187
|
-
|
189
|
+
$('[data-fiona7-private-workflow-button="' + action + '"]', cms_document.browser_window().document).click(function () {
|
190
|
+
if (buttons.indexOf(action) !== -1) {
|
191
|
+
workflowAction(action, obj.id(), reloadGivenWindow(source_frame));
|
192
|
+
}
|
193
|
+
});
|
188
194
|
});
|
189
195
|
|
190
196
|
// conditionally enable release button
|
191
197
|
// find the release button
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
// release impossibru
|
196
|
-
button.attr('title', obj.restriction_messages().join("; "));
|
197
|
-
} else {
|
198
|
-
button.removeAttr('disabled');
|
199
|
-
button.removeClass('disabled');
|
200
|
-
button.click(function () {
|
201
|
-
releaseAction(obj.id(), reloadGivenWindow(source_frame));
|
202
|
-
});
|
198
|
+
$('[data-fiona7-private-workflow-button="release"]', cms_document.browser_window().document).click(function () {
|
199
|
+
if( obj.modification() || ( buttons.length > 0 && buttons.indexOf("release") !== -1) ) {
|
200
|
+
releaseAction(obj.id(), reloadGivenWindow(source_frame));
|
203
201
|
}
|
202
|
+
});
|
203
|
+
|
204
|
+
enable_workflow_buttons( cms_document.browser_window().document, obj, buttons, source_frame );
|
205
|
+
|
206
|
+
var check_actions = function(){
|
207
|
+
scrivito.ajax('GET', 'objs/' + obj.id() + '/workflow/list').then( function( data ) {
|
208
|
+
if( !data || data.error ) {
|
209
|
+
return;
|
210
|
+
}
|
211
|
+
enable_workflow_buttons(cms_document.browser_window().document, obj, data.actions, source_frame );
|
212
|
+
buttons = data.actions;
|
213
|
+
});
|
204
214
|
}
|
205
215
|
|
216
|
+
scrivito.write_monitor.on('end_write', function() {
|
217
|
+
if (!scrivito.write_monitor.is_writing()) {
|
218
|
+
check_actions();
|
219
|
+
}
|
220
|
+
});
|
206
221
|
return;
|
207
222
|
}
|
208
223
|
|
@@ -266,6 +281,14 @@
|
|
266
281
|
});
|
267
282
|
});
|
268
283
|
|
284
|
+
scrivito.on('load', function() {
|
285
|
+
scrivito.page_menu(cms_document).update("scrivito.sdk.save_obj_to_clipboard",{
|
286
|
+
disabled: function disabled() {
|
287
|
+
return false;
|
288
|
+
}
|
289
|
+
});
|
290
|
+
});
|
291
|
+
|
269
292
|
});
|
270
293
|
|
271
294
|
return;
|
@@ -15,6 +15,10 @@
|
|
15
15
|
scrivito.write_monitor.start_write();
|
16
16
|
}
|
17
17
|
}
|
18
|
+
// perform link resolving synchronous
|
19
|
+
if (path == 'resolve_paths') {
|
20
|
+
options.async = false;
|
21
|
+
}
|
18
22
|
|
19
23
|
var ajaxPromise = singleAjax(type, path, options).then(function (result) {
|
20
24
|
if (result && result.task && _.size(result) === 1) {
|
@@ -24,6 +24,20 @@ module Fiona7
|
|
24
24
|
workflow_action('reject')
|
25
25
|
end
|
26
26
|
|
27
|
+
def list
|
28
|
+
@obj = WriteObj.find(params[:id])
|
29
|
+
actions = []
|
30
|
+
if ::Fiona7.workflows_enabled? and @obj.workflow.present?
|
31
|
+
actions = @obj.send(:crul_obj).valid_actions
|
32
|
+
else
|
33
|
+
actions = @obj.send(:crul_obj).valid_actions.select{ |a| ["release","edit"].include? a }
|
34
|
+
end
|
35
|
+
render json: { actions: actions }
|
36
|
+
rescue => e
|
37
|
+
Rails.logger.error("Error #{e.inspect} when executing valid_actions on #{@obj.id}")
|
38
|
+
render json: {message: e.message, message_for_editor: e.message}, status: 412
|
39
|
+
end
|
40
|
+
|
27
41
|
protected
|
28
42
|
def workflow_action(action)
|
29
43
|
@obj = WriteObj.find(params[:id])
|
data/config/precedence_routes.rb
CHANGED
@@ -22,6 +22,7 @@ Fiona7::Engine.routes.draw do
|
|
22
22
|
put '/__scrivito/objs/workflow/commit(.:format)', to: 'fiona7/workflow#commit', as: :fiona7_workflow_commit
|
23
23
|
put '/__scrivito/objs/workflow/sign(.:format)', to: 'fiona7/workflow#sign', as: :fiona7_workflow_sign
|
24
24
|
put '/__scrivito/objs/workflow/reject(.:format)', to: 'fiona7/workflow#reject', as: :fiona7_workflow_reject
|
25
|
+
get '/__scrivito/objs/:id/workflow/list(.:format)', to: 'fiona7/workflow#list', as: :fiona7_workflow_list
|
25
26
|
|
26
27
|
|
27
28
|
get '/__scrivito/objs/:id/release/preview(.:format)', to: 'fiona7/release#preview', as: :fiona7_release_preview
|
data/infopark_fiona7.gemspec
CHANGED
@@ -8,11 +8,11 @@ require "fiona7/version"
|
|
8
8
|
Gem::Specification.new do |s|
|
9
9
|
s.name = "infopark_fiona7"
|
10
10
|
s.version = Fiona7::VERSION
|
11
|
-
s.authors = ["
|
12
|
-
s.email = ["
|
11
|
+
s.authors = ["Infopark AG"]
|
12
|
+
s.email = ["support@infopark.de"]
|
13
13
|
s.homepage = "https://www.infopark.de"
|
14
|
-
s.summary = "scrivito-compatible interface for
|
15
|
-
s.description = "scrivito-compatible interface for
|
14
|
+
s.summary = "scrivito-compatible interface for Infopark CMS Fiona 7"
|
15
|
+
s.description = "scrivito-compatible interface for Infopark CMS Fiona 7"
|
16
16
|
|
17
17
|
s.files = Dir["{app,config,db,lib}/**/*", "Rakefile", "README.md", "infopark_fiona7.gemspec"].reject do |f|
|
18
18
|
/^app\/assets.*\.es6\.js$/ =~ f ||
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency "scrivito_sdk"
|
25
25
|
s.add_dependency "scrivito_editors"
|
26
26
|
s.add_dependency "infopark_fiona_connector", "= 7.0.1.beta2"
|
27
|
-
s.add_dependency "infopark_reactor", ">= 1.
|
27
|
+
s.add_dependency "infopark_reactor", ">= 1.26.1"
|
28
28
|
s.add_dependency "mini_magick"
|
29
29
|
#s.add_development_dependency "ruby-prof"
|
30
30
|
s.add_development_dependency "scrivito_development"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fiona7
|
2
|
+
module BinaryFilesCleaner
|
3
|
+
|
4
|
+
def delete_unused(binary)
|
5
|
+
perform_with_unused(binary, "delete!")
|
6
|
+
end
|
7
|
+
def unrelease_unused(binary)
|
8
|
+
perform_with_unused(binary, "unrelease!")
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def perform_with_unused(binary, action)
|
13
|
+
blob_objs = Fiona7::WriteObj.where(obj_class: binary.obj_class, parent_obj_id: binary.parent_obj_id)
|
14
|
+
blob_objs.each do |blob_obj|
|
15
|
+
Rails.logger.info("Checking binary obj #{blob_obj.obj_id}")
|
16
|
+
if (!blob_obj.has_super_links? && blob_obj.obj_id != binary.obj_id)
|
17
|
+
# perform delete! without to check released?
|
18
|
+
if action == "delete!" || blob_obj.released?
|
19
|
+
Rails.logger.info("#{action} binary obj #{blob_obj.obj_id}")
|
20
|
+
Reactor::Sudo.su(Fiona7.root) do
|
21
|
+
blob_obj.send(:crul_obj).send(action)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -3,6 +3,7 @@ require 'fiona7/blob_id_generator'
|
|
3
3
|
require 'fiona7/builder/indirect_blob_builder_for_obj'
|
4
4
|
require 'fiona7/builder/container_chain_builder'
|
5
5
|
require 'fiona7/upload_path_selector'
|
6
|
+
require 'fiona7/binary_files_cleaner'
|
6
7
|
|
7
8
|
module Fiona7
|
8
9
|
module Builder
|
@@ -22,6 +23,8 @@ module Fiona7
|
|
22
23
|
# NOTE: there is an exception to the above:
|
23
24
|
# renaming a blob in standalone mode executes immediately
|
24
25
|
class LazyBlobCopier
|
26
|
+
include Fiona7::BinaryFilesCleaner
|
27
|
+
|
25
28
|
def initialize(attrs={})
|
26
29
|
@destination_obj = attrs[:destination_obj]
|
27
30
|
@attribute = attrs[:attr_name]
|
@@ -49,7 +49,7 @@ module Fiona7
|
|
49
49
|
# we first have to make sure that the new parent exists
|
50
50
|
# FIXME: moving the object and changing the obj class
|
51
51
|
# will not move the object
|
52
|
-
@obj.
|
52
|
+
@obj.send(:set_parent, ContainerChainBuilder.new(parent_path).call )
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -1,5 +1,9 @@
|
|
1
|
+
require 'fiona7/binary_files_cleaner'
|
2
|
+
|
1
3
|
module Fiona7
|
2
4
|
class ComplexObject
|
5
|
+
include Fiona7::BinaryFilesCleaner
|
6
|
+
|
3
7
|
def initialize(obj)
|
4
8
|
@obj = obj
|
5
9
|
end
|
@@ -11,14 +15,24 @@ module Fiona7
|
|
11
15
|
end
|
12
16
|
|
13
17
|
def binaries
|
18
|
+
referenced = []
|
14
19
|
type_definition = Fiona7::TypeRegister.instance.read_mangled(@obj.obj_class)
|
15
20
|
type_definition.attrs.each do |attribute|
|
16
21
|
if attribute.type == :binary && attribute.real_name != "blob"
|
17
|
-
(obj[attribute.real_name] || []).each do |link|
|
22
|
+
(@obj[attribute.real_name] || []).each do |link|
|
18
23
|
referenced << link.destination_object
|
24
|
+
Rails.logger.debug("referenced #{referenced}")
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
28
|
+
referenced
|
22
29
|
end
|
30
|
+
|
31
|
+
def check_binaries
|
32
|
+
binaries.each do |binary|
|
33
|
+
unrelease_unused(binary)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
23
37
|
end
|
24
38
|
end
|
@@ -271,7 +271,13 @@ module Fiona7
|
|
271
271
|
meta_binary = MetaBinary.new(binary_id, transformation)
|
272
272
|
|
273
273
|
if !meta_binary.present?
|
274
|
-
|
274
|
+
if Fiona7.mode == :standalone &&
|
275
|
+
(current_binary = get_current_binary_url(binary_id))
|
276
|
+
Rails.logger.info("Redirect to #{current_binary}")
|
277
|
+
redirect_to current_binary, status: 301
|
278
|
+
else
|
279
|
+
not_found
|
280
|
+
end
|
275
281
|
elsif !meta_binary.valid?
|
276
282
|
bad_request
|
277
283
|
elsif stale?(:last_modified => meta_binary.last_changed) && true
|
@@ -317,6 +323,18 @@ module Fiona7
|
|
317
323
|
def head_ok
|
318
324
|
head 200
|
319
325
|
end
|
326
|
+
|
327
|
+
def get_current_binary_url(binary_id)
|
328
|
+
current_binary_url = nil
|
329
|
+
blob_obj = Fiona7::WriteObj.find(binary_id.to_i) rescue nil
|
330
|
+
if blob_obj
|
331
|
+
binary_obj = blob_obj.parent.parent rescue nil
|
332
|
+
if binary_obj
|
333
|
+
current_binary_url = Obj.find(binary_obj.obj_id).blob.url rescue nil
|
334
|
+
end
|
335
|
+
end
|
336
|
+
current_binary_url
|
337
|
+
end
|
320
338
|
end
|
321
339
|
|
322
340
|
|
@@ -10,7 +10,7 @@ module Scrivito
|
|
10
10
|
path: obj.path,
|
11
11
|
obj_class: obj.obj_class,
|
12
12
|
description_for_editor: obj.description_for_editor,
|
13
|
-
has_children: obj.children.any?,
|
13
|
+
has_children: obj.children.reject(&:binary?).any?,
|
14
14
|
has_conflict: obj.has_conflict?,
|
15
15
|
has_details_view: obj_has_details_view?,
|
16
16
|
modification: modification(obj),
|
data/lib/fiona7/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_fiona7
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.1.1.
|
4
|
+
version: 1.6.1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Infopark AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.26.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.26.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mini_magick
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,9 +122,9 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description: scrivito-compatible interface for
|
125
|
+
description: scrivito-compatible interface for Infopark CMS Fiona 7
|
126
126
|
email:
|
127
|
-
-
|
127
|
+
- support@infopark.de
|
128
128
|
executables: []
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- lib/fiona7/attribute_writers/simple.rb
|
239
239
|
- lib/fiona7/attribute_writers/stringlist_as_text.rb
|
240
240
|
- lib/fiona7/attribute_writers/widgetlist_as_linklist.rb
|
241
|
+
- lib/fiona7/binary_files_cleaner.rb
|
241
242
|
- lib/fiona7/blob_id_generator.rb
|
242
243
|
- lib/fiona7/builder/batch_widget_writer.rb
|
243
244
|
- lib/fiona7/builder/container_chain_builder.rb
|
@@ -365,8 +366,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
365
366
|
version: '0'
|
366
367
|
requirements: []
|
367
368
|
rubyforge_project:
|
368
|
-
rubygems_version: 2.
|
369
|
+
rubygems_version: 2.6.13
|
369
370
|
signing_key:
|
370
371
|
specification_version: 4
|
371
|
-
summary: scrivito-compatible interface for
|
372
|
+
summary: scrivito-compatible interface for Infopark CMS Fiona 7
|
372
373
|
test_files: []
|