Пример #1
0
 def update_site(self):
     # update front-page
     frontpage = self.portal['front-page']
     if frontpage.Title() == 'Gestion du courrier 2.2':
         frontpage.setTitle(_("front_page_title"))
         frontpage.setDescription(_("front_page_descr"))
         frontpage.setText(_("front_page_text"), mimetype='text/html')
     # update portal title
     self.portal.title = 'Gestion du courrier 2.3'
     # set om folder as default page
     self.portal.templates.setDefaultPage('om')
     # change permission to remove dashboard from user menu
     self.portal.manage_permission('Portlets: Manage own portlets',
                                   ('Manager', 'Site Administrator'),
                                   acquire=0)
     # clean old messages
     if 'doc' in self.portal['messages-config']:
         api.content.delete(self.portal['messages-config']['doc'])
     add_message(
         'doc',
         'Documentation',
         u'<p>Vous pouvez consulter la <a href="https://docs.imio.be/'
         u'imio-doc/ia.docs/" target="_blank">documentation en ligne de la '
         u'version 2.3</a>, dont <a href="https://docs.imio.be/imio-doc/ia.docs/changelog" '
         u'target="_blank">les nouvelles fonctionnalités</a> ainsi que d\'autres documentations liées.</p>',
         msg_type='significant',
         can_hide=True,
         req_roles=['Authenticated'],
         activate=True)
     if 'new-version' in self.portal['messages-config']:
         api.content.delete(self.portal['messages-config']['new-version'])
     # update plonegroup
     if not get_registry_groups_mgt():
         set_registry_groups_mgt(['dir_general', 'encodeurs', 'expedition'])
         functions = get_registry_functions()
         for dic in functions:
             if dic['fct_id'] == u'encodeur':
                 dic['fct_title'] = u'Créateur CS'
         set_registry_functions(functions)
     # add group
     if api.group.get('lecteurs_globaux_ce') is None:
         api.group.create('lecteurs_globaux_ce', '2 Lecteurs Globaux CE')
     # change local roles
     fti = getUtility(IDexterityFTI, name='dmsincomingmail')  # i_e ok
     lr = getattr(fti, 'localroles')
     lrsc = lr['static_config']
     for state in [
             'proposed_to_manager', 'proposed_to_n_plus_1',
             'proposed_to_agent', 'in_treatment', 'closed'
     ]:
         if state in lrsc:
             if 'lecteurs_globaux_ce' not in lrsc[state]:
                 lrsc[state]['lecteurs_globaux_ce'] = {'roles': ['Reader']}
     lr._p_changed = True  # We need to indicate that the object has been modified and must be "saved"
     # mark tabs to add count on
     for folder_id in ('incoming-mail', 'outgoing-mail', 'tasks'):
         folder = self.portal[folder_id]
         if not ICountableTab.providedBy(folder):
             alsoProvides(folder, ICountableTab)
             folder.reindexObject(idxs='object_provides')
Пример #2
0
 def add_new_version_message(self):
     if 'new-version' in self.portal['messages-config']:
         api.content.delete(self.portal['messages-config']['new-version'])
     add_message(
         'new-version',
         'Version 1.3.1',
         u'<p>Vous êtes passés à la version d\'iA.PST 1.3.1 !</p>'
         u'<p>La <a href="https://docs.imio.be/imio-doc/ia.pst/" target="_blank">'
         u'documentation</a> a été mise à jour et comporte une nouvelle section sur les nouveautés</a>.</p>',
         msg_type='warning',
         can_hide=True,
         req_roles=['Authenticated'],
         activate=True)
Пример #3
0
 def add_new_dashboard_message(self):
     if 'new-version' in self.portal['messages-config']:
         api.content.delete(self.portal['messages-config']['new-version'])
     if 'new-dashboard' not in self.portal['messages-config']:
         add_message(
             'new-dashboard',
             'Nouveau modèle de tableau de bord',
             u'<p>Votre instance a été mise à jour avec <a href="https://docs.imio.be/imio-doc/ia.pst/'
             u'fonctionnalites/nouveau_modele_tableau_bord.html" target="_blank">une nouvelle fonctionnalité</a>.'
             u'</p>',
             msg_type='warning',
             can_hide=True,
             req_roles=['Authenticated'],
             activate=True)
Пример #4
0
 def add_backport_message(self):
     msgs_to_del = ('new-version', 'doc', 'new-dashboard')
     for msg_to_del in msgs_to_del:
         if msg_to_del in self.portal['messages-config']:
             api.content.delete(self.portal['messages-config'][msg_to_del])
     add_message(
         'backport',
         'Mise à jour',
         u'<p>Votre instance a été mise à jour !</p>'
         u'<p>La <a href="https://docs.imio.be/imio-doc/ia.pst/fonctionnalites/index.html#version-1-3-2" target="_blank">'
         u'documentation</a> a également été mise à jour avec les nouvelles fonctionnalités</a>.</p>',
         msg_type='warning',
         can_hide=True,
         req_roles=['Authenticated'],
         activate=True
     )
def add_default_messages(context):
    """ Add maintenance messages that can be activated when necessary """
    if context.readDataFile('collectivemessagesviewlet_messages.txt') is None:
        return
    resource = 'resource'
    if HAS_PLONE_5:
        resource = 'plone'
    site = api.portal.get()
    add_message('maintenance-soon', _('maintenance_soon_tit', context=site), _('maintenance_soon_txt', context=site),
                msg_type='significant', can_hide=True, req_roles=['Authenticated'])
    add_message('maintenance-now', _('maintenance_now_tit', context=site), _('maintenance_now_txt', context=site),
                msg_type='warning', can_hide=False, req_roles=['Anonymous'])
    add_message('test-site', _('test_site_tit', context=site), _('test_site_txt', context=site),
                msg_type='warning', can_hide=False)
    add_message('browser-warning', _('bad_browser_tit', context=site),
                _('bad_browser_txt ${resource}', mapping={'resource': resource}, context=site),
                msg_type='warning', can_hide=False,
                tal_condition="python:'Firefox' not in context.REQUEST.get('HTTP_USER_AGENT')")
    add_message('browser-warning-ff-chrome', _('bad_browser_ff_chrome_tit', context=site),
                _('bad_browser_ff_chrome_txt ${resource}', mapping={'resource': resource}, context=site),
                msg_type='warning', can_hide=False,
                tal_condition="python: 'Firefox' not in context.REQUEST.get('HTTP_USER_AGENT') and "
                "'Chrome' not in context.REQUEST.get('HTTP_USER_AGENT')")
 def setUp(self):
     """Custom shared utility setup for tests."""
     self.isHidden = [True, True, False]
     self.portal = self.layer['portal']
     self.message_types = [term.token for term in msg_types(self.portal)._terms]
     # The products build the "special" folder "messages-config" to store messages.
     self.message_config_folder = self.portal["messages-config"]
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     self.installer = api.portal.get_tool('portal_quickinstaller')
     self.wftool = self.portal.portal_workflow
     self.messages = []
     # Create some messages
     for i, message_type in enumerate(self.message_types):
         title = 'message%d' % (i + 1)
         text = "<p>This is test message number %d...</p>"\
                "<p>self-destruction programmed at the end of this test.</p>" % (i + 1)
         message = add_message(id=title,
                               title=title,
                               text=text,
                               msg_type=self.message_types[i],
                               can_hide=self.isHidden[i])
         self.messages.append(message)
 def setUp(self):
     """Custom shared utility setup for tests."""
     self.isHidden = [True, True, False]
     self.portal = self.layer['portal']
     self.request = self.portal.REQUEST
     self.message_types = [term.token for term in msg_types(self.portal)._terms]
     # The products build the "special" folder "messages-config" to store messages.
     self.message_config_folder = self.portal['messages-config']
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     self.installer = api.portal.get_tool('portal_quickinstaller')
     self.wftool = self.portal.portal_workflow
     self.messages = []
     # Create some messages
     for i, message_type in enumerate(self.message_types):
         title = 'message{0}'.format(i + 1)
         text = '<p>This is test message number {0}...</p>' \
                '<p>self-destruction programmed at the end of this test.</p>'.format(i + 1)
         message = add_message(id=title,
                               title=title,
                               text=text,
                               start=add_timezone(datetime(2019, 10, 26, 12, 0)),
                               msg_type=self.message_types[i],
                               can_hide=self.isHidden[i])
         self.messages.append(message)
