Browse files

Initial import of eggfied version of CMFContentPanels

  • Loading branch information...
1 parent 968bfc1 commit e4ff0b669cb18b3e022c97dd90ce4fda65f90beb erico_andrei committed Feb 10, 2009
View
2 MANIFEST.in
@@ -0,0 +1,2 @@
+recursive-include Products *
+global-exclude *pyc
View
4 Products/CMFContentPanels/ContentPanels.py
@@ -13,6 +13,7 @@
"""Implement the content panels content type."""
import pprint
+from zope.interface import implements
from copy import deepcopy
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base, aq_parent, aq_inner
@@ -38,6 +39,7 @@
from Products.Archetypes.public import ReadOnlyStorage
from Products.Archetypes.public import TextAreaWidget, SelectionWidget
+from Products.CMFContentPanels.interfaces import IContentPanels
from config import VOC_PAGE_LAYOUT, VOC_PORTLET_POS, PROJECTNAME
ContentPanelsSchema = BaseSchema.copy() + Schema((
@@ -115,7 +117,7 @@ class ContentPanels(BaseContent):
schema = ContentPanelsSchema
__implements__ = (getattr(BaseContent,'__implements__',()),)
-
+ implements(IContentPanels)
security = ClassSecurityInfo()
archetype_name = 'ContentPanels'
meta_type = 'CMF Content Panels'
View
6 Products/CMFContentPanels/ContentPanelsTool.py
@@ -1,3 +1,4 @@
+from zope.interface import implements
from Globals import InitializeClass, DTMLFile
from AccessControl import ClassSecurityInfo
from OFS.SimpleItem import SimpleItem
@@ -15,6 +16,8 @@
from Products.CMFPlone.migrations.migration_util import safeEditProperty
+from Products.CMFContentPanels.interfaces import IContentPanelsTool
+
viewlet_registery = []
def registerViewlets(actions):
for action in actions:
@@ -28,7 +31,8 @@ class ContentPanelsTool( UniqueObject, SimpleItem, PropertyManager, ActionsTool
action_providers = ('portal_contentpanels',)
security = ClassSecurityInfo()
-
+ implements(IContentPanelsTool)
+
manage_options = (ActionProviderBase.manage_options +
# ({ 'label' : 'Overview', 'action' : 'manage_overview' }
# ,
View
62 Products/CMFContentPanels/Extensions/Install.py
@@ -1,7 +1,8 @@
from Products.CMFCore.utils import getToolByName
from Products.Archetypes.public import listTypes
from Products.Archetypes.Extensions.utils import installTypes, install_subskin
-from Products.CMFContentPanels.config import PROJECTNAME, GLOBALS, STYLESHEETS, JAVASCRIPTS, NEW_VIEW_METHODS, ACTION_ICONS
+from Products.CMFContentPanels.config import PROJECTNAME, GLOBALS, NEW_VIEW_METHODS
+from Products.CMFContentPanels import HAS_PLONE30
from Products.CMFContentPanels.ContentPanelsTool import ContentPanelsTool
from Products.ExternalMethod import ExternalMethod
@@ -42,48 +43,6 @@ def addViewMethods(portal, out):
if real_new_methods:
ti.view_methods += tuple(real_new_methods)
-def install_actions(self, out):
- ai = getToolByName(self, 'portal_actionicons')
- for category, config in ACTION_ICONS.items():
- for icon_id, info in config.items():
- if ai.queryActionIcon(category, icon_id, None) is None:
- ai.addActionIcon(category, icon_id,
- info[0], info[1])
- print >> out, ('Installed action icon '
- 'for %s.' % info[1])
- else:
- print >> out, ('Action Icon for %s '
- 'was already Installed.'
- % info[1])
-
-def install_portal_css(portal, out):
- portal_css = getToolByName(portal, 'portal_css')
- for stylesheet in STYLESHEETS:
- try:
- portal_css.unregisterResource(stylesheet['id'])
- except:
- pass
- defaulttitle = '%s %s' % (PROJECTNAME, stylesheet['id'])
- defaults = {'id': '',
- 'expression': None,
- 'media': 'all',
- 'title': defaulttitle,
- 'enabled': True}
- defaults.update(stylesheet)
- portal_css.manage_addStylesheet(**defaults)
-
-def install_portal_js(portal, out):
- portal_js = getToolByName(portal, 'portal_javascripts')
- for js in JAVASCRIPTS:
- try:
- portal_js.unregisterResource(js['id'])
- except:
- pass
- defaults = {'id': '',
- 'enabled': True}
- defaults.update(js)
- portal_js.manage_addScript(**defaults)
-
def resetContentPanelsPermissions(portal, out):
permissions = ['Access contents information', 'Modify portal content', 'View']
portal_catalog = portal.portal_catalog
@@ -96,7 +55,11 @@ def resetContentPanelsPermissions(portal, out):
def install(self, reinstall=False):
portal = getToolByName(self, 'portal_url').getPortalObject()
-
+ setup_tool = getToolByName(self, 'portal_setup')
+ if HAS_PLONE30:
+ setup_tool.runAllImportStepsFromProfile(
+ "profile-Products.CMFContentPanels:default",
+ purge_old=False)
out = StringIO()
out.write( 'CMFContentPanels installation tool\n')
@@ -112,24 +75,13 @@ def install(self, reinstall=False):
install_RSSCache(portal, out)
install_default_page(portal, out)
- install_portal_css(portal, out)
- install_portal_js(portal, out)
factory_tool = getToolByName(self,'portal_factory')
factory_types=[
"ContentPanels",
] + factory_tool.getFactoryTypes().keys()
factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types)
- # contentpanels don't need any workflow
- # it is more like some template
- # if not reinstall:
- # wftool = getToolByName(portal, 'portal_workflow')
- # wftool.setChainForPortalTypes(('ContentPanels',), '')
-
addViewMethods(portal, out)
- install_actions(portal, out)
-
- # resetContentPanelsPermissions(portal, out)
return out.getvalue()
View
10 Products/CMFContentPanels/HISTORY.txt
@@ -1,3 +1,13 @@
+v2.6a
+ - Eggfication
+ [erico_andrei]
+
+ - Added a Generic Setup Profile
+ [erico_andrei]
+
+ - Added Editable Headline viewlet
+ [erico_andrei]
+
V2.5
- Added PoPoll viewlet.
View
16 Products/CMFContentPanels/TODO.txt
@@ -1,7 +1,11 @@
-- documentation
-- use TALES to locate the context content:
+TODO
+----
- - relative path
- - absolute path
- - by reference UID
- - any other TALES which returns a content
+- Modify the way Viewlets are registered (eventually change the name from
+viewlets to something else as Z3 brings us the Viewlet miracle)
+
+- Edition should be done in a easier way
+
+- Support for working copy support and versioning
+
+- A tableless version
View
14 Products/CMFContentPanels/__init__.py
@@ -9,16 +9,22 @@
from ContentPanelsTool import registerViewlets
from ContentPanelsTool import ContentPanelsTool
-from config import VIEWLETS, SKINS_DIR, GLOBALS
+from config import SKINS_DIR, GLOBALS,VIEWLETS
from config import PROJECTNAME, ADD_CONTENT_PERMISSION
registerViewlets(VIEWLETS)
-registerDirectory(SKINS_DIR, GLOBALS)
-
from Products.PythonScripts.Utility import allow_module
+
allow_module("feedparser")
allow_module('Products.CMFContentPanels.browser.subnavtree')
-
+# Check for Plone versions
+try:
+ from Products.CMFPlone.migrations import v3_0
+except ImportError:
+ HAS_PLONE30 = False
+else:
+ HAS_PLONE30 = True
+
def initialize(context):
import ContentPanels
View
4 Products/CMFContentPanels/config.py
@@ -114,6 +114,10 @@
'string:here/viewlet_popoll/macros/portlet',
'', 'View', 'PT:PlonePopoll', 1),
+ ('headline_viewlet', 'Editable Headline',
+ 'string:here/viewlet_headline/macros/portlet',
+ '', 'View', 'PT:News item', 1),
+
# GL: global viewlets
('macro_viewlet', 'ZPT macro',
View
14 Products/CMFContentPanels/configure.zcml
@@ -0,0 +1,14 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+ xmlns:five="http://namespaces.zope.org/five"
+ xmlns:plone="http://namespaces.plone.org/plone"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ i18n_domain="Products.CMFContentPanels">
+
+
+ <include file="profiles.zcml" />
+
+ <include file="skins.zcml" />
+
+</configure>
View
8 Products/CMFContentPanels/interfaces.py
@@ -0,0 +1,8 @@
+from zope.interface import Interface
+
+
+class IContentPanelsTool(Interface):
+ """Tool for ContentPanels."""
+
+class IContentPanels(Interface):
+ """ContentPanels."""
View
13 Products/CMFContentPanels/profiles.zcml
@@ -0,0 +1,13 @@
+ <configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+ i18n_domain="Products.CMFContentPanels">
+
+ <genericsetup:registerProfile
+ name="default"
+ title="Products.CMFContentPanels"
+ directory="profiles/default"
+ description="Extension profile"
+ provides="Products.GenericSetup.interfaces.EXTENSION"
+ />
+</configure>
View
7 Products/CMFContentPanels/profiles/default/actionicons.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<action-icons>
+ <action-icon category="plone" action_id="contentpanels"
+ title="Change display template for this view"
+ priority="0"
+ icon_expr="contentpanels_icon.gif"/>
+</action-icons>
View
13 Products/CMFContentPanels/profiles/default/cssregistry.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<object name="portal_css" meta_type="Stylesheets Registry">
+ <stylesheet title="CMFContentPanels contentpanels.css" cacheable="True"
+ compression="safe" cookable="True" enabled="on" expression=""
+ id="contentpanels.css" media="all" rel="stylesheet" rendering="import"/>
+ <stylesheet title="CMFContentPanels contentpanelsCustom.css" cacheable="True"
+ compression="safe" cookable="True" enabled="on" expression=""
+ id="contentpanelsCustom.css" media="all" rel="stylesheet"
+ rendering="import"/>
+ <stylesheet title="CMFContentPanels tabber.css" cacheable="True"
+ compression="safe" cookable="True" enabled="on" expression=""
+ id="tabber.css" media="all" rel="stylesheet" rendering="import"/>
+</object>
View
8 Products/CMFContentPanels/profiles/default/export_steps.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<export-steps>
+ <export-step id="contentpanel_actions" version="200902061525"
+ handler="Products.CMFContentTypes.exportimport.exportimport.exportActionProviders"
+ title="CMFContentPanels Action Provider">
+ Export Content Panels tool's action provider and its actions.
+ </export-step>
+</export-steps>
View
6 Products/CMFContentPanels/profiles/default/factorytool.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<object name="portal_factory" meta_type="Plone Factory Tool">
+ <factorytypes>
+ <type portal_type="ContentPanels"/>
+ </factorytypes>
+</object>
View
9 Products/CMFContentPanels/profiles/default/jsregistry.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<object name="portal_javascripts" meta_type="JavaScripts Registry">
+ <javascript cacheable="True" compression="safe" cookable="True"
+ enabled="True" expression="" id="tabberoptions.js" inline="False"/>
+ <javascript cacheable="True" compression="safe" cookable="True"
+ enabled="True" expression="" id="tabber-minimizer.js" inline="False"/>
+ <javascript cacheable="True" compression="safe" cookable="True"
+ enabled="True" expression="" id="tabber_inline.js" inline="False"/>
+</object>
View
4 Products/CMFContentPanels/profiles/default/metadata.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<metadata>
+ <version>2.6a</version>
+</metadata>
View
13 Products/CMFContentPanels/profiles/default/skins.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<object name="portal_skins" meta_type="Plone Skins Tool">
+ <object name="contentpanels"
+ meta_type="Filesystem Directory View"
+ directory="CMFContentPanels/skins/contentpanels"/>
+ <object name="cp_viewlets"
+ meta_type="Filesystem Directory View"
+ directory="CMFContentPanels/skins/cp_viewlets"/>
+ <skin-path name="*">
+ <layer insert-after="custom" name="contentpanels"/>
+ <layer insert-after="custom" name="cp_viewlets"/>
+ </skin-path>
+</object>
View
5 Products/CMFContentPanels/profiles/default/toolset.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<tool-setup>
+ <required tool_id="portal_contentpanels"
+ class="Products.CMFContentPanels.ContentPanelsTool"/>
+</tool-setup>
View
4 Products/CMFContentPanels/profiles/default/types.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<object name="portal_types" meta_type="Plone Types Tool">
+ <object name="ContentPanels" meta_type="Factory-based Type Information"/>
+</object>
View
51 Products/CMFContentPanels/profiles/default/types/ContentPanels.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<object name="ContentPanels" meta_type="Factory-based Type Information"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title">ContentPanels</property>
+ <property
+ name="description">ContentPanels is a portlet content to build composite page.</property>
+ <property name="content_icon">contentpanels_icon.gif</property>
+ <property name="content_meta_type">CMF Content Panels</property>
+ <property name="product">CMFContentPanels</property>
+ <property name="factory">addContentPanels</property>
+ <property name="immediate_view">contentpanels_edit_form</property>
+ <property name="global_allow">True</property>
+ <property name="filter_content_types">False</property>
+ <property name="allowed_content_types"/>
+ <property name="allow_discussion">False</property>
+ <alias from="(Default)" to="contentpanels_view"/>
+ <alias from="edit" to="base_edit"/>
+ <alias from="index.html" to="(Default)"/>
+ <alias from="properties" to="base_metadata"/>
+ <alias from="view" to="(Default)"/>
+ <action title="View" action_id="view" category="object" condition_expr=""
+ url_expr="string:${object_url}/contentpanels_view" visible="True">
+ <permission value="View"/>
+ </action>
+ <action title="Edit" action_id="edit" category="object"
+ condition_expr="not:object/@@plone_lock_info/is_locked_for_current_user"
+ 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="True">
+ <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="True">
+ <permission value="Modify portal content"/>
+ <permission value="Review portal content"/>
+ </action>
+ <action title="Layout" action_id="layout" category="object" condition_expr=""
+ url_expr="string:${object_url}/contentpanels_config_form" visible="True">
+ <permission value="Modify portal content"/>
+ </action>
+ <action title="Templates" action_id="templates" category="object"
+ condition_expr=""
+ url_expr="string:${object_url}/contentpanels_templates_form"
+ visible="True">
+ <permission value="Manage portal"/>
+ </action>
+</object>
View
9 Products/CMFContentPanels/skins.zcml
@@ -0,0 +1,9 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:cmf="http://namespaces.zope.org/cmf"
+ i18n_domain="Products.CMFContentPanels">
+
+ <cmf:registerDirectory name="contentpanels"/>
+ <cmf:registerDirectory name="cp_viewlets"/>
+
+</configure>
View
55 Products/CMFContentPanels/skins/cp_viewlets/viewlet_headline.pt
@@ -0,0 +1,55 @@
+<div metal:define-macro="portlet_viewletconf">
+
+ <div class="field">
+
+ <label i18n:domain="plone" i18n:translate="label_title">title:</label>
+
+ <input name="title"
+ tal:attributes="value viewletOptions/title | here/title_or_id| nothing"/>
+
+ </div>
+
+ <div class="field">
+ <label i18n:domain="contentpanels"
+ i18n:translate="label_text">Description:</label>
+ <textarea name="description" rows="6"
+ tal:content="viewletOptions/description | here/Description | nothing"></textarea>
+ </div>
+ <div class="field">
+ <label i18n:translate="label_size" i18n:domain="plone">size</label>
+ <select name="image_size"
+ tal:define="image_size viewletOptions/image_size | string:;
+ sizes python:{'':'original',
+ 'image_large':'large',
+ 'image_preview':'preview',
+ 'image_mini':'mini',
+ 'image_thumb':'thumb',}">
+ <option value=""
+ tal:repeat="v python:['','image_large','image_preview','image_mini','image_thumb']"
+ tal:content="python:sizes[v]"
+ tal:attributes="value v;
+ selected python:v==image_size">original</option>
+ </select>
+ </div>
+
+</div>
+
+<dl metal:define-macro="portlet"
+ class="portlet">
+
+ <dt class="portletHeader">
+ <span class="portletTopLeft"></span>
+ <span tal:content="viewletOptions/title | nothing">message</span>
+ <span class="portletTopRight"></span>
+ </dt>
+
+ <dd class="portletItem lastItem" tal:define="image_size viewletOptions/image_size| nothing">
+ <img tal:condition="python:here.getImage() and image_size" tal:attributes="src string:${here/absolute_url}/$image_size;
+ alt here/Title"/>
+ <span tal:content="viewletOptions/description | nothing">
+ message body</span>
+ <span class="portletBottomLeft"></span>
+ <span class="portletBottomRight"></span>
+ </dd>
+
+</dl>
View
2 Products/CMFContentPanels/version.txt
@@ -1 +1 @@
-2.5.a
+2.6a
View
6 Products/__init__.py
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
View
3 setup.cfg
@@ -0,0 +1,3 @@
+[egg_info]
+#tag_build = dev
+#tag_svn_revision = false
View
31 setup.py
@@ -0,0 +1,31 @@
+from setuptools import setup, find_packages
+import os
+
+version = open(os.path.join("Products", "CMFContentPanels", "version.txt")).read().strip()
+
+setup(name='Products.CMFContentPanels',
+ version=version,
+ description="CMFContentPanels is a plone portlets product to build composite pages",
+ long_description=open(os.path.join("Products", "CMFContentPanels", "README.txt")).read().decode('UTF8').encode('ASCII', 'replace'),
+ # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[
+ "Programming Language :: Python",
+ "Framework :: Plone"
+ ],
+ keywords='plone web composite_pages CMFContentPanels',
+ author='Erico Andrei',
+ author_email='erico@simplesconsultoria.com.br',
+ url='http://svn.plone.org/svn/collective/Products.CMFContentPanels/',
+ license='GPL',
+ packages=find_packages(exclude=['ez_setup']),
+ namespace_packages=['Products'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'setuptools',
+ # -*- Extra requirements: -*-,
+ ],
+ entry_points="""
+ # -*- Entry points: -*-
+ """,
+ )

0 comments on commit e4ff0b6

Please sign in to comment.