Пример #1
0
def document_sent(context, event):
    id_util = getUtility(IIntIds)
    objs = []

    for intid in event.intids:
        obj = id_util.getObject(intid)
        title = obj.Title().decode('utf-8')
        receiver = event.receiver
        message = event.message
        if isinstance(receiver, list):
            receiver = ', '.join(receiver)
        objs.append({'intid': intid, 'title': title})

    title = _(u'label_document_sent',
              default=u'Document sent by Mail: ${subject}',
              mapping={
                  'subject': event.subject.decode('utf-8'),
              })

    comment = translate(_(
        u'label_document_sent_comment',
        default=u'Attachments: ${documents} | Receivers: ${receiver} |'
        ' Message: ${message}',
        mapping={
            'documents': documents_list_helper(context, objs),
            'receiver': receiver.decode('utf-8'),
            'message': message.decode('utf-8'),
        }),
                        context=context.REQUEST)
    journal_entry_factory(context,
                          DOCUMENT_SENT,
                          title,
                          visible=True,
                          comment=comment)
Пример #2
0
 def columns(self):
     return (
         {
             'column': 'time',
             'column_title': _(u'label_time', default=u'Time'),
             'transform': helper.readable_date_time
         },
         {
             'column': 'title',
             'column_title': _(u'label_title', 'Title'),
             'transform': title_helper
         },
         {
             'column': 'actor',
             'column_title': _(u'label_actor', default=u'Changed by'),
             'transform': linked_ogds_author
         },
         {
             'column': 'comments',
             'column_title': _(u'label_comments', default=u'Comments'),
             'transform': tooltip_helper,
             'sortable': False
         },
         {
             'column': 'references',
             'column_title': _(u'label_references', default=u'References'),
             'transform': self.journal_references,
             'sortable': False
         },
     )
Пример #3
0
def file_copy_downloaded(context, event):

    title_unversioned = _(u'label_file_copy_downloaded',
                          default=u'Download copy')

    if IDocumentSchema.providedBy(context):
        version_id = getattr(event, 'version_id')

        if version_id is not None:
            version_string = _(u'label_file_copy_downloaded_version',
                               default=u'version ${version_id}',
                               mapping={'version_id': version_id})
        else:
            version_string = _(
                u'label_file_copy_downloaded_actual_version',
                default=u'current version (${version_id})',
                mapping={'version_id': getattr(context, 'version_id', 0)})

        title = _(u'label_file_copy_downloaded_with_version',
                  default=u'${title} ${version_string}',
                  mapping={'title': title_unversioned,
                           'version_string': version_string})
    else:
        title = title_unversioned

    journal_entry_factory(context, FILE_COPY_DOWNLOADED, title)
Пример #4
0
def document_sent(context, event):
    id_util = getUtility(IIntIds)
    objs = []

    for intid in event.intids:
        obj = id_util.getObject(intid)
        title = obj.Title().decode("utf-8")
        receiver = event.receiver
        message = event.message
        if isinstance(receiver, list):
            receiver = ", ".join(receiver)
        objs.append({"intid": intid, "title": title})

    title = _(
        u"label_document_sent",
        default=u"Document sent by Mail: ${subject}",
        mapping={"subject": event.subject.decode("utf-8")},
    )

    comment = translate(
        _(
            u"label_document_sent_comment",
            default=u"Attachments: ${documents} | Receivers: ${receiver} |" " Message: ${message}",
            mapping={
                "documents": documents_list_helper(context, objs),
                "receiver": receiver.decode("utf-8"),
                "message": message.decode("utf-8"),
            },
        ),
        context=context.REQUEST,
    )
    journal_entry_factory(context, DOCUMENT_SENT, title, visible=True, comment=comment)
Пример #5
0
def file_copy_downloaded(context, event):

    title_unversioned = _(u'label_file_copy_downloaded',
                          default=u'Download copy')

    if IDocumentSchema.providedBy(context):
        version_id = getattr(event, 'version_id')

        if version_id is not None:
            version_string = _(u'label_file_copy_downloaded_version',
                               default=u'version ${version_id}',
                               mapping={'version_id': version_id})
        else:
            version_string = _(u'label_file_copy_downloaded_actual_version',
                               default=u'current version (${version_id})',
                               mapping={'version_id': context.version_id})

        title = _(u'label_file_copy_downloaded_with_version',
                  default=u'${title} ${version_string}',
                  mapping={
                      'title': title_unversioned,
                      'version_string': version_string
                  })
    else:
        title = title_unversioned

    journal_entry_factory(context, FILE_COPY_DOWNLOADED, title)
