-
Notifications
You must be signed in to change notification settings - Fork 96
/
Constants.php
205 lines (181 loc) Β· 5.6 KB
/
Constants.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
/**
* @copyright Copyright (c) 2021 Jonas Rittershofer <jotoeri@users.noreply.github.com>
*
* @author Jonas Rittershofer <jotoeri@users.noreply.github.com>
*
* @license AGPL-3.0-or-later
*
* 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;
use OCP\Share\IShare;
class Constants {
/**
* Used AppConfig Keys
*/
public const CONFIG_KEY_ALLOWPERMITALL = 'allowPermitAll';
public const CONFIG_KEY_ALLOWPUBLICLINK = 'allowPublicLink';
public const CONFIG_KEY_CREATIONALLOWEDGROUPS = 'creationAllowedGroups';
public const CONFIG_KEY_RESTRICTCREATION = 'restrictCreation';
public const CONFIG_KEYS = [
self::CONFIG_KEY_ALLOWPERMITALL,
self::CONFIG_KEY_ALLOWPUBLICLINK,
self::CONFIG_KEY_CREATIONALLOWEDGROUPS,
self::CONFIG_KEY_RESTRICTCREATION
];
/**
* Maximum String lengths, the database is set to store.
*/
public const MAX_STRING_LENGTHS = [
'formTitle' => 256,
'formDescription' => 8192,
'submissionMessage' => 2048,
'questionText' => 2048,
'questionDescription' => 4096,
'optionText' => 1024,
'answerText' => 4096,
];
/**
* State flags of a form
*/
public const FORM_STATE_ACTIVE = 0;
public const FORM_STATE_CLOSED = 1;
public const FORM_STATE_ARCHIVED = 2;
/**
* Access flags of a form
*/
public const FORM_ACCESS_NOPUBLICSHARE = 0;
public const FORM_ACCESS_PERMITALLUSERS = 1;
public const FORM_ACCESS_SHOWTOALLUSERS = 2;
public const FORM_ACCESS_LEGACYLINK = 3;
public const FORM_ACCESS_LEGACYLINK_PERMITALLUSERS = 4;
public const FORM_ACCESS_LEGACYLINK_SHOWTOALLUSERS = 5;
public const FORM_ACCESS_ARRAY_PERMIT = [
self::FORM_ACCESS_PERMITALLUSERS,
self::FORM_ACCESS_LEGACYLINK_PERMITALLUSERS
];
public const FORM_ACCESS_ARRAY_SHOWN = [
self::FORM_ACCESS_SHOWTOALLUSERS,
self::FORM_ACCESS_LEGACYLINK_SHOWTOALLUSERS
];
/**
* !! Keep in sync with src/models/AnswerTypes.js !!
*/
// Available AnswerTypes
public const ANSWER_TYPE_MULTIPLE = 'multiple';
public const ANSWER_TYPE_MULTIPLEUNIQUE = 'multiple_unique';
public const ANSWER_TYPE_DROPDOWN = 'dropdown';
public const ANSWER_TYPE_SHORT = 'short';
public const ANSWER_TYPE_LONG = 'long';
public const ANSWER_TYPE_DATE = 'date';
public const ANSWER_TYPE_DATETIME = 'datetime';
public const ANSWER_TYPE_TIME = 'time';
// All AnswerTypes
public const ANSWER_TYPES = [
self::ANSWER_TYPE_MULTIPLE,
self::ANSWER_TYPE_MULTIPLEUNIQUE,
self::ANSWER_TYPE_DROPDOWN,
self::ANSWER_TYPE_SHORT,
self::ANSWER_TYPE_LONG,
self::ANSWER_TYPE_DATE,
self::ANSWER_TYPE_DATETIME,
self::ANSWER_TYPE_TIME
];
// AnswerTypes, that need/have predefined Options
public const ANSWER_TYPES_PREDEFINED = [
self::ANSWER_TYPE_MULTIPLE,
self::ANSWER_TYPE_MULTIPLEUNIQUE,
self::ANSWER_TYPE_DROPDOWN
];
// AnswerTypes for date/time questions
public const ANSWER_TYPES_DATETIME = [
self::ANSWER_TYPE_DATE,
self::ANSWER_TYPE_DATETIME,
self::ANSWER_TYPE_TIME
];
// Formats for AnswerTypes date/datetime/time
public const ANSWER_PHPDATETIME_FORMAT = [
self::ANSWER_TYPE_DATE => 'Y-m-d',
self::ANSWER_TYPE_DATETIME => 'Y-m-d H:i',
self::ANSWER_TYPE_TIME => 'H:i'
];
/**
* !! Keep in sync with src/models/ValidationTypes.js !!
*/
// Allowed short input types
public const SHORT_INPUT_TYPES = [
'phone',
'email',
'regex',
'number'
];
// This are allowed extra settings
public const EXTRA_SETTINGS_DROPDOWN = [
'allowOtherAnswer',
'shuffleOptions',
];
public const EXTRA_SETTINGS_MULTIPLE = [
'allowOtherAnswer',
'shuffleOptions',
];
public const EXTRA_SETTINGS_SHORT = [
'validationType',
'validationRegex'
];
/**
* !! Keep in sync with src/mixins/ShareTypes.js !!
*/
public const SHARE_TYPES_USED = [
IShare::TYPE_USER,
IShare::TYPE_GROUP,
IShare::TYPE_LINK,
IShare::TYPE_CIRCLE
];
/**
* !! Keep in sync with src/mixins/PermissionTypes.js !!
* Permission values equal the route names, thus making it easy on frontend to evaluate.
*/
// Define Form Permissions
public const PERMISSION_EDIT = 'edit';
public const PERMISSION_RESULTS = 'results';
public const PERMISSION_RESULTS_DELETE = 'results_delete';
public const PERMISSION_SUBMIT = 'submit';
/** Special internal permissions to allow embedding a form (share) into external websites */
public const PERMISSION_EMBED = 'embed';
public const PERMISSION_ALL = [
self::PERMISSION_EDIT,
self::PERMISSION_RESULTS,
self::PERMISSION_RESULTS_DELETE,
self::PERMISSION_SUBMIT,
self::PERMISSION_EMBED,
];
/**
* !! Keep in sync with src/FormsEmptyContent.vue !!
* InitialStates for emptyContent to render as...
*/
public const EMPTY_NOTFOUND = 'notfound';
public const EMPTY_EXPIRED = 'expired';
/**
* Constants related to extra settings for questions
*/
public const QUESTION_EXTRASETTINGS_OTHER_PREFIX = 'system-other-answer:';
public const SUPPORTED_EXPORT_FORMATS = [
'csv' => 'text/csv',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
];
public const DEFAULT_FILE_FORMAT = 'csv';
}