[Zope-CVS] CVS: Products/OSCOM/NOTSite - TODO.txt:1.1 utils.py:1.1 __init__.py:1.2 setup.py:1.2
Tres Seaver
tseaver@zope.com
Tue, 13 May 2003 12:10:22 -0400
Update of /cvs-repository/Products/OSCOM/NOTSite
In directory cvs.zope.org:/tmp/cvs-serv18729
Modified Files:
__init__.py setup.py
Added Files:
TODO.txt utils.py
Log Message:
- Bare initial pass at a product.
=== Added File Products/OSCOM/NOTSite/TODO.txt ===
OSCOM NOT Site To-do's
Site Setup
(x) Initialize product.
(x) Build out extended site / generator classes.
(x) Register / configure skin directories.
( ) Register / configure types.
( ) Register / configure workflow.
Content Types Work
( ) Define skins for Home Page Folder type.
( ) Define skins for Section Folder type.
( ) Define skins for Article Page type.
=== Added File Products/OSCOM/NOTSite/utils.py ===
""" Utility functions:
- _loadPageTemplateFile
$Id: utils.py,v 1.1 2003/05/13 16:09:51 tseaver Exp $
"""
import os
from Globals import package_home
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
_wwwdir = os.path.join( package_home( globals() ), 'www' )
def _loadPageTemplateFile( template_filename ):
return PageTemplateFile( template_filename, _wwwdir )
=== Products/OSCOM/NOTSite/__init__.py 1.1 => 1.2 ===
--- Products/OSCOM/NOTSite/__init__.py:1.1 Tue May 13 08:42:16 2003
+++ Products/OSCOM/NOTSite/__init__.py Tue May 13 12:09:51 2003
@@ -6,6 +6,12 @@
$Id$
"""
+from Products.CMFCore.DirectoryView import registerDirectory
+
+import utils
+import setup
+
+registerDirectory( 'skins', globals() )
def initialize( context ):
@@ -15,4 +21,10 @@
# Register content types.
- pass
+ context.registerClass( meta_type='NOT Site'
+ , constructors=( setup.addNOTSiteForm
+ , setup.addNOTSite
+ )
+ , icon='images/site.gif'
+ )
+
=== Products/OSCOM/NOTSite/setup.py 1.1 => 1.2 ===
--- Products/OSCOM/NOTSite/setup.py:1.1 Tue May 13 08:42:16 2003
+++ Products/OSCOM/NOTSite/setup.py Tue May 13 12:09:51 2003
@@ -3,7 +3,84 @@
$Id$
"""
-def addNOTSite( self, id ):
+from Products.CMFCore.utils import getToolByName
+from Products.CMFDefault.Portal import CMFSite
+from Products.CMFDefault.Portal import PortalGenerator
+
+from utils import _loadPageTemplateFile
+
+class NOTSite( CMFSite ):
+
+ """ Customize CMFDefault's site object.
+ """
+ meta_type = 'NOT Site'
+
+class NOTSiteGenerator( PortalGenerator ):
+
+ """ Set up a new NOTSite instance.
+ """
+ klass = NOTSite
+
+ def setup( self, new_site, create_userfolder ):
+
+ PortalGenerator.setup( self, new_site, create_userfolder )
+
+ def setupDefaultSkins( self, new_site ):
+
+ from Products.CMFCore.DirectoryView import addDirectoryViews
+
+ DEFAULT_SKIN_PATH = [ 'custom'
+ , 'NOTContent'
+ , 'NOTSite'
+ , 'zpt_topic'
+ , 'zpt_content'
+ , 'zpt_generic'
+ , 'zpt_control'
+ , 'topic'
+ , 'content'
+ , 'generic'
+ , 'control'
+ , 'Images'
+ ]
+
+ PortalGenerator.setupDefaultSkins( self, new_site )
+ skins_tool = getToolByName( new_site, 'portal_skins' )
+ addDirectoryViews( skins_tool, 'skins', globals() )
+ skins_tool.manage_properties( del_skin=1
+ , chosen=( 'Basic', 'Nouvelle', 'No CSS' ) )
+
+ skins_tool.addSkinSelection( 'Default'
+ , ', '.join( DEFAULT_SKIN_PATH )
+ , make_default=1
+ )
+
+addNOTSiteForm = _loadPageTemplateFile( 'site_add' )
+
+def addNOTSite( self
+ , id='NOTSite'
+ , title='New OSCOM Times'
+ , description=''
+ , email_from_address='postmaster@oscom.org'
+ , email_from_name='NOT Webmaster'
+ , validate_email=0
+ , create_userfolder=1
+ , REQUEST=None
+ ):
""" Add a New OSCOM Times site instance to self.
"""
+ generator = NOTSiteGenerator()
+ site = generator.create( self, id, create_userfolder=create_userfolder )
+ generator.setupDefaultProperties( site
+ , title=title
+ , description=description
+ , email_from_address=email_from_address
+ , email_from_name=email_from_name
+ , validate_email=validate_email
+ )
+
+ if REQUEST is not None:
+ REQUEST['RESPONSE'].redirect( '%s/manage_workspace'
+ % self.absolute_url()
+ )
+