def run(self): # check if oo port must be changed update_oo_config() self.runProfileSteps( 'imio.project.pst', steps=['actions', 'jsregistry', 'plone.app.registry', 'typeinfo']) self.various_update() self.adapt_dashboards() self.update_items() # templates self.runProfileSteps('imio.project.pst', steps=['imioprojectpst-update-templates'], profile='update') self.runProfileSteps('imio.project.pst', steps=['imioprojectpst-templates'], profile='default') self.upgradeAll(omit=['imio.project.pst:default']) # update portal_catalog # self.refreshDatabase() for prod in ['plonetheme.imioapps']: mark_last_version(self.portal, product=prod) # Reorder css and js self.runProfileSteps('imio.project.pst', steps=['cssregistry', 'jsregistry']) # Display duration self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 2.2...') # check if oo port or solr port must be changed update_solr_config() update_oo_config() self.cleanRegistries() self.install(['collective.portlet.actions']) self.upgradeProfile('collective.contact.core:default') self.check_roles() self.runProfileSteps('plonetheme.imioapps', steps=['viewlets']) self.runProfileSteps('imio.dms.mail', steps=[ 'actions', 'browserlayer', 'componentregistry', 'plone.app.registry', 'portlets', 'viewlets' ]) self.update_site() set_portlet(self.portal) # upgrade all except 'imio.dms.mail:default'. Needed with bin/upgrade-portals self.upgradeAll(omit=['imio.dms.mail:default']) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry[ 'collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False for prod in [ 'collective.ckeditor', 'plone.app.versioningbehavior', 'eea.jquery', 'collective.js.fancytree', 'plone.formwidget.masterselect', 'collective.quickupload', 'collective.behavior.talcondition', 'collective.contact.plonegroup', 'collective.contact.widget', 'collective.dms.basecontent', 'collective.eeafaceted.batchactions', 'collective.eeafaceted.collectionwidget', 'collective.eeafaceted.dashboard', 'collective.eeafaceted.z3ctable', 'collective.messagesviewlet', 'collective.querynextprev', 'collective.wfadaptations', 'collective.z3cform.chosen', 'dexterity.localroles', 'imio.actionspanel', 'imio.dashboard', 'imio.dms.mail', 'imio.history', 'plone.formwidget.datetime', 'plonetheme.imioapps' ]: mark_last_version(self.portal, product=prod) #self.refreshDatabase() self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 2.0...') self.cleanRegistries() self.runProfileSteps('imio.dms.mail', steps=['imiodmsmail-addOwnPersonnel'], profile='examples') #self.runProfileSteps('imio.dms.mail', steps=[]) # set front-page folder as not next/prev navigable if not INextPrevNotNavigable.providedBy(self.portal['front-page']): alsoProvides(self.portal['front-page'], INextPrevNotNavigable) # self.upgradeAll() # self.runProfileSteps('imio.dms.mail', steps=['cssregistry', 'jsregistry']) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry['collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False for prod in []: mark_last_version(self.portal, product=prod) #self.refreshDatabase() self.finish()
class Migrate_To_2_1(Migrator): def __init__(self, context): Migrator.__init__(self, context) self.registry = getUtility(IRegistry) self.catalog = api.portal.get_tool('portal_catalog') self.imf = self.portal['incoming-mail'] self.omf = self.portal['outgoing-mail'] def set_Members(self): if 'Members' in self.portal: return _createObjectByType('Folder', self.portal, id='Members', title='Users', description="Site Users") util = getUtility(ITranslationDomain, 'plonefrontpage') members = getattr(self.portal, 'Members') members.setTitle( util.translate(u'members-title', target_language='fr', default='Users')) members.setDescription( util.translate(u'members-description', target_language='fr', default="Site Users")) members.unmarkCreationFlag() members.setLanguage('fr') members.setExcludeFromNav(True) members.setConstrainTypesMode(1) members.setLocallyAllowedTypes([]) members.setImmediatelyAddableTypes([]) members.reindexObject() self.portal.portal_membership.memberareaCreationFlag = 0 self.portal.portal_membership.setMemberAreaType('member_area') transitions(members, 'show_internally') # add index_html to Members area if 'index_html' not in members.objectIds(): addPy = members.manage_addProduct[ 'PythonScripts'].manage_addPythonScript addPy('index_html') index_html = getattr(members, 'index_html') index_html.write(member_indexhtml) index_html.ZPythonScript_setTitle('User Search') # Block all right column portlets by default manager = getUtility(IPortletManager, name='plone.rightcolumn') if manager is not None: assignable = queryMultiAdapter((members, manager), ILocalPortletAssignmentManager) assignable.setBlacklistStatus('context', True) assignable.setBlacklistStatus('group', True) assignable.setBlacklistStatus('content_type', True) def update_templates(self): # Removed useless template if 'contacts-export' in self.portal['templates']: api.content.delete(self.portal['templates']['contacts-export']) # Change addable types template_types = POD_TEMPLATE_TYPES.keys() + [ 'Folder', 'DashboardPODTemplate' ] for path in ['templates', 'templates/om', 'templates/om/common']: obj = self.portal.unrestrictedTraverse(path) obj.setLocallyAllowedTypes(template_types) obj.setImmediatelyAddableTypes(template_types) # add templates configuration add_templates(self.portal) ml_uid = self.portal.restrictedTraverse('templates/om/mailing').UID() brains = api.content.find(context=self.portal['templates']['om'], portal_type=['ConfigurablePODTemplate']) for brain in brains: ob = brain.getObject() if not ob.mailing_loop_template: ob.mailing_loop_template = ml_uid def update_tasks(self): # NOT USED ! # change klass on task 'collective.task.content.task.Task' for brain in self.catalog(portal_type='task'): migrate_base_class_to_new_class( brain.getObject(), old_class_name='collective.task.content.task.Task', new_class_name='imio.dms.mail.browser.task.Task') def update_collections(self): # update incomingmail collections for brain in api.content.find(context=self.imf['mail-searches'], portal_type='DashboardCollection'): obj = brain.getObject() if 'CreationDate' in obj.customViewFields: buf = list(obj.customViewFields) buf[buf.index('CreationDate')] = u'reception_date' obj.customViewFields = tuple(buf) collections = [ {}, {}, {}, {}, {}, {}, {}, { 'id': 'in_copy_unread', 'tit': _('im_in_copy_unread'), 'subj': (u'todo', ), 'query': [ { 'i': 'portal_type', 'o': 'plone.app.querystring.operation.selection.is', 'v': ['dmsincomingmail'] }, # i_e ok { 'i': 'CompoundCriterion', 'o': 'plone.app.querystring.operation.compound.is', 'v': 'dmsincomingmail-in-copy-group-unread' } ], 'cond': u"", 'bypass': [], 'flds': (u'select_row', u'pretty_link', u'review_state', u'treating_groups', u'assigned_user', u'due_date', u'mail_type', u'sender', u'reception_date', u'actions'), 'sort': u'organization_type', 'rev': True, 'count': True }, {}, { 'id': 'followed', 'tit': _('im_followed'), 'subj': (u'search', ), 'query': [ { 'i': 'portal_type', 'o': 'plone.app.querystring.operation.selection.is', 'v': ['dmsincomingmail'] }, # i_e ok { 'i': 'CompoundCriterion', 'o': 'plone.app.querystring.operation.compound.is', 'v': 'dmsincomingmail-followed' } ], 'cond': u"", 'bypass': [], 'flds': (u'select_row', u'pretty_link', u'review_state', u'treating_groups', u'assigned_user', u'due_date', u'mail_type', u'sender', u'reception_date', u'actions'), 'sort': u'organization_type', 'rev': True, 'count': False } ] if 'in_copy_unread' not in self.imf['mail-searches']: createDashboardCollections(self.imf['mail-searches'], collections) # ICollectionCategories alsoProvides(self.imf['mail-searches'], ICollectionCategories) alsoProvides(self.omf['mail-searches'], ICollectionCategories) alsoProvides(self.portal['tasks']['task-searches'], ICollectionCategories) # I...BatchActions noLongerProvides(self.imf['mail-searches'], IIMDashboard) alsoProvides(self.imf['mail-searches'], IIMDashboardBatchActions) noLongerProvides(self.omf['mail-searches'], IOMDashboard) alsoProvides(self.omf['mail-searches'], IOMDashboardBatchActions) noLongerProvides(self.portal['tasks']['task-searches'], ITaskDashboard) alsoProvides(self.portal['tasks']['task-searches'], ITaskDashboardBatchActions) # Rename category label self.imf['mail-searches'].setRights('Courrier entrant') self.omf['mail-searches'].setRights('Courrier sortant') # Rename collection title self.imf['mail-searches']['all_mails'].setTitle(u'Tout') self.imf['mail-searches']['all_mails'].reindexObject() self.imf['mail-searches']['have_treated'].setTitle(u"Que j'ai traité") self.imf['mail-searches']['have_treated'].reindexObject() self.omf['mail-searches']['all_mails'].setTitle(u'Tout') self.omf['mail-searches']['all_mails'].reindexObject() self.omf['mail-searches']['have_treated'].setTitle(u"Que j'ai traité") self.omf['mail-searches']['have_treated'].reindexObject() self.portal['tasks']['task-searches']['to_treat'].setTitle( u'Qui me sont assignées') self.portal['tasks']['task-searches']['to_treat'].reindexObject() # reimport faceted reimport_faceted_config( self.imf['mail-searches'], xml='im-mail-searches.xml', default_UID=self.imf['mail-searches']['all_mails'].UID()) reimport_faceted_config( self.omf['mail-searches'], xml='om-mail-searches.xml', default_UID=self.omf['mail-searches']['all_mails'].UID()) 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 def update_contacts(self): contacts = self.portal['contacts'] if not IDirectoryFacetedNavigable.providedBy(contacts): return blacklistPortletCategory(contacts, value=False) noLongerProvides(contacts, IHidePloneLeftColumn) noLongerProvides(contacts, IHidePloneRightColumn) noLongerProvides(contacts, IDisableSmartFacets) noLongerProvides(contacts, IDirectoryFacetedNavigable) noLongerProvides(contacts, IActionsEnabled) self.portal.portal_types.directory.filter_content_types = False # add organizations searches col_folder = add_db_col_folder(contacts, 'orgs-searches', _("Organizations searches"), _("Organizations")) contacts.moveObjectToPosition('orgs-searches', 0) alsoProvides(col_folder, INextPrevNotNavigable) alsoProvides(col_folder, IOrganizationsDashboardBatchActions) createOrganizationsCollections(col_folder) # createStateCollections(col_folder, 'organization') configure_faceted_folder(col_folder, xml='organizations-searches.xml', default_UID=col_folder['all_orgs'].UID()) # configure contacts faceted configure_faceted_folder(contacts, xml='default_dashboard_widgets.xml', default_UID=col_folder['all_orgs'].UID()) # add held positions searches col_folder = add_db_col_folder(contacts, 'hps-searches', _("Held positions searches"), _("Held positions")) contacts.moveObjectToPosition('hps-searches', 1) alsoProvides(col_folder, INextPrevNotNavigable) alsoProvides(col_folder, IHeldPositionsDashboardBatchActions) createHeldPositionsCollections(col_folder) # createStateCollections(col_folder, 'held_position') configure_faceted_folder(col_folder, xml='held-positions-searches.xml', default_UID=col_folder['all_hps'].UID()) # add persons searches col_folder = add_db_col_folder(contacts, 'persons-searches', _("Persons searches"), _("Persons")) contacts.moveObjectToPosition('persons-searches', 2) alsoProvides(col_folder, INextPrevNotNavigable) alsoProvides(col_folder, IPersonsDashboardBatchActions) createPersonsCollections(col_folder) # createStateCollections(col_folder, 'person') configure_faceted_folder(col_folder, xml='persons-searches.xml', default_UID=col_folder['all_persons'].UID()) # add contact list searches col_folder = add_db_col_folder(contacts, 'cls-searches', _("Contact list searches"), _("Contact lists")) contacts.moveObjectToPosition('cls-searches', 3) alsoProvides(col_folder, INextPrevNotNavigable) alsoProvides(col_folder, IContactListsDashboardBatchActions) createContactListsCollections(col_folder) # createStateCollections(col_folder, 'contact_list') configure_faceted_folder(col_folder, xml='contact-lists-searches.xml', default_UID=col_folder['all_cls'].UID()) self.portal.portal_types.directory.filter_content_types = True # order contacts.moveObjectToPosition('personnel-folder', 4) # contact lists folder self.runProfileSteps('imio.dms.mail', profile='examples', steps=['imiodmsmail-addContactListsFolder']) cl_folder = contacts['contact-lists-folder'] cl_folder.manage_addLocalRoles('encodeurs', ['Contributor', 'Editor', 'Reader']) cl_folder.manage_addLocalRoles('expedition', ['Contributor', 'Editor', 'Reader']) cl_folder.manage_addLocalRoles('dir_general', ['Contributor', 'Editor', 'Reader']) dic = cl_folder['common'].__ac_local_roles__ for uid in self.registry[ORGANIZATIONS_REGISTRY]: dic["%s_encodeur" % uid] = ['Contributor'] if uid not in cl_folder: obj = uuidToObject(uid) full_title = obj.get_full_title(separator=' - ', first_index=1) folder = api.content.create(container=cl_folder, type='Folder', id=uid, title=full_title) folder.setLayout('folder_tabular_view') alsoProvides(folder, IActionsPanelFolderAll) alsoProvides(folder, INextPrevNotNavigable) roles = ['Contributor'] api.group.grant_roles(groupname='%s_encodeur' % uid, roles=roles, obj=folder) folder.reindexObjectSecurity() cl_folder['common']._p_changed = True # various contacts.moveObjectToPosition('plonegroup-organization', 6) blacklistPortletCategory(contacts['plonegroup-organization']) blacklistPortletCategory(contacts['personnel-folder']) def dms_config(self): try: get_dms_config() return except KeyError: pass set_dms_config( ['review_levels', 'dmsincomingmail'], # i_e ok OrderedDict([('dir_general', { 'st': ['proposed_to_manager'] }), ('_validateur', { 'st': ['proposed_to_service_chief'], 'org': 'treating_groups' })])) set_dms_config(['review_levels', 'task'], OrderedDict([('_validateur', { 'st': ['to_assign', 'realized'], 'org': 'assigned_group' })])) set_dms_config(['review_levels', 'dmsoutgoingmail'], OrderedDict([('_validateur', { 'st': ['proposed_to_service_chief'], 'org': 'treating_groups' })])) set_dms_config( ['review_states', 'dmsincomingmail'], # i_e ok OrderedDict([('proposed_to_manager', { 'group': 'dir_general' }), ('proposed_to_service_chief', { 'group': '_validateur', 'org': 'treating_groups' })])) set_dms_config(['review_states', 'task'], OrderedDict([('to_assign', { 'group': '_validateur', 'org': 'assigned_group' }), ('realized', { 'group': '_validateur', 'org': 'assigned_group' })])) set_dms_config(['review_states', 'dmsoutgoingmail'], OrderedDict([('proposed_to_service_chief', { 'group': '_validateur', 'org': 'treating_groups' })])) def run(self): logger.info('Migrating to imio.dms.mail 2.1...') self.cleanRegistries() self.set_Members() self.upgradeProfile('collective.contact.plonegroup:default') self.upgradeProfile('collective.dms.mailcontent:default') self.upgradeProfile('collective.messagesviewlet:default') self.upgradeProfile('imio.dashboard:default') self.upgradeProfile('collective.documentgenerator:default') self.runProfileSteps('imio.helpers', steps=['jsregistry']) self.install(['collective.contact.contactlist']) try: self.install(['ftw.labels']) except LookupError, e: if not e.message.startswith( 'Could not find ILabelJar on any parents'): raise e if 'contact-contactlist-mylists' in self.portal.portal_actions.user: self.portal.portal_actions.user.manage_delObjects( ids=['contact-contactlist-mylists']) self.runProfileSteps('imio.dms.mail', steps=[ 'actions', 'cssregistry', 'jsregistry', 'repositorytool', 'typeinfo', 'viewlets', 'workflow' ]) self.portal.portal_workflow.updateRoleMappings() # Apply workflow adaptations RECORD_NAME = 'collective.wfadaptations.applied_adaptations' if api.portal.get_registry_record(RECORD_NAME, default=False): success, errors = apply_from_registry() if errors: logger.error("Problem applying wf adaptations: %d errors" % errors) # check if oo port must be changed update_oo_config() self.runProfileSteps( 'imio.dms.mail', steps=['imiodmsmail-add-icons-to-contact-workflow'], profile='singles') add_transforms(self.portal) # replace faceted on contacts self.update_contacts() # update templates self.update_templates() self.runProfileSteps('imio.dms.mail', steps=['imiodmsmail-update-templates'], profile='singles') # set config self.dms_config() # update collections self.update_collections() # do various global adaptations self.update_site() # self.catalog.refreshCatalog(clear=1) # recatalog for brain in self.catalog(portal_type='dmsincomingmail'): # i_e ok brain.getObject().reindexObject( ['get_full_title', 'organization_type']) # upgrade all except 'imio.dms.mail:default'. Needed with bin/upgrade-portals self.upgradeAll(omit=['imio.dms.mail:default']) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry[ 'collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False for prod in [ 'collective.behavior.talcondition', 'collective.ckeditor', 'collective.contact.core', 'collective.contact.contactlist', 'collective.contact.duplicated', 'collective.contact.plonegroup', 'collective.contact.widget', 'collective.dms.basecontent', 'collective.dms.scanbehavior', 'collective.eeafaceted.batchactions', 'collective.eeafaceted.collectionwidget', 'collective.eeafaceted.z3ctable', 'collective.js.underscore', 'collective.messagesviewlet', 'collective.plonefinder', 'collective.querynextprev', 'collective.task', 'collective.z3cform.datagridfield', 'collective.z3cform.datetimewidget', 'dexterity.localroles', 'imio.actionspanel', 'imio.dashboard', 'imio.dms.mail', 'imio.history', 'plone.app.dexterity', 'plone.formwidget.autocomplete', 'plone.formwidget.contenttree', 'plone.formwidget.datetime', 'plonetheme.classic', 'plonetheme.imioapps' ]: mark_last_version(self.portal, product=prod) # self.refreshDatabase() self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 1.0...') self.cleanRegistries() self.upgradeProfile('collective.dms.mailcontent:default') # We have to reapply type info before doing other subproducts migration self.runProfileSteps('imio.dms.mail', steps=['typeinfo']) # We have to update type schema because plone.dexterity doesn't detect schema_policy modification. BUG #44 for portal_type in ['dmsincomingmail', 'dmsoutgoingmail']: # i_e ok schemaName = dxutils.portalTypeToSchemaName(portal_type) schema = getattr(plone.dexterity.schema.generated, schemaName) fti = getUtility(IDexterityFTI, name=portal_type) model = fti.lookupModel() syncSchema(model.schema, schema, overwrite=True, sync_bases=True) notify(plone.dexterity.schema.SchemaInvalidatedEvent(portal_type)) self.upgradeProfile('collective.task:default') self.upgradeProfile('dexterity.localroles:default') self.upgradeProfile('dexterity.localrolesfield:default') self.upgradeProfile('collective.contact.plonegroup:default') self.runProfileSteps('imio.dms.mail', steps=[ 'actions', 'componentregistry', 'controlpanel', 'plone.app.registry', 'portlets', 'repositorytool', 'rolemap', 'sharing', 'workflow' ]) self.portal.portal_workflow.updateRoleMappings() self.runProfileSteps('collective.dms.mailcontent', steps=['controlpanel']) self.runProfileSteps('collective.contact.plonegroup', steps=['controlpanel']) self.reinstall([ 'collective.messagesviewlet:messages', 'collective.querynextprev:default', 'imio.dashboard:default', ]) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry[ 'collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False # delete old dmsmail portlet self.delete_portlet(self.portal, 'portlet_maindmsmail') # remove deprecated interfaces self.remove_contact_interfaces() # moved notes content to task_description catalog = api.portal.get_tool('portal_catalog') brains = catalog.searchResults(portal_type='dmsincomingmail') # i_e ok for brain in brains: obj = brain.getObject() if not base_hasattr(obj, 'notes') or not obj.notes: continue text = u'<p>%s</p>\r\n' % obj.notes.replace('\r\n', '<br />\r\n') obj.task_description = richtextval(text) delattr(obj, 'notes') # obj.reindexObject() # replace collections by Dashboard collections im_folder = self.portal['incoming-mail'] alsoProvides(im_folder, INextPrevNotNavigable) alsoProvides(im_folder, IIMDashboard) self.replaceCollections(im_folder) # apply contact faceted config reimport_faceted_config(self.portal['contacts'], 'contacts-faceted.xml') # add new indexes for dashboard addOrUpdateIndexes(self.portal, indexInfos={ 'mail_type': ('FieldIndex', {}), 'mail_date': ('DateIndex', {}), 'in_out_date': ('DateIndex', {}), }) # set dashboard on incoming mail configure_faceted_folder( im_folder, xml='default_dashboard_widgets.xml', default_UID=im_folder['mail-searches']['all_mails'].UID()) # set task local roles configuration configure_task_rolefields(self.portal) # update dexterity local roles configuration self.update_local_roles() # add task actionspanel config if not self.registry[ 'imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions']: self.registry['imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions'] = [] self.registry['imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions'] += \ ['task.back_in_created|', 'task.back_in_to_assign|', 'task.back_in_to_do|', 'task.back_in_progress|', 'task.back_in_realized|'] # activate ckeditor configure_ckeditor(self.portal, custom='ged') # Set markup allowed types adapter = MarkupControlPanelAdapter(self.portal) adapter.set_allowed_types(['text/html']) # update searchabletext self.update_dmsmainfile() self.upgradeAll() for prod in [ 'plone.formwidget.autocomplete', 'collective.documentviewer', 'plone.formwidget.masterselect', 'collective.contact.core', 'collective.contact.duplicated', 'collective.dms.basecontent', 'collective.dms.scanbehavior', 'collective.externaleditor', 'plone.app.collection', 'plone.app.intid', 'collective.contact.facetednav', 'plonetheme.imioapps', 'PasswordStrength', 'imio.dms.mail' ]: mark_last_version(self.portal, product=prod) self.portal.manage_permission( 'CMFEditions: Revert to previous versions', ('Manager', 'Site Administrator'), acquire=0) #self.refreshDatabase() self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 1.1...') self.cleanRegistries() self.runProfileSteps('imio.dms.mail', steps=['actions', 'cssregistry', 'jsregistry', 'workflow']) self.runProfileSteps('collective.messagesviewlet', steps=['collective-messagesviewlet-messages'], profile='messages') self.upgradeProfile('collective.dms.mailcontent:default') self.upgradeProfile('collective.task:default') self.upgradeProfile('eea.facetednavigation:default') self.upgradeProfile('collective.querynextprev:default') im_folder = self.portal['incoming-mail'] # set mail-searches folder as not next/prev navigable if not INextPrevNotNavigable.providedBy(im_folder['task-searches']): alsoProvides(im_folder['task-searches'], INextPrevNotNavigable) # activate field on DashboardCollection self.add_view_field('mail_type', im_folder['mail-searches'], before='CreationDate') self.add_view_field('sender', im_folder['mail-searches'], before='CreationDate') self.add_view_field('task_parent', im_folder['task-searches'], before='review_state') # set showNumberOfItems on some collections self.update_count(im_folder['mail-searches'], ids=['to_validate', 'to_treat', 'im_treating', 'created']) self.update_count(im_folder['task-searches'], ids=['to_validate', 'to_treat', 'im_treating']) # update criterion on validation collections self.update_validation_collections() # Activate browser message msg = self.portal['messages-config']['browser-warning'] api.content.transition(obj=msg, to_state='activated') # update searchabletext self.update_dmsmainfile() self.update_dmsincomingmail() # add new indexes addOrUpdateIndexes(self.portal, indexInfos={'state_group': ('FieldIndex', {})}) # add metadata in portal_catalog addOrUpdateColumns(self.portal, columns=('mail_type',)) # block parent portlets on contacts blacklistPortletCategory(self.portal, self.portal['contacts']) # add local roles self.portal['contacts'].manage_addLocalRoles('dir_general', ['Contributor', 'Editor', 'Reader']) # configure autocomplete widget self.configure_autocomplete_widget(im_folder['mail-searches']) # configure task batch actions alsoProvides(im_folder['task-searches'], IIMTaskDashboard) # reimport contact faceted config reimport_faceted_config(self.portal['contacts'], xml='contacts-faceted.xml') # remove tinymce resources configure_ckeditor(self.portal, default=0, allusers=0, forceTextPaste=0, scayt=0) self.upgradeAll() self.runProfileSteps('imio.dms.mail', steps=['cssregistry', 'jsregistry']) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry['collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False for prod in ['plone.formwidget.autocomplete', 'collective.plonefinder', 'plone.formwidget.contenttree', 'plone.app.dexterity', 'plone.formwidget.masterselect', 'collective.behavior.talcondition', 'collective.contact.facetednav', 'collective.contact.plonegroup', 'collective.contact.widget', 'collective.dms.batchimport', 'collective.dms.scanbehavior', 'collective.documentgenerator', 'collective.eeafaceted.collectionwidget', 'collective.eeafaceted.z3ctable', 'collective.messagesviewlet', 'collective.querynextprev', 'dexterity.localroles', 'dexterity.localrolesfield', 'imio.actionspanel', 'imio.dashboard', 'imio.dms.mail', 'plone.formwidget.datetime', 'plonetheme.imioapps']: mark_last_version(self.portal, product=prod) #self.refreshDatabase() self.finish()
def run(self): self.upgradeProfile('collective.messagesviewlet:default') # call the following to correct criterion to avoid error messages in dashboard upgrade, where there was a typo self.upgradeProfile('collective.eeafaceted.collectionwidget:default') self.upgradeProfile('imio.dashboard:default') # skip 4320 to 4330. Do it programmatically ckp = self.portal.portal_properties.ckeditor_properties if not ckp.hasProperty('skin'): if base_hasattr(ckp, 'skin'): delattr(ckp, 'skin') ckp.manage_addProperty('skin', 'moono-lisa', 'string') self.ps.setLastVersionForProfile('collective.ckeditor:default', '4330') self.upgradeProfile('collective.ckeditor:default') self.upgradeProfile('plonetheme.imioapps:default') self.upgradeProfile('imio.actionspanel:default') # add icon to existing actions self.runProfileSteps('plonetheme.imioapps', steps=['actions'], profile='default') self.upgradeProfile('collective.contact.core:default') self.upgradeProfile('collective.contact.plonegroup:default') self.upgradeProfile('collective.documentgenerator:default') self.runProfileSteps('imio.helpers', steps=['jsregistry']) self.upgradeProfile('collective.task:default') # ordering viewlets self.runProfileSteps('imio.project.core', steps=['viewlets'], profile='default') self.runProfileSteps('imio.project.pst', steps=['actions', 'typeinfo']) # 'catalog', 'componentregistry', 'jsregistry', 'portlets', 'propertiestool', 'plone.app.registry', 'workflow' self.AT2Dx() self.adapt_dashboards() self.migrate_tasks() # update security settings # self.portal.portal_workflow.updateRoleMappings() self.various_update() # templates self.runProfileSteps('imio.project.pst', steps=['imioprojectpst-update-templates'], profile='update') self.runProfileSteps('imio.project.pst', steps=['imioprojectpst-templates'], profile='default') # self.upgradeAll() # update portal_catalog # self.refreshDatabase() # check if oo port must be changed update_oo_config() for prod in ['collective.eeafaceted.colletionwidget', 'collective.eeafaceted.z3ctable', 'collective.behavior.talcondition', 'collective.compoundcriterion', 'collective.ckeditor', 'collective.contact.widget', 'collective.plonefinder', 'collective.quickupload', 'collective.z3cform.datagridfield', 'collective.z3cform.datetimewidget', 'communesplone.layout', 'dexterity.localroles', 'dexterity.localrolesfield', 'eea.facetednavigation', 'eea.jquery', 'imio.dashboard', 'imio.history', 'imio.project.core', 'imio.project.pst', 'PasswordStrength', 'plone.app.collection', 'plone.app.dexterity', 'plone.app.versioningbehavior', 'plone.formwidget.autocomplete', 'plone.formwidget.contenttree', 'plone.formwidget.datetime', 'plonetheme.classic', 'plonetheme.imioapps']: mark_last_version(self.portal, product=prod) # Reorder css and js self.runProfileSteps('imio.project.pst', steps=['cssregistry', 'jsregistry']) # Display duration self.finish()
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()
def run(self): # check if oo port must be changed update_oo_config() self.check_roles() self.remove_simplify_layout() self.install(['collective.portlet.actions']) self.install(['collective.behavior.sdg']) self.install(['collective.z3cform.chosen']) self.upgradeProfile('collective.contact.core:default') self.upgradeProfile('collective.documentgenerator:default') self.upgradeProfile('imio.project.core:default') self.runProfileSteps( 'imio.project.core', steps=['controlpanel', 'plone.app.registry', 'typeinfo'], run_dependencies=False) self.runProfileSteps('imio.project.pst', steps=[ 'actions', 'catalog', 'componentregistry', 'controlpanel', 'plone.app.registry', 'portlets', 'typeinfo', 'viewlets', 'workflow' ], run_dependencies=False) self.runProfileSteps('imio.project.pst', steps=['portlets', 'repositorytool'], profile='demo', run_dependencies=False) self.runProfileSteps('imio.pm.wsclient', steps=['plone.app.registry'], run_dependencies=False) # to hide messages-viewlet self.runProfileSteps('plonetheme.imioapps', steps=['viewlets'], run_dependencies=False) self.correct_component_registry() self.various_update() set_portlet(self.portal) self.migrate_description() self.adapt_collections() self.migrate_representative_responsible() self.update_collections_folder_name() self.set_priority() self.adapt_templates() self.migrate_pstactions() self.add_missing_attributes() # templates self.runProfileSteps('imio.project.pst', steps=['imioprojectpst-override-templates'], profile='update', run_dependencies=False) self.runProfileSteps('imio.project.pst', steps=['imioprojectpst-templates'], profile='default', run_dependencies=False) self.runProfileSteps('imio.project.core', steps=['plone.app.registry'], profile='default', run_dependencies=False) self.dx_local_roles() self.upgradeAll(omit=['imio.project.pst:default']) for prod in [ 'collective.behavior.talcondition', 'collective.ckeditor', 'collective.compoundcriterion', 'collective.contact.plonegroup', 'collective.contact.widget', 'collective.eeafaceted.batchactions', 'collective.eeafaceted.collectionwidget', 'collective.eeafaceted.dashboard', 'collective.eeafaceted.z3ctable', 'collective.fingerpointing', 'collective.messagesviewlet', 'communesplone.layout', 'dexterity.localroles', 'dexterity.localrolesfield', 'eea.jquery', 'imio.actionspanel', 'imio.dashboard', 'imio.history', 'imio.pm.wsclient', 'imio.project.core', 'imio.project.pst', 'plone.formwidget.datetime', 'plone.formwidget.masterselect', 'plonetheme.classic', 'plonetheme.imioapps' ]: mark_last_version(self.portal, product=prod) # Reorder css and js self.runProfileSteps('imio.project.pst', steps=['cssregistry', 'jsregistry'], run_dependencies=False) # Display duration self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 1.0...') self.cleanRegistries() self.upgradeProfile('collective.dms.mailcontent:default') # We have to reapply type info before doing other subproducts migration self.runProfileSteps('imio.dms.mail', steps=['typeinfo']) # We have to update type schema because plone.dexterity doesn't detect schema_policy modification. BUG #44 for portal_type in ['dmsincomingmail', 'dmsoutgoingmail']: schemaName = dxutils.portalTypeToSchemaName(portal_type) schema = getattr(plone.dexterity.schema.generated, schemaName) fti = getUtility(IDexterityFTI, name=portal_type) model = fti.lookupModel() syncSchema(model.schema, schema, overwrite=True, sync_bases=True) notify(plone.dexterity.schema.SchemaInvalidatedEvent(portal_type)) self.upgradeProfile('collective.task:default') self.upgradeProfile('dexterity.localroles:default') self.upgradeProfile('dexterity.localrolesfield:default') self.upgradeProfile('collective.contact.plonegroup:default') self.runProfileSteps('imio.dms.mail', steps=['actions', 'componentregistry', 'controlpanel', 'plone.app.registry', 'portlets', 'repositorytool', 'rolemap', 'sharing', 'workflow']) self.portal.portal_workflow.updateRoleMappings() self.runProfileSteps('collective.dms.mailcontent', steps=['controlpanel']) self.runProfileSteps('collective.contact.plonegroup', steps=['controlpanel']) self.reinstall([ 'collective.messagesviewlet:messages', 'collective.querynextprev:default', 'imio.dashboard:default', ]) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry['collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False # delete old dmsmail portlet self.delete_portlet(self.portal, 'portlet_maindmsmail') # remove deprecated interfaces self.remove_contact_interfaces() # moved notes content to task_description catalog = api.portal.get_tool('portal_catalog') brains = catalog.searchResults(portal_type='dmsincomingmail') for brain in brains: obj = brain.getObject() if not base_hasattr(obj, 'notes') or not obj.notes: continue text = u'<p>%s</p>\r\n' % obj.notes.replace('\r\n', '<br />\r\n') obj.task_description = create_richtextval(text) delattr(obj, 'notes') # obj.reindexObject() # replace collections by Dashboard collections im_folder = self.portal['incoming-mail'] alsoProvides(im_folder, INextPrevNotNavigable) alsoProvides(im_folder, IIMDashboard) self.replaceCollections(im_folder) # apply contact faceted config reimport_faceted_config(self.portal['contacts'], 'contacts-faceted.xml') # add new indexes for dashboard addOrUpdateIndexes(self.portal, indexInfos={'mail_type': ('FieldIndex', {}), 'mail_date': ('DateIndex', {}), 'in_out_date': ('DateIndex', {}), }) # set dashboard on incoming mail configure_faceted_folder(im_folder, xml='default_dashboard_widgets.xml', default_UID=im_folder['mail-searches']['all_mails'].UID()) # set task local roles configuration configure_task_rolefields(self.portal) # update dexterity local roles configuration self.update_local_roles() # add task actionspanel config if not self.registry['imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions']: self.registry['imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions'] = [] self.registry['imio.actionspanel.browser.registry.IImioActionsPanelConfig.transitions'] += \ ['task.back_in_created|', 'task.back_in_to_assign|', 'task.back_in_to_do|', 'task.back_in_progress|', 'task.back_in_realized|'] # activate ckeditor configure_ckeditor(self.portal, custom='ged') # Set markup allowed types adapter = MarkupControlPanelAdapter(self.portal) adapter.set_allowed_types(['text/html']) # update searchabletext self.update_dmsmainfile() self.upgradeAll() for prod in ['plone.formwidget.autocomplete', 'collective.documentviewer', 'plone.formwidget.masterselect', 'collective.contact.core', 'collective.contact.duplicated', 'collective.dms.basecontent', 'collective.dms.scanbehavior', 'collective.externaleditor', 'plone.app.collection', 'plone.app.intid', 'collective.contact.facetednav', 'plonetheme.imioapps', 'PasswordStrength', 'imio.dms.mail']: mark_last_version(self.portal, product=prod) self.portal.manage_permission('CMFEditions: Revert to previous versions', ('Manager', 'Site Administrator'), acquire=0) #self.refreshDatabase() self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 2.0...') self.cleanRegistries() self.delete_outgoing_examples() self.upgradeProfile('collective.task:default') self.upgradeProfile('collective.contact.core:default') self.upgradeProfile('collective.dms.scanbehavior:default') # self.upgradeProfile('collective.schedulefield:default') self.manage_localroles() self.runProfileSteps('imio.dms.mail', steps=['actions', 'componentregistry', 'jsregistry', 'plone.app.registry', 'propertiestool', 'typeinfo', 'workflow']) self.portal.portal_workflow.updateRoleMappings() self.runProfileSteps('imio.dms.mail', profile='examples', steps=['imiodmsmail-addOwnPersonnel', 'imiodmsmail-configureImioDmsMail']) # create persons from users create_persons_from_users(self.portal) # add missing pdf transforms self.add_missing_transforms() # configure dashboard on omf self.configure_dashboard() # do various global adaptations self.update_site() # configure local roles on omf and add folders in templates # call event to do it at modification record = self.registry.records.get('collective.contact.plonegroup.browser.settings.IContactPlonegroupConfig.' 'organizations') event.notify(RecordModifiedEvent(record, [], [])) # manage task for both incoming and outgoing mails self.create_tasks_folder() # migrate tasks: enquirer field self.migrate_tasks() # configure role fields on task configure_task_rolefields(self.portal, force=True) configure_task_config(self.portal) # remove actions on all_... collections #self.update_collections() # configure role fields on dmsoutgoingmail configure_om_rolefields(self.portal) # refresh some indexes brains = self.catalog.searchResults(portal_type=['dmsincomingmail']) # i_e ok for brain in brains: obj = brain.getObject() obj.reindexObjectSecurity() # upgrade all except 'imio.dms.mail:default'. Needed with bin/upgrade-portals self.upgradeAll(omit=['imio.dms.mail:default']) self.catalog.reindexIndex(['assigned_user', 'mail_date', 'in_out_date', 'due_date'], self.portal.REQUEST) self.runProfileSteps('imio.dms.mail', steps=['cssregistry', 'jsregistry']) self.reinstall([ 'collective.js.fancytree:default', 'collective.js.fancytree:theme-vista', ]) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry['collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False for prod in ["plone.formwidget.autocomplete", "collective.ckeditor", "collective.plonefinder", "plone.formwidget.contenttree", "collective.z3cform.datagridfield", "plone.app.dexterity", "eea.facetednavigation", "eea.jquery", "plone.formwidget.masterselect", "collective.quickupload", "plone.app.relationfield", "collective.behavior.talcondition", "collective.compoundcriterion", "collective.contact.core", "collective.contact.duplicated", "collective.contact.facetednav", "collective.contact.plonegroup", "collective.contact.widget", "collective.dms.basecontent", "collective.dms.batchimport", "collective.dms.mailcontent", "collective.dms.scanbehavior", "collective.documentgenerator", "collective.eeafaceted.collectionwidget", "collective.eeafaceted.z3ctable", "collective.externaleditor", "collective.messagesviewlet", "collective.querynextprev", "collective.task", "communesplone.layout", "dexterity.localroles", "dexterity.localrolesfield", "imio.actionspanel", "imio.dashboard", "imio.dms.mail", "imio.history", "plone.app.collection", "plonetheme.imioapps"]: mark_last_version(self.portal, product=prod) #self.refreshDatabase() self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 2.3...') # check if oo port or solr port must be changed update_solr_config() update_oo_config() # add new dms config used in update_transitions_levels_config if 'wf_from_to' not in get_dms_config(): set_dms_config( ['wf_from_to', 'dmsincomingmail', 'n_plus', 'from'], # i_e ok [('created', 'back_to_creation'), ('proposed_to_manager', 'back_to_manager')]) set_dms_config( ['wf_from_to', 'dmsincomingmail', 'n_plus', 'to'], # i_e ok [('proposed_to_agent', 'propose_to_agent')]) set_dms_config(['wf_from_to', 'dmsoutgoingmail', 'n_plus', 'from'], [('created', 'back_to_creation')]) set_dms_config(['wf_from_to', 'dmsoutgoingmail', 'n_plus', 'to'], [('to_be_signed', 'propose_to_be_signed')]) self.cleanRegistries() self.correct_actions() auc_stored = self.registry[AUC_RECORD] self.upgradeProfile('collective.contact.plonegroup:default') self.install( ['collective.contact.importexport', 'collective.fontawesome']) self.runProfileSteps('plonetheme.imioapps', steps=['viewlets']) # to hide messages-viewlet if not self.portal.portal_quickinstaller.isProductInstalled( 'collective.wfadaptations'): self.install(['collective.wfadaptations']) self.runProfileSteps('imio.dms.mail', steps=['actions', 'plone.app.registry'], run_dependencies=False) # add new task collection createTaskCollections(self.portal['tasks']['task-searches']) # migrate assigned_user_check self.update_assigned_user_check(auc_stored) # remove service_chief related self.remove_service_chief() # do various global adaptations self.update_site() # update daterange criteria self.update_dashboards() # update templates self.runProfileSteps('imio.dms.mail', steps=['imiodmsmail-update-templates'], profile='singles') # upgrade all except 'imio.dms.mail:default'. Needed with bin/upgrade-portals self.upgradeAll(omit=['imio.dms.mail:default']) self.runProfileSteps('imio.dms.mail', steps=['cssregistry', 'jsregistry']) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry[ 'collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False for prod in [ 'collective.contact.core', 'collective.contact.widget', 'collective.dms.batchimport', 'collective.dms.mailcontent', 'collective.eeafaceted.batchactions', 'collective.eeafaceted.collectionwidget', 'collective.eeafaceted.dashboard', 'collective.eeafaceted.z3ctable', 'collective.fingerpointing', 'collective.messagesviewlet', 'collective.wfadaptations', 'collective.z3cform.datetimewidget', 'communesplone.layout', 'eea.facetednavigation', 'eea.jquery', 'imio.actionspanel', 'imio.dashboard', 'imio.dms.mail', 'imio.history', 'plone.formwidget.autocomplete', 'plone.formwidget.contenttree', 'plonetheme.classic', 'plonetheme.imio.apps' ]: mark_last_version(self.portal, product=prod) # self.refreshDatabase() self.finish()
def run(self): logger.info('Migrating to imio.dms.mail 1.1...') self.cleanRegistries() self.runProfileSteps( 'imio.dms.mail', steps=['actions', 'cssregistry', 'jsregistry', 'workflow']) self.runProfileSteps('collective.messagesviewlet', steps=['collective-messagesviewlet-messages'], profile='messages') self.upgradeProfile('collective.dms.mailcontent:default') self.upgradeProfile('collective.task:default') self.upgradeProfile('eea.facetednavigation:default') self.upgradeProfile('collective.querynextprev:default') im_folder = self.portal['incoming-mail'] # set mail-searches folder as not next/prev navigable if not INextPrevNotNavigable.providedBy(im_folder['task-searches']): alsoProvides(im_folder['task-searches'], INextPrevNotNavigable) # activate field on DashboardCollection self.add_view_field('mail_type', im_folder['mail-searches'], before='CreationDate') self.add_view_field('sender', im_folder['mail-searches'], before='CreationDate') self.add_view_field('task_parent', im_folder['task-searches'], before='review_state') # set showNumberOfItems on some collections self.update_count(im_folder['mail-searches'], ids=[ 'to_validate', 'to_treat', 'im_treating', 'searchfor_created' ]) self.update_count(im_folder['task-searches'], ids=['to_validate', 'to_treat', 'im_treating']) # update criterion on validation collections self.update_validation_collections() # Activate browser message msg = self.portal['messages-config']['browser-warning'] api.content.transition(obj=msg, to_state='activated') # update searchabletext self.update_dmsmainfile() self.update_dmsincomingmail() # add new indexes addOrUpdateIndexes(self.portal, indexInfos={'state_group': ('FieldIndex', {})}) # add metadata in portal_catalog addOrUpdateColumns(self.portal, columns=('mail_type', )) # block parent portlets on contacts blacklistPortletCategory(self.portal['contacts']) # add local roles self.portal['contacts'].manage_addLocalRoles( 'dir_general', ['Contributor', 'Editor', 'Reader']) # configure autocomplete widget self.configure_autocomplete_widget(im_folder['mail-searches']) # configure task batch actions alsoProvides(im_folder['task-searches'], ITaskDashboard) # reimport contact faceted config reimport_faceted_config(self.portal['contacts'], xml='contacts-faceted.xml') # remove tinymce resources configure_ckeditor(self.portal, default=0, allusers=0, forceTextPaste=0, scayt=0) self.upgradeAll() self.runProfileSteps('imio.dms.mail', steps=['cssregistry', 'jsregistry']) # set jqueryui autocomplete to False. If not, contact autocomplete doesn't work self.registry[ 'collective.js.jqueryui.controlpanel.IJQueryUIPlugins.ui_autocomplete'] = False for prod in [ 'plone.formwidget.autocomplete', 'collective.plonefinder', 'plone.formwidget.contenttree', 'plone.app.dexterity', 'plone.formwidget.masterselect', 'collective.behavior.talcondition', 'collective.contact.facetednav', 'collective.contact.plonegroup', 'collective.contact.widget', 'collective.dms.batchimport', 'collective.dms.scanbehavior', 'collective.documentgenerator', 'collective.eeafaceted.collectionwidget', 'collective.eeafaceted.z3ctable', 'collective.messagesviewlet', 'collective.querynextprev', 'dexterity.localroles', 'dexterity.localrolesfield', 'imio.actionspanel', 'imio.dashboard', 'imio.dms.mail', 'plone.formwidget.datetime', 'plonetheme.imioapps' ]: mark_last_version(self.portal, product=prod) #self.refreshDatabase() self.finish()