Example #1
0
 def get_attributes(self):
     return [
         {'id': 'reference_number',
          'title': dossier_mf(u'label_reference_number',
                              default=u'Reference Number')},
         {'id': 'title',
          'title': dossier_mf('label_title', default=u'title')},
         {'id': 'start',
          'title': dossier_mf(u'label_start', default=u'Opening Date'),
          'number_format': DATE_NUMBER_FORMAT},
         {'id': 'end',
          'title': dossier_mf(u'label_end', default=u'Closing Date'),
          'number_format': DATE_NUMBER_FORMAT},
         {'id': 'public_trial',
          'title': base_mf(u'label_public_trial', default=u'Public Trial'),
          'transform': StringTranslater(
              self.request, 'opengever.base').translate},
         {'id': 'archival_value',
          'title': base_mf(u'label_archival_value',
                           default=u'Archival value'),
          'transform': StringTranslater(
              self.request, 'opengever.base').translate},
         {'id': 'archival_value_annotation',
          'title': base_mf(u'label_archival_value_annotation',
                           default=u'archivalValueAnnotation'),
          'transform': StringTranslater(
              self.request, 'opengever.base').translate},
         {'id': 'appraisal',
          'title': base_mf(u'label_appraisal', default=u'Appraisal')},
     ]
 def get_attributes(self):
     return [
         {
             'id':
             'reference_number',
             'title':
             dossier_mf(u'label_reference_number',
                        default=u'Reference Number')
         },
         {
             'id': 'title',
             'title': dossier_mf('label_title', default=u'title')
         },
         {
             'id': 'start',
             'title': dossier_mf(u'label_start', default=u'Opening Date'),
             'number_format': DATE_NUMBER_FORMAT
         },
         {
             'id': 'end',
             'title': dossier_mf(u'label_end', default=u'Closing Date'),
             'number_format': DATE_NUMBER_FORMAT
         },
         {
             'id':
             'public_trial',
             'title':
             base_mf(u'label_public_trial', default=u'Public Trial'),
             'transform':
             StringTranslater(self.request, 'opengever.base').translate
         },
         {
             'id':
             'archival_value',
             'title':
             base_mf(u'label_archival_value', default=u'Archival value'),
             'transform':
             StringTranslater(self.request, 'opengever.base').translate
         },
         {
             'id':
             'archival_value_annotation',
             'title':
             base_mf(u'label_archival_value_annotation',
                     default=u'archivalValueAnnotation'),
             'transform':
             StringTranslater(self.request, 'opengever.base').translate
         },
         {
             'id': 'appraisal',
             'title': _(u'label_appraisal', default=u'Appraisal'),
             'transform': readable_appraisal
         },
     ]
Example #3
0
 def get_items(self):
     return [
         {'class': 'document_created',
          'label': base_mf('label_created', default='Created'),
          'content': self.created(),
          'replace': False},
         {'class': 'review_state',
          'label': plone_mf('State', default='State'),
          'content': self.workflow_state(),
          'replace': False},
         {'class': 'last_modified',
          'label': base_mf('label_last_modified', default='Last modified'),
          'content': self.modified(),
          'replace': False},
     ]
Example #4
0
class IOGMail(form.Schema):
    """Opengever specific behavior,
    which add a title Field to the form.
    """

    form.fieldset(
        u'common',
        label=base_mf(u'fieldset_common', u'Common'),
        fields=[u'title', 'original_message', 'message_source'])

    form.order_before(title='message')
    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=dossier_mf(u'label_title', default=u'Title'),
        required=False,
    )

    form.mode(original_message=DISPLAY_MODE)
    form.read_permission(original_message='cmf.ManagePortal')
    form.write_permission(original_message='cmf.ManagePortal')
    original_message = field.NamedBlobFile(
        title=_(u'label_original_message',
                default=u'Raw *.msg message before conversion'),
        required=False,
    )

    form.mode(message_source=DISPLAY_MODE)
    form.read_permission(message_source='cmf.ManagePortal')
    form.write_permission(message_source='cmf.ManagePortal')
    message_source = schema.Choice(
        title=_('label_message_source',
                default='Message source'),
        vocabulary=get_message_source_vocabulary(),
        required=False,
    )
