def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     from Products.NaayaPhotoArchive.NyPhotoGallery import addNyPhotoGallery
     from Products.NaayaPhotoArchive.NyPhotoFolder import addNyPhotoFolder
     from Products.NaayaPhotoArchive.NyPhoto import addNyPhoto
     addNyFolder(self.portal,
                 'myfolder',
                 contributor='contributor',
                 submitted=1)
     addNyPhotoGallery(self.portal.myfolder,
                       id='g',
                       title='My gallery',
                       submitted=1,
                       contributor='admin')
     addNyPhotoFolder(self.portal.myfolder.g,
                      id='f',
                      title='My folder',
                      submitted=1,
                      contributor='admin')
     addNyPhoto(self.portal.myfolder.g.f,
                id='myphoto',
                title='My photo',
                submitted=1,
                contributor='contributor')
     import transaction
     transaction.commit()
    def test_cut_paste(self):
        return #TODO: cannot paste from the test; some photos are not correctly pasted (d and d, e-34, and pasting when id exists)
        photos_zip = load_file('data/test.zip')
        addNyPhotoGallery(self.portal.myfolder, id='mygallery2', title='My second photo gallery', submitted=1, contributor='contributor')
        addNyPhotoFolder(self.portal.myfolder.mygallery2, id='myalbum', title='My photo album')
        self.portal.myfolder.mygallery2.myalbum.uploadPhotoOrZip(photos_zip)
        import transaction; transaction.commit()

        album_source = self.portal.myfolder.mygallery2.myalbum
        album_destination = self.portal.myfolder.mygallery.myalbum
        pics = [
            {'zip': 'a.gif' , 'portal': 'a.gif'},
            {'zip': 'b.gif' , 'portal': 'b.gif'},
            {'zip': 'c-d.gif' , 'portal': 'c-d.gif'},
            {'zip': 'd and d.gif' , 'portal': 'd_and_d.gif'},
            {'zip': 'e-34.gif' , 'portal': 'e-34.gif'},
            {'zip': 'k.gif' , 'portal': 'k.gif'},
        ]

        photos_zip = zipfile.ZipFile(photos_zip)

        paste_data = album_source.cutObjects(ids=[pic['portal'] for pic in pics])
        album_destination.pasteObjects(cp_data=paste_data)

        for pic in pics:
            self.failIf(pic['portal'] not in album_destination.objectIds(), '%s not in destination.' % pic['portal'])
            self.browser.go('http://localhost/%s/%s/view?display=Original' % (album_destination.absolute_url(1), pic['portal']))
            self.failUnlessEqual(photos_zip.read(pic['zip']), self.browser.get_html(), '%s contents doesn\'t match original.' % pic['portal'])
 def _add_gallery(self):
     """ Add and search gallery """
     addNyPhotoGallery(self._portal().info, id='mygallery', title='Photo Gallery', lang='en')
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Photo Gallery'])
     for x in meta:
         if x.getLocalProperty('title', 'en') == 'Photo Gallery':
             return x
     return None
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     addNyPhotoGallery(self.portal.myfolder, id='mygallery', title='My photo gallery', submitted=1, contributor='contributor')
     addNyPhotoFolder(self.portal.myfolder.mygallery, id='myalbum', title='My photo album')
     addNyPhoto(self.portal.myfolder.mygallery.myalbum, id="myphoto1", title="My photo 1")
     addNyPhoto(self.portal.myfolder.mygallery.myalbum, id="myphoto2", title="My photo 2")
     self.portal.myfolder.approveThis()
     import transaction; transaction.commit()
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     from Products.NaayaPhotoArchive.NyPhotoGallery import addNyPhotoGallery
     from Products.NaayaPhotoArchive.NyPhotoFolder import addNyPhotoFolder
     from Products.NaayaPhotoArchive.NyPhoto import addNyPhoto
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     addNyPhotoGallery(self.portal.myfolder, id='g', title='My gallery', submitted=1, contributor='admin')
     addNyPhotoFolder(self.portal.myfolder.g, id='f', title='My folder', submitted=1, contributor='admin')
     addNyPhoto(self.portal.myfolder.g.f, id='myphoto', title='My photo', submitted=1, contributor='contributor')
     import transaction; transaction.commit()
     transaction.commit()
    def afterSetUp(self):
        from Products.Naaya.NyFolder import addNyFolder
        from Products.NaayaPhotoArchive.NyPhotoGallery import addNyPhotoGallery
        from Products.NaayaPhotoArchive.NyPhotoFolder import addNyPhotoFolder
        from Products.NaayaPhotoArchive.NyPhoto import addNyPhoto

        addNyFolder(self.portal, "myfolder", contributor="contributor", submitted=1)
        addNyPhotoGallery(self.portal.myfolder, id="g", title="My gallery", submitted=1, contributor="admin")
        addNyPhotoFolder(self.portal.myfolder.g, id="f", title="My folder", submitted=1, contributor="admin")
        addNyPhoto(self.portal.myfolder.g.f, id="myphoto", title="My photo", submitted=1, contributor="contributor")
        import transaction

        transaction.commit()
Exemple #7
0
 def add_object(self, parent):
     kwargs = {
         'id': 'mygallery',
         'title': 'My photo gallery',
         'submitted': 1,
         'contributor': 'contributor',
         'start_date': "10/10/2000",
     }
     ob = parent[addNyPhotoGallery(parent, **kwargs)]
     ob.approveThis()
     return ob
 def add_object(self, parent):
     kwargs = {
         'id': 'mygallery',
         'title': 'My photo gallery',
         'submitted': 1,
         'contributor': 'contributor',
         'start_date': "10/10/2000",
     }
     ob = parent[addNyPhotoGallery(parent, **kwargs)]
     ob.approveThis()
     return ob
Exemple #9
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')
Exemple #10
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')