def __call__(self):
        disable_edit_bar()

        if not self.context.has_attachments():
            msg = _(u'error_no_attachments_to_extract',
                    default=u'This mail has no attachments to extract.')
            api.portal.show_message(msg, request=self.request, type='warning')
            return self.request.RESPONSE.redirect(self.context.absolute_url())

        if self.request.get('form.cancelled'):
            return self.request.RESPONSE.redirect(self.context.absolute_url())

        if self.request.get('form.submitted'):
            attachments = self.request.get('attachments')
            if not attachments:
                msg = _(u'error_no_attachments_selected',
                        default=u'You have not selected any attachments.')
                api.portal.show_message(msg,
                                        request=self.request,
                                        type='error')
            else:
                attachments = [int(pos) for pos in attachments]
                delete_action = self.request.get('delete_action', 'nothing')
                if delete_action not in self.allowed_delete_actions:
                    raise ValueError('Expected delete action to be one of ' +
                                     str(self.allowed_delete_actions))

                self.extract_attachments(attachments, delete_action)
                return self.request.RESPONSE.redirect("{}/#documents".format(
                    self.context.get_extraction_parent().absolute_url()))

        return super(ExtractAttachments, self).__call__()
    def __call__(self):
        disable_edit_bar()

        if not self.context.has_attachments():
            msg = _(u'error_no_attachments_to_extract',
                    default=u'This mail has no attachments to extract.')
            api.portal.show_message(msg, request=self.request, type='warning')
            return self.request.RESPONSE.redirect(self.context.absolute_url())

        if self.request.get('form.cancelled'):
            return self.request.RESPONSE.redirect(self.context.absolute_url())

        if self.request.get('form.submitted'):
            attachments = self.request.get('attachments')
            if not attachments:
                msg = _(u'error_no_attachments_selected',
                        default=u'You have not selected any attachments.')
                api.portal.show_message(
                    msg, request=self.request, type='error')
            else:
                attachments = [int(pos) for pos in attachments]
                delete_action = self.request.get('delete_action', 'nothing')
                if delete_action not in self.allowed_delete_actions:
                    raise ValueError('Expected delete action to be one of ' +
                                     str(self.allowed_delete_actions))

                self.extract_attachments(attachments, delete_action)
                return self.request.RESPONSE.redirect(
                    "{}/#documents".format(
                        self.context.get_extraction_parent().absolute_url()))

        return super(ExtractAttachments, self).__call__()
    def __call__(self):
        disable_edit_bar()

        annotations = IAnnotations(self.context)
        self.source_document = uuidToObject(annotations.get(PDF_SAVE_SOURCE_UUID_KEY))
        self.version_id = annotations.get(PDF_SAVE_SOURCE_VERSION_KEY)
        self.destination_document = self.context
        self.destination = self.context.get_parent_dossier()
        self.trigger_conversion()
        return self.template()
    def __call__(self):
        disable_edit_bar()

        annotations = IAnnotations(self.context)
        self.source_document = uuidToObject(
            annotations.get(PDF_SAVE_SOURCE_UUID_KEY))
        self.version_id = annotations.get(PDF_SAVE_SOURCE_VERSION_KEY)
        self.destination_document = self.context
        self.destination = self.context.get_parent_dossier()
        self.trigger_conversion()
        return self.template()
예제 #5
0
    def __call__(self):
        disable_edit_bar()
        alsoProvides(self.request, IDisableCSRFProtection)

        job_id = self.request.get('job_id', None)
        if job_id:
            # Render view in polling mode
            require_job(self.request, self.model, job_id)
            self.job_id = job_id
            return super(DemandMeetingZip, self).__call__()

        else:
            # Create a new job, and then redirect to view in polling mode
            logger.info('Starting PDF Zip export for %s' % self.model.get_url())
            job = MeetingZipExporter(self.model).demand_pdfs()
            url = "{}/@@demand_meeting_zip?job_id={}".format(
                self.context.absolute_url(), job.job_id)
            return self.request.RESPONSE.redirect(url)
예제 #6
0
    def update(self):
        super(TaskTransitionResponseAddForm, self).update()
        if api.user.is_anonymous():
            # Traversing request from relation widget
            return ''

        disable_edit_bar()

        if self.is_final_transition:
            if self.context.revoke_permissions:
                self.status = _(
                    u'msg_revoking_permissions',
                    default=u'This transtion revokes temporary permissions for '
                    'the responsible user and agency group.')

            else:
                self.status = _(
                    u'msg_not_revoking_permissions',
                    default=u'Temporary permissions will not be revoked by this '
                    'transtion as revoke permissions is unchecked for this task')
예제 #7
0
    def update(self):
        super(TaskTransitionResponseAddForm, self).update()
        if api.user.is_anonymous():
            # Traversing request from relation widget
            return ''

        disable_edit_bar()

        if self.is_final_transition:
            if self.context.revoke_permissions:
                self.status = _(
                    u'msg_revoking_permissions',
                    default=u'This transtion revokes temporary permissions for '
                    'the responsible user and agency group.')

            else:
                self.status = _(
                    u'msg_not_revoking_permissions',
                    default=u'Temporary permissions will not be revoked by this '
                    'transtion as revoke permissions is unchecked for this task'
                )
예제 #8
0
 def __call__(self):
     disable_edit_bar()
     return super(SubmitAdditionalDocuments, self).__call__()
예제 #9
0
 def __call__(self):
     disable_edit_bar()
     return super(SubmitAdditionalDocument, self).__call__()
예제 #10
0
 def __init__(self, context, request):
     super(ModelAddForm, self).__init__(context, request)
     self._created_object = None
     disable_edit_bar()
예제 #11
0
 def __init__(self, context, request):
     super(ModelAddForm, self).__init__(context, request)
     self._created_object = None
     disable_edit_bar()