Added new custom fields for GPG keys
This commit is contained in:
parent
b7e943d90e
commit
3b6fd47a61
10 changed files with 78 additions and 2 deletions
|
@ -12,6 +12,8 @@ module.exports.grouped = ['radio', 'checkbox', 'dropdown'];
|
|||
module.exports.types = {
|
||||
text: 'Text',
|
||||
website: 'Website',
|
||||
longtext: 'Multi-line text',
|
||||
gpg: 'GPG Public Key',
|
||||
number: 'Number',
|
||||
radio: 'Radio Buttons',
|
||||
checkbox: 'Checkboxes',
|
||||
|
@ -26,6 +28,8 @@ module.exports.types = {
|
|||
module.exports.genericTypes = {
|
||||
text: 'string',
|
||||
website: 'string',
|
||||
longtext: 'textarea',
|
||||
gpg: 'textarea',
|
||||
number: 'number',
|
||||
'date-us': 'date',
|
||||
'date-eur': 'date',
|
||||
|
@ -264,7 +268,7 @@ function addCustomField(listId, name, defaultValue, type, group, visible, callba
|
|||
|
||||
let column = null;
|
||||
let key = slugify('merge ' + name, '_').toUpperCase();
|
||||
let allowedTypes = ['text', 'number', 'radio', 'checkbox', 'dropdown', 'date-us', 'date-eur', 'birthday-us', 'birthday-eur', 'website', 'option'];
|
||||
let allowedTypes = ['text', 'number', 'radio', 'checkbox', 'dropdown', 'date-us', 'date-eur', 'birthday-us', 'birthday-eur', 'website', 'option', 'gpg', 'longtext'];
|
||||
|
||||
if (allowedTypes.indexOf(type) < 0) {
|
||||
return callback(new Error('Unknown column type ' + type));
|
||||
|
@ -308,7 +312,11 @@ function addCustomField(listId, name, defaultValue, type, group, visible, callba
|
|||
switch (type) {
|
||||
case 'text':
|
||||
case 'website':
|
||||
query = 'ALTER TABLE `subscription__' + listId + '` ADD COLUMN `' + column + '` VARCHAR(255) DEFAULT NULL';
|
||||
query = 'ALTER TABLE `subscription__' + listId + '` ADD COLUMN `' + column + '` VARCHAR(255) DEFAULT NULL, ADD INDEX (' + column + ')';
|
||||
break;
|
||||
case 'gpg':
|
||||
case 'longtext':
|
||||
query = 'ALTER TABLE `subscription__' + listId + '` ADD COLUMN `' + column + '` TEXT DEFAULT NULL';
|
||||
break;
|
||||
case 'number':
|
||||
query = 'ALTER TABLE `subscription__' + listId + '` ADD COLUMN `' + column + '` INT(11) DEFAULT NULL, ADD INDEX (' + column + ')';
|
||||
|
@ -358,6 +366,8 @@ module.exports.getRow = (fieldList, values, useDate, showAll) => {
|
|||
switch (field.type) {
|
||||
case 'text':
|
||||
case 'website':
|
||||
case 'gpg':
|
||||
case 'longtext':
|
||||
{
|
||||
let item = {
|
||||
type: field.type,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue