Ejemplo n.º 1
0
 def output(self):
     output = BaseBackOfficeController.output(self)
     output.update(form_data=self.form_data,
                   form_schema=self.form_schema,
                   form_errors=self.form_errors,
                   imported_files=self.imported_files)
     return output
Ejemplo n.º 2
0
 def output(self):
     output = BaseBackOfficeController.output(self)
     output.update(
         user_collection = self.user_collection,
         search_expanded = self.search_expanded
     )
     return output
Ejemplo n.º 3
0
 def output(self):
     output = BaseBackOfficeController.output(self)
     output.update(form_schema=self.form_schema,
                   form_data=self.form_data,
                   form_errors=self.form_errors,
                   results=self.results)
     return output
Ejemplo n.º 4
0
    def __call__(self, *args, **kwargs):

        rel = cherrypy.request.params.get("relation-select")

        # Open the item selector
        if rel:

            # Load persistent collection parameters before redirecting
            self.user_collection

            pos = rel.find("-")
            root_content_type_name = rel[:pos]
            selection_parameter = str(rel[pos + 1:])

            for content_type in chain([Item], Item.derived_schemas()):
                if content_type.full_name == root_content_type_name:

                    edit_stacks_manager = self.context["edit_stacks_manager"]
                    edit_stack = edit_stacks_manager.current_edit_stack

                    if edit_stack is None:
                        edit_stack = edit_stacks_manager.create_edit_stack()
                        edit_stacks_manager.current_edit_stack = edit_stack

                    node = SelectionNode()
                    node.content_type = content_type
                    node.selection_parameter = selection_parameter
                    edit_stack.push(node)
                    raise cherrypy.HTTPRedirect(
                        node.uri(
                            selection=self.params.read(
                                schema.String(selection_parameter)),
                            client_side_scripting=self.client_side_scripting))

        return BaseBackOfficeController.__call__(self, **kwargs)
Ejemplo n.º 5
0
 def output(self):
     if self.handling_ajax_request:
         return {}
     else:
         output = BaseBackOfficeController.output(self)
         output.update(content_type=self.content_type,
                       collection=self.collection,
                       selection=self.selection)
         return output
Ejemplo n.º 6
0
    def __call__(self, *args, **kwargs):

        if "cancel" in kwargs:
            raise cherrypy.HTTPRedirect(
                self.edit_uri(CampaignMonitorExtension.instance,
                              "lists",
                              edit_stack=None))

        return BaseBackOfficeController.__call__(self, *args, **kwargs)
Ejemplo n.º 7
0
 def output(self):
     output = BaseBackOfficeController.output(self)
     output.update(user_collection=self.user_collection,
                   available_languages=self.available_languages,
                   selection_mode=self.selection_mode,
                   root_content_type=self.root_content_type,
                   search_expanded=self.search_expanded,
                   user_views=self.user_views)
     return output
Ejemplo n.º 8
0
class BackOfficeController(BaseBackOfficeController):

    _cp_config = BaseBackOfficeController.copy_config()
    _cp_config["rendering.engine"] = "cocktail"

    _edit_stacks_manager_class = \
        "woost.controllers.backoffice.editstack.EditStacksManager"

    default_section = "content"

    content = ContentController
    delete = DeleteController
    order = OrderController
    move = MoveController
    changelog = ChangeLogController
    render_preview = RenderPreviewController
    upload_files = UploadFilesController
    drop = DragAndDropController
    blocks = EditBlocksController
    drop_block = DropBlockController

    def submit(self):
        raise cherrypy.HTTPRedirect(
            self.contextual_uri(self.default_section) + "?" + view_state())

    @event_handler
    def handle_traversed(cls, event):
        controller = event.source
        controller.context["edit_stacks_manager"] = \
            resolve(controller._edit_stacks_manager_class)()

    @event_handler
    def handle_before_request(cls, event):
        user = get_current_user()
        language = (user and user.prefered_language or
                    Configuration.instance.get_setting("backoffice_language"))
        set_language(language)

    @event_handler
    def handle_after_request(cls, event):

        if event.error is None:
            controller = event.source
            edit_stacks_manager = controller.context["edit_stacks_manager"]
            edit_stack = edit_stacks_manager.current_edit_stack

            if edit_stack is not None:
                edit_stacks_manager.preserve_edit_stack(edit_stack)

    @cherrypy.expose
    def keep_alive(self, *args, **kwargs):
        pass

    synchronization = SiteSyncController
Ejemplo n.º 9
0
 def output(self):
     if self.handling_ajax_request:
         return {}
     else:
         output = BaseBackOfficeController.output(self)
         output.update(
             root = self.root,
             item = self.item,
             position = self.position,
             selection = self.selection
         )
         return output
Ejemplo n.º 10
0
 def output(self):
     output = BaseBackOfficeController.output(self)
     stack_node = self.stack_node 
     output.update(
         edited_item = stack_node.item,
         edited_content_type = stack_node.content_type,
         errors = self.errors,
         form_schema = stack_node.form_schema,
         form_data = stack_node.form_data,
         changes = set(stack_node.iter_changes()),
         translations = stack_node.translations,
         section = self.section,
         tab = self.tab
     )
     return output
Ejemplo n.º 11
0
 def handle_error(self, error):
     if self.handling_ajax_request:
         self.output["error"] = translations(error)
     else:
         BaseBackOfficeController.handle_error(self, error)
Ejemplo n.º 12
0
 def output(self):
     output = BaseBackOfficeController.output(self)
     output.update(edited_item=self.edited_item)
     return output
 def __init__(self, *args, **kwargs):
     BaseBackOfficeController.__init__(self, *args, **kwargs)
     FormControllerMixin.__init__(self, *args, **kwargs)
     self.selection = self.params.read(
         schema.Collection("selection", items = schema.Reference(type = Publishable))
     )
 def output(self):
     output = BaseBackOfficeController.output(self)
     output.update(
         selection = self.selection
     )
     return output