def loadDefaultData(self):
        """ """
        # set default 'Naaya' configuration
        NySite.__dict__['createPortalTools'](self)
        NySite.__dict__['loadDefaultData'](self)

        # remove Naaya default content
        layout_tool = self.getLayoutTool()
        naaya_skins = [
            skin.getId() for skin in layout_tool.objectValues('Naaya Skin')
        ]
        logos = [image.getId() for image in layout_tool.objectValues('Image')]
        layout_tool.manage_delObjects(naaya_skins + logos)
        self.getPortletsTool().manage_delObjects(
            ['menunav_links', 'topnav_links'])
        self.manage_delObjects('info')

        # load groupware skel
        self.loadSkeleton(Globals.package_home(globals()))

        if rdf_calendar_available:
            manage_addRDFCalendar(self,
                                  id="portal_rdfcalendar",
                                  title="Events calendar")
            rdfcalendar_ob = self._getOb('portal_rdfcalendar')

            # adding range index to catalog
            class Empty(object):
                pass

            extra = Empty()  # Extra has to be an object.. see DateRangeIndex
            extra.since_field = 'start_date'
            extra.until_field = 'end_date'
            self.getCatalogTool().addIndex('resource_interval',
                                           'DateRangeIndex',
                                           extra=extra)

            # adding local_events Script (Python)
            manage_addPythonScript(rdfcalendar_ob, 'local_events')
            local_events_ob = rdfcalendar_ob._getOb('local_events')
            local_events_ob._params = 'year=None, month=None, day=None'
            local_events_ob.write(
                open(
                    os.path.dirname(__file__) + '/skel/others/local_events.py',
                    'r').read())

        self.getPortletsTool().assign_portlet('library', 'right',
                                              'portlet_latestuploads_rdf',
                                              True)

        # set default main topics
        self.getPropertiesTool().manageMainTopics(['about', 'library'])

        # add meta on brains for group local roles
        self.getCatalogTool().addColumn('ny_ldap_group_roles')
