Index: trunk/Citation/Citation.py =================================================================== --- (revision ) +++ trunk/Citation/Citation.py (revision 7) @@ -1,0 +1,215 @@ +# -*- coding: utf-8 -*- +# +# File: Citation.py +# +# Copyright (c) 2007 by University of North Carolina +# Department of Marine Science +# +# GNU General Public License (GPL) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# + +__author__ = """Chris Calloway & + Veda Williams """ +__docformat__ = 'plaintext' + +from AccessControl import ClassSecurityInfo +from Products.Archetypes.atapi import * +from Products.Citation.config import * + +##code-section module-header #fill in your manual code here +##/code-section module-header + +schema = Schema(( + + LinesField( + name='primary', + required=1, + widget=LinesWidget( + label='Primary Authors', + label_msgid='Citation_label_primary', + i18n_domain='Citation', + ) + ), + + LinesField( + name='authors', + widget=LinesWidget( + label='Other Authors', + label_msgid='Citation_label_authors', + i18n_domain='Citation', + ) + ), + + StringField( + name='journal', + required=1, + widget=StringWidget( + label='Journal Name', + label_msgid='Citation_label_journal', + i18n_domain='Citation', + ) + ), + + StringField( + name='volume', + widget=StringWidget( + label='Journal Volume', + label_msgid='Citation_label_volume', + i18n_domain='Citation', + ) + ), + + IntegerField( + name='beginPage', + widget=IntegerWidget( + label='Beginning Page Number', + label_msgid='Citation_label_beginPage', + i18n_domain='Citation', + ) + ), + + IntegerField( + name='endPage', + widget=IntegerWidget( + label='Ending Page Number', + label_msgid='Citation_label_endPage', + i18n_domain='Citation', + ) + ), + + DateTimeField( + name='date', + widget=CalendarWidget( + label='Journal Date', + label_msgid='Citation_label_date', + i18n_domain='Citation', + ) + ), + + StringField( + name='doi', + widget=StringWidget( + label='DOI Number', + label_msgid='Citation_label_doi', + i18n_domain='Citation', + ) + ), + + TextField( + name='short', + required=1, + widget=TextAreaWidget( + label='Short Description', + label_msgid='Citation_label_short', + i18n_domain='Citation', + ) + ), + + TextField( + name='long', + widget=TextAreaWidget( + label='Long Description', + label_msgid='Citation_label_long', + i18n_domain='Citation', + ) + ), + + TextField( + name='abstract', + required=1, + widget=TextAreaWidget( + label='Abstract', + label_msgid='Citation_label_abstract', + i18n_domain='Citation', + ) + ), + + StringField( + name='link', + widget=StringWidget( + label='Link to Journal Text Online', + label_msgid='Citation_label_link', + i18n_domain='Citation', + ) + ), + + LinesField( + name='area', + widget=SelectionWidget( + label='Related Website Area', + label_msgid='Citation_label_area', + i18n_domain='Citation', + ) + ), + + LinesField( + name='tags', + widget=LinesWidget( + label='Tags', + label_msgid='Citation_label_tags', + i18n_domain='Citation', + ) + ), + +), +) + +##code-section after-local-schema #fill in your manual code here +##/code-section after-local-schema + +Citation_schema = BaseSchema.copy() + \ + schema.copy() + +##code-section after-schema #fill in your manual code here +##/code-section after-schema + +class Citation(BaseContent): + """ + """ + security = ClassSecurityInfo() + __implements__ = (getattr(BaseContent,'__implements__',()),) + + # This name appears in the 'add' box + archetype_name = 'Citation' + + meta_type = 'Citation' + portal_type = 'Citation' + allowed_content_types = [] + filter_content_types = 0 + global_allow = 1 + #content_icon = 'Citation.gif' + immediate_view = 'base_view' + default_view = 'base_view' + suppl_views = () + typeDescription = "Citation" + typeDescMsgId = 'description_edit_citation' + + _at_rename_after_creation = True + + schema = Citation_schema + + ##code-section class-header #fill in your manual code here + ##/code-section class-header + + # Methods + +registerType(Citation, PROJECTNAME) +# end of class Citation + +##code-section module-footer #fill in your manual code here +##/code-section module-footer Index: trunk/Citation/Extensions/Install.py =================================================================== --- (revision ) +++ trunk/Citation/Extensions/Install.py (revision 7) @@ -1,0 +1,232 @@ +# -*- coding: utf-8 -*- +# +# File: Install.py +# +# Copyright (c) 2007 by Chris Calloway & Veda Williams +# Generator: ArchGenXML Version 1.5.0 svn/devel +# http://plone.org/products/archgenxml +# +# GNU General Public License (GPL) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# + +__author__ = """Chris Calloway & Veda Williams """ +__docformat__ = 'plaintext' + + +import os.path +import sys +from StringIO import StringIO +from sets import Set +from App.Common import package_home +from Products.CMFCore.utils import getToolByName +from Products.CMFCore.utils import manage_addTool +from Products.ExternalMethod.ExternalMethod import ExternalMethod +from zExceptions import NotFound, BadRequest + +from Products.Archetypes.Extensions.utils import installTypes +from Products.Archetypes.Extensions.utils import install_subskin +from Products.Archetypes.config import TOOL_NAME as ARCHETYPETOOLNAME +from Products.Archetypes.atapi import listTypes +from Products.Citation.config import PROJECTNAME +from Products.Citation.config import product_globals as GLOBALS + +def install(self): + """ External Method to install Citation """ + out = StringIO() + print >> out, "Installation log of %s:" % PROJECTNAME + + # If the config contains a list of dependencies, try to install + # them. Add a list called DEPENDENCIES to your custom + # AppConfig.py (imported by config.py) to use it. + try: + from Products.Citation.config import DEPENDENCIES + except: + DEPENDENCIES = [] + portal = getToolByName(self,'portal_url').getPortalObject() + quickinstaller = portal.portal_quickinstaller + for dependency in DEPENDENCIES: + print >> out, "Installing dependency %s:" % dependency + quickinstaller.installProduct(dependency) + get_transaction().commit(1) + + classes = listTypes(PROJECTNAME) + installTypes(self, out, + classes, + PROJECTNAME) + install_subskin(self, out, GLOBALS) + + + # try to call a workflow install method + # in 'InstallWorkflows.py' method 'installWorkflows' + try: + installWorkflows = ExternalMethod('temp', 'temp', + PROJECTNAME+'.InstallWorkflows', + 'installWorkflows').__of__(self) + except NotFound: + installWorkflows = None + + if installWorkflows: + print >>out,'Workflow Install:' + res = installWorkflows(self,out) + print >>out,res or 'no output' + else: + print >>out,'no workflow install' + + + # enable portal_factory for given types + factory_tool = getToolByName(self,'portal_factory') + factory_types=[ + "Citation", + ] + factory_tool.getFactoryTypes().keys() + factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) + + from Products.Citation.config import STYLESHEETS + try: + portal_css = getToolByName(portal, 'portal_css') + for stylesheet in STYLESHEETS: + try: + portal_css.unregisterResource(stylesheet['id']) + except: + pass + defaults = {'id': '', + 'media': 'all', + 'enabled': True} + defaults.update(stylesheet) + portal_css.manage_addStylesheet(**defaults) + except: + # No portal_css registry + pass + from Products.Citation.config import JAVASCRIPTS + try: + portal_javascripts = getToolByName(portal, 'portal_javascripts') + for javascript in JAVASCRIPTS: + try: + portal_javascripts.unregisterResource(javascript['id']) + except: + pass + defaults = {'id': ''} + defaults.update(javascript) + portal_javascripts.registerScript(**defaults) + except: + # No portal_javascripts registry + pass + + # try to call a custom install method + # in 'AppInstall.py' method 'install' + try: + install = ExternalMethod('temp', 'temp', + PROJECTNAME+'.AppInstall', 'install') + except NotFound: + install = None + + if install: + print >>out,'Custom Install:' + res = install(self) + if res: + print >>out,res + else: + print >>out,'no output' + else: + print >>out,'no custom install' + return out.getvalue() + +def uninstall(self): + out = StringIO() + + # try to call a workflow uninstall method + # in 'InstallWorkflows.py' method 'uninstallWorkflows' + try: + uninstallWorkflows = ExternalMethod('temp', 'temp', + PROJECTNAME+'.InstallWorkflows', + 'uninstallWorkflows').__of__(self) + except NotFound: + uninstallWorkflows = None + + if uninstallWorkflows: + print >>out, 'Workflow Uninstall:' + res = uninstallWorkflows(self, out) + print >>out, res or 'no output' + else: + print >>out,'no workflow uninstall' + + # try to call a custom uninstall method + # in 'AppInstall.py' method 'uninstall' + try: + uninstall = ExternalMethod('temp', 'temp', + PROJECTNAME+'.AppInstall', 'uninstall') + except: + uninstall = None + + if uninstall: + print >>out,'Custom Uninstall:' + res = uninstall(self) + if res: + print >>out,res + else: + print >>out,'no output' + else: + print >>out,'no custom uninstall' + + return out.getvalue() + +def beforeUninstall(self, reinstall, product, cascade): + """ try to call a custom beforeUninstall method in 'AppInstall.py' + method 'beforeUninstall' + """ + out = StringIO() + try: + beforeuninstall = ExternalMethod('temp', 'temp', + PROJECTNAME+'.AppInstall', 'beforeUninstall') + except: + beforeuninstall = [] + + if beforeuninstall: + print >>out, 'Custom beforeUninstall:' + res = beforeuninstall(self, reinstall=reinstall + , product=product + , cascade=cascade) + if res: + print >>out, res + else: + print >>out, 'no output' + else: + print >>out, 'no custom beforeUninstall' + return (out,cascade) + +def afterInstall(self, reinstall, product): + """ try to call a custom afterInstall method in 'AppInstall.py' method + 'afterInstall' + """ + out = StringIO() + try: + afterinstall = ExternalMethod('temp', 'temp', + PROJECTNAME+'.AppInstall', 'afterInstall') + except: + afterinstall = None + + if afterinstall: + print >>out, 'Custom afterInstall:' + res = afterinstall(self, product=None + , reinstall=None) + if res: + print >>out, res + else: + print >>out, 'no output' + else: + print >>out, 'no custom afterInstall' + return out Index: trunk/Citation/Extensions/__init__.py =================================================================== --- (revision ) +++ trunk/Citation/Extensions/__init__.py (revision 7) @@ -1,0 +1,1 @@ +# make me a python module Index: trunk/Citation/README.txt =================================================================== --- (revision ) +++ trunk/Citation/README.txt (revision 7) @@ -1,0 +1,6 @@ +Citation Product. + +Written by Chris Calloway & Veda Williams . + +Converted using ArchGenXML and http://uml.joelburton.com. + Index: trunk/Citation/__init__.py =================================================================== --- (revision ) +++ trunk/Citation/__init__.py (revision 7) @@ -1,0 +1,99 @@ +# -*- coding: utf-8 -*- +# +# File: Citation.py +# +# Copyright (c) 2007 by Chris Calloway & Veda Williams +# Generator: ArchGenXML Version 1.5.0 svn/devel +# http://plone.org/products/archgenxml +# +# GNU General Public License (GPL) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# + +__author__ = """Chris Calloway & Veda Williams """ +__docformat__ = 'plaintext' + + +# There are three ways to inject custom code here: +# +# - To set global configuration variables, create a file AppConfig.py. +# This will be imported in config.py, which in turn is imported in +# each generated class and in this file. +# - To perform custom initialisation after types have been registered, +# use the protected code section at the bottom of initialize(). +# - To register a customisation policy, create a file CustomizationPolicy.py +# with a method register(context) to register the policy. + +from zLOG import LOG, INFO, DEBUG + +LOG('Citation', DEBUG, 'Installing Product') + +try: + import CustomizationPolicy +except ImportError: + CustomizationPolicy = None + +from Globals import package_home +from Products.CMFCore import utils as cmfutils +from Products.CMFCore import CMFCorePermissions +from Products.CMFCore import DirectoryView +from Products.CMFPlone.PloneUtilities import ToolInit +from Products.Archetypes.atapi import * +from Products.Archetypes import listTypes +from Products.Archetypes.utils import capitalize + +import os, os.path + +from Products.Citation.config import * + +DirectoryView.registerDirectory('skins', product_globals) +DirectoryView.registerDirectory('skins/Citation', + product_globals) + +##code-section custom-init-head #fill in your manual code here +##/code-section custom-init-head + + +def initialize(context): + ##code-section custom-init-top #fill in your manual code here + ##/code-section custom-init-top + + # imports packages and types for registration + + import Citation + + # Initialize portal content + content_types, constructors, ftis = process_types( + listTypes(PROJECTNAME), + PROJECTNAME) + + cmfutils.ContentInit( + PROJECTNAME + ' Content', + content_types = content_types, + permission = DEFAULT_ADD_CONTENT_PERMISSION, + extra_constructors = constructors, + fti = ftis, + ).initialize(context) + + # Apply customization-policy, if theres any + if CustomizationPolicy and hasattr(CustomizationPolicy, 'register'): + CustomizationPolicy.register(context) + print 'Customization policy for Citation installed' + + ##code-section custom-init-bottom #fill in your manual code here + ##/code-section custom-init-bottom + Index: trunk/Citation/config.py =================================================================== --- (revision ) +++ trunk/Citation/config.py (revision 7) @@ -1,0 +1,85 @@ +# -*- coding: utf-8 -*- +# +# File: Citation.py +# +# Copyright (c) 2007 by Chris Calloway & Veda Williams +# Generator: ArchGenXML Version 1.5.0 svn/devel +# http://plone.org/products/archgenxml +# +# GNU General Public License (GPL) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. +# + +__author__ = """Chris Calloway & Veda Williams """ +__docformat__ = 'plaintext' + + +# Product configuration. +# +# The contents of this module will be imported into __init__.py, the +# workflow configuration and every content type module. +# +# If you wish to perform custom configuration, you may put a file +# AppConfig.py in your product's root directory. This will be included +# in this file if found. + +from Products.CMFCore.CMFCorePermissions import setDefaultRoles +##code-section config-head #fill in your manual code here +##/code-section config-head + + +PROJECTNAME = "Citation" + +# Check for Plone 2.1 +try: + from Products.CMFPlone.migrations import v2_1 +except ImportError: + HAS_PLONE21 = False +else: + HAS_PLONE21 = True + +# Permissions +DEFAULT_ADD_CONTENT_PERMISSION = "Add portal content" +setDefaultRoles(DEFAULT_ADD_CONTENT_PERMISSION, ('Manager', 'Owner')) + +product_globals = globals() + +# Dependencies of Products to be installed by quick-installer +# override in custom configuration +DEPENDENCIES = [] + +# Dependend products - not quick-installed - used in testcase +# override in custom configuration +PRODUCT_DEPENDENCIES = [] + +# You can overwrite these two in an AppConfig.py: +# STYLESHEETS = [{'id': 'my_global_stylesheet.css'}, +# {'id': 'my_contenttype.css', +# 'expression': 'python:object.getTypeInfo().getId() == "MyType"'}] +# You can do the same with JAVASCRIPTS. +STYLESHEETS = [] +JAVASCRIPTS = [] + +##code-section config-bottom #fill in your manual code here +##/code-section config-bottom + + +# Load custom configuration not managed by ArchGenXML +try: + from Products.Citation.AppConfig import * +except ImportError: + pass Index: trunk/Citation/i18n/generated.pot =================================================================== --- (revision ) +++ trunk/Citation/i18n/generated.pot (revision 7) @@ -1,0 +1,88 @@ +# ArchGenXML generated POT File +# Chris Calloway & Veda Williams , 2007. +msgid "" +msgstr "" +"Project-Id-Version: Citation\n" +"POT-Creation-Date: Fri Jan 26 21:51:08 2007\n" +"PO-Revision-Date: Fri Jan 26 21:51:08 2007\n" +"Last-Translator: Chris Calloway & Veda Williams \n" +"Language-Team: Chris Calloway & Veda Williams \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0\n" +"Language-Code: en\n" +"Language-Name: English\n" +"Preferred-Encodings: latin1 utf-8\n" +"Domain: Citation\n" + +#. Default: "Abstract" +#: Citation.py +msgid "Citation_label_abstract" +msgstr "" + +#. Default: "Area" +#: Citation.py +msgid "Citation_label_area" +msgstr "" + +#. Default: "Authors" +#: Citation.py +msgid "Citation_label_authors" +msgstr "" + +#. Default: "Beginpage" +#: Citation.py +msgid "Citation_label_beginPage" +msgstr "" + +#. Default: "Date" +#: Citation.py +msgid "Citation_label_date" +msgstr "" + +#. Default: "Doi" +#: Citation.py +msgid "Citation_label_doi" +msgstr "" + +#. Default: "Endpage" +#: Citation.py +msgid "Citation_label_endPage" +msgstr "" + +#. Default: "Journal" +#: Citation.py +msgid "Citation_label_journal" +msgstr "" + +#. Default: "Link" +#: Citation.py +msgid "Citation_label_link" +msgstr "" + +#. Default: "Long" +#: Citation.py +msgid "Citation_label_long" +msgstr "" + +#. Default: "Primary" +#: Citation.py +msgid "Citation_label_primary" +msgstr "" + +#. Default: "Short" +#: Citation.py +msgid "Citation_label_short" +msgstr "" + +#. Default: "Tags" +#: Citation.py +msgid "Citation_label_tags" +msgstr "" + +#. Default: "Volume" +#: Citation.py +msgid "Citation_label_volume" +msgstr "" + Index: trunk/Citation/skins/Citation/readme.txt =================================================================== --- (revision ) +++ trunk/Citation/skins/Citation/readme.txt (revision 7) @@ -1,0 +1,6 @@ +Directory 'skins/Citation': + +This skin layer has low priority, put unique templates and scripts here. + +I.e. if you to want to create own unique views or forms for your product, this +is the right place. Index: trunk/Citation/version.txt =================================================================== --- (revision ) +++ trunk/Citation/version.txt (revision 7) @@ -1,0 +1,1 @@ +0.1 build 1