diff --git a/CHANGES.rst b/CHANGES.rst index 7990fd96..72aa63c7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,9 @@ Changelog 3.2.2 (unreleased) ------------------ -- Nothing changed yet. +- Add filesize upload limit. [ThibautBorn] + +- update Dutch translations [ThibautBorn] 3.2.1 (2022-12-01) diff --git a/src/collective/easyform/browser/controlpanel.py b/src/collective/easyform/browser/controlpanel.py index d6d34867..d01fb3c9 100644 --- a/src/collective/easyform/browser/controlpanel.py +++ b/src/collective/easyform/browser/controlpanel.py @@ -46,6 +46,12 @@ class IEasyFormControlPanel(Interface): default=u",", ) + max_filesize = schema.Int( + title=_(u"Filesize limit"), + description=_(u"Set the maximum filesize (in bytes) that users should be able to upload."), + required=False + ) + class EasyFormControlPanelForm(RegistryEditForm): schema = IEasyFormControlPanel diff --git a/src/collective/easyform/fields.zcml b/src/collective/easyform/fields.zcml index 189ed6cb..85fd18af 100644 --- a/src/collective/easyform/fields.zcml +++ b/src/collective/easyform/fields.zcml @@ -74,4 +74,13 @@ name="collective.easyform.fields.Likert" component=".fields.LikertHandler" /> + diff --git a/src/collective/easyform/locales/collective.easyform.pot b/src/collective/easyform/locales/collective.easyform.pot index a6bc168f..58280bf0 100644 --- a/src/collective/easyform/locales/collective.easyform.pot +++ b/src/collective/easyform/locales/collective.easyform.pot @@ -1,6 +1,6 @@ -# --- PLEASE EDIT THE LINES BELOW CORRECTLY --- -# SOME DESCRIPTIVE TITLE. -# FIRST AUTHOR , YEAR. +#--- PLEASE EDIT THE LINES BELOW CORRECTLY --- +#SOME DESCRIPTIVE TITLE. +#FIRST AUTHOR , YEAR. msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" @@ -42,7 +42,7 @@ msgstr "" msgid "Advanced" msgstr "" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "" @@ -92,6 +92,10 @@ msgstr "" msgid "Export" msgstr "" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "" @@ -166,7 +170,7 @@ msgstr "" msgid "Thanks Page" msgstr "" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "" diff --git a/src/collective/easyform/locales/de/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/de/LC_MESSAGES/collective.easyform.po index 013a6f66..71095697 100644 --- a/src/collective/easyform/locales/de/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/de/LC_MESSAGES/collective.easyform.po @@ -41,7 +41,7 @@ msgstr "Adressierung" msgid "Advanced" msgstr "Erweitert" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "Erlaubte Felder" @@ -91,6 +91,10 @@ msgstr "XML Feldmodell bearbeiten" msgid "Export" msgstr "Exportieren" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "Feldmodell" @@ -165,7 +169,7 @@ msgstr "" msgid "Thanks Page" msgstr "Danke-Seite" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "Diese Felder stehen für das Formular zur Verfügung." diff --git a/src/collective/easyform/locales/en/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/en/LC_MESSAGES/collective.easyform.po index ea4e645f..ce747e2e 100644 --- a/src/collective/easyform/locales/en/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/en/LC_MESSAGES/collective.easyform.po @@ -39,7 +39,7 @@ msgstr "" msgid "Advanced" msgstr "" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "" @@ -89,6 +89,10 @@ msgstr "" msgid "Export" msgstr "" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "" @@ -163,7 +167,7 @@ msgstr "" msgid "Thanks Page" msgstr "" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "" diff --git a/src/collective/easyform/locales/es/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/es/LC_MESSAGES/collective.easyform.po index 987531a9..37de8dc5 100644 --- a/src/collective/easyform/locales/es/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/es/LC_MESSAGES/collective.easyform.po @@ -44,7 +44,7 @@ msgstr "Direcciónes" msgid "Advanced" msgstr "" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "Campos permitidos" @@ -94,6 +94,10 @@ msgstr "Editar XML de Modelo de Campos" msgid "Export" msgstr "Exportar" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "Modelo de campos" @@ -168,7 +172,7 @@ msgstr "" msgid "Thanks Page" msgstr "Página de agradecimiento" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "Estos campos están disponibles para tus formularios" diff --git a/src/collective/easyform/locales/eu/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/eu/LC_MESSAGES/collective.easyform.po index 93539544..9a5d41b7 100644 --- a/src/collective/easyform/locales/eu/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/eu/LC_MESSAGES/collective.easyform.po @@ -41,7 +41,7 @@ msgstr "Helbideak" msgid "Advanced" msgstr "" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "Onartutako eremuak" @@ -91,6 +91,10 @@ msgstr "Eremuen XML eredua editatu" msgid "Export" msgstr "Esportatu" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "Eremuen eredua" @@ -165,7 +169,7 @@ msgstr "" msgid "Thanks Page" msgstr "Eskertza-orria" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "Eremu hauek gehitu daitezke formularioetan." diff --git a/src/collective/easyform/locales/it/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/it/LC_MESSAGES/collective.easyform.po index cd21b41a..888f1c60 100644 --- a/src/collective/easyform/locales/it/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/it/LC_MESSAGES/collective.easyform.po @@ -40,7 +40,7 @@ msgstr "Indirizzi" msgid "Advanced" msgstr "" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "Campi consentiti" @@ -90,6 +90,10 @@ msgstr "Modifica l'XML dei campi" msgid "Export" msgstr "Esporta" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "Modello dei campi" @@ -164,7 +168,7 @@ msgstr "" msgid "Thanks Page" msgstr "Pagina di ringraziamento" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "" diff --git a/src/collective/easyform/locales/ja/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/ja/LC_MESSAGES/collective.easyform.po index 4fa6c72b..7593e6dd 100644 --- a/src/collective/easyform/locales/ja/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/ja/LC_MESSAGES/collective.easyform.po @@ -52,7 +52,7 @@ msgid "Advanced" msgstr "上級者向け設定" # コントロールパネル内 -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "追加許可フィールド" @@ -113,6 +113,10 @@ msgstr " XML アクションズフィールドを編集" msgid "Export" msgstr "エクスポート" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + # 場所不明 #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" @@ -205,7 +209,7 @@ msgid "Thanks Page" msgstr "送信完了ページ" # コントロールパネル -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "このフォームで利用できるフィールドは、以下の通りです" diff --git a/src/collective/easyform/locales/nl/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/nl/LC_MESSAGES/collective.easyform.po index e4769e17..d3b57710 100644 --- a/src/collective/easyform/locales/nl/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/nl/LC_MESSAGES/collective.easyform.po @@ -43,7 +43,7 @@ msgstr "Adressering" msgid "Advanced" msgstr "Geavanceerd" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "Toegestane velden" @@ -51,7 +51,7 @@ msgstr "Toegestane velden" #: collective/easyform/browser/controlpanel.py:42 #: collective/easyform/browser/saveddata_form.pt:34 msgid "CSV delimiter" -msgstr "" +msgstr "CSV-scheidingsteken" #: collective/easyform/browser/saveddata_form.pt:37 msgid "CSV delimiter is required." @@ -93,6 +93,10 @@ msgstr "Bewerk XML veldenmodel" msgid "Export" msgstr "Exporteer" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "Veldenmodel" @@ -161,13 +165,17 @@ msgstr "Opslag" #: collective/easyform/browser/controlpanel.py:44 msgid "Set the default delimiter for CSV download." -msgstr "" +msgstr "Stel het standaardscheidingsteken in voor CSV-downloads" + +#: collective/easyform/browser/controlpanel.py:39 +msgid "Set the maximum filesize (in bytes) that users should be able to upload." +msgstr "Maximale grootte (in bytes) voor bestanden die kunnen worden opgeladen" #: collective/easyform/interfaces/easyform.py:117 msgid "Thanks Page" msgstr "'Bedankt' pagina" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "Deze velden zijn beschikbaar voor het formulier" @@ -889,7 +897,7 @@ msgstr "Het bestandstype ${ftype} is niet toegestaan ​​als upload" #: collective/easyform/browser/view.py:399 msgid "msg_file_too_big" -msgstr "Het geüploade bestand is groter dan $ {size} bytes." +msgstr "Het geüploade bestand is groter dan ${size} bytes." #. Default: "Comma-Separated Values" #: collective/easyform/vocabularies.py:80 diff --git a/src/collective/easyform/locales/pt_BR/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/pt_BR/LC_MESSAGES/collective.easyform.po index 8e62b990..f69ddcc5 100644 --- a/src/collective/easyform/locales/pt_BR/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/pt_BR/LC_MESSAGES/collective.easyform.po @@ -39,7 +39,7 @@ msgstr "Endereçamento" msgid "Advanced" msgstr "" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "Campos permitidos" @@ -89,6 +89,10 @@ msgstr "Editar o XML do modelo de campos" msgid "Export" msgstr "Exportar" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "Modelo de campos" @@ -163,7 +167,7 @@ msgstr "" msgid "Thanks Page" msgstr "Página de agradecimento" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "Estes campos estão disponíveis para seus formulários" diff --git a/src/collective/easyform/locales/uk/LC_MESSAGES/collective.easyform.po b/src/collective/easyform/locales/uk/LC_MESSAGES/collective.easyform.po index 7d895d09..fd102671 100644 --- a/src/collective/easyform/locales/uk/LC_MESSAGES/collective.easyform.po +++ b/src/collective/easyform/locales/uk/LC_MESSAGES/collective.easyform.po @@ -42,7 +42,7 @@ msgstr "Адреси" msgid "Advanced" msgstr "" -#: collective/easyform/browser/controlpanel.py:28 +#: collective/easyform/browser/controlpanel.py:20 #: collective/easyform/profiles/default/registry.xml msgid "Allowed Fields" msgstr "" @@ -92,6 +92,10 @@ msgstr "Редагувати XML модель полів" msgid "Export" msgstr "Експортувати" +#: collective/easyform/interfaces/fields.py:94 +msgid "Field depends on" +msgstr "" + #: collective/easyform/interfaces/easyform.py:90 msgid "Fields Model" msgstr "Модель полів" @@ -166,7 +170,7 @@ msgstr "" msgid "Thanks Page" msgstr "Сторінка подяки" -#: collective/easyform/browser/controlpanel.py:29 +#: collective/easyform/browser/controlpanel.py:21 #: collective/easyform/profiles/default/registry.xml msgid "This Fields are available for your forms." msgstr "" diff --git a/src/collective/easyform/profiles/default/metadata.xml b/src/collective/easyform/profiles/default/metadata.xml index 94f484f9..4305c3ca 100644 --- a/src/collective/easyform/profiles/default/metadata.xml +++ b/src/collective/easyform/profiles/default/metadata.xml @@ -1,4 +1,4 @@ - 1011 + 1012 diff --git a/src/collective/easyform/profiles/default/registry.xml b/src/collective/easyform/profiles/default/registry.xml index 7f9a8e77..ba5d48dd 100644 --- a/src/collective/easyform/profiles/default/registry.xml +++ b/src/collective/easyform/profiles/default/registry.xml @@ -85,4 +85,16 @@ interface="collective.easyform.browser.controlpanel.IEasyFormControlPanel" name="easyform.csv_delimiter"> + + + + + + Easyform + + ++plone++bootstrap-icons/ui-checks.svg + + diff --git a/src/collective/easyform/upgrades/1012.zcml b/src/collective/easyform/upgrades/1012.zcml new file mode 100644 index 00000000..84266082 --- /dev/null +++ b/src/collective/easyform/upgrades/1012.zcml @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/src/collective/easyform/upgrades/configure.zcml b/src/collective/easyform/upgrades/configure.zcml index e9a5d653..09fdb9c9 100644 --- a/src/collective/easyform/upgrades/configure.zcml +++ b/src/collective/easyform/upgrades/configure.zcml @@ -10,5 +10,5 @@ - + diff --git a/src/collective/easyform/upgrades/profiles/1012/registry.xml b/src/collective/easyform/upgrades/profiles/1012/registry.xml new file mode 100644 index 00000000..57d864d9 --- /dev/null +++ b/src/collective/easyform/upgrades/profiles/1012/registry.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/src/collective/easyform/validators.py b/src/collective/easyform/validators.py index 8b7722f6..521d3de6 100644 --- a/src/collective/easyform/validators.py +++ b/src/collective/easyform/validators.py @@ -1,11 +1,16 @@ # -*- coding: utf-8 -*- from collective.easyform import easyformMessageFactory as _ +from collective.easyform.browser.view import ValidateFile from collective.easyform.interfaces import IFieldValidator from plone import api from Products.CMFPlone.RegistrationTool import EmailAddressInvalid from Products.validation import validation from Products.validation.validators.BaseValidators import baseValidators from zope.component import provideUtility +from zope.schema import ValidationError +from z3c.form.interfaces import NOT_CHANGED +from z3c.form import validator + import six @@ -81,4 +86,27 @@ def validate(value, **kwargs): ) +class FileTooBig(ValidationError): + def __init__(self, message): + self.message = message + + def doc(self): + return self.message + +class FileSizeValidator(validator.SimpleFieldValidator): + + def validate(self, value): + # The NOT_CHANGED value needs to be handled better since we may have + # stored an invalid value in an earlier request. + if value is NOT_CHANGED: + value = self.widget.value + super(FileSizeValidator, self).validate(value) + view = ValidateFile(self.context, self.request) + max_size = api.portal.get_registry_record("easyform.max_filesize") + if max_size: + result = view(value, size=max_size) + if result: + raise FileTooBig(result) + + update_validators()