Пример #1
0
def setupCollections(portal, logger):
    """
       Collections for display 
       latestvideos / featured-videos / news-and-events
    """

    wftool = getToolByName(portal,'portal_workflow')

    #The front page, @@featured_videos_homepage, contains
    #links to 'featured-videos' which is a smart folder containing
    #all the videos with keyword 'featured' and 'lastestvideos'
    #which is a smart folder of the latest videos. this method will
    #simply install them.

    # Items to deploy on install.
    items = (dict(id      = 'featured-videos',
                  title   = _(u'Featured Videos'),
                  desc    = _(u'Videos featured by the editorial team.'),
                  layout  = "video_listing_view",
                  exclude = True),

             dict(id      = 'latestvideos',
                  title   = _(u'Latest Videos'),
                  desc    = _(u''),
                  layout  = "video_listing_view",
                  exclude = False),

             dict(id      = 'recent_comments',
                  title   = _(u'Recent Comments'),
                  desc    = _(u'Recent comments.'),
                  layout  = "folder_listing",
                  exclude = True),

            )

    # Items creation
    for item in items:
        try:
            canon = getattr(portal, item['id'])
            deleteTranslations(canon)
            portal.manage_delObjects([item['id']])
        except:
            ## This is nasty to silence it all
            pass

        # We create the element
        portal.invokeFactory('Topic',
                           id = item['id'],
                           title = item['title'],
                           description = item['desc'].translate({}))

        fv = getattr(portal, item['id'])
 

        # We change its ownership and wf status
        publishObject(wftool, fv)

        # Filter results to ATEngageVideo
        # Have to use the name of the Title (and ATEngageVideo will be 
        #    re-named by configATEngageVideo to Video!)
        # this will actually use ALL objects with title 'Video', which 
        #    means atm, ATEngageVideo and ATVideo
        type_criterion = fv.addCriterion('Type', 'ATPortalTypeCriterion')
        if item['id'] is 'recent_comments':
            type_criterion.setValue( ("Comment") )
            sort_crit = fv.addCriterion('created',"ATSortCriterion")
            right = getUtility(IPortletManager, name='plone.rightcolumn')
            rightColumnInThisContext = getMultiAdapter((portal, right), IPortletAssignmentMapping)
            urltool  = getToolByName(portal, 'portal_url')
            commentsCollectionPortlet = Assignment(header=u"Recent Comments",
                                        limit=5,
                                        target_collection = '/'.join(urltool.getRelativeContentPath(portal.recent_comments)),
                                        random=False,
                                        show_more=True,
                                        show_dates=True)
          
    
            def saveAssignment(mapping, assignment):
                chooser = INameChooser(mapping)
                mapping[chooser.chooseName(None, assignment)] = assignment
            if not rightColumnInThisContext.has_key('recent-comments'):
                saveAssignment(rightColumnInThisContext, commentsCollectionPortlet)
          
    
            def saveAssignment(mapping, assignment):
                chooser = INameChooser(mapping)
                mapping[chooser.chooseName(None, assignment)] = assignment
            if not rightColumnInThisContext.has_key('recent-comments'):
                saveAssignment(rightColumnInThisContext, commentsCollectionPortlet)

        else:
            type_criterion.setValue("Video")
            sort_crit = fv.addCriterion('effective',"ATSortCriterion")

        sort_crit.setReversed(True)

        ## add criteria for showing only published videos
        state_crit = fv.addCriterion('review_state', 'ATListCriterion')
        if item['id'] is 'featured-videos':
            state_crit.setValue(['featured'])
        elif item['id'] is 'news_and_events':
            state_crit.setValue(['published'])
        else:
            state_crit.setValue(['published','featured'])

        if item['exclude'] is True:
            fv.setExcludeFromNav(True)

        if item['layout'] is not None:
            fv.setLayout(item['layout'])

        fv.reindexObject()
