def setup_content(context): if sht.isNotThisProfile(context, "g24.importer-setup_content.txt"): return site = context.getSite() # delete some default folders AND posts folder sht.delete_items(site, ("front-page", "news", "events", "Members"), logger) site.setLayout("stream") _type = "g24.elements.basetypecontainer" posts = create(site, _type) posts.id = "posts" posts = add(posts, site) posts.setLayout("stream") posts.title = u"Posts" events = create(site, _type) events.id = "events" events = add(events, site) events.setLayout("event_listing") events.title = u"Events" places = create(site, _type) places.id = "places" places = add(places, site) places.setLayout("stream") places.title = u"Places"
def start_import(context): if sht.isNotThisProfile(context, 'g24.importer.postnuke_import.txt'): return site = context.getSite() imp = ImportPhpBB(site) imp.import_mysql_connect() imp.import_nuke_phpbb_users() #imp.import_nuke_phpbb_categories() #imp.import_nuke_phpbb_forums() #imp.import_nuke_phpbb_topics() #imp.import_nuke_phpbb_posts() imp.import_finish()
def setup_content(context): if sht.isNotThisProfile(context, 'plonetheme.zopeorg_setup_content.txt'): return site = context.getSite() sht.delete_items(site, ('front-page', 'news', 'events'), logger) sht.hide_and_retract(site['Members'], logger) content_structure = [ { 'type': 'Image', 'title': 'old.zope.org Screenshot', 'id': u'Screenshotold.zope.org.png', 'opts': { 'setExcludeFromNav': True }, 'data': { 'image': sht.load_file(globals(), 'setupdata/Screenshotold.zope.org.png') } }, { 'type': 'Folder', 'title': u'Teasers', 'opts': { 'workflow': None, # leave private 'setLocallyAllowedTypes': [ 'Teaser', ], 'setImmediatelyAddableTypes': [ 'Teaser', ], 'setLayout': 'folder_summary_view' }, 'childs': [{ 'type': 'Teaser', 'title': 'The World of Zope', 'data': { 'image': sht.load_file(globals(), 'setupdata/teaser_world-of-zope.jpg'), 'importance': u'3' } }] }, { 'type': 'Collage', 'title': u'Start', 'id': 'front-page', 'data': { 'show_title': False, 'show_description': False, }, 'childs': [ { 'type': 'CollageRow', 'title': '', 'id': '1', 'childs': [ # the following column should hold a teaser portlet { 'type': 'CollageColumn', 'title': '', 'id': '1' } ] }, { 'type': 'CollageRow', 'title': '', 'id': '2', 'childs': [ { 'type': 'CollageColumn', 'title': '', 'id': '1', 'childs': [{ 'type': 'Document', 'title': u'Zope Community', 'id': u'front-community', 'opts': { 'setExcludeFromNav': True }, 'data': { 'text': START_ZOPE_COMMUNITY_TEXT } }] }, { 'type': 'CollageColumn', 'title': '', 'id': '2', 'childs': [{ 'type': 'Document', 'title': u'Zope Foundation', 'id': u'front-foundation', 'opts': { 'setExcludeFromNav': True }, 'data': { 'text': START_ZOPE_FOUNDATION_TEXT } }] }, { 'type': 'CollageColumn', 'title': '', 'id': '3', 'childs': [{ 'type': 'Document', 'title': u'Zope.org legacy', 'id': u'front-legacy', 'opts': { 'setExcludeFromNav': True }, 'data': { 'text': START_ZOPEORG_LEGACY_TEXT } }] }, ] }, ] }, { 'type': 'Document', 'title': u'The World of Zope', 'id': 'the-world-of-zope', 'data': { 'text': THE_WORLD_OF_ZOPE_TEXT } }, { 'type': 'Document', 'title': u'News & Events', 'id': u'news-events', 'data': { 'text': NEWS_EVENTS_TEXT } }, { 'type': 'Document', 'title': u'Community', 'id': u'community', 'data': { 'text': COMMUNITY_TEXT } }, { 'type': 'Document', 'title': u'Resources', 'id': u'resources', 'data': { 'text': RESOURCES_TEXT } }, { 'type': 'Document', 'title': u'Zope Foundation', 'id': u'foundation', 'data': { 'text': ZOPE_FOUNDATION_TEXT } }, { 'type': 'Document', 'title': u'Legal', 'id': u'legal', 'opts': { 'setExcludeFromNav': True }, 'data': { 'description': u"""Zope.org Legal Notice.""", 'text': LEGAL_TEXT } }, ] sht.create_item_runner(site, content_structure, logger=logger) #the collage column will hold a portlet, so the view must be portlets-top from Products.Collage.interfaces import IDynamicViewManager manager = IDynamicViewManager(site['front-page']['1']['1']) manager.setLayout('portlets-top') #set the link reference in the teaser site['teasers']['the-world-of-zope'].setLink_internal( site['the-world-of-zope']) site['teasers']['the-world-of-zope'].reindexObject()
def setup_content(context): if sht.isNotThisProfile(context, 'plonetheme.zopeorg_setup_content.txt'): return site = context.getSite() sht.delete_items(site, ('front-page', 'news', 'events'), logger) sht.hide_and_retract(site['Members'], logger) content_structure = [ {'type': 'Image', 'title': 'old.zope.org Screenshot', 'id': u'Screenshotold.zope.org.png', 'opts': {'setExcludeFromNav': True}, 'data': {'image': sht.load_file(globals(), 'setupdata/Screenshotold.zope.org.png')}}, {'type': 'Folder', 'title': u'Teasers', 'opts': {'workflow': None, # leave private 'setLocallyAllowedTypes': ['Teaser',], 'setImmediatelyAddableTypes':['Teaser',], 'setLayout': 'folder_summary_view'}, 'childs': [ {'type': 'Teaser', 'title': 'The World of Zope', 'data': {'image': sht.load_file(globals(), 'setupdata/teaser_world-of-zope.jpg'), 'importance': u'3'}}]}, {'type': 'Collage', 'title': u'Start', 'id': 'front-page', 'data': { 'show_title': False, 'show_description': False, }, 'childs': [ {'type': 'CollageRow', 'title': '', 'id': '1', 'childs': [ # the following column should hold a teaser portlet {'type': 'CollageColumn', 'title': '', 'id': '1'}]}, {'type': 'CollageRow', 'title': '', 'id': '2', 'childs': [ {'type': 'CollageColumn', 'title': '', 'id': '1', 'childs': [ {'type': 'Document', 'title': u'Zope Community', 'id': u'front-community', 'opts': {'setExcludeFromNav': True}, 'data': {'text': START_ZOPE_COMMUNITY_TEXT}}]}, {'type': 'CollageColumn', 'title': '', 'id': '2', 'childs': [ {'type': 'Document', 'title': u'Zope Foundation', 'id': u'front-foundation', 'opts': {'setExcludeFromNav': True}, 'data': {'text': START_ZOPE_FOUNDATION_TEXT}}]}, {'type': 'CollageColumn', 'title': '', 'id': '3', 'childs': [ {'type': 'Document', 'title': u'Zope.org legacy', 'id': u'front-legacy', 'opts': {'setExcludeFromNav': True}, 'data': {'text': START_ZOPEORG_LEGACY_TEXT}}]}, ]}, ]}, {'type': 'Document', 'title': u'The World of Zope', 'id': 'the-world-of-zope', 'data': {'text': THE_WORLD_OF_ZOPE_TEXT}}, {'type': 'Document', 'title': u'News & Events', 'id': u'news-events', 'data': {'text': NEWS_EVENTS_TEXT}}, {'type': 'Document', 'title': u'Community', 'id': u'community', 'data': {'text': COMMUNITY_TEXT}}, {'type': 'Document', 'title': u'Resources', 'id': u'resources', 'data': {'text': RESOURCES_TEXT}}, {'type': 'Document', 'title': u'Zope Foundation', 'id': u'foundation', 'data': {'text': ZOPE_FOUNDATION_TEXT}}, {'type': 'Document', 'title': u'Legal', 'id': u'legal', 'opts': {'setExcludeFromNav': True}, 'data': {'description':u"""Zope.org Legal Notice.""", 'text': LEGAL_TEXT}}, ] sht.create_item_runner(site, content_structure, logger=logger) #the collage column will hold a portlet, so the view must be portlets-top from Products.Collage.interfaces import IDynamicViewManager manager = IDynamicViewManager(site['front-page']['1']['1']) manager.setLayout('portlets-top') #set the link reference in the teaser site['teasers']['the-world-of-zope'].setLink_internal(site['the-world-of-zope']) site['teasers']['the-world-of-zope'].reindexObject()
def setup_html_transform(context): if sht.isNotThisProfile(context, "g24.importer-setup_content.txt"): return sht.unsafe_html_transform(logger)
def setup_dummy_content(context): if sht.isNotThisProfile(context, 'g24.importer-setup_dummy_content.txt'): return site = context.getSite() # setup admin + some test users sht.add_group(site, 'Members', roles=['Members'], logger=logger) # groups=['Administrators'] sht.add_user(site, 'thet', 'thet', email='*****@*****.**', fullname="Johannes Raggam", groups=['Members'], logger=logger) sht.add_user(site, 'test1', 'test1', email='test1@localhost', fullname="Testuser1", groups=['Members'], logger=logger) sht.add_user(site, 'test2', 'test2', email='test2@localhost', fullname="Testuser2", groups=['Members'], logger=logger) sht.add_user(site, 'test3', 'test3', email='test3@localhost', fullname="Testuser3", groups=['Members'], logger=logger) # textparts to generate postings textparts = [ u'g24 10 Jahresfeier im Forum Stadtpark.', u'Musik Videos aus den 80er-Jahren', u'BürgerInneninitiative für eine Abschaffung der EU-Richtlinie zur Vorratsdatenspeicherung 2006/24/EG', u'Den – wortwörtlich – schwerpunkt bilden jetzt bassig-wummernde drones', u'Zumindest immer wieder, schöne, aber eisige harmonien. ', u'Seit kurzem ist die Festival-Website online und freudig kündigen wir die ersten Filme an', u'FM4, Biorama, The Gap, Junge Welt, oekonews.at, ZiGe.TV, Radio Helsinki, g24.at', u'Yeni Hayat, Analyse&Kritik, Lebensart, Luxemburg, iz3w ', u'Green Economy (Was wird im Rahmen der UNO diskutiert? Welche Chancen und Gefahren sind damit verbunden?', u'Mit einem spannenden, aktuellen Filmprogramm sowie zahlreichen Vorträgen, Workshops und Podiumsdiskussionen', u'Über direkte Demokratie im Nationalrat, Parteiprogramme, Liquid Democrazy, ... ', u'This module implements pseudo-random number generators for various distributions.', ] #pm = getToolByName(context, 'portal_membership') #myuser = pm.getMemberById('testuser3') def create_g24_posting(container, texts, cats, maxchilds): content = [] for i in range(2, randint(3, 12)): content.append(texts[randint(0, len(texts)-1)]) data = { 'is_title': True, 'title': texts[randint(0, len(texts)-1)], 'text': u'\n'.join(content), 'subjects': (cats[randint(0, len(cats)-1)], cats[randint(0, len(cats)-1)]), } obj = create(container, G24_BASETYPE) obj = add(obj, container) obj.setCreators(choice(users)) # set the creators by loginname. if more than one, seperate by whitespace obj.creation_date = base_DT + int(obj.id) edit(obj, data, order=FEATURES, ignores=IGNORES) logger.info('Created object with id: %s' % obj.id) myChilds = randint(0, maxchilds) for i in range(0, myChilds): create_g24_posting(obj, texts, cats, maxchilds - myChilds) return obj # postsfolder must exist. created by setup_content step postsfolder = site['posts'] # create 25 randomized posting-threads for i in range(0, 25) : create_g24_posting(postsfolder, textparts, cat, 4)