Пример #8
0
    def update_site(self):
        # add documentation message
        if 'doc' not in self.portal['messages-config']:
            add_message(
                'doc',
                'Documentation',
                u'<p>Vous pouvez consulter la <a href="http://www.imio.be/'
                u'support/documentation/topic/cp_app_ged" target="_blank">documentation en ligne de la '
                u'dernière version</a>, ainsi que d\'autres documentations liées.</p>',
                msg_type='significant',
                can_hide=True,
                req_roles=['Authenticated'],
                activate=True)
        if 'doc2-0' in self.portal['messages-config']:
            api.content.delete(obj=self.portal['messages-config']['doc2-0'])

        # update front-page
        frontpage = self.portal['front-page']
        if frontpage.Title() == 'Gestion du courrier 2.0':
            frontpage.setTitle(_("front_page_title"))
            frontpage.setDescription(_("front_page_descr"))
            frontpage.setText(_("front_page_text"), mimetype='text/html')

        # update portal title
        self.portal.title = 'Gestion du courrier'

        # for collective.externaleditor
        if 'MailingLoopTemplate' not in self.registry[
                'externaleditor.externaleditor_enabled_types']:
            self.registry['externaleditor.externaleditor_enabled_types'] = [
                'PODTemplate', 'ConfigurablePODTemplate',
                'DashboardPODTemplate', 'SubTemplate', 'StyleTemplate',
                'dmsommainfile', 'MailingLoopTemplate'
            ]
        # documentgenerator
        api.portal.set_registry_record(
            'collective.documentgenerator.browser.controlpanel.'
            'IDocumentGeneratorControlPanelSchema.raiseOnError_for_non_managers',
            True)

        # ftw.labels
        if not ILabelRoot.providedBy(self.imf):
            labels = {
                self.imf: [('Lu', 'green', True), ('Suivi', 'yellow', True)],
                self.omf: [],
                self.portal['tasks']: []
            }
            for folder in labels:
                if not ILabelRoot.providedBy(folder):
                    alsoProvides(folder, ILabelRoot)
                    adapted = ILabelJar(folder)
                    existing = [dic['title'] for dic in adapted.list()]
                    for title, color, by_user in labels[folder]:
                        if title not in existing:
                            adapted.add(title, color, by_user)

            self.portal.manage_permission('ftw.labels: Manage Labels Jar',
                                          ('Manager', 'Site Administrator'),
                                          acquire=0)
            self.portal.manage_permission('ftw.labels: Change Labels',
                                          ('Manager', 'Site Administrator'),
                                          acquire=0)
            self.portal.manage_permission(
                'ftw.labels: Change Personal Labels',
                ('Manager', 'Site Administrator', 'Member'),
                acquire=0)

            self.runProfileSteps('imio.dms.mail',
                                 steps=['imiodmsmail-mark-copy-im-as-read'],
                                 profile='singles')

        # INextPrevNotNavigable
        alsoProvides(self.portal['tasks'], INextPrevNotNavigable)

        # registry
        api.portal.set_registry_record(
            name=
            'Products.CMFPlone.interfaces.syndication.ISiteSyndicationSettings.'
            'search_rss_enabled',
            value=False)

        # activing versioning
        self.portal.portal_diff.setDiffForPortalType(
            'task', {'any': "Compound Diff for Dexterity types"})
        self.portal.portal_diff.setDiffForPortalType(
            'dmsommainfile', {'any': "Compound Diff for Dexterity types"})

        # change permission
        self.portal.manage_permission('imio.dms.mail: Write userid field', (),
                                      acquire=0)
        pf = self.portal.contacts['personnel-folder']
        pf.manage_permission('imio.dms.mail: Write userid field',
                             ('Manager', 'Site Administrator'),
                             acquire=0)

        # ckeditor skin
        self.portal.portal_properties.ckeditor_properties.skin = 'moono-lisa'

        # update mailcontent options
        self.registry[
            'collective.dms.mailcontent.browser.settings.IDmsMailConfig.outgoingmail_edit_irn'] = u'hide'
        self.registry[
            'collective.dms.mailcontent.browser.settings.IDmsMailConfig.outgoingmail_increment_number'] = True

        # hide faceted actions
        paob = self.portal.portal_actions.object_buttons
        for act in ('faceted.sync', 'faceted.disable', 'faceted.enable',
                    'faceted.search.disable', 'faceted.search.enable',
                    'faceted.actions.disable', 'faceted.actions.enable'):
            if act in paob:
                paob[act].visible = False
Пример #9
0
 def update_site(self):
     # add documentation message
     if u'⏺' not in api.portal.get_registry_record(
             'collective.contact.core.interfaces.IContactCoreParameters.'
             'contact_source_metadata_content'):
         api.portal.set_registry_record(
             'collective.contact.core.interfaces.IContactCoreParameters.'
             'contact_source_metadata_content',
             u'{gft} ⏺ {number}, {street}, {zip_code}, {city} ⏺ {email}')
     api.portal.set_registry_record(
         'collective.contact.core.interfaces.IContactCoreParameters.'
         'display_below_content_title_on_views', True)
     if not api.portal.get_registry_record(
             'imio.dms.mail.browser.settings.IImioDmsMailConfig.imail_fields_order'
     ):
         api.portal.set_registry_record(
             'imio.dms.mail.browser.settings.IImioDmsMailConfig.imail_fields_order',
             [
                 'IDublinCore.title', 'IDublinCore.description', 'sender',
                 'treating_groups', 'ITask.assigned_user',
                 'recipient_groups', 'reception_date', 'ITask.due_date',
                 'mail_type', 'reply_to', 'ITask.task_description',
                 'external_reference_no', 'original_mail_date',
                 'internal_reference_no'
             ])
     if not api.portal.get_registry_record(
             'imio.dms.mail.browser.settings.IImioDmsMailConfig.omail_fields_order'
     ):
         api.portal.set_registry_record(
             'imio.dms.mail.browser.settings.IImioDmsMailConfig.omail_fields_order',
             [
                 'IDublinCore.title', 'IDublinCore.description',
                 'recipients', 'treating_groups', 'ITask.assigned_user',
                 'sender', 'recipient_groups', 'mail_type', 'mail_date',
                 'reply_to', 'ITask.task_description', 'ITask.due_date',
                 'outgoing_date', 'external_reference_no',
                 'internal_reference_no'
             ])
     # update front-page
     frontpage = self.portal['front-page']
     if frontpage.Title() == 'Gestion du courrier 2.1':
         frontpage.setTitle(_tr("front_page_title"))
         frontpage.setDescription(_tr("front_page_descr"))
         frontpage.setText(_tr("front_page_text"), mimetype='text/html')
     # message
     if 'new-version' not in self.portal['messages-config']:
         add_message(
             'new-version',
             'Version 2.2',
             u'<p>Vous êtes passés à la version d\'iA.docs 2.2 !</p>'
             u'<p>La <a href="https://www.imio.be/support/documentation/topic/cp_app_ged" target="_blank">'
             u'documentation</a> a été mise à jour et comporte plusieurs nouvelles sections, dont '
             u'<a href="https://www.imio.be/support/documentation/manual/gestion-de-courriers/'
             u'introduction/les-nouvelles-fonctionnalites-de-la-version-2.2" target="_blank">'
             u'une page sur les nouveautés</a>.</p>',
             msg_type='warning',
             can_hide=True,
             req_roles=['Authenticated'],
             activate=True)
     if ('indispo' in self.portal['messages-config']
             and api.content.get_state(
                 self.portal['messages-config']['indispo']) == 'activated'):
         api.content.transition(self.portal['messages-config']['indispo'],
                                'deactivate')
Пример #10
0
    def run(self):
        # Removed old import step
        setup = api.portal.get_tool('portal_setup')
        ir = setup.getImportStepRegistry()
        # /cputils_removeStep?step=imioprojectpst-adaptDefaultPortal
        if 'imioprojectpst-adaptDefaultPortal' in ir._registered:
            del ir._registered['imioprojectpst-adaptDefaultPortal']
        self.upgradeProfile('collective.contact.core:default')
        self.upgradeProfile('collective.contact.plonegroup:default')
        self.upgradeProfile('plone.formwidget.masterselect:default')
        self.reinstall(['dexterity.localrolesfield:default'])
        self.runProfileSteps('imio.project.pst',
                             steps=[
                                 'actions', 'catalog', 'componentregistry',
                                 'jsregistry', 'portlets', 'propertiestool',
                                 'plone.app.registry', 'typeinfo', 'workflow'
                             ])
        # update security settings
        self.portal.portal_workflow.updateRoleMappings()

        self.reinstall([
            'collective.documentgenerator:default',
            'collective.externaleditor:default',
            'collective.messagesviewlet:messages',
            'collective.task:default',
            'imio.dashboard:default',
            'plonetheme.imioapps:pstskin',
        ])

        self.various_update()

        indexes_to_add = {
            'categories': ('KeywordIndex', {}),
            'priority': ('FieldIndex', {}),
            'representative_responsible': ('KeywordIndex', {}),
            'administrative_responsible': ('KeywordIndex', {}),
            'manager': ('KeywordIndex', {}),
            'planned_begin_date': ('DateIndex', {}),
            'planned_end_date': ('DateIndex', {}),
            'effective_begin_date': ('DateIndex', {}),
            'effective_end_date': ('DateIndex', {}),
            'health_indicator': ('FieldIndex', {}),
            'progress': ('FieldIndex', {}),
            'extra_concerned_people': ('ZCTextIndex', {}),
        }
        addOrUpdateIndexes(self.context, indexes_to_add)

        # remove the old collections and configure the dashboard
        if 'collections' in self.portal.pst:
            api.content.delete(obj=self.portal.pst['collections'])
        for brain in self.pc(portal_type='Collection',
                             path='/'.join(self.portal.pst.getPhysicalPath())):
            api.content.delete(obj=brain.getObject())

        configureDashboard(self.portal.pst)
        self.portal.pst.setLayout('view')

        self.runProfileSteps('imio.project.pst',
                             steps=['portlets'],
                             profile='demo')

        # migrate oo fields
        brains = self.pc(portal_type="operationalobjective")
        for brain in brains:
            oo = brain.getObject()
            oo.administrative_responsible = [
                r[:-13] for r in oo.administrative_responsible
                if r.endswith('_actioneditor')
            ]
            oo.manager = [
                m[:-13] for m in oo.manager if m.endswith('_actioneditor')
            ]

        self.migrate_pst_action_fields()

        # update faceted navigation configs
        mapping = {
            'strategicobjectives': 'strategicobjective',
            'operationalobjectives': 'operationalobjective',
            'pstactions': 'pstaction',
        }
        for col_folder_id, content_type in mapping.iteritems():
            col_folder = self.portal.pst[col_folder_id]
            reimport_faceted_config(col_folder,
                                    xml='{}.xml'.format(content_type),
                                    default_UID=col_folder['all'].UID())

        add_plonegroups_to_registry()
        configure_actions_panel(self.portal)
        configure_rolefields(self.portal)

        # migrate to documentgenerator
        self.migrate_templates()

        self.upgradeAll()

        # add documentation message
        add_message(
            'doc1-0',
            'Documentation 1.0',
            u'<p>Vous pouvez consulter la <a href="http://www.imio.be/support'
            '/documentation/manual/gestion-de-projet-1.0" target="_blank">documentation en ligne de la '
            'nouvelle version</a>.</p>',
            msg_type='significant',
            can_hide=True,
            req_roles=['Authenticated'],
            activate=True)

        # update portal_catalog
        self.refreshDatabase()

        for prod in [
                'collective.ckeditor', 'collective.contact.core',
                'collective.contact.plonegroup', 'collective.plonefinder',
                'collective.quickupload', 'collective.z3cform.datagridfield',
                'imio.project.core', 'imio.project.pst', 'plonetheme.classic',
                'plone.app.collection', 'plone.app.dexterity',
                'plone.app.intid', 'plone.app.relationfield',
                'plone.formwidget.masterselect',
                'plone.formwidget.autocomplete', 'plone.formwidget.contenttree'
        ]:
            mark_last_version(self.portal, product=prod)

        # Reorder css and js
        self.runProfileSteps('imio.project.pst',
                             steps=['cssregistry', 'jsregistry'])

        # Display duration
        self.finish()