Пример #2
0
def setupDocuments(self, logger):

    wftool = getToolByName(self, 'portal_workflow')

    #Avoid doing all the following when reinstalling

    # Taxonomy - smart folder hierarchy setup - genres/categories/countries/
    #    for videos we automatically [RE]create collections , hierarchically,
    #    for all available vocabulary items
    #
    logger.info('starting taxonomy hierarchy setup')

    #delete the taxonomy folder and it's translations.
    #this should also delete all children and children's children etc
    try:
        canon = getattr(self, 'taxonomy')
        deleteTranslations(canon)
        self.manage_delObjects(['taxonomy'])
    except:
        pass
    self.invokeFactory(
        'Folder',
        id=TOPLEVEL_TAXONOMY_FOLDER,
        title=_(u'Browse Content'),
        #                      description = _(u'The top-level taxonomy of the content')
    )
    taxonomy_fldr = getattr(self, TOPLEVEL_TAXONOMY_FOLDER, None)
    # we start in 'taxonomy', and shld already have sub-folders constructed
    #    to hold the topics objects (smart folders), via generic setup XML
    publishObject(wftool, taxonomy_fldr)

    createTranslations(self, taxonomy_fldr)
    layout_name = "video_listing_view"

    #
    # 1 of 5: video genre
    #
    taxonomy_fldr.invokeFactory('Folder',
                                id=GENRE_FOLDER,
                                title=_(u'Video Genres'))
    genre_fldr = getattr(taxonomy_fldr, GENRE_FOLDER, None)
    publishObject(wftool, genre_fldr)
    createTranslations(self, genre_fldr)
    #description string for new smart folders
    for vocab in vocabs['video_genre']:
        new_smart_fldr_id = vocab[0]

        #skip topic creation if id=None
        if not new_smart_fldr_id == "none":
            #make the new SmartFolder
            genre_fldr.invokeFactory('Topic',
                                     id=new_smart_fldr_id,
                                     title=vocab[1])
            fldr = getattr(genre_fldr, new_smart_fldr_id)

            # Filter results to Plumi Video
            type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion')
            #Have to use the name of the Title of the Type you want to filter.
            type_criterion.setValue("Video")

            # Filter results to this individual genre
            type_criterion = fldr.addCriterion('getGenre',
                                               'ATSimpleStringCriterion')
            #match against the ID of the vocab term. see getGenre in content types
            type_criterion.setValue(vocab[0])
            ## add criteria for showing only published videos
            state_crit = fldr.addCriterion('review_state', 'ATListCriterion')
            state_crit.setValue(['published', 'featured'])

            #XXX used to have a custom getFirstPublishedTransitionTime
            #sort on reverse date order, using the first published time transition
            sort_crit = fldr.addCriterion('effective', "ATSortCriterion")
            sort_crit.setReversed(True)

            #make the folder published
            fldr.setLayout(layout_name)
            publishObject(wftool, fldr)
            createTranslations(self, fldr)

    #
    # 2 of 5: video categories aka topic
    #
    taxonomy_fldr.invokeFactory('Folder',
                                id=CATEGORIES_FOLDER,
                                title=_(u'Video Topics'))
    categ_fldr = getattr(taxonomy_fldr, CATEGORIES_FOLDER, None)
    publishObject(wftool, categ_fldr)
    createTranslations(self, categ_fldr)

    for vocab in vocabs['video_categories']:
        new_smart_fldr_id = vocab[0]
        #skip topic creation if id=None
        if not new_smart_fldr_id == "none":
            #make the new SmartFolder
            categ_fldr.invokeFactory('Topic',
                                     id=new_smart_fldr_id,
                                     title=vocab[1])
            fldr = getattr(categ_fldr, new_smart_fldr_id)

            # Filter results to Plumi Video
            type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion')
            type_criterion.setValue("Video")
            # Filter results to this individual category
            type_criterion = fldr.addCriterion('getCategories',
                                               'ATListCriterion')
            #match against the ID of the vocab term. see getCategories in content objects
            type_criterion.setValue(vocab[0])
            #match if any vocab term is present in the video's selected categories
            type_criterion.setOperator('or')
            ## add criteria for showing only published videos
            state_crit = fldr.addCriterion('review_state', 'ATListCriterion')
            state_crit.setValue(['published', 'featured'])
            #sort on reverse date order
            #XXX old getfirstpublishedtransition time
            sort_crit = fldr.addCriterion('effective', "ATSortCriterion")
            sort_crit.setReversed(True)

            #make the folder published.
            fldr.setLayout(layout_name)
            publishObject(wftool, fldr)
            createTranslations(self, fldr)

    #
    # 3 of 5: video countries
    #

    #Countries
    #get the countries from the country vocab!

    taxonomy_fldr.invokeFactory('Folder',
                                id=COUNTRIES_FOLDER,
                                title=_(u'Countries'))
    countries_fldr = getattr(taxonomy_fldr, COUNTRIES_FOLDER, None)
    publishObject(wftool, countries_fldr)
    createTranslations(self, countries_fldr)

    for country in vocabs['video_countries']:
        new_smart_fldr_id = country[0]

        # maybe it already exists?
        try:
            #skip topic creation if id=None
            if not new_smart_fldr_id == "none":
                # make the new SmartFolder
                if new_smart_fldr_id == 'XX':
                    #International country has --International-- title to show first on drop down, we're overriding that
                    countries_fldr.invokeFactory('Topic',
                                                 id=new_smart_fldr_id,
                                                 title='International')
                else:
                    countries_fldr.invokeFactory('Topic',
                                                 id=new_smart_fldr_id,
                                                 title=country[1])
                fldr = getattr(countries_fldr, new_smart_fldr_id)

                # Filter results to  Plumi Video
                type_criterion = fldr.addCriterion('Type',
                                                   'ATPortalTypeCriterion')
                type_criterion.setValue("Video")

                # Filter results to this individual category
                type_criterion = fldr.addCriterion('getCountries',
                                                   'ATListCriterion')
                #
                #match against the ID of the vocab term. see getCategories in content objects
                type_criterion.setValue(country[0])
                #match if any vocab term is present in the video's selected categories
                type_criterion.setOperator('or')
                ## add criteria for showing only published videos
                state_crit = fldr.addCriterion('review_state',
                                               'ATListCriterion')
                state_crit.setValue(['published', 'featured'])
                #sort on reverse date order
                sort_crit = fldr.addCriterion('effective', "ATSortCriterion")
                sort_crit.setReversed(True)
                #publish folder
                fldr.setLayout(layout_name)
                publishObject(wftool, fldr)
                createTranslations(self, fldr)
        except:
            # should be ok from previous installation
            pass