Example #5
0
class IRestrictAddableDossierTemplates(model.Schema):

    model.fieldset(
        u'common',
        label=base_mf(u'fieldset_common', default=u'Common'),
        fields=[
            u'addable_dossier_templates',
        ],
    )

    addable_dossier_templates = RelationList(
        title=_(u'label_addable_dossier_templates',
                default=u'Addable dossier templates'),
        default=[],
        missing_value=[],
        value_type=RelationChoice(
            title=u'Addable dossiertemplate',
            source=SolrObjPathSourceBinder(
                portal_type=("opengever.dossier.dossiertemplate"),
                is_subdossier=False,
                navigation_tree_query={
                    'object_provides':
                    ['opengever.dossier.templatefolder.interfaces.ITemplateFolder',
                     'opengever.dossier.dossiertemplate.behaviors.IDossierTemplateSchema']
                }),
            ),
        required=False,
    )
Example #6
0
 def translations(self):
     return json.dumps({
         'label_search': self.plone_translate('label_search'),
         'label_inherit_local_roles': self.plone_translate('label_inherit_local_roles'),
         'help_inherit_local_roles': self.translate(
             _(u'help_inherit_local_roles',
               default=u'By default, permissions from the container of this '
               u'item are inherited. If you disable this, only the '
               u'explicitly defined sharing permissions will be valid.')),
         'image_link_icon': self.plone_translate('image_link_icon'),
         'image_confirm_icon': self.plone_translate('image_confirm_icon'),
         'principal_search_placeholder': self.translate(
             _(u'principal_search_placeholder',
               default=u'Search for Users and Groups')),
         'label_name': self.plone_translate('label_name'),
         'label_acquired': self.translate(
             _(u'label_acquired_permission', default=u'Acquired permission')),
         'label_local': self.translate(
             _(u'label_local_permission', default=u'Local permission')),
         'label_save': self.translate(PMF(u'Save')),
         'label_cancel': self.translate(PMF(u'Cancel')),
         'label_automatic_permission': self.translate(
             _(u'label_automatic_permission', default=u'Automatic permission')),
         'label_local_permission': self.translate(
             _(u'label_local_permission', default=u'Local permission')),
         'label_save_failed': self.translate(
             _(u'message_save_failed', default=u'Local roles save failed.')),
         'message_title_error': self.translate(
             base_mf('message_title_error', default=u"Error")),
     })
Example #7
0
class IDossierTemplateSchema(form.Schema):
    """Schema interface for dossier template types.

    Use this type of dossier to create a reusable template structures.
    """

    form.fieldset(
        u'common',
        label=base_mf(u'fieldset_common', default=u'Common'),
        fields=[
            u'title_help',
            u'predefined_keywords',
            u'restrict_keywords',
        ],
    )

    title_help = schema.TextLine(
        title=_(u'label_title_help', default=u'Title help'),
        description=_(u'help_title_help',
                      default=u'Recommendation for the title. Will be '
                      u'displayed as a help text if you create '
                      u'a dossier from template'),
        required=False,
    )

    form.order_after(predefined_keywords='IDossierTemplate.keywords')
    predefined_keywords = schema.Bool(
        title=_(u'label_predefined_keywords', default=u'Predefined Keywords'),
        description=_(u'description_predefined_keywords',
                      default=u'The defined keywords will be preselected for '
                      u'new dossies from template.'),
        required=False,
        missing_value=True,
        default=True,
    )

    form.order_after(restrict_keywords='predefined_keywords')
    restrict_keywords = schema.Bool(
        title=_(u'label_restrict_keywords', default=u'Restrict Keywords'),
        description=_(
            u'description_restrict_keywords',
            default=u'The user can choose only from the defined keywords '
            u'in a new dossier from template. It also prevents '
            u'the user for creating new keywords'),
        required=False,
        missing_value=False,
        default=False,
    )
Example #8
0
 def translations(self):
     return json.dumps({
         'label_search':
         self.plone_translate('label_search'),
         'label_inherit_local_roles':
         self.plone_translate('label_inherit_local_roles'),
         'help_inherit_local_roles':
         self.translate(
             _(u'help_inherit_local_roles',
               default=u'By default, permissions from the container of this '
               u'item are inherited. If you disable this, only the '
               u'explicitly defined sharing permissions will be valid.')),
         'image_link_icon':
         self.plone_translate('image_link_icon'),
         'image_confirm_icon':
         self.plone_translate('image_confirm_icon'),
         'principal_search_placeholder':
         self.translate(
             _(u'principal_search_placeholder',
               default=u'Search for Users and Groups')),
         'label_name':
         self.plone_translate('label_name'),
         'label_acquired':
         self.translate(
             _(u'label_acquired_permission',
               default=u'Acquired permission')),
         'label_local':
         self.translate(
             _(u'label_local_permission', default=u'Local permission')),
         'label_save':
         self.translate(PMF(u'Save')),
         'label_cancel':
         self.translate(PMF(u'Cancel')),
         'label_automatic_permission':
         self.translate(
             _(u'label_automatic_permission',
               default=u'Automatic permission')),
         'label_local_permission':
         self.translate(
             _(u'label_local_permission', default=u'Local permission')),
         'label_save_failed':
         self.translate(
             _(u'message_save_failed',
               default=u'Local roles save failed.')),
         'message_title_error':
         self.translate(base_mf('message_title_error', default=u"Error")),
     })
Example #9
0
from zope.lifecycleevent.interfaces import IObjectCreatedEvent
from zope.lifecycleevent.interfaces import IObjectModifiedEvent
import os
import re


from plone.namedfile.interfaces import HAVE_BLOBS
if HAVE_BLOBS:
    from plone.namedfile import NamedBlobFile as NamedFile
else:
    from plone.namedfile import NamedFile


IMail.setTaggedValue(FIELDSETS_KEY, [
    Fieldset('common',
             label=base_mf(u'fieldset_common', u'Common'),
             fields=[u'message'])
])


class IOGMailMarker(Interface):
    """Marker Interface for opengever mails."""


class IOGMail(form.Schema):
    """Opengever specific behavior,
    which add a title Field to the form."""

    form.fieldset(
        u'common',
        label=base_mf(u'fieldset_common', u'Common'),
Example #10
0
def _linked_document_with_tooltip(item, value, trashed=False):

    data = {}

    if isinstance(value, unicode):
        value = value.encode('utf-8')
    data['value'] = value

    # Determine URL method
    data['url'] = '#'
    if hasattr(item, 'getURL'):
        data['url'] = item.getURL()
    elif hasattr(item, 'absolute_url'):
        data['url'] = item.absolute_url()

    # tooltip links
    data['preview_link'] = '%s/@@download_pdfpreview' % (data['url'])
    data['preview_label'] = translate(
        base_mf(u'button_pdf', 'PDF'), context=item.REQUEST).encode('utf-8')

    data['edit_metadata_link'] = '%s/edit_checker' % (data['url'])
    data['edit_metadata_label'] = translate(
        pmf(u'Edit metadata'), context=item.REQUEST).encode('utf-8')

    data['edit_direct_link'] = '%s/editing_document' % (data['url'])
    data['edit_direct_label'] = translate(
        pmf(u'Checkout and edit'), context=item.REQUEST).encode('utf-8')

    # Construct CSS class
    data['css_class'] = get_css_class(item)

    # Construct breadcrumbs
    breadcrumb_titles = _breadcrumbs_from_item(item)
    data['breadcrumbs'] = " > ".join(t for t in breadcrumb_titles)

    # Make sure all data used in the HTML snippet is properly escaped
    for k, v in data.items():
        data[k] = cgi.escape(v, quote=True)

    tooltip_links = []

    is_doc = item.portal_type == 'opengever.document.document'

    if is_doc and PDFCONVERTER_AVAILABLE:
        tooltip_links.append("""<a href='%(preview_link)s'>
                    %(preview_label)s
                </a>""" % data)

    if not trashed:
        tooltip_links.append("""<a href='%(edit_metadata_link)s'>
                    %(edit_metadata_label)s
                </a>""" % data)

    if is_doc and not trashed:
        tooltip_links.append("""<a href='%(edit_direct_link)s'>
                    %(edit_direct_label)s
                </a>""" % data)

    data['tooltip_links'] = """
                """.join(tooltip_links)

    link = """<div class='linkWrapper'>
    <a class='tabbedview-tooltip %(css_class)s' href='%(url)s'></a>
    <a href='%(url)s'>%(value)s</a>
    <div class='tabbedview-tooltip-data'>
        <div class='tooltip-content'>
            <div class='tooltip-header'>%(value)s</div>
            <div class='tooltip-breadcrumb'>%(breadcrumbs)s</div>
            <div class='tooltip-links'>
                %(tooltip_links)s
            </div>
        </div>
        <div class='bottomImage'></div>
    </div>
</div>""" % data

    return link
Example #11
0
if HAVE_BLOBS:
    from plone.namedfile import NamedBlobFile as NamedFile
else:
    from plone.namedfile import NamedFile


MESSAGE_SOURCE_DRAG_DROP_UPLOAD = 'upload'
MESSAGE_SOURCE_MAILIN = 'mailin'
NO_SUBJECT_FALLBACK_ID = 'no_subject'
NO_SUBJECT_TITLE_FALLBACK = '[No Subject]'


IMail.setTaggedValue(FIELDSETS_KEY, [
    Fieldset('common',
             label=base_mf(u'fieldset_common', u'Common'),
             fields=[u'message'])
])


class IOGMailMarker(Interface):
    """Marker Interface for opengever mails."""


def get_message_source_vocabulary():
    terms = [
        SimpleTerm(MESSAGE_SOURCE_MAILIN,
                   title=_('label_message_source_mailin',
                           default='Mail-in')),
        SimpleTerm(MESSAGE_SOURCE_DRAG_DROP_UPLOAD,
                   title=_('label_message_source_d_n_d_upload',
Example #12
0
def _linked_document_with_tooltip(item, value, trashed=False):

    data = {}

    if isinstance(value, unicode):
        value = value.encode('utf-8')
    data['value'] = value

    # Determine URL method
    data['url'] = '#'
    if hasattr(item, 'getURL'):
        data['url'] = item.getURL()
    elif hasattr(item, 'absolute_url'):
        data['url'] = item.absolute_url()

    # tooltip links
    data['preview_link'] = '%s/@@download_pdfpreview' % (data['url'])
    data['preview_label'] = translate(base_mf(u'button_pdf', 'PDF'),
                                      context=item.REQUEST).encode('utf-8')

    data['edit_metadata_link'] = '%s/edit_checker' % (data['url'])
    data['edit_metadata_label'] = translate(
        pmf(u'Edit metadata'), context=item.REQUEST).encode('utf-8')

    data['edit_direct_link'] = '%s/editing_document' % (data['url'])
    data['edit_direct_label'] = translate(pmf(u'Checkout and edit'),
                                          context=item.REQUEST).encode('utf-8')

    # Construct CSS class
    data['css_class'] = get_css_class(item)

    # Construct breadcrumbs
    breadcrumb_titles = _breadcrumbs_from_item(item)
    data['breadcrumbs'] = " > ".join(t for t in breadcrumb_titles)

    # Make sure all data used in the HTML snippet is properly escaped
    for k, v in data.items():
        data[k] = cgi.escape(v, quote=True)

    tooltip_links = []

    is_doc = item.portal_type == 'opengever.document.document'

    if is_doc and PDFCONVERTER_AVAILABLE:
        tooltip_links.append("""<a href='%(preview_link)s'>
                    %(preview_label)s
                </a>""" % data)

    if not trashed:
        tooltip_links.append("""<a href='%(edit_metadata_link)s'>
                    %(edit_metadata_label)s
                </a>""" % data)

    if is_doc and not trashed:
        tooltip_links.append("""<a href='%(edit_direct_link)s'>
                    %(edit_direct_label)s
                </a>""" % data)

    data['tooltip_links'] = """
                """.join(tooltip_links)

    link = """<div class='linkWrapper'>
    <a class='tabbedview-tooltip %(css_class)s' href='%(url)s'></a>
    <a href='%(url)s'>%(value)s</a>
    <div class='tabbedview-tooltip-data'>
        <div class='tooltip-content'>
            <div class='tooltip-header'>%(value)s</div>
            <div class='tooltip-breadcrumb'>%(breadcrumbs)s</div>
            <div class='tooltip-links'>
                %(tooltip_links)s
            </div>
        </div>
        <div class='bottomImage'></div>
    </div>
</div>""" % data

    return link