Merge
Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 9.0.1 to 9.0.2. - [Release notes](https://github.com/webpack-contrib/sass-loader/releases) - [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack-contrib/sass-loader/compare/v9.0.1...v9.0.2) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Bump @nextcloud/vue from 2.2.0 to 2.2.1 Bumps [@nextcloud/vue](https://github.com/nextcloud/nextcloud-vue) from 2.2.0 to 2.2.1. - [Release notes](https://github.com/nextcloud/nextcloud-vue/releases) - [Commits](https://github.com/nextcloud/nextcloud-vue/compare/v2.2.0...v2.2.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Bump vuedraggable from 2.23.2 to 2.24.0 Bumps [vuedraggable](https://github.com/SortableJS/Vue.Draggable) from 2.23.2 to 2.24.0. - [Release notes](https://github.com/SortableJS/Vue.Draggable/releases) - [Commits](https://github.com/SortableJS/Vue.Draggable/compare/v2.23.2...v2.24.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Bump @nextcloud/axios from 1.3.2 to 1.3.3 Bumps [@nextcloud/axios](https://github.com/nextcloud/nextcloud-axios) from 1.3.2 to 1.3.3. - [Release notes](https://github.com/nextcloud/nextcloud-axios/releases) - [Changelog](https://github.com/nextcloud/nextcloud-axios/blob/master/CHANGELOG.md) - [Commits](https://github.com/nextcloud/nextcloud-axios/compare/v1.3.2...v1.3.3) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> [tx-robot] updated from transifex Move to webpack vue global config & clean routes Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> Lint fix Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> @nextcloud/webpack-vue-config@1.0.3 Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> [tx-robot] updated from transifex [tx-robot] updated from transifex Bump @nextcloud/webpack-vue-config from 1.0.3 to 1.1.0 Bumps [@nextcloud/webpack-vue-config](https://github.com/nextcloud/webpack-vue-config) from 1.0.3 to 1.1.0. - [Release notes](https://github.com/nextcloud/webpack-vue-config/releases) - [Commits](https://github.com/nextcloud/webpack-vue-config/compare/v1.0.3...v1.1.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Bump @babel/core from 7.10.4 to 7.10.5 Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.10.4 to 7.10.5. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.10.5/packages/babel-core) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> [tx-robot] updated from transifex Add screenshot of response visualization, adjust readme Signed-off-by: Jan C. Borchardt <hey@jancborchardt.net> [tx-robot] updated from transifex [tx-robot] updated from transifex Revert "Allow navigation through edit via Tab-Key" v2.0.0-rc.1 Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> [tx-robot] updated from transifex Bump webpack from 4.43.0 to 4.44.0 Bumps [webpack](https://github.com/webpack/webpack) from 4.43.0 to 4.44.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v4.43.0...v4.44.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> [tx-robot] updated from transifex Update stylelint config Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> Fix actions Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com> [tx-robot] updated from transifex Fix dropdown submission insert Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> 2.0.0 Force enable for master Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> [tx-robot] updated from transifex Fix substring utf8 Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com> 2.0.1 [Security] Bump elliptic from 6.5.0 to 6.5.3 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.0 to 6.5.3. **This update includes a security fix.** - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.0...v6.5.3) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> [tx-robot] updated from transifex Increase description length Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com> 2.0.2 Bump webpack from 4.44.0 to 4.44.1 Bumps [webpack](https://github.com/webpack/webpack) from 4.44.0 to 4.44.1. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v4.44.0...v4.44.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Bump @babel/core from 7.10.5 to 7.11.0 Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.10.5 to 7.11.0. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.11.0/packages/babel-core) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Bump @babel/preset-env from 7.10.4 to 7.11.0 Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.10.4 to 7.11.0. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.11.0/packages/babel-preset-env) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> [tx-robot] updated from transifex [tx-robot] updated from transifex
This commit is contained in:
parent
e3002ea31f
commit
e2959be243
68 changed files with 1490 additions and 1280 deletions
|
|
@ -40,14 +40,15 @@ use OCA\Forms\Db\SubmissionMapper;
|
|||
use OCA\Forms\Service\FormsService;
|
||||
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
use OCP\AppFramework\Db\IMapperException;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\ILogger;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Security\ISecureRandom;
|
||||
|
||||
class ApiController extends Controller {
|
||||
|
|
@ -725,7 +726,11 @@ class ApiController extends Controller {
|
|||
}
|
||||
|
||||
foreach ($answerArray as $answer) {
|
||||
if ($question['type'] === 'multiple' || $question['type'] === 'multiple_unique') {
|
||||
// Are we using answer ids as values
|
||||
if ($question['type'] === 'multiple'
|
||||
|| $question['type'] === 'multiple_unique'
|
||||
|| $question['type'] === 'dropdown') {
|
||||
|
||||
// Search corresponding option, skip processing if not found
|
||||
$optionIndex = array_search($answer, array_column($question['options'], 'id'));
|
||||
if ($optionIndex === false) {
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ class PageController extends Controller {
|
|||
*/
|
||||
private $maxStringLengths = [
|
||||
'formTitle' => 256,
|
||||
'formDescription' => 2048,
|
||||
'formDescription' => 8192,
|
||||
'questionText' => 2048,
|
||||
'optionText' => 1024,
|
||||
'answerText' => 2048,
|
||||
'answerText' => 4096,
|
||||
];
|
||||
|
||||
public function __construct(string $appName,
|
||||
|
|
@ -126,61 +126,7 @@ class PageController extends Controller {
|
|||
* @return TemplateResponse
|
||||
*/
|
||||
public function index(): TemplateResponse {
|
||||
Util::addScript($this->appName, 'forms');
|
||||
Util::addStyle($this->appName, 'forms');
|
||||
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
||||
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function createForm(): TemplateResponse {
|
||||
Util::addScript($this->appName, 'forms');
|
||||
Util::addStyle($this->appName, 'forms');
|
||||
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
||||
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* TODO: Implement cloning
|
||||
*
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function cloneForm(): TemplateResponse {
|
||||
Util::addScript($this->appName, 'forms');
|
||||
Util::addStyle($this->appName, 'forms');
|
||||
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
||||
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function editForm(): TemplateResponse {
|
||||
Util::addScript($this->appName, 'forms');
|
||||
Util::addStyle($this->appName, 'forms');
|
||||
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
||||
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getResult(): TemplateResponse {
|
||||
Util::addScript($this->appName, 'forms');
|
||||
Util::addScript($this->appName, 'forms-main');
|
||||
Util::addStyle($this->appName, 'forms');
|
||||
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
||||
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
|
||||
|
|
@ -219,7 +165,7 @@ class PageController extends Controller {
|
|||
}
|
||||
|
||||
// Main Template to fill the form
|
||||
Util::addScript($this->appName, 'submit');
|
||||
Util::addScript($this->appName, 'forms-submit');
|
||||
$this->initialStateService->provideInitialState($this->appName, 'form', $this->formsService->getPublicForm($form->getId()));
|
||||
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
||||
return $this->provideTemplate(self::TEMPLATE_MAIN, $form);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
|
|||
]);
|
||||
$table->addColumn('description', Type::STRING, [
|
||||
'notnull' => false,
|
||||
'length' => 2048,
|
||||
'length' => 8192,
|
||||
]);
|
||||
$table->addColumn('owner_id', Type::STRING, [
|
||||
'notnull' => true,
|
||||
|
|
@ -199,7 +199,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
|
|||
]);
|
||||
$table->addColumn('text', Type::STRING, [
|
||||
'notnull' => true,
|
||||
'length' => 2048,
|
||||
'length' => 4096,
|
||||
]);
|
||||
$table->setPrimaryKey(['id']);
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
|
|||
//In case the old Question would have been longer than current possible length, create a warning and shorten text to avoid Error on upgrade.
|
||||
if (strlen($question['form_question_text']) > 2048) {
|
||||
$output->warning("Question-text is too long for new Database: '" . $question['form_question_text'] . "'");
|
||||
$question['form_question_text'] = substr($question['form_question_text'], 0, 2048);
|
||||
$question['form_question_text'] = mb_substr($question['form_question_text'], 0, 2048);
|
||||
}
|
||||
|
||||
$qb_restore->insert('forms_v2_questions')
|
||||
|
|
@ -285,7 +285,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
|
|||
//In case the old Answer would have been longer than current possible length, create a warning and shorten text to avoid Error on upgrade.
|
||||
if (strlen($answer['text']) > 1024) {
|
||||
$output->warning("Option-text is too long for new Database: '" . $answer['text'] . "'");
|
||||
$answer['text'] = substr($answer['text'], 0, 1024);
|
||||
$answer['text'] = mb_substr($answer['text'], 0, 1024);
|
||||
}
|
||||
|
||||
$qb_restore->insert('forms_v2_options')
|
||||
|
|
@ -350,9 +350,9 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
|
|||
$last_vote = $vote;
|
||||
|
||||
//In case the old Answer would have been longer than current possible length, create a warning and shorten text to avoid Error on upgrade.
|
||||
if (strlen($vote['vote_answer']) > 2048) {
|
||||
if (strlen($vote['vote_answer']) > 4096) {
|
||||
$output->warning("Answer-text is too long for new Database: '" . $vote['vote_answer'] . "'");
|
||||
$vote['vote_answer'] = substr($vote['vote_answer'], 0, 2048);
|
||||
$vote['vote_answer'] = mb_substr($vote['vote_answer'], 0, 4096);
|
||||
}
|
||||
|
||||
/* Due to the unconventional storing fo vote_option_ids, the vote_option_id needs to get mapped onto old question-id and from there to new question-id.
|
||||
|
|
|
|||
61
lib/Migration/Version020002Date20200729205932.php
Normal file
61
lib/Migration/Version020002Date20200729205932.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @author Jonas Rittershofer <jotoeri@users.noreply.github.com>
|
||||
*
|
||||
* @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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Forms\Migration;
|
||||
|
||||
use Closure;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
||||
class Version020002Date20200729205932 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) {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if ($schema->hasTable('forms_v2_forms')) {
|
||||
$schema->getTable('forms_v2_forms')
|
||||
->changeColumn('description', [
|
||||
'length' => 8192,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($schema->hasTable('forms_v2_answers')) {
|
||||
$schema->getTable('forms_v2_answers')
|
||||
->changeColumn('text', [
|
||||
'length' => 4096,
|
||||
]);
|
||||
}
|
||||
|
||||
return $schema;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue