diff --git a/lib/Constants.php b/lib/Constants.php index 60af263ff..a2263c0d6 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -46,6 +46,7 @@ class Constants { public const MAX_STRING_LENGTHS = [ 'formTitle' => 256, 'formDescription' => 8192, + 'submissionMessage' => 2048, 'questionText' => 2048, 'questionDescription' => 4096, 'optionText' => 1024, diff --git a/lib/Db/Form.php b/lib/Db/Form.php index 3f0b7d0af..e4021f534 100644 --- a/lib/Db/Form.php +++ b/lib/Db/Form.php @@ -52,6 +52,8 @@ * @method void setShowExpiration(bool $value) * @method integer getLastUpdated() * @method void setLastUpdated(integer $value) + * @method string getSubmissionMessage() + * @method void setSubmissionMessage(string $value) */ class Form extends Entity { protected $hash; @@ -64,6 +66,7 @@ class Form extends Entity { protected $isAnonymous; protected $submitMultiple; protected $showExpiration; + protected $submissionMessage; protected $lastUpdated; /** @@ -102,7 +105,8 @@ public function read() { 'isAnonymous' => (bool)$this->getIsAnonymous(), 'submitMultiple' => (bool)$this->getSubmitMultiple(), 'showExpiration' => (bool)$this->getShowExpiration(), - 'lastUpdated' => (int)$this->getLastUpdated() + 'lastUpdated' => (int)$this->getLastUpdated(), + 'submissionMessage' => $this->getSubmissionMessage() ?? '', ]; } } diff --git a/lib/Migration/Version030400Date20230628011500.php b/lib/Migration/Version030400Date20230628011500.php new file mode 100644 index 000000000..6b3846ee6 --- /dev/null +++ b/lib/Migration/Version030400Date20230628011500.php @@ -0,0 +1,61 @@ + + * + * @author Ferdinand Thiessen + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Forms\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version030400Date20230628011500 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + $table = $schema->getTable('forms_v2_forms'); + + if (!$table->hasColumn('submission_message')) { + $table->addColumn('submission_message', Types::STRING, [ + 'notnull' => false, + 'default' => '', + 'length' => 2048, + 'comment' => 'custom thank you message', + ]); + + return $schema; + } + + return null; + } +} diff --git a/src/components/SidebarTabs/SettingsSidebarTab.vue b/src/components/SidebarTabs/SettingsSidebarTab.vue index 7f3d11475..31a24a9b3 100644 --- a/src/components/SidebarTabs/SettingsSidebarTab.vue +++ b/src/components/SidebarTabs/SettingsSidebarTab.vue @@ -59,6 +59,23 @@ {{ t('forms', 'Show expiration date on form') }} +
+