|
1 | 1 | # -*- coding: utf-8 -*- |
| 2 | +from collective.classification.folder.browser.settings import IClassificationConfig |
| 3 | +from collective.classification.folder.browser.settings import SettingsEditForm as CFSettingsEditForm |
| 4 | +from collective.classification.folder.browser.settings import SettingsView as CFSettingsView |
2 | 5 | from collective.contact.plonegroup.config import get_registry_functions |
3 | 6 | from collective.contact.plonegroup.config import get_registry_organizations |
4 | 7 | from collective.contact.plonegroup.config import set_registry_functions |
|
37 | 40 | from plone.dexterity.fti import ftiModified |
38 | 41 | from plone.dexterity.interfaces import IDexterityFTI |
39 | 42 | from plone.registry.interfaces import IRecordModifiedEvent |
| 43 | +from plone.registry.interfaces import IRegistry |
40 | 44 | from plone.registry.recordsproxy import RecordsProxy |
41 | 45 | from plone.supermodel import model |
42 | 46 | from plone.z3cform import layout |
@@ -449,6 +453,25 @@ class ISignerRuleSchema(Interface): |
449 | 453 | ] |
450 | 454 | ) |
451 | 455 |
|
| 456 | +omail_duplicate_fields = SimpleVocabulary( |
| 457 | + [ |
| 458 | + SimpleTerm(value=u"category", title=_(u"Keep classification category")), |
| 459 | + SimpleTerm(value=u"folder", title=_(u"Keep classification folder")), |
| 460 | + SimpleTerm(value=u"reply_to", title=_(u"Keep reply_to mails")), |
| 461 | + SimpleTerm(value=u"dms_files", title=_(u"Keep DMS files")), |
| 462 | + SimpleTerm(value=u"annexes", title=_(u"Keep annexes")), |
| 463 | + SimpleTerm(value=u"link_to_duplicated", title=_(u"Link to duplicated mail")), |
| 464 | + ] |
| 465 | +) |
| 466 | + |
| 467 | +folder_duplicate_fields = SimpleVocabulary( |
| 468 | + [ |
| 469 | + SimpleTerm(value=u"subfolders", title=_(u"Keep subfolders")), |
| 470 | + SimpleTerm(value=u"linked_mails", title=_(u"Keep linked mails")), |
| 471 | + SimpleTerm(value=u"annexes", title=_(u"Keep annexes")), |
| 472 | + ] |
| 473 | +) |
| 474 | + |
452 | 475 |
|
453 | 476 | class ITableListSchema(Interface): |
454 | 477 | value = schema.TextLine(title=_("Stored value/id"), required=True, constraint=is_valid_identifier) |
@@ -594,6 +617,8 @@ class IImioDmsMailConfig(model.Schema): |
594 | 617 | "omail_send_modes", |
595 | 618 | "omail_post_mailing", |
596 | 619 | "omail_signer_rules", |
| 620 | + "omail_duplicate_display_fields", |
| 621 | + "omail_duplicate_true_default_values", |
597 | 622 | "omail_fields", |
598 | 623 | "omail_group_encoder", |
599 | 624 | ], |
@@ -678,6 +703,21 @@ class IImioDmsMailConfig(model.Schema): |
678 | 703 | auto_append=False, |
679 | 704 | ) |
680 | 705 |
|
| 706 | + omail_duplicate_display_fields = schema.List( |
| 707 | + title=_(u"Fields to display when duplicating an outgoing mail"), |
| 708 | + required=False, |
| 709 | + value_type=schema.Choice(vocabulary=omail_duplicate_fields), |
| 710 | + default=[u"category", u"folder", u"reply_to", u"dms_files", u"annexes", u"link_to_duplicated"], |
| 711 | + ) |
| 712 | + |
| 713 | + omail_duplicate_true_default_values = schema.List( |
| 714 | + title=_(u"Default values to True when duplicating an outgoing mail"), |
| 715 | + description=_(u"If checked, the default value will be True."), |
| 716 | + required=False, |
| 717 | + value_type=schema.Choice(vocabulary=omail_duplicate_fields), |
| 718 | + default=[u"category", u"folder", u"annexes"], |
| 719 | + ) |
| 720 | + |
681 | 721 | omail_fields = schema.List( |
682 | 722 | title=_(u"${type} fields display", mapping={"type": _("Outgoing mail")}), |
683 | 723 | description=_(u"Configure this carefully. You can order with arrows."), |
@@ -1473,3 +1513,40 @@ class IImioDmsMailConfig2(Interface): |
1473 | 1513 | product_version = schema.TextLine( |
1474 | 1514 | title=_(u"Current product version"), |
1475 | 1515 | ) |
| 1516 | + |
| 1517 | + |
| 1518 | +# --- Classification folder settings |
| 1519 | + |
| 1520 | +class IImioClassificationConfig(IClassificationConfig): |
| 1521 | + |
| 1522 | + folder_duplicate_display_fields = schema.List( |
| 1523 | + title=_(u"Fields to display when duplicating a folder"), |
| 1524 | + required=False, |
| 1525 | + value_type=schema.Choice(vocabulary=folder_duplicate_fields), |
| 1526 | + default=[u"subfolders", u"linked_mails", u"annexes"], |
| 1527 | + ) |
| 1528 | + |
| 1529 | + folder_duplicate_true_default_values = schema.List( |
| 1530 | + title=_(u"Default values to True when duplicating a folder"), |
| 1531 | + description=_(u"If checked, the default value will be True."), |
| 1532 | + required=False, |
| 1533 | + value_type=schema.Choice(vocabulary=folder_duplicate_fields), |
| 1534 | + default=[u"subfolders", u"linked_mails", u"annexes"], |
| 1535 | + ) |
| 1536 | + |
| 1537 | + |
| 1538 | +class ImioClassificationSettingsEditForm(CFSettingsEditForm): |
| 1539 | + schema = IImioClassificationConfig |
| 1540 | + label = _(u"Classification Config") |
| 1541 | + |
| 1542 | + def getContent(self): |
| 1543 | + registry = getUtility(IRegistry) |
| 1544 | + return registry.forInterface( |
| 1545 | + self.schema, |
| 1546 | + prefix='collective.classification.folder.browser.settings.IClassificationConfig', |
| 1547 | + check=False |
| 1548 | + ) |
| 1549 | + |
| 1550 | + |
| 1551 | +class ImioClassificationSettingsView(CFSettingsView): |
| 1552 | + form = ImioClassificationSettingsEditForm |
0 commit comments