[Checkins] SVN: gzo.plonepolicy/trunk/gzo/plonepolicy/ Bring setup up-to-date with production site. Configure the Documentation area to rely on new Topic portlet.

Kevin Teague kevin at bud.ca
Sun Jan 20 06:42:48 EST 2008


Log message for revision 82974:
  Bring setup up-to-date with production site. Configure the Documentation area to rely on new Topic portlet.

Changed:
  _U  gzo.plonepolicy/trunk/gzo/plonepolicy/
  U   gzo.plonepolicy/trunk/gzo/plonepolicy/Extensions/Install.py
  A   gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/actions.xml
  U   gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml
  U   gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/.objects
  D   gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/front-page
  A   gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/types/
  A   gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/types/HelpCenter.xml
  U   gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py

-=-

Property changes on: gzo.plonepolicy/trunk/gzo/plonepolicy
___________________________________________________________________
Name: svn:ignore
   + *.pyc


Modified: gzo.plonepolicy/trunk/gzo/plonepolicy/Extensions/Install.py
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/Extensions/Install.py	2008-01-20 04:23:55 UTC (rev 82973)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/Extensions/Install.py	2008-01-20 11:42:47 UTC (rev 82974)
@@ -1,7 +1,7 @@
 import transaction
 from Products.CMFCore.utils import getToolByName
 
-PRODUCT_DEPENDENCIES = ('gzo.plonesmashtheme',)
+PRODUCT_DEPENDENCIES = ('gzo.plonesmashtheme','PloneHelpCenter',)
 EXTENSION_PROFILES = ('gzo.plonepolicy:default',)
 
 def install(self, reinstall=False):

Added: gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/actions.xml
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/actions.xml	                        (rev 0)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/actions.xml	2008-01-20 11:42:47 UTC (rev 82974)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<object name="portal_actions" meta_type="Plone Actions Tool"
+   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+
+ <object name="document_actions" meta_type="CMF Action Category">
+  <property name="title"></property>
+  
+  <object name="sendto" meta_type="CMF Action" i18n:domain="plone">
+   <property name="title" i18n:translate="">Send this</property>
+   <property name="description" i18n:translate=""></property>
+   <property name="url_expr">string:$object_url/sendto_form</property>
+   <property name="icon_expr"></property>
+   <property name="available_expr"></property>
+   <property name="permissions">
+    <element value="Allow sendto"/>
+   </property>
+   <property name="visible">False</property>
+  </object>
+  
+  <object name="print" meta_type="CMF Action" i18n:domain="plone">
+   <property name="title" i18n:translate="">Print this</property>
+   <property name="description" i18n:translate=""></property>
+   <property name="url_expr">string:javascript:this.print();</property>
+   <property name="icon_expr"></property>
+   <property name="available_expr"></property>
+   <property name="permissions">
+    <element value="View"/>
+   </property>
+   <property name="visible">False</property>
+  </object>
+
+ </object>
+
+</object>

Modified: gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml	2008-01-20 04:23:55 UTC (rev 82973)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/import_steps.xml	2008-01-20 11:42:47 UTC (rev 82974)
@@ -1,20 +1,26 @@
 <?xml version="1.0"?>
 <import-steps>
+  <import-step id="public-website-location" version="20080119-01"
+                 handler="gzo.plonepolicy.setuphandlers.publicWebsiteLocation"
+                 title="/public_website policy">
+     Grok web site content lives at /public_website policy
+ </import-step>    
  <import-step id="gzo-portlets" version="20071105-01"
               handler="gzo.plonepolicy.setuphandlers.assignPortlets"
               title="Portlet Assignment">
   Grok Portlets policy
+  <dependency step="public-website-location"/>
  </import-step>
- <import-step id="remove-default-content" version="20071112-03"
-              handler="gzo.plonepolicy.setuphandlers.removeDefaultContent"
-              title="Delete default content">
+ <import-step id="gzo-phc-policy" version="20080119-01"
+              handler="gzo.plonepolicy.setuphandlers.configureGrokDocumentationHelpCenter"
+              title="Configure Grok Documentation area">
+  Grok Help Center customization policy
   <dependency step="gzo-portlets"/>
-    Delete default content.
  </import-step>
  <import-step id="sample-content" version="20071112-01"
               handler="Products.CMFCore.exportimport.content.importSiteStructure"
               title="Content">
-  <dependency step="remove-default-content"/>
+  <dependency step="gzo-portlets"/>
     Import some sample structure and content for developers.
  </import-step>
  <import-step id="setup-sample-content" version="20071112-02"

Modified: gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/.objects
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/.objects	2008-01-20 04:23:55 UTC (rev 82973)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/.objects	2008-01-20 11:42:47 UTC (rev 82974)
@@ -3,4 +3,3 @@
 develop,Folder
 download,Folder
 sample-page,Document
-front-page,Document

Deleted: gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/front-page
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/front-page	2008-01-20 04:23:55 UTC (rev 82973)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/structure/front-page	2008-01-20 11:42:47 UTC (rev 82974)
@@ -1,75 +0,0 @@
-id: front-page
-title: Grok Home Page
-description: Test the grok Site Style. This is the description.
-subject: 
-relatedItems: 
-location: 
-language: 
-effectiveDate: None
-expirationDate: None
-creation_date: 2007/11/12 04:30:45.410 US/Pacific
-modification_date: 2007/11/12 04:31:49.457 US/Pacific
-creators: grok
-contributors: 
-rights: 
-allowDiscussion: False
-excludeFromNav: False
-presentation: False
-tableContents: False
-Content-Type: text/html
-
-
-<div>
-
-<div class="feature_top">
-    <img style="float: left;" src="Highlight_TL.jpg" alt="" />
-    <img style="float: right;" src="Highlight_TR.jpg" alt="" />&nbsp;</div>
-<div class="feature">
-<p>
-        <a title="Go to the benefits of the GROK framework" href="/about">
-            <img class="track_button" src="FP_Evaluate.gif" alt="" />
-            <strong>Evaluate</strong> the benefits of the GROK framework.
-            Everything from code samples to the big picture...
-        </a></p>
-</div>
-
-<div class="feature">
-<p>
-        <a title="Go to the gory details of GROK to learn." href="/learn">
-            <img class="track_button" src="FP_Learn.gif" alt="" />
-            <strong>Learn</strong> the gory details of GROK. Go from newbie to expert as you follow the life of Grok-the-caveman...
-        </a></p>
-</div>
-<div class="feature">
-<p>
-        <a title="Go to the API docs, patterns, forums, mailing lists..." href="/develop">
-            <img class="track_button" src="FP_Develop.gif" alt="" />
-
-            <strong>Develop</strong> great applications with Grok. API docs, patterns, forums, mailing lists...
-        </a></p>
-</div>
-<div class="feature">
-<p>
-        <a title="Go to the GROK community" href="/resources">
-            <img class="track_button" src="FP_Contribute.gif" alt="" />
-            <strong>Contribute</strong> to the GROK community. Discussions, core developer blogs, road map and more...
-        </a></p>
-
-</div>
-<div class="feature">
-<p>
-        <a title="Go to download the stuff" href="/download">
-            <img class="track_button" src="FP_Download.gif" alt="" />
-            <strong>Download</strong> the stuff you need... releases, source code, component directory etc...
-        </a></p>
-</div>
-<div class="feature_bottom">
-    <img style="float: left;" src="Highlight_BL.jpg" alt="" />
-    <img style="float: right;" src="Highlight_BR.jpg" alt="" /></div>
-
-<h1>Summary</h1>
-<p>Grok is a web application framework based on Zope 3. Zope 3 is designed as an enterprise grade
-    component architecture that promotes scalability, reuse and easy maintenance. Grok just simplifies
-    everything in the Zope 3 world. From coding to configuration.</p>
-
-</div>

