示例#1
0
    def render(self):
        unit_id = self.request.get('unit_id')

        if unit_id:
            get_ou_selector().set_current_unit(unit_id)

        return self.request.RESPONSE.redirect(self.context.absolute_url())
示例#2
0
    def render(self):
        unit_id = self.request.get('unit_id')

        if unit_id:
            get_ou_selector().set_current_unit(unit_id)

        return self.request.RESPONSE.redirect(self.context.absolute_url())
示例#3
0
 def get_active_unit(self):
     try:
         if not self.current_unit:
             self.current_unit = get_ou_selector().get_current_unit()
     except OperationalError as e:
         logger.exception(e)
     return self.current_unit
示例#4
0
 def get_active_unit(self):
     try:
         if not self.current_unit:
             self.current_unit = get_ou_selector().get_current_unit()
     except OperationalError as e:
         logger.exception(e)
     return self.current_unit
    def update(self):
        """Store default value for relatedItems in the request.

        The added objects will later be moved inside the forwarding.
        """
        paths = self.request.get('paths', [])

        search_endpoint = (
            '++widget++form.widgets.responsible/search'
            in self.request.get('ACTUAL_URL', '')
            )

        if not (
                search_endpoint
                or paths
                or self.request.form.get('form.widgets.relatedItems', [])
            ):
            # add status message and redirect current window back to inbox
            # but ONLY if we're not in a z3cform_inline_validation.
            IStatusMessage(self.request).addStatusMessage(
                _(
                    u'error_no_document_selected',
                    u'Error: Please select at least one document to forward.',
                    ),
                type=u'error',
                )

            redir_url = self.request.get(
                'orig_template',
                self.context.absolute_url(),
                )

            self.request.RESPONSE.redirect(redir_url)

        if paths:
            self.request.set('form.widgets.relatedItems', paths)

        # put default value for issuer into request
        if not self.request.get('form.widgets.issuer', None):
            self.request.set(
                'form.widgets.issuer',
                get_current_org_unit().inbox().id(),
                )

        # put the default responsible into the request
        if not self.request.get('form.widgets.responsible_client', None):
            org_unit = (
                get_ou_selector(ignore_anonymous=True).get_current_unit()
                )

            self.request.set('form.widgets.responsible_client', org_unit.id())

            self.request.set(
                'form.widgets.responsible',
                [org_unit.inbox().id()],
                )

        super(ForwardingAddForm, self).update()
示例#6
0
 def after_create(self, obj):
     if self._as_current_org_unit:
         get_ou_selector().set_current_unit(obj.id())
     return obj
示例#7
0
 def get_units(self):
     return get_ou_selector().available_units()
示例#8
0
 def __call__(self):
     return get_ou_selector().get_current_unit().id()
示例#9
0
 def get_units(self):
     return get_ou_selector().available_units()
示例#10
0
 def after_create(self, obj):
     if self._as_current_org_unit:
         get_ou_selector().set_current_unit(obj.id())
     return obj
 def __call__(self):
     return get_ou_selector().get_current_unit().id()