diff --git a/src/collective/judgment/browser/addpdffiles.py b/src/collective/judgment/browser/addpdffiles.py new file mode 100644 index 0000000..fcca4ed --- /dev/null +++ b/src/collective/judgment/browser/addpdffiles.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# from collective.judgment import _ +from Acquisition import aq_inner +from plone.dexterity.browser.add import DefaultAddForm +from plone.dexterity.browser.add import DefaultAddView +from plone.dexterity.interfaces import IDexterityFTI +from plone.dexterity.utils import addContentToContainer +from zope.component import getUtility + + +class PdfFileAddForm(DefaultAddForm): + portal_type = 'Pdf File' + + def add(self, object): + + fti = getUtility(IDexterityFTI, name=self.portal_type) + container = aq_inner(self.context) + new_object = addContentToContainer(container, object) + + parentfti = getUtility(IDexterityFTI, name=container.portal_type) + + if parentfti.immediate_view: + self.immediate_view = "/".join( + [container.absolute_url(), fti.immediate_view] + ) + else: + self.immediate_view = "/".join( + [container.absolute_url(), ] + ) + + +class PdfFileAddView(DefaultAddView): + form = PdfFileAddForm diff --git a/src/collective/judgment/browser/configure.zcml b/src/collective/judgment/browser/configure.zcml index 40f3b86..a675ab4 100644 --- a/src/collective/judgment/browser/configure.zcml +++ b/src/collective/judgment/browser/configure.zcml @@ -17,8 +17,30 @@ type="plone" directory="static" /> + + + + + + + + diff --git a/src/collective/judgment/profiles/default/types/Pdf_File.xml b/src/collective/judgment/profiles/default/types/Pdf_File.xml new file mode 100644 index 0000000..0658362 --- /dev/null +++ b/src/collective/judgment/profiles/default/types/Pdf_File.xml @@ -0,0 +1,94 @@ + + + + + Pdf File + Lets you upload a file to the site. + + False + Pdf File + + + + + + True + False + + + collective.judgment.AddPromotion + collective.judgment.content.files.PdfFile + + + collective.judgment.content.files.IPdfFile + + + + + + + + + + + + + + + string:${folder_url}/++add++Pdf File + file_view + False + view + + + + + + + + + + + + + + + + + + + diff --git a/src/collective/judgment/profiles/default/types/promotion.xml b/src/collective/judgment/profiles/default/types/promotion.xml index ef5b5e4..ef1b338 100644 --- a/src/collective/judgment/profiles/default/types/promotion.xml +++ b/src/collective/judgment/profiles/default/types/promotion.xml @@ -21,6 +21,7 @@ True True +