Пример #11
0
    def various_update(self):
        # doc message
        for id in ('doc1-0', 'doc'):
            if id in self.portal['messages-config']:
                api.content.delete(self.portal['messages-config'][id])
        if ('indispo' in self.portal['messages-config']
                and api.content.get_state(
                    self.portal['messages-config']['indispo']) == 'activated'):
            api.content.transition(self.portal['messages-config']['indispo'],
                                   'deactivate')
        if 'doc' not in self.portal['messages-config']:
            add_message(
                'doc',
                'Documentation', u'<p>Vous pouvez consulter la '
                u'<a href="https://docs.imio.be/imio-doc/ia.pst/" target="_blank">documentation en ligne de la '
                u'dernière version</a>, ainsi que <a href="https://www.imio.be/nos-applications/ia-pst/'
                u'les-actus-de-pst/ia-pst-1-3" target="_blank">les nouveautés</a>.</p>',
                msg_type='significant',
                can_hide=True,
                req_roles=['Authenticated'],
                activate=True)
        # activate user external edit pref
        change_user_properties(self.portal, kw='ext_editor:True', dochange='1')
        # replace front-page
        frontpage = getattr(self.portal, 'front-page')
        frontpage.title = _tr("front_page_title")
        frontpage.description = _tr("front_page_descr")
        frontpage.text = richtextval(_tr("front_page_text"))
        transitions(frontpage, ('retract', 'publish_internally'))
        frontpage.reindexObject()
        # remove portlets on pst
        for brain in self.catalog(
                object_provides='imio.project.pst.interfaces.IImioPSTProject'):
            ann = IAnnotations(brain.getObject())
            if 'plone.portlets.contextassignments' in ann:
                if 'plone.leftcolumn' in ann[
                        'plone.portlets.contextassignments']:
                    for name in ('portlet_dashboard', 'navigation',
                                 'portlet_actions'):
                        if name in ann['plone.portlets.contextassignments'][
                                'plone.leftcolumn']:
                            del ann['plone.portlets.contextassignments'][
                                'plone.leftcolumn'][name]
                    if not len(ann['plone.portlets.contextassignments']
                               ['plone.leftcolumn']):
                        del ann['plone.portlets.contextassignments'][
                            'plone.leftcolumn']
                if not len(ann['plone.portlets.contextassignments']):
                    del ann['plone.portlets.contextassignments']
        # registry
        api.portal.set_registry_record(
            'collective.contact.core.interfaces.IContactCoreParameters.'
            'display_below_content_title_on_views', True)
        registry = getUtility(IRegistry)
        record = registry.records.get(
            'imio.pm.wsclient.browser.settings.IWS4PMClientSettings.generated_actions'
        )
        if record is not None:
            val = api.portal.get_registry_record(
                'imio.pm.wsclient.browser.settings.IWS4PMClientSettings.'
                'generated_actions')
            if val is not None:
                event.notify(RecordModifiedEvent(record, val, val))
        # update dashboard criterias
        for brain in self.catalog(
                object_provides='imio.project.pst.interfaces.IImioPSTProject'):
            pst = brain.getObject()
            mapping = {
                'strategicobjectives': 'strategicobjective',
                'operationalobjectives': 'operationalobjective',
                'pstactions': 'pstaction',
                'tasks': 'task'
            }
            for col_folder_id, content_type in mapping.iteritems():
                col_folder = pst[col_folder_id]
                reimport_faceted_config(col_folder,
                                        xml='{}.xml'.format(content_type),
                                        default_UID=col_folder['all'].UID())
        # rename pst
        titles = {
            u'PST (2012-2018)': u'PST 2013-2018',
            u'PST (2018-2024)': u'PST 2019-2024',
            u'PST (2019-2024)': u'PST 2019-2024',
            u'PST': u'PST 2019-2024'
        }
        values = titles.values()
        for brain in self.catalog(
                object_provides='imio.project.pst.interfaces.IImioPSTProject'):
            pst = brain.getObject()
            for tit in titles:
                if pst.title == tit:
                    pst.title = titles[tit]
                    modified(pst)
                    break
            else:
                if pst.title not in values:
                    logger.warning("PST rename: not replaced '{}'".format(
                        pst.title.encode('utf8')))
        # update ckeditor to remove format and avoid html <h> tags
        cke_props = self.portal.portal_properties.ckeditor_properties
        custom = (
            u"[\n['AjaxSave'],\n['Cut','Copy','Paste','PasteText','PasteFromWord','-',"
            u"'Scayt'],\n['Undo','Redo','-','RemoveFormat'],\n['Bold','Italic','Underline','Strike'],\n"
            u"['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],\n['JustifyLeft',"
            u"'JustifyCenter', 'JustifyRight','JustifyBlock'],\n['Table','SpecialChar','Link','Unlink'],\n'/',"
            u"\n['Styles'],\n['Maximize', 'ShowBlocks', 'Source']\n]")
        cke_props.toolbar_Custom = custom
        if cke_props.menuStyles.find(CKEDITOR_MENUSTYLES_CUSTOMIZED_MSG) == -1:
            enc = self.portal.portal_properties.site_properties.getProperty(
                'default_charset')
            msg_highlight_red = _tr('ckeditor_style_highlight_in_red').encode(
                'utf-8')
            msg_highlight_blue = _tr(
                'ckeditor_style_highlight_in_blue').encode('utf-8')
            msg_highlight_green = _tr(
                'ckeditor_style_highlight_in_green').encode('utf-8')
            msg_highlight_yellow = _tr(
                'ckeditor_style_highlight_in_yellow').encode('utf-8')
            msg_x_small = _tr('ckeditor_style_x_small').encode('utf-8')
            msg_small = _tr('ckeditor_style_small').encode('utf-8')
            msg_large = _tr('ckeditor_style_large').encode('utf-8')
            msg_x_large = _tr('ckeditor_style_x_large').encode('utf-8')
            msg_indent = _tr('ckeditor_style_indent_first_line').encode(
                'utf-8')
            msg_table_no_optimization = _tr(
                'ckeditor_style_table_no_optimization').encode('utf-8')

            menuStyles = unicode(
                "[\n{0}\n{{ name : '{1}'\t\t, element : 'span', attributes : {{ 'class' : 'highlight-red' }} }},\n"
                "{{ name : '{2}'\t\t, element : 'span', attributes : {{ 'class' : 'highlight-blue' }} }},\n"
                "{{ name : '{3}'\t\t, element : 'span', attributes : {{ 'class' : 'highlight-green' }} }},\n"
                "{{ name : '{4}'\t\t, element : 'span', attributes : {{ 'class' : 'highlight-yellow' }} }},\n"
                "{{ name : '{5}'\t\t, element : 'p', attributes : {{ 'class' : 'xSmallText' }} }},\n"
                "{{ name : '{6}'\t\t, element : 'p', attributes : {{ 'class' : 'smallText' }} }},\n"
                "{{ name : '{7}'\t\t, element : 'p', attributes : {{ 'class' : 'largeText' }} }},\n"
                "{{ name : '{8}'\t\t, element : 'p', attributes : {{ 'class' : 'xLargeText' }} }},\n"
                "{{ name : '{9}'\t\t, element : 'table', styles : {{ 'table-layout' : 'fixed' }} }},\n"
                "{{ name : '{10}'\t\t, element : 'p', attributes : {{ 'style' : 'text-indent: 40px;' }} }},\n]\n"
                .format(CKEDITOR_MENUSTYLES_CUSTOMIZED_MSG, msg_highlight_red,
                        msg_highlight_blue, msg_highlight_green,
                        msg_highlight_yellow, msg_x_small, msg_small,
                        msg_large, msg_x_large, msg_table_no_optimization,
                        msg_indent), enc)
            cke_props.menuStyles = menuStyles