Пример #6
0
class JournalTab(grok.View, OpengeverTab, ListingView):
    """Journal tab implementing IJorunalConfig.
    """

    implements(IJournalSourceConfig)

    grok.name('tabbedview_view-journal')
    grok.require('zope2.View')
    grok.context(IJournalizable)

    # do not select
    select_all_template = lambda *a, **kw: ''

    sort_on = 'time'
    sort_reverse = True

    # do not show the selects, because no action is enabled
    show_selects = False
    enabled_actions = []
    major_actions = []
    selection = ViewPageTemplateFile("no_selection_amount.pt")

    columns = (
        {
            'column': 'title',
            'column_title': _(u'label_title', 'Title'),
            'transform': title_helper
        },
        {
            'column': 'actor',
            'column_title': _(u'label_actor', default=u'Actor'),
            'transform': linked_ogds_author
        },
        {
            'column': 'time',
            'column_title': _(u'label_time', default=u'Time'),
            'transform': helper.readable_date_time
        },
        {
            'column': 'comments',
            'column_title': _(u'label_comments', default=u'Comments'),
            'transform': tooltip_helper
        },
    )

    def get_base_query(self):
        return None

    __call__ = ListingView.__call__
    update = ListingView.update
    render = __call__
Пример #7
0
def document_added(context, event):
    title = _(u"label_document_added", default=u"Document added: ${title}", mapping={"title": context.title_or_id()})
    # journal_entry for document:
    journal_entry_factory(context, DOCUMENT_ADDED_ACTION, title)
    # journal entry for parent (usually dossier)
    journal_entry_factory(context.aq_inner.aq_parent, DOCUMENT_ADDED_ACTION, title)
    return
Пример #8
0
class ManualJournalEntryAddForm(AddForm):
    """Provide a z3c.form to enter a manual journal entry."""

    label = _(u'label_add_journal_entry', default=u'Add journal entry')
    fields = Fields(IManualJournalEntry)

    fields['contacts'].widgetFactory = ParameterizedWidget(KeywordWidget,
                                                           async=True)

    def createAndAdd(self, data):
        contacts, users = self.split_contacts_and_users(data.get('contacts'))
        entry = ManualJournalEntry(self.context, data.get('category'),
                                   data.get('comment'), contacts, users,
                                   data.get('related_documents'))
        entry.save()
        return entry

    def split_contacts_and_users(self, items):
        """Spliting up the contact list, in to a list of contact objects
        and a list of adapted users.
        """
        contacts = []
        users = []
        for item in items:
            if item.is_adapted_user:
                users.append(item)
            else:
                contacts.append(item)

        return contacts, users

    def nextURL(self):
        return '{}#journal'.format(self.context.absolute_url())
    def add_journal_entry(self, journal_context, fixed_context,
                          old_period, new_period):
        """Add a journal entry to `journal_context` indicating that
        `fixed_context` has been fixed.

        The journal entry is not translated, we don't want to add translations
        for this fix to opengever.core.

        We use message objects to make it possible to add translations should
        it be required, also this helps to avoid an UnicodeDecodeError.

        """
        title = _(u'label_retention_period_fixed',
                  default=u'Aufbewahrungsdauer korrigiert "${name}"',
                  mapping={'name':
                           fixed_context.Title().decode('utf-8')})
        # the comment is handled different from the title, it does not get
        # translated when displaying :-o.
        comment = 'Alter Wert: "{} Jahre", neuer Wert: "{} Jahre"'\
                  .format(old_period, new_period)

        journal_entry_factory(journal_context,
                              ACTION_RETENTION_PERIOD_FIXED,
                              title=title,
                              comment=comment)
Пример #10
0
def dossier_added(context, event):
    title = _(
        u'label_dossier_added',
        default=u'Dossier added: ${title}',
        mapping={'title': context.title_or_id(), })
    journal_entry_factory(context, DOSSIER_ADDED_ACTION, title)
    return