Added: gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/types/HelpCenter.xml
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/types/HelpCenter.xml	                        (rev 0)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/profiles/default/types/HelpCenter.xml	2008-01-20 11:42:47 UTC (rev 82974)
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<object name="HelpCenter"
+   meta_type="Factory-based Type Information with dynamic views"
+   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title">Help Center</property>
+ <property name="description">A simple folderish archetype</property>
+ <property name="content_icon">helpcenter_icon.gif</property>
+ <property name="content_meta_type">HelpCenter</property>
+ <property name="product">PloneHelpCenter</property>
+ <property name="factory">addHelpCenter</property>
+ <property name="immediate_view">base_edit</property>
+ <property name="global_allow">True</property>
+ <property name="filter_content_types">True</property>
+ <property name="allowed_content_types">
+  <element value="HelpCenterFAQFolder"/>
+  <element value="HelpCenterHowToFolder"/>
+  <element value="HelpCenterTutorialFolder"/>
+  <element value="HelpCenterReferenceManualFolder"/>
+  <element value="HelpCenterLinkFolder"/>
+  <element value="HelpCenterErrorReferenceFolder"/>
+  <element value="HelpCenterGlossary"/>
+  <element value="HelpCenterInstructionalVideoFolder"/>
+ </property>
+ <property name="allow_discussion">False</property>
+ <property name="default_view">helpcenter_view</property>
+ <property name="view_methods">
+  <element value="helpcenter_topicview"/>
+  <element value="helpcenter_topicview_main"/>
+  <element value="helpcenter_view"/>
+  <element value="dochome"/>  
+ </property>
+ <property name="default_view_fallback">False</property>
+ <alias from="(Default)" to="(dynamic view)"/>
+ <alias from="edit" to="base_edit"/>
+ <alias from="properties" to="base_metadata"/>
+ <alias from="sharing" to="folder_localrole_form"/>
+ <alias from="stats" to="phc_stats"/>
+ <alias from="view" to="dochome"/>
+ <action title="View" action_id="view" category="object" condition_expr=""
+    url_expr="string:${object_url}" visible="True">
+  <permission value="View"/>
+ </action>
+ <action title="Edit" action_id="edit" category="object" condition_expr=""
+    url_expr="string:${object_url}/edit" visible="True">
+  <permission value="Modify portal content"/>
+ </action>
+ <action title="Properties" action_id="metadata" category="object"
+    condition_expr="" url_expr="string:${object_url}/properties"
+    visible="False">
+  <permission value="Modify portal content"/>
+ </action>
+ <action title="References" action_id="references" category="object"
+    condition_expr="object/archetype_tool/has_graphviz"
+    url_expr="string:${object_url}/reference_graph" visible="False">
+  <permission value="Modify portal content"/>
+  <permission value="Review portal content"/>
+ </action>
+ <action title="Folder Listing" action_id="folderlisting" category="folder"
+    condition_expr="object/isPrincipiaFolderish"
+    url_expr="string:${folder_url}/view" visible="False">
+  <permission value="View"/>
+ </action>
+ <action title="Statistics" action_id="stats" category="object"
+    condition_expr="" url_expr="string:${object_url}/stats" visible="True">
+  <permission value="Manage properties"/>
+ </action>
+</object>

Modified: gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py
===================================================================
--- gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py	2008-01-20 04:23:55 UTC (rev 82973)
+++ gzo.plonepolicy/trunk/gzo/plonepolicy/setuphandlers.py	2008-01-20 11:42:47 UTC (rev 82974)
@@ -5,13 +5,48 @@
 from Products.CMFPlone.utils import _createObjectByType
 from Products.CMFPlone.utils import base_hasattr
 from Products.CMFPlone.utils import transaction
+from Products.Five.utilities.interfaces import IMarkerInterfaces
 
 from plone.portlets.interfaces import IPortletAssignmentMapping
+from plone.portlets.interfaces import ILocalPortletAssignmentManager
 from plone.portlets.interfaces import IPortletManager
 from plone.portlets.interfaces import IPortletType
-
+from plone.portlets.constants import CONTEXT_CATEGORY
 from plone.app.portlets import portlets
 
+from gzo.plonesmashtheme.portlets import grokdoc
+
+def publicWebsiteLocation(context):
+    "All Grok web site content lives in Folder at /public_website"
+    # this makes it easier to manage content, especially if people
+    # toss a lot of stuff in the top content level
+    portal = context.getSite()
+    if not base_hasattr(portal, 'public_website'):
+        _createObjectByType(
+            'Folder', portal, id='public_website',
+            title='Grok',
+            description=""
+        )
+    pubweb = portal['public_website']
+    
+    # mark public_website as INavigationRoot and publish it
+    mifaces_for_pubweb = IMarkerInterfaces(pubweb)
+    add = mifaces_for_pubweb.dottedToInterfaces(
+        ['plone.app.layout.navigation.interfaces.INavigationRoot',]
+    )
+    mifaces_for_pubweb.update(add=add)
+    wftool = getToolByName(portal, "portal_workflow")
+    if wftool.getInfoFor(pubweb, 'review_state') != 'published':
+        wftool.doActionFor(pubweb, 'publish')
+
+
+def _get_column_portlet_data(name, context):
+    # i wonder if a shortcut like this already exists?
+    column_mgr  = getUtility(IPortletManager, name=name, context=context)
+    return getMultiAdapter(
+        (context, column_mgr,), IPortletAssignmentMapping, context=context)
+    
+
 def assignPortlets(context):
     "Portlet Assignment"
 
