Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/collective/documentgenerator/browser/controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@ class IDocumentGeneratorControlPanelSchema(Interface):
description=_(u'If enabled, this will automatically apply the default page style on the firstparagraph'
u'of a POD template using the "mailing" attribute (if no page style was set).'),
required=False,
default=False
default=False,
)

page_break_type = schema.Choice(
title=_(u"Page break type"),
description=_(
u"Type of page break to use in the document. 'duplex' for recto/verso printing, 'simplex' otherwise."
),
vocabulary="collective.documentgenerator.PageBreakType",
required=True,
default="duplex",
)


Expand Down
15 changes: 15 additions & 0 deletions src/collective/documentgenerator/content/vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
from zope.schema.vocabulary import SimpleVocabulary


class PageBreakTypeVocabularyFactory(object):
"""
Vocabulary factory for 'page_break_type' field.
"""

def __call__(self, context):
vocabulary = SimpleVocabulary(
[
SimpleTerm("simplex", "simplex", "simplex"),
SimpleTerm("duplex", "duplex", "duplex"),
]
)
return vocabulary


class FormatsVocabularyFactory(object):
"""
Vocabulary factory for 'pod_formats' field.
Expand Down
7 changes: 7 additions & 0 deletions src/collective/documentgenerator/content/vocabulary.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
xmlns="http://namespaces.zope.org/zope"
i18n_domain="collective.documentgenerator">

<!-- Page Break Vocabulary -->
<utility
factory=".vocabulary.PageBreakTypeVocabularyFactory"
name="collective.documentgenerator.PageBreakType"
provides="zope.schema.interfaces.IVocabularyFactory"
/>

<!-- Formats Vocabulary -->
<utility
factory=".vocabulary.FormatsVocabularyFactory"
Expand Down
7 changes: 7 additions & 0 deletions src/collective/documentgenerator/helper/dexterity.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ def get_relations(self, context=None, attribute=None, backrefs=False, as_obj=Fal
context = self.real_context
return ih_get_relations(context, attribute=attribute, backrefs=backrefs, as_obj=as_obj)

@property
def page_break_type(self):
registry = api.portal.get_tool(name="portal_registry")
return registry[
"collective.documentgenerator.browser.controlpanel.IDocumentGeneratorControlPanelSchema.page_break_type"
]


class DXDisplayProxyObject(DisplayProxyObject):

Expand Down
10 changes: 10 additions & 0 deletions src/collective/documentgenerator/profiles.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@
import_steps="plone.app.registry" />
</genericsetup:upgradeSteps>

<genericsetup:upgradeSteps
source="15"
destination="16"
profile="collective.documentgenerator:default">
<genericsetup:upgradeDepends
title="Reapply registry.xml"
description="This will add new parameter 'page_break_type'"
import_steps="plone.app.registry" />
</genericsetup:upgradeSteps>

<utility factory=".setuphandlers.HiddenProfiles" name="collective.documentgenerator" />
<utility factory=".setuphandlers.HiddenProducts" name="collective.documentgenerator" />

Expand Down
Binary file not shown.