Пример #11
0
def mail_added(context, event):
    title = _(u'label_mail_added',
              default=u'Mail added: ${title}',
              mapping={'title': context.title_or_id()})

    journal_entry_factory(context.aq_inner.aq_parent, MAIL_ADDED_EVENT, title)
    return
Пример #12
0
def document_checked_in(context, event):
    user_comment = event.comment
    title = _(u'label_document_checkin',
              default=u'Document checked in', )
    journal_entry_factory(context, DOCUMENT_CHECKED_IN, title,
                          comment=user_comment)
    return
Пример #13
0
def participation_removed(context, event):
    title = _(
        u"label_participant_removed",
        default=u"Participant removed: ${contact}",
        mapping={"contact": readable_ogds_author(event.participant, event.participant.contact)},
    )

    journal_entry_factory(context, PARTICIPANT_REMOVED, title)
Пример #14
0
def attachments_deleted(context, event):
    attachment_names = event.attachments
    title = _(u'label_attachments_deleted',
              default=u'Attachments deleted: ${filenames}',
              mapping={'filenames': ', '.join(attachment_names)})

    journal_entry_factory(context, ATTACHMENTS_DELETED_ACTION, title)
    return
Пример #15
0
def document_zipped(context, event):
    title = _(u'label_document_zipped',
              default=u'Document included in a zip export: ${title}',
              mapping={'title': context.title_or_id()})

    journal_entry_factory(context, DOCUMENT_EXPORTED, title)

    return
Пример #16
0
def dossier_local_roles_acquisition_activated(context, event):

    journal_entry_factory(context,
                          LOCAL_ROLES_AQUISITION_ACTIVATED,
                          title=_(u'label_local_roles_acquisition_activated',
                                  default=u'Local roles aquistion activated.'))

    return
Пример #17
0
def document_zipped(context, event):
    title = _(u'label_document_zipped',
              default=u'Document included in a zip export: ${title}',
              mapping={'title': context.title_or_id()})

    journal_entry_factory(context, DOCUMENT_EXPORTED, title)

    return
Пример #18
0
def repository_prefix_unlock(context, event):
    title = _(
        u"label_prefix_unlocked",
        default=u"Unlocked prefix ${prefix} in ${repository}.",
        mapping={"prefix": event.prefix, "repository": context.title_or_id()},
    )

    journal_entry_factory(get_repository_root(context), REPOSITORY_PREFIX_UNLOCKED, title=title)
Пример #19
0
def dossier_added(context, event):
    title = _(u'label_dossier_added',
              default=u'Dossier added: ${title}',
              mapping={
                  'title': context.title_or_id(),
              })
    journal_entry_factory(context, DOSSIER_ADDED_ACTION, title)
    return
Пример #20
0
def dossier_local_roles_acquisition_blocked(context, event):

    journal_entry_factory(
        context,
        LOCAL_ROLES_AQUISITION_BLOCKED,
        title=_(u'label_local_roles_acquisition_blocked',
                default=u'Local roles aquistion blocked.'))

    return
Пример #21
0
def object_will_be_moved(context, event):
    if not IObjectWillBeAddedEvent.providedBy(event):
        title = _(u'label_object_cut',
                  default=u'Object cut: ${title}',
                  mapping={'title': context.title_or_id()})

        journal_entry_factory(context.aq_inner.aq_parent,
                              OBJECT_WILL_BE_MOVED_EVENT, title)
    return
Пример #22
0
def attachments_deleted(context, event):
    attachment_names = event.attachments
    title = _(
        u'label_attachments_deleted',
        default=u'Attachments deleted: ${filenames}',
        mapping={'filenames': ', '.join(attachment_names)})

    journal_entry_factory(context, ATTACHMENTS_DELETED_ACTION, title)
    return
Пример #23
0
def document_untrashed(context, event):
    title = _(u'label_restore',
              default=u'Object restored: ${title}',
              mapping={
                  'title': context.title_or_id(),
              })
    journal_entry_factory(context, OBJECT_RESTORE, title)
    journal_entry_factory(context.aq_inner.aq_parent, OBJECT_RESTORE, title)
    return
Пример #24
0
def dossier_local_roles_acquisition_activated(context, event):

    journal_entry_factory(
        context,
        LOCAL_ROLES_AQUISITION_ACTIVATED,
        title=_(u"label_local_roles_acquisition_activated", default=u"Local roles aquistion activated."),
    )

    return
Пример #25
0
def document_sent(context, event):
    def make_document_event_list(context, items):
        urlstring = ''
        url_template = u'<span><a href="{}">{}{}</a></span>'
        lastindex = len(items) - 1
        for i, item in enumerate(items):
            comma = '' if lastindex == i else ', '
            urlstring += url_template.format(item['url'], item['title'], comma)
        return urlstring

    id_util = getUtility(IIntIds)
    objs = []

    for intid in event.intids:
        obj = id_util.getObject(intid)
        url = obj.absolute_url()
        title = obj.Title().decode('utf-8')
        receiver = event.receiver
        message = event.message
        if isinstance(receiver, list):
            receiver = ', '.join(receiver)
        objs.append({'url': url, 'title': title})

    title = _(u'label_document_sent',
              default=u'Document sent by Mail: ${subject}',
              mapping={
                  'subject': event.subject.decode('utf-8'),
              })

    comment = translate(_(
        u'label_document_sent_comment',
        default=u'Attachments: ${documents} | Receivers: ${receiver} |'
        ' Message: ${message}',
        mapping={
            'documents': make_document_event_list(context, objs),
            'receiver': receiver.decode('utf-8'),
            'message': message.decode('utf-8'),
        }),
                        context=context.REQUEST)
    journal_entry_factory(context,
                          DOCUMENT_SENT,
                          title,
                          visible=True,
                          comment=comment)
Пример #26
0
def dossier_local_roles_modified(context, event):

    journal_entry_factory(
        context,
        LOCAL_ROLES_MODIFIED,
        title=_(u"label_local_roles_modified", default=u"Local roles modified."),
        comment=role_mapping_to_str(context, event.new_local_roles),
    )

    return
Пример #27
0
def document_untrashed(context, event):
    title = _(
        u'label_restore',
        default=u'Object restored: ${title}',
        mapping={
            'title': context.title_or_id(),
            })
    journal_entry_factory(context, OBJECT_RESTORE, title)
    journal_entry_factory(context.aq_inner.aq_parent, OBJECT_RESTORE, title)
    return
Пример #28
0
def repositoryfolder_local_roles_acquisition_blocked(context, event):
    title = _(
        u"label_local_roles_acquisition_blocked_at",
        default=u"Local roles aquistion blocked at ${repository}.",
        mapping={"repository": context.title_or_id()},
    )

    journal_entry_factory(get_repository_root(context), LOCAL_ROLES_AQUISITION_BLOCKED, title=title)

    return
Пример #29
0
def participation_removed(context, event):
    title = _(u'label_participant_removed',
              default=u'Participant removed: ${contact}',
              mapping={
                  'contact':
                  readable_ogds_author(event.participant,
                                       event.participant.contact),
              })

    journal_entry_factory(context, PARTICIPANT_REMOVED, title)
Пример #30
0
def dossier_attached_to_email(context, event):
    dossier_journal = _(u'label_document_in_dossier_attached',
                        default=u'Document in dossier attached to email '
                                u'via OfficeConnector')

    journal_entry_factory(
        event.object, DOCUMENT_IN_DOSSIER_ATTACHED, dossier_journal,
        visible=True, documents=event.documents)

    return
Пример #31
0
def dossier_local_roles_modified(context, event):

    journal_entry_factory(context,
                          LOCAL_ROLES_MODIFIED,
                          title=_(u'label_local_roles_modified',
                                  default=u'Local roles modified.'),
                          comment=role_mapping_to_str(context,
                                                      event.new_local_roles))

    return
Пример #32
0
def task_added(context, event):
    title = _(u'label_task_added',
              default=u'Task added: ${title}',
              mapping={
                  'title': context.title_or_id(),
              })

    # journal entry for parent (usually dossier)
    journal_entry_factory(context.aq_inner.aq_parent, TASK_ADDED_EVENT, title)
    return
Пример #33
0
def repository_prefix_unlock(context, event):
    title = _(u'label_prefix_unlocked',
              default=u'Unlocked prefix ${prefix} in ${repository}.',
              mapping={'prefix': event.prefix,
                       'repository': context.title_or_id()})

    journal_entry_factory(
        get_repository_root(context),
        REPOSITORY_PREFIX_UNLOCKED,
        title=title)
Пример #34
0
def document_restored(context, event):
    if event.action == context.restore_transition:
        title = _(u'label_document_restored',
                  default=u'Document ${title} restored.',
                  mapping={'title': context.title_or_id()})

        parent = aq_parent(aq_inner(context))
        journal_entry_factory(context, OBJECT_RESTORED, title)
        journal_entry_factory(parent, OBJECT_RESTORED, title)

    return
Пример #35
0
def document_added(context, event):
    title = _(
        u'label_document_added',
        default=u'Document added: ${title}',
        mapping={'title': context.title, })
    # journal_entry for document:
    journal_entry_factory(context, DOCUMENT_ADDED_ACTION, title)
    # journal entry for parent (usually dossier)
    journal_entry_factory(
        context.aq_inner.aq_parent, DOCUMENT_ADDED_ACTION, title)
    return
Пример #36
0
def document_trashed(context, event):
    title = _(u'label_to_trash',
              default=u'Object moved to trash: ${title}',
              mapping={
                  'title': context.title_or_id(),
              })

    journal_entry_factory(context, OBJECT_MOVE_TO_TRASH, title)
    journal_entry_factory(context.aq_inner.aq_parent, OBJECT_MOVE_TO_TRASH,
                          title)
    return
Пример #37
0
def task_added(context, event):
    title = _(
        u'label_task_added',
        default=u'Task added: ${title}',
        mapping={
            'title': context.title_or_id(),
            })

    # journal entry for parent (usually dossier)
    journal_entry_factory(context.aq_inner.aq_parent, TASK_ADDED_EVENT, title)
    return
Пример #38
0
def document_restored(context, event):
    if event.action == context.restore_transition:
        title = _(u'label_document_restored',
                  default=u'Document ${title} restored.',
                  mapping={'title': context.title_or_id()})

        parent = aq_parent(aq_inner(context))
        journal_entry_factory(context, OBJECT_RESTORED, title)
        journal_entry_factory(parent, OBJECT_RESTORED, title)

    return
Пример #39
0
def participation_removed(context, event):
    title = _(
        u'label_participant_removed',
        default=u'Participant removed: ${contact}',
        mapping={
            'contact': readable_ogds_author(
                event.participant,
                event.participant.contact),
            })

    journal_entry_factory(context, PARTICIPANT_REMOVED, title)
Пример #40
0
def repository_prefix_unlock(context, event):
    title = _(u'label_prefix_unlocked',
              default=u'Unlocked prefix ${prefix} in ${repository}.',
              mapping={
                  'prefix': event.prefix,
                  'repository': context.title_or_id()
              })

    journal_entry_factory(get_repository_root(context),
                          REPOSITORY_PREFIX_UNLOCKED,
                          title=title)
Пример #41
0
def document_checked_in(context, event):
    user_comment = event.comment
    title = _(
        u'label_document_checkin',
        default=u'Document checked in',
    )
    journal_entry_factory(context,
                          DOCUMENT_CHECKED_IN,
                          title,
                          comment=user_comment)
    return
Пример #42
0
def participation_created(context, event):
    title = _(
        u"label_participant_added",
        default=u"Participant added: ${contact} with " "roles ${roles}",
        mapping={
            "contact": readable_ogds_author(event.participant, event.participant.contact),
            "roles": role_list_helper(event.participant, event.participant.roles),
        },
    )

    journal_entry_factory(context, PARTICIPANT_ADDED, title)
Пример #43
0
def object_moved(context, event):
    # Since IObjectAddedEvent subclasses IObjectMovedEvent this event
    # handler is also called for IObjectAddedEvent but we should not
    # do anything in this case.
    if IObjectAddedEvent.providedBy(event):
        return

    title = _(u"label_object_moved", default=u"Object moved: ${title}", mapping={"title": context.title_or_id()})

    journal_entry_factory(context.aq_inner.aq_parent, OBJECT_MOVED_EVENT, title)
    return
Пример #44
0
def document_trashed(context, event):
    title = _(
        u'label_to_trash',
        default=u'Object moved to trash: ${title}',
        mapping={
            'title': context.title_or_id(),
            })

    journal_entry_factory(context, OBJECT_MOVE_TO_TRASH, title)
    journal_entry_factory(
        context.aq_inner.aq_parent, OBJECT_MOVE_TO_TRASH, title)
    return
Пример #45
0
def repositoryfolder_local_roles_acquisition_activated(context, event):

    title = _(u'label_local_roles_acquisition_activated_at',
              default=u'Local roles aquistion activated at ${repository}.',
              mapping={'repository': context.title_or_id(), })

    journal_entry_factory(
        get_repository_root(context),
        LOCALROLES_AQUISITION_ACTIVATED,
        title=title)

    return
Пример #46
0
def dossier_attached_to_email(context, event):
    dossier_journal = _(u'label_document_in_dossier_attached',
                        default=u'Document in dossier attached to email '
                        u'via OfficeConnector')

    journal_entry_factory(event.object,
                          DOCUMENT_IN_DOSSIER_ATTACHED,
                          dossier_journal,
                          visible=True,
                          documents=event.documents)

    return
Пример #47
0
def document_added(context, event):
    title = _(u'label_document_added',
              default=u'Document added: ${title}',
              mapping={
                  'title': context.title,
              })
    # journal_entry for document:
    journal_entry_factory(context, DOCUMENT_ADDED_ACTION, title)
    # journal entry for parent (usually dossier)
    journal_entry_factory(context.aq_inner.aq_parent, DOCUMENT_ADDED_ACTION,
                          title)
    return
Пример #48
0
def repositoryfolder_local_roles_acquisition_blocked(context, event):
    title = _(u'label_local_roles_acquisition_blocked_at',
              default=u'Local roles aquistion blocked at ${repository}.',
              mapping={
                  'repository': context.title_or_id(),
              })

    journal_entry_factory(get_repository_root(context),
                          LOCAL_ROLES_AQUISITION_BLOCKED,
                          title=title)

    return
Пример #49
0
def repositoryfolder_local_roles_modified(context, event):

    title = _(u'label_local_roles_modified_at',
              default=u'Local roles modified at ${repository}.',
              mapping={'repository': context.title_or_id(), })

    journal_entry_factory(
        get_repository_root(context),
        LOCAL_ROLES_MODIFIED,
        title=title,
        comment=role_mapping_to_str(context, event.new_local_roles))

    return
Пример #50
0
def document_file_reverted(context, event):
    try:
        create = event.create_version
    except AttributeError:
        return
    else:
        if not create:
            return

    title = _(u'label_document_file_reverted',
              default=u'Reverte document file to version ${version_id}',
              mapping=dict(version_id=event.version_id))
    journal_entry_factory(context, DOCUMENT_FILE_REVERTED, title)
Пример #51
0
def document_attached_to_email(context, event):
    """Journal OfficeConnector email attach events from the plone.rest
    OfficeConnector action payload service in the site root context.

    The document in question is passed into the ObjectEvent.
    """
    document = event.object

    doc_journal = _(u'label_document_attached',
                    default=u'Document attached to email via OfficeConnector')
    journal_entry_factory(document, DOCUMENT_ATTACHED, doc_journal)

    return
Пример #52
0
class IManualJournalEntry(model.Schema):
    """Provide a z3c.form.Schema to enter a manual journal entry."""

    category = schema.Choice(
        title=_(u'label_category', default=u'Category'),
        vocabulary='opengever.journal.manual_entry_categories',
        required=True,
    )

    comment = schema.Text(
        title=_(u'label_comment', default=u'Comment'),
        required=False,
    )

    contacts = schema.List(
        title=_(u'label_contacts', default=u'Contacts'),
        value_type=schema.Choice(
            source=ContactsSourceBinder()),
        required=False,
    )

    related_documents = RelationList(
        title=_(u'label_related_documents', default=u'Related Documents'),
        default=[],
        missing_value=[],
        value_type=RelationChoice(
            title=u"Related",
            source=DossierPathSourceBinder(
                portal_type=("opengever.document.document", "ftw.mail.mail"),
                navigation_tree_query={
                    'object_provides':
                    ['opengever.dossier.behaviors.dossier.IDossierMarker',
                     'opengever.document.document.IDocumentSchema',
                     'opengever.task.task.ITask',
                     'ftw.mail.mail.IMail']
                }),
            ),
        required=False,
    )
Пример #53
0
def document_attached_to_email(context, event):
    """Journal OfficeConnector email attach events from the plone.rest
    OfficeConnector action payload service in the site root context.

    The document in question is passed into the ObjectEvent.
    """
    document = event.object

    doc_journal = _(u'label_document_attached',
                    default=u'Document attached to email via OfficeConnector')
    journal_entry_factory(document, DOCUMENT_ATTACHED, doc_journal)

    return
Пример #54
0
def document_file_reverted(context, event):
    try:
        create = event.create_version
    except AttributeError:
        return
    else:
        if not create:
            return

    title = _(u'label_document_file_reverted',
              default=u'Reverte document file to version ${version_id}',
              mapping=dict(version_id=event.version_id))
    journal_entry_factory(context, DOCUMENT_FILE_REVERTED, title)
Пример #55
0
def task_modified(context, event):
    title = _(u"label_task_modified", default=u"Task modified: ${title}", mapping={"title": context.title_or_id()})
    # XXX dirty
    try:
        # if we delete the working copy,
        # we get a aq_based object and don't wanna
        # make a journal entry
        context.portal_types
    except AttributeError:
        return

    journal_entry_factory(context.aq_inner.aq_parent, TASK_MODIIFED_ACTION, title)
    return
def create_cropped_title_journal_entry(obj, type_, in_desc=False):
    # German translations as a default. Hack, because we don't want to
    # maintain translations in opengever.maintenance
    if in_desc:
        title = _(u'label_title_cropped_saved_in_desc',
                  default=u'Titel gek\xfcrzt: ${obj_id}; Urspr\xfcnglicher '
                          u'Titel wurde in Feld "Beschreibung" gespeichert.',
                  mapping={'obj_id': obj.id})
    else:
        title = _(u'label_title_cropped',
                  default=u'Titel gek\xfcrzt: ${obj_id}',
                  mapping={'obj_id': obj.id})

    if type_ == 'Task':
        journal_target = obj.get_containing_dossier()
    elif type_ == 'Dossier':
        journal_target = obj
    else:
        raise NotImplementedError

    journal_entry_factory(
        journal_target, 'Title cropped', title, actor='SYSTEM')
Пример #57
0
def participation_created(context, event):
    author = readable_ogds_author(event.participant, event.participant.contact)
    roles = role_list_helper(event.participant, event.participant.roles)

    title = _(u'label_participant_added',
              default=u'Participant added: ${contact} with '
              'roles ${roles}',
              mapping={
                  'contact': author,
                  'roles': roles
              })

    journal_entry_factory(context, PARTICIPANT_ADDED, title)
Пример #58
0
def object_moved(context, event):
    # Since IObjectAddedEvent subclasses IObjectMovedEvent this event
    # handler is also called for IObjectAddedEvent but we should not
    # do anything in this case.
    if IObjectAddedEvent.providedBy(event):
        return

    title = _(u'label_object_moved',
              default=u'Object moved: ${title}',
              mapping={'title': context.title_or_id()})

    journal_entry_factory(context.aq_inner.aq_parent, OBJECT_MOVED_EVENT,
                          title)
    return
Пример #59
0
def repositoryfolder_local_roles_modified(context, event):

    title = _(u'label_local_roles_modified_at',
              default=u'Local roles modified at ${repository}.',
              mapping={
                  'repository': context.title_or_id(),
              })

    journal_entry_factory(get_repository_root(context),
                          LOCAL_ROLES_MODIFIED,
                          title=title,
                          comment=role_mapping_to_str(context,
                                                      event.new_local_roles))

    return
Пример #60
0
def object_will_be_moved(context, event):
    if IObjectWillBeAddedEvent.providedBy(event):
        return

    # Skip automatically renamed objects during copy & paste process.
    if ICopyPasteRequestLayer.providedBy(getRequest()):
        return

    title = _(u'label_object_cut',
              default=u'Object cut: ${title}',
              mapping={'title': context.title_or_id()})

    journal_entry_factory(context.aq_inner.aq_parent,
                          OBJECT_WILL_BE_MOVED_EVENT, title)
    return