示例#1
0
    def test_events(self):
        """ Find NaayaEvents """

        calendar_id = 'portal_calendar'

        #add calendar
        manage_addEventCalendar(self._portal(),
                                id=calendar_id,
                                title='Events calendar',
                                day_len='3',
                                start_day='Monday',
                                catalog='portal_catalog')
        calendar = self._portal()._getOb(calendar_id)
        calendar.cal_meta_types = calendar.setCalMetaTypes('Naaya Event')

        #add portal catalog index
        catalog = self._portal()._getOb('portal_catalog')
        extra = Record(since_field='start_date', until_field='end_date')
        catalog.addIndex('resource_interval', 'DateRangeIndex', extra)

        #add event
        addNyFolder(self._portal(), 'myfolder')
        addNyEvent(self._portal().myfolder,
                   id='myevent',
                   title='My event',
                   lang='en',
                   start_date="10/10/2000",
                   end_date="15/10/2000")
        event = self._portal().myfolder._getOb('myevent')

        #get events
        self.assertEqual(calendar.getEvents(year=2000, month=10),
                         [(event, '10 October 2000', '15 October 2000')])
示例#2
0
    def test_main(self):
        """ Add, Edit, Delete Naaya Calendar """

        calendar_id = 'portal_calendar'

        #add
        manage_addEventCalendar(self._portal(),
                                id=calendar_id,
                                title='Events calendar',
                                day_len='3',
                                start_day='Monday',
                                catalog='portal_catalog')
        self.assertTrue(hasattr(self._portal(), calendar_id))

        #edit properties
        calendar = self._portal()._getOb(calendar_id)
        calendar.manageProperties(title='Events calendar edited',
                                  description='Calendar of events edited',
                                  day_len='1',
                                  cal_meta_types='Naaya Event',
                                  start_day='Sunday',
                                  catalog='portal_catalog')

        self.assertEqual(calendar.getCalMetaTypes(), 'Naaya Event')
        self.assertEqual(calendar.catalog, 'portal_catalog')

        #delete
        self._portal().manage_delObjects([calendar_id])
        self.assertFalse(hasattr(self._portal(), calendar_id))