#    #
#    #4 of 5 : CallOut submission categories
#    #
#    topic_description_string = "CallOuts for Topic - %s "
#    taxonomy_fldr.invokeFactory('Folder',id=SUBMISSIONS_FOLDER,
#                                title=_(u'Call Outs'))
#    submissions_fldr = getattr(taxonomy_fldr,SUBMISSIONS_FOLDER,None)
#    #publishObject(wftool,submissions_fldr)
#    createTranslations(self,submissions_fldr)

#    for submission_categ in vocabs['submission_categories']:
#        new_smart_fldr_id = submission_categ[0]
#
#        #skip topic creation if id=None
#        if not new_smart_fldr_id == "none":
#            #make the new SmartFolder
#            submissions_fldr.invokeFactory('Topic', id=new_smart_fldr_id,title=submission_categ[1])
#            fldr = getattr(submissions_fldr,new_smart_fldr_id)
#            # Filter results to Callouts
#            type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion' )
#            #the title of the type, not the class name, or portal_type
#            type_criterion.setValue("Plumi Call Out")
#
#            # Filter results to this individual category
#            type_criterion = fldr.addCriterion('getSubmissionCategories', 'ATListCriterion' )
#            #
#            #match against the ID of the vocab term. see getCategories in callout.py (Callout object)
#            type_criterion.setValue(submission_categ[0])
#            #match if any vocab term is present in the video's selected categories
#            type_criterion.setOperator('or')
#
#            ## add criteria for showing only published callouts
#            state_crit = fldr.addCriterion('review_state', 'ATSimpleStringCriterion')
#            state_crit.setValue(['published','featured'])
#            #sort on reverse date order
#            sort_crit = fldr.addCriterion('effective',"ATSortCriterion")
#            sort_crit.setReversed(True)
#            #publish the folder
#            fldr.setLayout(layout_name)
#            publishObject(wftool,fldr)
#            createTranslations(self,fldr)

