Index: /quintagroup.portlet.pfg/trunk/MANIFEST.in
===================================================================
--- /quintagroup.portlet.pfg/trunk/MANIFEST.in (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/MANIFEST.in (revision 2763)
@@ -0,0 +1,4 @@
+recursive-include docs *
+recursive-include quintagroup *
+global-exclude *.pyc
+global-exclude *.mo
Index: /quintagroup.portlet.pfg/trunk/README.txt
===================================================================
--- /quintagroup.portlet.pfg/trunk/README.txt (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/README.txt (revision 2763)
@@ -0,0 +1,4 @@
+Introduction
+============
+
+Render form created by PloneFormGen package.
Index: /quintagroup.portlet.pfg/trunk/docs/HISTORY.txt
===================================================================
--- /quintagroup.portlet.pfg/trunk/docs/HISTORY.txt (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/docs/HISTORY.txt (revision 2763)
@@ -0,0 +1,7 @@
+Changelog
+=========
+
+1.0 (xxxx-xx-xx)
+----------------
+
+* Initial release
Index: /quintagroup.portlet.pfg/trunk/quintagroup/__init__.py
===================================================================
--- /quintagroup.portlet.pfg/trunk/quintagroup/__init__.py (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/quintagroup/__init__.py (revision 2763)
@@ -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__)
Index: /quintagroup.portlet.pfg/trunk/quintagroup/portlet/__init__.py
===================================================================
--- /quintagroup.portlet.pfg/trunk/quintagroup/portlet/__init__.py (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/quintagroup/portlet/__init__.py (revision 2763)
@@ -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__)
Index: /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/configure.zcml
===================================================================
--- /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/configure.zcml (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/configure.zcml (revision 2763)
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
Index: /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/pfg.pt
===================================================================
--- /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/pfg.pt (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/pfg.pt (revision 2763)
@@ -0,0 +1,12 @@
+
+
+ -
+
+
+
+
+
Index: /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/pfg.py
===================================================================
--- /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/pfg.py (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/pfg.py (revision 2763)
@@ -0,0 +1,91 @@
+from zope import schema
+from zope.component import getMultiAdapter
+from zope.formlib import form
+from zope.interface import implements
+
+from plone.app.portlets.portlets import base
+from plone.memoize.compress import xhtml_compress
+from plone.portlets.interfaces import IPortletDataProvider
+
+from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
+from Products.CMFPlone import PloneMessageFactory as _
+from Products.CMFCore.utils import getToolByName
+
+from Products.PloneFormGen.interfaces import IPloneFormGenForm
+from plone.app.vocabularies.catalog import SearchableTextSourceBinder
+from plone.app.form.widgets.uberselectionwidget import UberSelectionWidget
+
+class IPFGPortlet(IPortletDataProvider):
+
+ target_form = schema.Choice(
+ title=_(u"Target form"),
+ description=_(u"Find the form which you want to be",
+ "displayed in portlet."),
+ required=True,
+ source=SearchableTextSourceBinder(
+ {'object_provides':IPloneFormGenForm.__identifier__},
+ default_query='path:'))
+
+class Assignment(base.Assignment):
+ implements(IPFGPortlet)
+
+ def __init__(self, target_form=''):
+ self.target_form = target_form
+
+ @property
+ def title(self):
+ return _(u"PFG Portlet")
+
+class Renderer(base.Renderer):
+
+ _template = ViewPageTemplateFile('pfg.pt')
+
+ def __init__(self, *args):
+ base.Renderer.__init__(self, *args)
+ self.portal_state = getMultiAdapter((self.context, self.request),
+ name=u'plone_portal_state')
+ self.portal = self.portal_state.portal()
+
+
+ def render(self):
+ return xhtml_compress(self._template())
+
+ def pfg_object(self):
+ pfg_path = self.data.target_form
+ if pfg_path.startswith('/'):
+ pfg_path = pfg_path[1:]
+
+ return self.portal.restrictedTraverse(pfg_path, default=None)
+
+ def pfgTitle(self):
+ return self.pfg_object().Title()
+
+ def available(self):
+ """By default, portlets are available
+ """
+ return self.pfg_object() and True or False
+
+ def render_form(self):
+ pfg_path = self.pfg_object().absolute_url(True)
+ form_view = self.portal.restrictedTraverse('%s/@@embedded' % pfg_path)
+ form_view.prefix = 'pfgportlet'
+ return form_view()
+
+class AddForm(base.AddForm):
+
+ form_fields = form.Fields(IPFGPortlet)
+ form_fields['target_form'].custom_widget = UberSelectionWidget
+
+ label = _(u"Add PFG Portlet")
+ description = _(u"This portlet displays pfg content.")
+
+ def create(self, data):
+ return Assignment(target_form=data.get('target_form', ''))
+
+class EditForm(base.EditForm):
+
+ form_fields = form.Fields(IPFGPortlet)
+ form_fields['target_form'].custom_widget = UberSelectionWidget
+
+ label = _(u"Edit PFG Portlet")
+ description = _(u"This portlet displays pfg content.")
Index: /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/profiles/default/portlets.xml
===================================================================
--- /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/profiles/default/portlets.xml (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/profiles/default/portlets.xml (revision 2763)
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
Index: /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/versions.txt
===================================================================
--- /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/versions.txt (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/versions.txt (revision 2763)
@@ -0,0 +1,1 @@
+0.1
Index: /quintagroup.portlet.pfg/trunk/setup.cfg
===================================================================
--- /quintagroup.portlet.pfg/trunk/setup.cfg (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/setup.cfg (revision 2763)
@@ -0,0 +1,3 @@
+[egg_info]
+tag_build = dev
+tag_svn_revision = true
Index: /quintagroup.portlet.pfg/trunk/setup.py
===================================================================
--- /quintagroup.portlet.pfg/trunk/setup.py (revision 2763)
+++ /quintagroup.portlet.pfg/trunk/setup.py (revision 2763)
@@ -0,0 +1,32 @@
+from setuptools import setup, find_packages
+import os
+
+version = '1.0'
+
+setup(name='quintagroup.portlet.pfg',
+ version=version,
+ description="Render form created by PloneFormGen pachage.",
+ long_description=open("README.txt").read() + "\n" +
+ open(os.path.join("docs", "HISTORY.txt")).read(),
+ # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[
+ "Programming Language :: Python",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ ],
+ keywords='portlet pfg',
+ author='Melnychuk Taras',
+ author_email='fenix@quintagroup.com',
+ url='',
+ license='GPL',
+ packages=find_packages(exclude=['ez_setup']),
+ namespace_packages=['quintagroup', 'quintagroup.portlet'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'setuptools',
+ # -*- Extra requirements: -*-
+ ],
+ entry_points="""
+ # -*- Entry points: -*-
+ """,
+ )