lib/fiona7/engine.rb in infopark_fiona7-1.5.5.5.1 vs lib/fiona7/engine.rb in infopark_fiona7-1.6.1.1.0

- old
+ new

@@ -15,11 +15,10 @@ require "fiona7/initializer" require "fiona7/mode_switch" require "fiona7/controller_helper" require "fiona7/scrivito_patches/attribute_content" -require "fiona7/scrivito_patches/attribute_serializer" require "fiona7/scrivito_patches/basic_obj" require "fiona7/scrivito_patches/basic_widget" require "fiona7/scrivito_patches/binary" require "fiona7/scrivito_patches/child_list_tag" require "fiona7/scrivito_patches/cms_backend" @@ -30,12 +29,10 @@ require "fiona7/scrivito_patches/cms_routing" require "fiona7/scrivito_patches/layout_tags" require "fiona7/scrivito_patches/log_subscriber" require "fiona7/scrivito_patches/link_parser" require "fiona7/scrivito_patches/migrator" -require "fiona7/scrivito_patches/model_library" -require "fiona7/scrivito_patches/obj_params_parser" require "fiona7/scrivito_patches/page_config" require "fiona7/scrivito_patches/preset_routes" require "fiona7/scrivito_patches/routing_extensions" require "fiona7/scrivito_patches/type_computer" require "fiona7/scrivito_patches/workspace" @@ -45,10 +42,11 @@ require "fiona7/middleware/table_switching_middleware" require "fiona7/middleware/server_detection_middleware" # components require "fiona7/recursive_object_finder" +require "fiona7/release_collector" require "fiona7/complex_object" require "fiona7/routers/rest_api" require 'fiona7/scrivito_user' @@ -74,9 +72,57 @@ self.callbacks = { :create_obj => [], :update_obj => [], :release_obj => [] } + + # Allows to specify custom release patterns for objects + # So for example if releasing a page should release some other + # (for example unreferenced) page, then this can be used + # to achieve the desired behavior. + # + # This parameter accepts anything responding to .call method + # and receiveing one parameter: obj_id. + # + # Thus it is possible to use a lambda like this: + # + # release_collector = lambda do |obj_id| + # # ... + # end + # + # or a class based implementation. + # + # It is expected that the release collector returns an Array + # of Hashes with the following format: + # + # [ + # { + # # this is a title for a group of objects + # title: 'This title will be shown in the dialog', + # # this is the list of objects presented underneath + # objs: [ + # { + # # the ID of the object to be released + # id: 2001, + # # "Title" of the object which will be displayed + # title: 'Root', + # # "Description" of the object, typically obj_class + # description: 'RootObj', + # # If true, then release checkbox will be checked + # # i.e. without additional input from the user it will + # # get released automatically + # checked: true + # } + # ] + # ] + # + # Obviously it possible to define multiple groups and multiple + # objects in each group. + # + # It is recommended that custom implementations inherit + # or delegate to Fiona7::ReleaseCollector which is the + # default implementation. + mattr_accessor :release_collector # Allows to specify custom typing for virtual attribute types # Besides the built in mapping: # link: :linklist, # reference: :linklist,