#
# 5 of 5: video languages
#

#Languages
#get the languages from the languages vocab!

    taxonomy_fldr.invokeFactory('Folder',
                                id=LANGUAGES_FOLDER,
                                title=_(u'Video Languages'))
    languages_fldr = getattr(taxonomy_fldr, LANGUAGES_FOLDER, None)
    publishObject(wftool, languages_fldr)
    createTranslations(self, languages_fldr)

    for language in vocabs['video_languages']:
        new_smart_fldr_id = language[0]

        # maybe it already exists?
        try:
            #skip topic creation if id=None
            if not new_smart_fldr_id == "none":
                # make the new SmartFolder
                languages_fldr.invokeFactory('Topic',
                                             id=new_smart_fldr_id,
                                             title=language[1])
                fldr = getattr(languages_fldr, new_smart_fldr_id)

                # Filter results to  Plumi Video
                type_criterion = fldr.addCriterion('Type',
                                                   'ATPortalTypeCriterion')
                type_criterion.setValue("Video")

                # Filter results to this individual category
                type_criterion = fldr.addCriterion('getVideoLanguage',
                                                   'ATListCriterion')
                #
                #match against the ID of the vocab term. see getCategories in content objects
                type_criterion.setValue(language[0])
                #match if any vocab term is present in the video's selected categories
                type_criterion.setOperator('or')
                ## add criteria for showing only published videos
                state_crit = fldr.addCriterion('review_state',
                                               'ATListCriterion')
                state_crit.setValue(['published', 'featured'])
                #sort on reverse date order
                sort_crit = fldr.addCriterion('effective', "ATSortCriterion")
                sort_crit.setReversed(True)
                #publish folder
                fldr.setLayout(layout_name)
                publishObject(wftool, fldr)
                createTranslations(self, fldr)
        except:
            # should be ok from previous installation
            pass
def setupDocuments(self, logger):

    wftool = getToolByName(self, "portal_workflow")

    # Avoid doing all the following when reinstalling

    # Taxonomy - smart folder hierarchy setup - genres/categories/countries/
    #    for videos we automatically [RE]create collections , hierarchically,
    #    for all available vocabulary items
    #
    logger.info("starting taxonomy hierarchy setup")

    # delete the taxonomy folder and it's translations.
    # this should also delete all children and children's children etc
    try:
        canon = getattr(self, "taxonomy")
        deleteTranslations(canon)
        self.manage_delObjects(["taxonomy"])
    except:
        pass
    self.invokeFactory(
        "Folder",
        id=TOPLEVEL_TAXONOMY_FOLDER,
        title=_(u"Browse Content"),
        #                      description = _(u'The top-level taxonomy of the content')
    )
    taxonomy_fldr = getattr(self, TOPLEVEL_TAXONOMY_FOLDER, None)
    # we start in 'taxonomy', and shld already have sub-folders constructed
    #    to hold the topics objects (smart folders), via generic setup XML
    publishObject(wftool, taxonomy_fldr)

    createTranslations(self, taxonomy_fldr)
    layout_name = "video_listing_view"

    #
    # 1 of 5: video genre
    #
    taxonomy_fldr.invokeFactory("Folder", id=GENRE_FOLDER, title=_(u"Media Genres"))
    genre_fldr = getattr(taxonomy_fldr, GENRE_FOLDER, None)
    publishObject(wftool, genre_fldr)
    createTranslations(self, genre_fldr)
    # description string for new smart folders
    for vocab in vocabs["video_genre"]:
        new_smart_fldr_id = vocab[0]

        # skip topic creation if id=None
        if not new_smart_fldr_id == "none":
            # make the new SmartFolder
            genre_fldr.invokeFactory("Topic", id=new_smart_fldr_id, title=vocab[1])
            fldr = getattr(genre_fldr, new_smart_fldr_id)

            # Filter results to Plumi Video
            type_criterion = fldr.addCriterion("Type", "ATPortalTypeCriterion")
            # Have to use the name of the Title of the Type you want to filter.
            type_criterion.setValue("Video")

            # Filter results to this individual genre
            type_criterion = fldr.addCriterion("getGenre", "ATSimpleStringCriterion")
            # match against the ID of the vocab term. see getGenre in content types
            type_criterion.setValue(vocab[0])
            ## add criteria for showing only published videos
            state_crit = fldr.addCriterion("review_state", "ATListCriterion")
            state_crit.setValue(["published", "featured"])

            # XXX used to have a custom getFirstPublishedTransitionTime
            # sort on reverse date order, using the first published time transition
            sort_crit = fldr.addCriterion("effective", "ATSortCriterion")
            sort_crit.setReversed(True)

            # make the folder published
            fldr.setLayout(layout_name)
            publishObject(wftool, fldr)
            createTranslations(self, fldr)

    #
    # 2 of 5: video categories aka topic
    #
    taxonomy_fldr.invokeFactory("Folder", id=CATEGORIES_FOLDER, title=_(u"Media Topics"))
    categ_fldr = getattr(taxonomy_fldr, CATEGORIES_FOLDER, None)
    publishObject(wftool, categ_fldr)
    createTranslations(self, categ_fldr)

    for vocab in vocabs["video_categories"]:
        new_smart_fldr_id = vocab[0]
        # skip topic creation if id=None
        if not new_smart_fldr_id == "none":
            # make the new SmartFolder
            categ_fldr.invokeFactory("Topic", id=new_smart_fldr_id, title=vocab[1])
            fldr = getattr(categ_fldr, new_smart_fldr_id)

            # Filter results to Plumi Video
            type_criterion = fldr.addCriterion("Type", "ATPortalTypeCriterion")
            type_criterion.setValue("Video")
            # Filter results to this individual category
            type_criterion = fldr.addCriterion("getCategories", "ATListCriterion")
            # match against the ID of the vocab term. see getCategories in content objects
            type_criterion.setValue(vocab[0])
            # match if any vocab term is present in the video's selected categories
            type_criterion.setOperator("or")
            ## add criteria for showing only published videos
            state_crit = fldr.addCriterion("review_state", "ATListCriterion")
            state_crit.setValue(["published", "featured"])
            # sort on reverse date order
            # XXX old getfirstpublishedtransition time
            sort_crit = fldr.addCriterion("effective", "ATSortCriterion")
            sort_crit.setReversed(True)

            # make the folder published.
            fldr.setLayout(layout_name)
            publishObject(wftool, fldr)
            createTranslations(self, fldr)

    #
    # 3 of 5: video countries
    #

    # Countries
    # get the countries from the country vocab!

    taxonomy_fldr.invokeFactory("Folder", id=COUNTRIES_FOLDER, title=_(u"Countries"))
    countries_fldr = getattr(taxonomy_fldr, COUNTRIES_FOLDER, None)
    publishObject(wftool, countries_fldr)
    createTranslations(self, countries_fldr)

    for country in vocabs["video_countries"]:
        new_smart_fldr_id = country[0]

        # maybe it already exists?
        try:
            # skip topic creation if id=None
            if not new_smart_fldr_id == "none":
                # make the new SmartFolder
                if new_smart_fldr_id == "XX":
                    # International country has --International-- title to show first on drop down, we're overriding that
                    countries_fldr.invokeFactory("Topic", id=new_smart_fldr_id, title="International")
                else:
                    countries_fldr.invokeFactory("Topic", id=new_smart_fldr_id, title=country[1])
                fldr = getattr(countries_fldr, new_smart_fldr_id)

                # Filter results to  Plumi Video
                type_criterion = fldr.addCriterion("Type", "ATPortalTypeCriterion")
                type_criterion.setValue("Video")

                # Filter results to this individual category
                type_criterion = fldr.addCriterion("getCountries", "ATListCriterion")
                #
                # match against the ID of the vocab term. see getCategories in content objects
                type_criterion.setValue(country[0])
                # match if any vocab term is present in the video's selected categories
                type_criterion.setOperator("or")
                ## add criteria for showing only published videos
                state_crit = fldr.addCriterion("review_state", "ATListCriterion")
                state_crit.setValue(["published", "featured"])
                # sort on reverse date order
                sort_crit = fldr.addCriterion("effective", "ATSortCriterion")
                sort_crit.setReversed(True)
                # publish folder
                fldr.setLayout(layout_name)
                publishObject(wftool, fldr)
                createTranslations(self, fldr)
        except:
            # should be ok from previous installation
            pass
Пример #4
0
def setupDocuments(self, logger):
    
    wftool = getToolByName(self,'portal_workflow')

    #Avoid doing all the following when reinstalling

    # Taxonomy - smart folder hierarchy setup - genres/categories/countries/ 
    #    for videos we automatically [RE]create collections , hierarchically, 
    #    for all available vocabulary items
    #
    logger.info('starting taxonomy hierarchy setup')

    #delete the taxonomy folder and it's translations.
    #this should also delete all children and children's children etc
    try:
        canon = getattr(self, 'taxonomy')
        deleteTranslations(canon)
        self.manage_delObjects(['taxonomy'])
    except:
        pass
    self.invokeFactory('Folder', id = TOPLEVEL_TAXONOMY_FOLDER,
                       title = _(u'Browse Content'),
#                      description = _(u'The top-level taxonomy of the content')
                       )
    taxonomy_fldr = getattr(self,TOPLEVEL_TAXONOMY_FOLDER,None) 
    # we start in 'taxonomy', and shld already have sub-folders constructed
    #    to hold the topics objects (smart folders), via generic setup XML
    publishObject(wftool,taxonomy_fldr)

    createTranslations(self,taxonomy_fldr)
    layout_name = "video_listing_view"


    #
    # 1 of 5: video genre
    #
    taxonomy_fldr.invokeFactory('Folder', id=GENRE_FOLDER, 
                                title=_(u'Video Genres'))
    genre_fldr = getattr(taxonomy_fldr, GENRE_FOLDER,None)
    publishObject(wftool,genre_fldr)
    createTranslations(self,genre_fldr)
    #description string for new smart folders
    for vocab in vocabs['video_genre']:
        new_smart_fldr_id = vocab[0]

        #skip topic creation if id=None
        if not new_smart_fldr_id == "none":
            #make the new SmartFolder
            genre_fldr.invokeFactory('Topic', id=new_smart_fldr_id,title=vocab[1])
            fldr = getattr(genre_fldr,new_smart_fldr_id)
             
            # Filter results to Plumi Video
            type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion' )
            #Have to use the name of the Title of the Type you want to filter.
            type_criterion.setValue("Video")
             
            # Filter results to this individual genre
            type_criterion = fldr.addCriterion('getGenre', 'ATSimpleStringCriterion' )
            #match against the ID of the vocab term. see getGenre in content types 
            type_criterion.setValue(vocab[0])
            ## add criteria for showing only published videos
            state_crit = fldr.addCriterion('review_state', 'ATListCriterion')
            state_crit.setValue(['published','featured'])
            
            #XXX used to have a custom getFirstPublishedTransitionTime 
            #sort on reverse date order, using the first published time transition
            sort_crit = fldr.addCriterion('effective',"ATSortCriterion")
            sort_crit.setReversed(True)

            #make the folder published
            fldr.setLayout(layout_name)
            publishObject(wftool,fldr)
            createTranslations(self,fldr)

    #
    # 2 of 5: video categories aka topic
    #
    taxonomy_fldr.invokeFactory('Folder',id=CATEGORIES_FOLDER,
                                title=_(u'Video Topics'))
    categ_fldr = getattr(taxonomy_fldr, CATEGORIES_FOLDER,None)
    publishObject(wftool,categ_fldr)
    createTranslations(self,categ_fldr)

    for vocab in vocabs['video_categories']:
        new_smart_fldr_id = vocab[0]
        #skip topic creation if id=None
        if not new_smart_fldr_id == "none":
            #make the new SmartFolder
            categ_fldr.invokeFactory('Topic', id=new_smart_fldr_id,title=vocab[1])
            fldr = getattr(categ_fldr,new_smart_fldr_id)

            # Filter results to Plumi Video
            type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion' )
            type_criterion.setValue("Video")
            # Filter results to this individual category
            type_criterion = fldr.addCriterion('getCategories', 'ATListCriterion' )
            #match against the ID of the vocab term. see getCategories in content objects
            type_criterion.setValue(vocab[0])
            #match if any vocab term is present in the video's selected categories
            type_criterion.setOperator('or')
            ## add criteria for showing only published videos
            state_crit = fldr.addCriterion('review_state', 'ATListCriterion')
            state_crit.setValue(['published','featured'])
            #sort on reverse date order
            #XXX old getfirstpublishedtransition time 
            sort_crit = fldr.addCriterion('effective',"ATSortCriterion")
            sort_crit.setReversed(True)

            #make the folder published.
            fldr.setLayout(layout_name)
            publishObject(wftool,fldr)
            createTranslations(self,fldr)


    #
    # 3 of 5: video countries
    #
   
    #Countries
    #get the countries from the country vocab!

    taxonomy_fldr.invokeFactory('Folder',id=COUNTRIES_FOLDER,
                                title=_(u'Countries'))
    countries_fldr = getattr(taxonomy_fldr,COUNTRIES_FOLDER,None)
    publishObject(wftool,countries_fldr)
    createTranslations(self,countries_fldr)

    for country in vocabs['video_countries']:
        new_smart_fldr_id = country[0]

        # maybe it already exists?
        try: 
            #skip topic creation if id=None
            if not new_smart_fldr_id == "none":
                # make the new SmartFolder              
                if new_smart_fldr_id == 'XX':
                    #International country has --International-- title to show first on drop down, we're overriding that
                    countries_fldr.invokeFactory('Topic', id=new_smart_fldr_id,title='International') 
                else:
                    countries_fldr.invokeFactory('Topic', id=new_smart_fldr_id,title=country[1]) 
                fldr = getattr(countries_fldr,new_smart_fldr_id)

                # Filter results to  Plumi Video
                type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion' )
                type_criterion.setValue("Video")

                # Filter results to this individual category
                type_criterion = fldr.addCriterion('getCountries', 'ATListCriterion' )
                #
                #match against the ID of the vocab term. see getCategories in content objects
                type_criterion.setValue(country[0])
                #match if any vocab term is present in the video's selected categories
                type_criterion.setOperator('or')
                ## add criteria for showing only published videos
                state_crit = fldr.addCriterion('review_state', 'ATListCriterion')
                state_crit.setValue(['published','featured'])
                #sort on reverse date order
                sort_crit = fldr.addCriterion('effective',"ATSortCriterion")
                sort_crit.setReversed(True)
                #publish folder
                fldr.setLayout(layout_name)
                publishObject(wftool,fldr)
                createTranslations(self,fldr)
        except:
            # should be ok from previous installation
            pass