示例#3
0
    def loadDefaultData(self):
        """ """
        #set default 'Naaya' configuration
        NySite.__dict__['createPortalTools'](self)
        NySite.__dict__['loadDefaultData'](self)

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

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

        #set default PhotoFolder
        manage_addNyPhotoFolder(self, ID_PHOTOARCHIVE, TITLE_PHOTOARCHIVE)
        self._getOb(ID_PHOTOARCHIVE).approveThis()

        #create and configure LinkChecker instance
        manage_addLinkChecker(self, ID_LINKCHECKER, TITLE_LINKCHECKER)
        linkchecker_ob = self._getOb(ID_LINKCHECKER)
        linkchecker_ob.manage_edit(proxy='', batch_size=10, catalog_name=ID_CATALOGTOOL)
        linkchecker_ob.manage_addMetaType(METATYPE_NYURL)
        linkchecker_ob.manage_addProperty(METATYPE_NYURL, 'locator')
        for k,v in self.get_content_urls().items():
            linkchecker_ob.manage_addMetaType(k)
            for p in v:
                linkchecker_ob.manage_addProperty(k, p)

        #create helpdesk instance
        manage_addHelpDesk(self, ID_HELPDESKAGENT, TITLE_HELPDESKAGENT, self.getAuthenticationToolPath(1))
        #create NaayaCalendar instance
        manage_addEventCalendar(self, id="portal_calendar", title='Calendar of Events', description='',
                            day_len='2', cal_meta_types='Naaya Event', start_day='Monday', catalog=self.getCatalogTool().id, REQUEST=None)
        #create index for Naaya Calendar
        extra=Extra_for_DateRangeIndex(since_field='start_date', until_field='end_date')
        self.getCatalogTool().manage_addIndex("resource_interval", 'DateRangeIndex', extra=extra)
        #create and fill glossaries
        manage_addGlossaryCentre(self, ID_GLOSSARY_KEYWORDS, TITLE_GLOSSARY_KEYWORDS)
        self._getOb(ID_GLOSSARY_KEYWORDS).xliff_import(self.futRead(join(CHM2_PRODUCT_PATH, 'skel', 'others', 'glossary_keywords.xml')))
        self.add_glossary_coverage()

        #portal_map custom index
        custom_map_index = self.futRead(join(CHM2_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='')
        
        #set glossary for pick lists
        self.keywords_glossary = ID_GLOSSARY_KEYWORDS
        self.coverage_glossary = ID_GLOSSARY_COVERAGE
        self._p_changed = 1
        #add Forum instance
        manage_addNyForum(self, id='portal_forum', title='CHM Forum', description='', categories=['CHM', 'Biodiversity', 'Other'], file_max_size=0, REQUEST=None)
    def test_main(self):
        """ Add, Edit, Delete Naaya Calendar """

        calendar_id = 'portal_calendar'

        #add
        manage_addEventCalendar(self._portal(), id=calendar_id, title='Events calendar', day_len='3', start_day='Monday', catalog='portal_catalog')
        self.assertTrue(hasattr(self._portal(), calendar_id))

        #edit properties
        calendar = self._portal()._getOb(calendar_id)
        calendar.manageProperties(title='Events calendar edited', description='Calendar of events edited', day_len='1',
                         cal_meta_types='Naaya Event', start_day='Sunday', catalog='portal_catalog')

        self.assertEqual(calendar.getCalMetaTypes(), 'Naaya Event')
        self.assertEqual(calendar.catalog, 'portal_catalog')

        #delete
        self._portal().manage_delObjects([calendar_id])
        self.assertFalse(hasattr(self._portal(), calendar_id))
    def test_events(self):
        """ Find NaayaEvents """

        calendar_id = 'portal_calendar'

        #add calendar
        manage_addEventCalendar(self._portal(), id=calendar_id, title='Events calendar', day_len='3', start_day='Monday', catalog='portal_catalog')
        calendar = self._portal()._getOb(calendar_id)
        calendar.cal_meta_types = calendar.setCalMetaTypes('Naaya Event')

        #add portal catalog index
        catalog = self._portal()._getOb('portal_catalog')
        extra = Record(since_field='start_date', until_field='end_date')
        catalog.addIndex('resource_interval', 'DateRangeIndex', extra)

        #add event
        addNyFolder(self._portal(), 'myfolder')
        addNyEvent(self._portal().myfolder, id='myevent', title='My event', lang='en', start_date="10/10/2000", end_date="15/10/2000")
        event = self._portal().myfolder._getOb('myevent')

        #get events
        self.assertEqual(calendar.getEvents(year=2000, month=10), [(event, '10 October 2000', '15 October 2000')])
示例#6
0
文件: CHMSite.py 项目: eaudeweb/naaya
    def loadDefaultData(self):
        """ """
        # set default 'Naaya' configuration
        NySite.__dict__["createPortalTools"](self)
        NySite.__dict__["loadDefaultData"](self)

        # load site skeleton - configuration
        self.loadSkeleton(join(CHM2_PRODUCT_PATH, "skel"))

        # remove Naaya default content
        self.getLayoutTool().manage_delObjects("skin")

        # set default PhotoFolder
        manage_addNyPhotoFolder(self, ID_PHOTOARCHIVE, TITLE_PHOTOARCHIVE)
        self._getOb(ID_PHOTOARCHIVE).approveThis()

        # create and configure LinkChecker instance
        manage_addLinkChecker(self, ID_LINKCHECKER, TITLE_LINKCHECKER)
        linkchecker_ob = self._getOb(ID_LINKCHECKER)
        linkchecker_ob.manage_edit(proxy="", batch_size=10, catalog_name=ID_CATALOGTOOL)
        linkchecker_ob.manage_addMetaType(METATYPE_NYURL)
        linkchecker_ob.manage_addProperty(METATYPE_NYURL, "locator")
        for k, v in self.get_content_urls().items():
            linkchecker_ob.manage_addMetaType(k)
            for p in v:
                linkchecker_ob.manage_addProperty(k, p)

        # create helpdesk instance
        manage_addHelpDesk(self, ID_HELPDESKAGENT, TITLE_HELPDESKAGENT, self.getAuthenticationToolPath(1))
        # create NaayaCalendar instance
        manage_addEventCalendar(
            self,
            id="portal_calendar",
            title="Calendar of Events",
            description="",
            day_len="2",
            cal_meta_types="Naaya Event",
            start_day="Monday",
            catalog=self.getCatalogTool().id,
            REQUEST=None,
        )
        # create index for Naaya Calendar
        extra = Extra_for_DateRangeIndex(since_field="start_date", until_field="end_date")
        self.getCatalogTool().manage_addIndex("resource_interval", "DateRangeIndex", extra=extra)
        # create and fill glossaries
        manage_addGlossaryCentre(self, ID_GLOSSARY_KEYWORDS, TITLE_GLOSSARY_KEYWORDS)
        self._getOb(ID_GLOSSARY_KEYWORDS).xliff_import(
            self.futRead(join(CHM2_PRODUCT_PATH, "skel", "others", "glossary_keywords.xml"))
        )
        self.add_glossary_coverage()

        # portal_map custom index
        custom_map_index = self.futRead(join(CHM2_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="")

        # set glossary for pick lists
        self.keywords_glossary = ID_GLOSSARY_KEYWORDS
        self.coverage_glossary = ID_GLOSSARY_COVERAGE
        self._p_changed = 1
        # add Forum instance
        manage_addNyForum(
            self,
            id="portal_forum",
            title="CHM Forum",
            description="",
            categories=["CHM", "Biodiversity", "Other"],
            file_max_size=0,
            REQUEST=None,
        )
示例#7
0
    def loadDefaultData(self, load_glossaries=[], skel_handler=None):
        """ """
        # 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)

        # load site skeleton - configuration
        if skel_handler is not None:
            self._load_skel_from_handler(skel_handler)

        # set default PhotoFolder
        addNyPhotoGallery(self, id='PhotoGallery', title=TITLE_PHOTOARCHIVE)
        self._getOb('PhotoGallery').approveThis()

        # create and configure LinkChecker instance
        manage_addLinkChecker(self, ID_LINKCHECKER, TITLE_LINKCHECKER)
        linkchecker_ob = self._getOb(ID_LINKCHECKER)
        linkchecker_ob.manage_edit(proxy='', batch_size=10,
                                   catalog_name=ID_CATALOGTOOL)
        linkchecker_ob.manage_addMetaType(METATYPE_NYURL)
        linkchecker_ob.manage_addProperty(METATYPE_NYURL, 'locator')
        for k, v in self.get_content_urls().items():
            linkchecker_ob.manage_addMetaType(k)
            for p in v:
                linkchecker_ob.manage_addProperty(k, p)

        # set default main topics
        self.getPropertiesTool().manageMainTopics(['convention', 'cooperation',
                                                   'network', 'information'])

        # create NaayaCalendar instance
        manage_addEventCalendar(
            self, id="portal_calendar", title='Calendar of Events',
            description='', day_len='2', start_day='Monday',
            catalog=self.getCatalogTool().id, REQUEST=None)
        calendar = self._getOb('portal_calendar')
        calendar.cal_meta_types = calendar.setCalMetaTypes('Naaya Event')
        # create index for Naaya Calendar
        extra = Extra_for_DateRangeIndex(since_field='start_date',
                                         until_field='end_date')
        self.getCatalogTool().manage_addIndex("resource_interval",
                                              'DateRangeIndex', extra=extra)

        # create and fill glossaries
        if 'coverage' in load_glossaries:
            self.add_glossary_coverage()
        if 'keywords' in load_glossaries:
            self.add_glossary_keywords()
        if 'chm_terms' in load_glossaries:
            self.add_chm_terms_glossary()

        # set glossary for pick lists
        self._p_changed = 1
        # add Forum instance
        addNyForum(self, id='portal_forum', title='CHM Forum', description='',
                   categories=['CHM', 'Biodiversity', 'Other'],
                   file_max_size=0, REQUEST=None)
        # add EC CHM to network portals list
        self.admin_addnetworkportal('EC CHM',
                                    'http://biodiversity-chm.eea.europa.eu/')

        # enable some notifications
        self['portal_notification'].config['enable_monthly'] = True

        portal_layout = self['portal_layout']
        if 'chm3' in portal_layout.objectIds():
            portal_layout['chm3']._setProperty('main_section_image_size',
                                               '978x75')
            portal_layout['chm3']._setProperty('slider_image_size', '978x240')
示例#8
0
    def loadDefaultData(self, load_glossaries=[], skel_handler=None):
        """ """
        #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)

        #load site skeleton - configuration
        if skel_handler is not None:
            self._load_skel_from_handler(skel_handler)

        #set default PhotoFolder
        addNyPhotoGallery(self, id='PhotoGallery', title=TITLE_PHOTOARCHIVE)
        self._getOb('PhotoGallery').approveThis()

        #create and configure LinkChecker instance
        manage_addLinkChecker(self, ID_LINKCHECKER, TITLE_LINKCHECKER)
        linkchecker_ob = self._getOb(ID_LINKCHECKER)
        linkchecker_ob.manage_edit(proxy='',
                                   batch_size=10,
                                   catalog_name=ID_CATALOGTOOL)
        linkchecker_ob.manage_addMetaType(METATYPE_NYURL)
        linkchecker_ob.manage_addProperty(METATYPE_NYURL, 'locator')
        for k, v in self.get_content_urls().items():
            linkchecker_ob.manage_addMetaType(k)
            for p in v:
                linkchecker_ob.manage_addProperty(k, p)

        #set default main topics
        self.getPropertiesTool().manageMainTopics(
            ['convention', 'cooperation', 'network', 'information'])

        #create NaayaCalendar instance
        manage_addEventCalendar(self,
                                id="portal_calendar",
                                title='Calendar of Events',
                                description='',
                                day_len='2',
                                start_day='Monday',
                                catalog=self.getCatalogTool().id,
                                REQUEST=None)
        calendar = self._getOb('portal_calendar')
        calendar.cal_meta_types = calendar.setCalMetaTypes('Naaya Event')
        #create index for Naaya Calendar
        extra = Extra_for_DateRangeIndex(since_field='start_date',
                                         until_field='end_date')
        self.getCatalogTool().manage_addIndex("resource_interval",
                                              'DateRangeIndex',
                                              extra=extra)

        #create and fill glossaries
        if 'coverage' in load_glossaries:
            self.add_glossary_coverage()
        if 'keywords' in load_glossaries:
            self.add_glossary_keywords()
        if 'chm_terms' in load_glossaries:
            self.add_chm_terms_glossary()

        #set glossary for pick lists
        self._p_changed = 1
        #add Forum instance
        addNyForum(self,
                   id='portal_forum',
                   title='CHM Forum',
                   description='',
                   categories=['CHM', 'Biodiversity', 'Other'],
                   file_max_size=0,
                   REQUEST=None)
        #add EC CHM to network portals list
        self.admin_addnetworkportal('EC CHM',
                                    'http://biodiversity-chm.eea.europa.eu/')

        # enable some notifications
        self['portal_notification'].config['enable_monthly'] = True

        portal_layout = self['portal_layout']
        if 'chm3' in portal_layout.objectIds():
            portal_layout['chm3']._setProperty('main_section_image_size',
                                               '978x75')
            portal_layout['chm3']._setProperty('slider_image_size', '978x240')