infopark_fiona7 1.5.5.5.1 → 1.6.1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +17 -0
- data/app/assets/javascripts/fiona7/task_list_dialog.js +2 -2
- data/app/assets/javascripts/fiona7/templates.js +1 -16
- data/app/assets/javascripts/fiona7/translations.js +22 -23
- data/app/assets/javascripts/fiona7_ui.js +56 -59
- data/app/assets/javascripts/scrivito_patches/base_obj_path.js +11 -5
- data/app/assets/javascripts/scrivito_patches/binary_request.js +53 -0
- data/app/assets/javascripts/scrivito_patches/client/ajax.js +122 -0
- data/app/assets/javascripts/scrivito_patches/{models/api → client}/basic_obj.js +150 -243
- data/app/assets/javascripts/scrivito_patches/client/cms_rest_api.js +209 -0
- data/app/assets/javascripts/scrivito_patches/components/sidebar/workspaces_panel.js +325 -0
- data/app/assets/javascripts/scrivito_patches/components/sidebar/workspaces_panel.js.jsx +294 -0
- data/app/assets/javascripts/scrivito_patches/models/{obj.js → legacy_obj.js} +27 -54
- data/app/assets/stylesheets/fiona7_ui.css.scss +2 -0
- data/app/controllers/fiona7/release_controller.rb +7 -6
- data/app/controllers/fiona7/sessions_controller.rb +10 -2
- data/app/controllers/fiona7/uploads_controller.rb +22 -0
- data/app/controllers/fiona7_login_page_controller.rb +3 -0
- data/app/controllers/scrivito/obj_class_controller.rb +28 -5
- data/app/views/fiona7/release/preview.html.erb +5 -38
- data/app/views/fiona7_login_page/index.html.erb +6 -0
- data/config/precedence_routes.rb +7 -7
- data/infopark_fiona7.gemspec +2 -2
- data/lib/fiona7/attribute_readers/number_as_string.rb +6 -1
- data/lib/fiona7/attribute_writers/binary_as_binary.rb +4 -2
- data/lib/fiona7/attribute_writers/binary_as_linklist.rb +4 -2
- data/lib/fiona7/builder/container_chain_builder.rb +50 -0
- data/lib/fiona7/builder/indirect_blob_builder.rb +7 -47
- data/lib/fiona7/builder/indirect_blob_builder_for_obj.rb +14 -0
- data/lib/fiona7/builder/lazy_blob_copier.rb +68 -14
- data/lib/fiona7/builder/obj_builder.rb +6 -32
- data/lib/fiona7/builder/obj_updater.rb +12 -4
- data/lib/fiona7/builder/widget_builder.rb +1 -1
- data/lib/fiona7/controllers/rest_api/blob_controller.rb +8 -2
- data/lib/fiona7/controllers/rest_api/obj_controller.rb +12 -8
- data/lib/fiona7/controllers/rest_api/workspace_controller.rb +6 -0
- data/lib/fiona7/engine.rb +49 -3
- data/lib/fiona7/forbidden_obj_classes.rb +14 -3
- data/lib/fiona7/linked_id_finder.rb +44 -0
- data/lib/fiona7/name_and_parent_from_path.rb +11 -0
- data/lib/fiona7/referenced_id_finder.rb +24 -0
- data/lib/fiona7/release_collector.rb +85 -0
- data/lib/fiona7/routers/rest_api.rb +2 -0
- data/lib/fiona7/scrivito_patches/cms_field_tag.rb +1 -0
- data/lib/fiona7/scrivito_patches/cms_rest_api.rb +16 -16
- data/lib/fiona7/scrivito_patches/cms_routing.rb +1 -0
- data/lib/fiona7/scrivito_patches/link_parser.rb +10 -7
- data/lib/fiona7/scrivito_patches/workspace.rb +0 -5
- data/lib/fiona7/super_id_finder.rb +68 -0
- data/lib/fiona7/super_object_finder.rb +5 -20
- data/lib/fiona7/temporary_uploader.rb +33 -0
- data/lib/fiona7/upload_path_selector.rb +17 -0
- data/lib/fiona7/verity_search_engine.rb +25 -12
- data/lib/fiona7/version.rb +1 -1
- metadata +23 -19
- data/app/assets/javascripts/fiona7/task_list_command.js +0 -15
- data/app/assets/javascripts/fiona7/task_list_menu_item.js +0 -30
- data/app/assets/javascripts/scrivito_patches/ajax.js +0 -225
- data/app/assets/javascripts/scrivito_patches/attribute_serializer.js +0 -259
- data/app/assets/javascripts/scrivito_patches/binary_utils.js +0 -33
- data/app/assets/javascripts/scrivito_patches/cms_rest_api.js +0 -371
- data/app/assets/javascripts/scrivito_patches/models/binary_field_element.js +0 -53
- data/app/assets/javascripts/scrivito_patches/obj_serializer.js +0 -91
- data/lib/fiona7/scrivito_patches/attribute_serializer.rb +0 -37
- data/lib/fiona7/scrivito_patches/model_library.rb +0 -19
- data/lib/fiona7/scrivito_patches/obj_params_parser.rb +0 -20
@@ -1,53 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
(function () {
|
4
|
-
// -- PATCH BEGINS HERE --
|
5
|
-
// remove old scrivito.binaryFieldElement
|
6
|
-
var definitions = scrivito.cms_element.definitions;
|
7
|
-
for (var i = 0; i < definitions.length; ++i) {
|
8
|
-
if (definitions[i] === scrivito.binaryFieldElement) {
|
9
|
-
definitions.splice(i, 1);
|
10
|
-
break;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
// -- PATCH ENDS HERE --
|
14
|
-
|
15
|
-
scrivito.binaryFieldElement = {
|
16
|
-
create_instance: function create_instance(cmsElement) {
|
17
|
-
if (cmsElement.dom_element().attr('data-scrivito-field-type') === 'binary') {
|
18
|
-
var that = scrivito.cms_field_element.create_instance(cmsElement);
|
19
|
-
// -- PATCH BEGINS HERE --
|
20
|
-
/*
|
21
|
-
const bufferedWriter = new scrivito.BufferedWriter((value) => {
|
22
|
-
if (scrivito.BinaryUtils.isFile(value)) {
|
23
|
-
return scrivito.Binary.upload(value).into(that.basic_obj());
|
24
|
-
}
|
25
|
-
if (value instanceof scrivito.FutureBinary) {
|
26
|
-
return value.into(that.basic_obj());
|
27
|
-
}
|
28
|
-
return scrivito.Promise.resolve(value);
|
29
|
-
});
|
30
|
-
_.extend(that, {
|
31
|
-
preprocess(value) {
|
32
|
-
return bufferedWriter.write(value).catch((error) => {
|
33
|
-
scrivito.handleAjaxError(error);
|
34
|
-
throw error;
|
35
|
-
});
|
36
|
-
},
|
37
|
-
});
|
38
|
-
*/
|
39
|
-
|
40
|
-
_.extend(that, {
|
41
|
-
preprocess: function preprocess(value) {
|
42
|
-
return scrivito.Promise.resolve(value);
|
43
|
-
}
|
44
|
-
});
|
45
|
-
// -- PATCH ENDS HERE --
|
46
|
-
|
47
|
-
return that;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
};
|
51
|
-
|
52
|
-
scrivito.cms_element.definitions.push(scrivito.binaryFieldElement);
|
53
|
-
})();
|
@@ -1,91 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
(function () {
|
4
|
-
scrivito.ObjSerializer = {
|
5
|
-
serialize: function serialize(objId, attrs) {
|
6
|
-
var promise = serializeWidgetPool(objId, attrs._widget_pool).then(function (widgetPool) {
|
7
|
-
return serializeAttrs(objId, attrs).then(function (serializedAttrs) {
|
8
|
-
if (widgetPool) {
|
9
|
-
serializedAttrs._widget_pool = widgetPool;
|
10
|
-
}
|
11
|
-
return serializedAttrs;
|
12
|
-
});
|
13
|
-
});
|
14
|
-
|
15
|
-
return scrivito.promise.wrapInJqueryDeferred(promise);
|
16
|
-
},
|
17
|
-
|
18
|
-
serializeValue: function serializeValue(value) {
|
19
|
-
if (_.isDate(value)) {
|
20
|
-
return moment.utc(value).toISOString();
|
21
|
-
}
|
22
|
-
|
23
|
-
return value;
|
24
|
-
}
|
25
|
-
};
|
26
|
-
|
27
|
-
function serializeWidgetPool(objId, widgetPool) {
|
28
|
-
if (widgetPool) {
|
29
|
-
var promises = _.map(widgetPool, function (attrs, widgetId) {
|
30
|
-
return serializeAttrs(objId, attrs).then(function (serializedAttrs) {
|
31
|
-
return [widgetId, serializedAttrs];
|
32
|
-
});
|
33
|
-
});
|
34
|
-
|
35
|
-
return scrivito.Promise.all(promises).then(function (serializedWidgetPool) {
|
36
|
-
return _.object(serializedWidgetPool);
|
37
|
-
});
|
38
|
-
}
|
39
|
-
|
40
|
-
return scrivito.Promise.resolve(widgetPool);
|
41
|
-
}
|
42
|
-
|
43
|
-
function serializeAttrs(objId, attrs) {
|
44
|
-
var promises = _.map(attrs, function (attrValue, attrName) {
|
45
|
-
return serializeAttr(objId, attrName, attrValue);
|
46
|
-
});
|
47
|
-
|
48
|
-
return scrivito.Promise.all(promises).then(function (serializedAttrs) {
|
49
|
-
return _.object(serializedAttrs);
|
50
|
-
});
|
51
|
-
}
|
52
|
-
|
53
|
-
function serializeAttr(objId, attrName, attrValue) {
|
54
|
-
if (scrivito.BinaryUtils.isFile(attrValue) || scrivito.BinaryUtils.isBlob(attrValue)) {
|
55
|
-
return serializeFile(objId, attrName, attrValue);
|
56
|
-
}
|
57
|
-
|
58
|
-
if (attrValue instanceof scrivito.UploadedBlob) {
|
59
|
-
return serializeUploadedBlob(objId, attrName, attrValue);
|
60
|
-
}
|
61
|
-
|
62
|
-
if (attrValue instanceof scrivito.FutureBinary) {
|
63
|
-
return serializeFutureBinary(objId, attrName, attrValue);
|
64
|
-
}
|
65
|
-
|
66
|
-
return scrivito.Promise.resolve([attrName, scrivito.ObjSerializer.serializeValue(attrValue)]);
|
67
|
-
}
|
68
|
-
|
69
|
-
function serializeFile(objId, attrName, file) {
|
70
|
-
return scrivito.Promise.resolve([attrName, file]); // <-- PATCH HERE
|
71
|
-
}
|
72
|
-
|
73
|
-
function serializeUploadedBlob(objId, attrName, uploadedBlob) {
|
74
|
-
return serializeFutureBinary(objId, attrName, uploadedBlob.copy());
|
75
|
-
}
|
76
|
-
|
77
|
-
function serializeFutureBinary(objId, attrName, futureBinary) {
|
78
|
-
if (futureBinary.idToCopy) {
|
79
|
-
// blob copy/rename
|
80
|
-
var blob = {
|
81
|
-
id_to_copy: futureBinary.idToCopy
|
82
|
-
};
|
83
|
-
if (futureBinary.filename) blob.filename = futureBinary.filename;
|
84
|
-
if (futureBinary.contentType) blob.content_type = futureBinary.contentType;
|
85
|
-
return scrivito.Promise.resolve([attrName, blob]);
|
86
|
-
} else if (futureBinary.source) {
|
87
|
-
// normal upload
|
88
|
-
return scrivito.Promise.resolve([attrName, { blob_to_upload: futureBinary.source, filename: futureBinary.filename }]);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
})();
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'scrivito/attribute_serializer'
|
2
|
-
|
3
|
-
module Scrivito
|
4
|
-
class AttributeSerializer
|
5
|
-
def serialize_binary_value(attribute_value, attribute_definition)
|
6
|
-
case attribute_value
|
7
|
-
when File then attribute_value
|
8
|
-
when FutureBinary then special_handling_of_future_binary(attribute_value, attribute_definition)
|
9
|
-
when UploadedBinary then attribute_value.params
|
10
|
-
else
|
11
|
-
raise_validation_error(attribute_definition.name,
|
12
|
-
'an instance of File, Scrivito::UploadedBinary or nil', attribute_value)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
def special_handling_of_future_binary(future_binary, attribute_definition)
|
18
|
-
if future_binary.file_to_upload
|
19
|
-
# The easy case: just upload the file directly, it works
|
20
|
-
future_binary.file_to_upload
|
21
|
-
elsif future_binary.id_to_copy
|
22
|
-
# The hard case: magic blob copy/rename needs to happen
|
23
|
-
{
|
24
|
-
obj_id: obj_id,
|
25
|
-
attr_name: attribute_definition.name.to_s,
|
26
|
-
id_to_copy: future_binary.id_to_copy,
|
27
|
-
filename: future_binary.filename,
|
28
|
-
content_type: future_binary.content_type
|
29
|
-
}
|
30
|
-
else
|
31
|
-
# The unknown case: ???
|
32
|
-
Rails.logger.error("Unsure how to proceed with an upload of #{future_binary.inspect}")
|
33
|
-
nil
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require "scrivito/model_library"
|
2
|
-
|
3
|
-
module Scrivito
|
4
|
-
class ModelLibrary
|
5
|
-
|
6
|
-
private
|
7
|
-
# support for ShadowClasses
|
8
|
-
def load_model(class_name, base_class)
|
9
|
-
model_class = class_name.constantize
|
10
|
-
return model_class if model_class.ancestors.include?(base_class)
|
11
|
-
|
12
|
-
if Fiona7.mode == :legacy && model_class.respond_to?(:shadow_class)
|
13
|
-
model_class = model_class.shadow_class rescue nil
|
14
|
-
model_class if model_class && model_class.ancestors.include?(base_class)
|
15
|
-
end
|
16
|
-
rescue LoadError
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "scrivito/obj_params_parser"
|
2
|
-
|
3
|
-
|
4
|
-
module Scrivito
|
5
|
-
class ObjParamsParser
|
6
|
-
private
|
7
|
-
def parse_binary_params(params)
|
8
|
-
return unless params
|
9
|
-
|
10
|
-
if params.kind_of?(Hash) && params[:copy]
|
11
|
-
parse_copy_binary_params(params[:copy])
|
12
|
-
else
|
13
|
-
# Uploaded binary may contain anything at this point
|
14
|
-
# an ID (string) or a File or even UploadedFile
|
15
|
-
# but the backed will sort this out
|
16
|
-
UploadedBinary.new(params)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|