#    #
#    #4 of 5 : CallOut submission categories
#    #
#    topic_description_string = "CallOuts for Topic - %s "
#    taxonomy_fldr.invokeFactory('Folder',id=SUBMISSIONS_FOLDER,
#                                title=_(u'Call Outs'))
#    submissions_fldr = getattr(taxonomy_fldr,SUBMISSIONS_FOLDER,None)
#    #publishObject(wftool,submissions_fldr)
#    createTranslations(self,submissions_fldr)

#    for submission_categ in vocabs['submission_categories']:
#        new_smart_fldr_id = submission_categ[0]
#
#        #skip topic creation if id=None
#        if not new_smart_fldr_id == "none":
#            #make the new SmartFolder
#            submissions_fldr.invokeFactory('Topic', id=new_smart_fldr_id,title=submission_categ[1])
#            fldr = getattr(submissions_fldr,new_smart_fldr_id)
#            # Filter results to Callouts
#            type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion' )
#            #the title of the type, not the class name, or portal_type 
#            type_criterion.setValue("Plumi Call Out")
#
#            # Filter results to this individual category
#            type_criterion = fldr.addCriterion('getSubmissionCategories', 'ATListCriterion' )
#            #
#            #match against the ID of the vocab term. see getCategories in callout.py (Callout object)
#            type_criterion.setValue(submission_categ[0])
#            #match if any vocab term is present in the video's selected categories
#            type_criterion.setOperator('or')
#
#            ## add criteria for showing only published callouts
#            state_crit = fldr.addCriterion('review_state', 'ATSimpleStringCriterion')
#            state_crit.setValue(['published','featured'])
#            #sort on reverse date order
#            sort_crit = fldr.addCriterion('effective',"ATSortCriterion")
#            sort_crit.setReversed(True)
#            #publish the folder
#            fldr.setLayout(layout_name)
#            publishObject(wftool,fldr)
#            createTranslations(self,fldr)

    #
    # 5 of 5: video languages
    #
   
    #Languages
    #get the languages from the languages vocab!

    taxonomy_fldr.invokeFactory('Folder',id=LANGUAGES_FOLDER,
                                title=_(u'Video Languages'))
    languages_fldr = getattr(taxonomy_fldr,LANGUAGES_FOLDER,None)
    publishObject(wftool,languages_fldr)
    createTranslations(self,languages_fldr)

    for language in vocabs['video_languages']:
        new_smart_fldr_id = language[0]

        # maybe it already exists?
        try: 
            #skip topic creation if id=None
            if not new_smart_fldr_id == "none":
                # make the new SmartFolder              
                languages_fldr.invokeFactory('Topic', id=new_smart_fldr_id,title=language[1]) 
                fldr = getattr(languages_fldr,new_smart_fldr_id)

                # Filter results to  Plumi Video
                type_criterion = fldr.addCriterion('Type', 'ATPortalTypeCriterion' )
                type_criterion.setValue("Video")

                # Filter results to this individual category
                type_criterion = fldr.addCriterion('getVideoLanguage', 'ATListCriterion' )
                #
                #match against the ID of the vocab term. see getCategories in content objects
                type_criterion.setValue(language[0])
                #match if any vocab term is present in the video's selected categories
                type_criterion.setOperator('or')
                ## add criteria for showing only published videos
                state_crit = fldr.addCriterion('review_state', 'ATListCriterion')
                state_crit.setValue(['published','featured'])
                #sort on reverse date order
                sort_crit = fldr.addCriterion('effective',"ATSortCriterion")
                sort_crit.setReversed(True)
                #publish folder
                fldr.setLayout(layout_name)
                publishObject(wftool,fldr)
                createTranslations(self,fldr)
        except:
            # should be ok from previous installation
            pass