Exemple #2
0
    def loadDefaultData(self):
        """ """
        #set default 'Naaya' configuration
        NySite.__dict__['createPortalTools'](self)
        NySite.__dict__['loadDefaultData'](self)

        #load site skeleton - configuration
        self.loadSkeleton(join(SMAP_PRODUCT_PATH, 'skel'))

        #custom indexes
        try:    self.getCatalogTool().manage_addIndex('resource_area', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_focus', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_area_exp', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_focus_exp', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_country', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass

        #remove Naaya default content
        self.getLayoutTool().manage_delObjects('skin')
        self.manage_delObjects('info')
        self.getPortletsTool().manage_delObjects('topnav_links')

        #set default 'Main topics'
        try:    self.getPropertiesTool().manageMainTopics(['fol120392', 'fol657555', 'fol112686', 'fol034934', 'test1'])
        except: pass

        #set portal index's right portlets
        self.getPortletsTool().set_right_portlets_locations('', ['portlet_rdfcalendar'])

        #default Forum instance
        manage_addNyForum(self, id=ID_FORUM, title=TITLE_FORUM)

        #default RDF Calendar settings
        manage_addRDFCalendar(self, id=ID_RDFCALENDAR, title=TITLE_RDFCALENDAR, week_day_len=1)
        #to be done after add
        #rdfcalendar_ob = self._getOb(ID_RDFCALENDAR)
        #manage_addRDFSummary(rdfcalendar_ob, 'events', 'Events',
        #                     'http://smap.ewindows.eu.org/events/index_rdf', '', 'no')
        #rdfcal_ob = self._getOb(ID_RDFCALENDAR)
        #rdfcal_ob._getOb('events').update()
        country_folder = self._getOb('fol112686')
        country_folder.manage_role('Authenticated', ['Naaya - Add Naaya Contact objects', 'Naaya - Add Naaya Event objects', 'Naaya - Add Naaya Document objects', 'Naaya - Add Naaya Extended File objects', 'Naaya - Add Naaya File objects', 'Naaya - Access administrative area', 'Naaya - Add Naaya Folder objects', 'Naaya - Add Naaya GeoPoint objects', 'Naaya - Add Naaya Media File objects', 'Naaya - Add Naaya News objects', 'Naaya - Add Naaya Pointer objects', 'Naaya - Add Naaya SMAP Expert objects', 'Naaya - Add Naaya SMAP Project objects'])

        #portal_map custom index
        custom_map_index = self.futRead(join(SMAP_PRODUCT_PATH, 'skel', 'others', 'map_index.zpt'))
        portal_map = self.getGeoMapTool()
        manage_addPageTemplate(portal_map, id='map_index', title='', text='')
        map_index = portal_map._getOb(id='map_index')
        map_index.pt_edit(text=custom_map_index, content_type='')
    def loadDefaultData(self):
        """ """
        # set default 'Naaya' configuration
        NySite.__dict__['createPortalTools'](self)
        NySite.__dict__['loadDefaultData'](self)

        # remove Naaya default content
        layout_tool = self.getLayoutTool()
        naaya_skins = [skin.getId() for skin in
                       layout_tool.objectValues('Naaya Skin')]
        logos = [image.getId() for image in
                 layout_tool.objectValues('Image')]
        layout_tool.manage_delObjects(naaya_skins + logos)
        self.getPortletsTool().manage_delObjects(['menunav_links',
                                                  'topnav_links'])
        self.manage_delObjects('info')

        # load groupware skel
        self.loadSkeleton(Globals.package_home(globals()))

        if rdf_calendar_available:
            manage_addRDFCalendar(self, id="portal_rdfcalendar",
                                  title="Events calendar")
            rdfcalendar_ob = self._getOb('portal_rdfcalendar')

            # adding range index to catalog
            class Empty(object):
                pass
            extra = Empty()  # Extra has to be an object.. see DateRangeIndex
            extra.since_field = 'start_date'
            extra.until_field = 'end_date'
            self.getCatalogTool().addIndex('resource_interval',
                                           'DateRangeIndex', extra=extra)

            # adding local_events Script (Python)
            manage_addPythonScript(rdfcalendar_ob, 'local_events')
            local_events_ob = rdfcalendar_ob._getOb('local_events')
            local_events_ob._params = 'year=None, month=None, day=None'
            local_events_ob.write(open(os.path.dirname(__file__) +
                                  '/skel/others/local_events.py', 'r').read())

        self.getPortletsTool().assign_portlet('library', 'right',
                                              'portlet_latestuploads_rdf',
                                              True)

        # set default main topics
        self.getPropertiesTool().manageMainTopics(['about', 'library'])

        # add meta on brains for group local roles
        self.getCatalogTool().addColumn('ny_ldap_group_roles')
    def loadDefaultData(self):
        """ """
        #set default 'Naaya' configuration
        NySite.__dict__['createPortalTools'](self)
        NySite.__dict__['loadDefaultData'](self)

        #remove Naaya default content
        layout_tool = self.getLayoutTool()
        naaya_skins = [skin.getId() for skin in
            layout_tool.objectValues('Naaya Skin')]
        logos = [image.getId() for image in
            layout_tool.objectValues('Image')]
        layout_tool.manage_delObjects(naaya_skins + logos)
        self.manage_delObjects('info')

        #load site skeleton - configuration
        self.loadSkeleton(ENVIROWINDOWS_PRODUCT_PATH)

        #custom indexes
        try:    self.getCatalogTool().manage_addIndex('resource_area', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_focus', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_area_exp', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_focus_exp', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_country', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass

        #default RDF Calendar settings
        manage_addRDFCalendar(self, id=ID_RDFCALENDAR, title=TITLE_RDFCALENDAR, week_day_len=1)
        rdfcalendar_ob = self._getOb(ID_RDFCALENDAR)
        #adding local_events Script (Python)
        manage_addPythonScript(rdfcalendar_ob, 'local_events')
        local_events_ob = rdfcalendar_ob._getOb('local_events')
        local_events_ob._params = 'year=None, month=None, day=None'
        local_events_ob.write(open(os.path.dirname(__file__) + '/skel/others/local_events.py', 'r').read())

        #Adding custom SchemaTool properties
        schema_tool = self.getSchemaTool()
        naaya_folder_schema = schema_tool.getSchemaForMetatype(METATYPE_FOLDER)
        widget_args = dict(
            label='Allow users enrolment here?',
            data_type='bool',
            widget_type='Checkbox',
            localized=True,
        )
        naaya_folder_schema.addWidget('show_contributor_request_role',
                                      **widget_args)

        naaya_consultation_schema = schema_tool.getSchemaForMetatype(
                                        'Naaya Consultation')
        if naaya_consultation_schema:
            naaya_consultation_schema.addWidget('show_contributor_request_role',
                                      **widget_args)

        naaya_simple_consultation_schema = schema_tool.getSchemaForMetatype(
                                        'Naaya Simple Consultation')
        if naaya_simple_consultation_schema:
            naaya_simple_consultation_schema.addWidget(
                'show_contributor_request_role', **widget_args)

        #add survey tool
        try:
            from Products.NaayaSurvey.SurveyTool import manage_addSurveyTool
            manage_addSurveyTool(self)
        except:
            pass

        self._install_link_checker()

        addNyFolder(self, id='events', title='Events', publicinterface=1)
        folder_meta_types = FolderMetaTypes(self._getOb('events'))
        folder_meta_types.set_values(['Naaya Event'])
        event_folder_custom_index = (
            "<metal:block use-macro=\"python:here.getFormsTool()."
            "getForm('event_folder_index').macros['page']\" />")
        self['events']['index'].pt_edit(text=event_folder_custom_index,
                                        content_type='')