@@ -20,11 +55,8 @@
     
     portal = context.getSite()
     
-    leftColumn = getUtility(IPortletManager, name=u'plone.leftcolumn', context=portal)
-    rightColumn = getUtility(IPortletManager, name=u'plone.rightcolumn', context=portal)
-
-    left = getMultiAdapter((portal, leftColumn,), IPortletAssignmentMapping, context=portal)
-    right = getMultiAdapter((portal, rightColumn,), IPortletAssignmentMapping, context=portal)
+    left = _get_column_portlet_data(u'plone.leftcolumn', portal)
+    right = _get_column_portlet_data(u'plone.rightcolumn', portal)
     
     # delete stock portlets
     for key in left.keys():
@@ -32,28 +64,51 @@
     for key in right.keys():
         del right[key]
     
+    pubweb = portal.public_website
+    left = _get_column_portlet_data(u'plone.leftcolumn', pubweb)
+    
+    if left.has_key('top'):
+        return
     left[u'top'] = portlets.classic.Assignment('portlet_leftcolumntop','portlet')
     left[u'search'] = portlets.classic.Assignment('portlet_search','portlet')
     left[u'navigation'] = portlets.navigation.Assignment(
         includeTop=True, topLevel=0, )
+    left[u'download'] = portlets.classic.Assignment('portlet_download','portlet')
     left[u'news'] = portlets.classic.Assignment('portlet_news','portlet')
-    left[u'download'] = portlets.classic.Assignment('portlet_download','portlet')
 
     left.updateOrder(
         (u'top',u'search',u'navigation',u'news',u'download',)
     )
 
-def removeDefaultContent(context):
-    # TODO: if we load the sample content front-page we get "potential link breakage"
-    # warnings and things don't work ...
-    plone = context.getSite()
-    try:
-        plone.manage_delObjects('front-page')
-        transaction.commit()
-    except AttributeError:
-        # already deleted
-        pass
 
+def configureGrokDocumentationHelpCenter(context):
+    portal = context.getSite()
+    pubweb = portal.public_website
+    
+    # PHC must already be installed at /public_website/documentation
+    if not base_hasattr(pubweb, 'documentation'):
+        return
+    
+    # TODO: shouldn't the HelpCenter provide ILocalPortletAssignable?
+    mifaces_for_docs = IMarkerInterfaces(pubweb.documentation)
+    add = mifaces_for_docs.dottedToInterfaces(
+        ['plone.portlets.interfaces.ILocalPortletAssignable',]
+    )
+    mifaces_for_docs.update(add=add)
+
+    # Assign Grok Doc portlet
+    left = _get_column_portlet_data(u'plone.leftcolumn', pubweb.documentation)
+    if not left.has_key('grokdoc'):
+        left[u'grokdoc'] = grokdoc.Assignment()
+
+    # Block parent portlets
+    portletManager = getUtility(IPortletManager,
+        name=u'plone.leftcolumn', context=pubweb.documentation)
+    assignable = getMultiAdapter(
+        (pubweb.documentation, portletManager,), ILocalPortletAssignmentManager)
+    assignable.setBlacklistStatus(CONTEXT_CATEGORY, True)
+
+
 def _createLorumIpsumNews(p):
     "Some dummy news for CSS styling"
     _createObjectByType(
@@ -80,6 +135,7 @@
         if wftool.getInfoFor(content, 'review_state') != 'published':
             wftool.doActionFor(content, 'publish')
 
+
 def setupSampleContent(context):
     "Sample content for providing something to add CSS too"
     if context.readDataFile('gzo.sample_content.txt') is None:



More information about the Checkins mailing list