Пример #12
0
    def update_site(self):
        # documentgenerator config
        set_oo_port()
        set_uno_path()

        # add templates configuration
        add_templates(self.portal)

        # set som objects as not next/prev navigable
        for obj in (self.portal['front-page'], self.portal['contacts'], self.portal['templates']):
            if not INextPrevNotNavigable.providedBy(obj):
                alsoProvides(obj, INextPrevNotNavigable)

        # publish outgoing-mail folder
        if api.content.get_state(self.omf) != 'internally_published':
            transitions(self.omf, ["show_internally"])
        # add group
        if api.group.get('expedition') is None:
            api.group.create('expedition', '1 Expédition courrier sortant')
            self.portal['outgoing-mail'].manage_addLocalRoles('expedition', ['Contributor'])
            self.portal['contacts'].manage_addLocalRoles('expedition', ['Contributor', 'Editor', 'Reader'])
            api.group.add_user(groupname='expedition', username='******')
        # dir_general can add outgoing mails
        self.portal['outgoing-mail'].manage_addLocalRoles('dir_general', ['Contributor'])

        # rename group title
        encodeurs = api.group.get('encodeurs')
        if encodeurs.getProperty('title') != '1 Encodeurs courrier entrant':
            self.portal.portal_groups.editGroup('encodeurs', title='1 Encodeurs courrier entrant')
        # update im mail-searches
        # alsoProvides(self.imf['mail-searches'], ICollectionCategories)
        # add new collection to_treat_in_my_group
        createIMailCollections(self.imf['mail-searches'])
        reimport_faceted_config(self.imf['mail-searches'], xml='im-mail-searches.xml',
                                default_UID=self.imf['mail-searches']['all_mails'].UID())
        # update permissions
        for perm in ("imio.dms.mail: Write mail base fields", "imio.dms.mail: Write treating group field",
                     "imio.dms.mail: Write userid field"):
            if 'Site Administrator' not in [dic['name'] for dic in self.portal.rolesOfPermission(perm)
                                            if dic['selected'] == 'SELECTED']:
                self.portal.manage_permission(perm, ('Manager', 'Site Administrator'), acquire=0)

        # configure external edition
        self.portal.portal_memberdata.manage_changeProperties(ext_editor=True)
        self.registry['externaleditor.ext_editor'] = True
        if 'Image' in self.registry['externaleditor.externaleditor_enabled_types']:
            self.registry['externaleditor.externaleditor_enabled_types'] = ['PODTemplate', 'ConfigurablePODTemplate',
                                                                            'DashboardPODTemplate', 'SubTemplate',
                                                                            'StyleTemplate', 'dmsommainfile']
        change_user_properties(self.portal, kw='ext_editor:True', dochange='1')

        # searched types
        changeSearchedTypes(self.portal)

        # add documentation message
        add_message('doc2-0', 'Documentation 2.0', u'<p>Vous pouvez consulter la <a href="http://www.imio.be/'
                    u'support/documentation/topic/cp_app_ged" target="_blank">documentation en ligne de la '
                    u'version 2.0</a>, ainsi que d\'autres documentations liées.</p>', msg_type='significant',
                    can_hide=True, req_roles=['Authenticated'], activate=True)

        val = api.portal.get_registry_record('imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions')
        if 'dmsoutgoingmail.back_to_agent|' not in val:
            val += ['dmsoutgoingmail.back_to_agent|', 'dmsoutgoingmail.back_to_creation|',
                    'dmsoutgoingmail.back_to_service_chief|', 'dmsoutgoingmail.back_to_print|',
                    'dmsoutgoingmail.back_to_be_signed|', 'dmsoutgoingmail.back_to_scanned|']
            api.portal.set_registry_record('imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions',
                                           val)
        # update front-page
        frontpage = self.portal['front-page']
        if frontpage.Title() == 'Gestion du courrier 1.1':
            frontpage.setTitle(_("front_page_title"))
            frontpage.setDescription(_("front_page_descr"))
            frontpage.setText(_("front_page_text"), mimetype='text/html')