From: Steve Sutton Date: Fri, 20 Jul 2018 19:26:18 +0000 (-0400) Subject: Starting work on grouping fields X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=b410aafb0231dea91a84ddf778a096e070d0d5cc;p=WP-Plugins%2Fglm-member-db-fields.git Starting work on grouping fields Feature branch for adding grouping to the custom fields. For contacts. --- diff --git a/config/plugin.ini b/config/plugin.ini index e6f76cb..348e73a 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -6,6 +6,7 @@ ; [custom_field_types] -text = 'text' -textarea = 'textarea' -checkbox = 'checkbox' +text = 'Text Field' +textarea = 'Multiline - Textarea' +checkbox = 'Checkbox' +picklist = 'Picklist of Options' diff --git a/setup/databaseScripts/create_database_V0.0.4.sql b/setup/databaseScripts/create_database_V0.0.4.sql index 70a416a..9deb7c2 100644 --- a/setup/databaseScripts/create_database_V0.0.4.sql +++ b/setup/databaseScripts/create_database_V0.0.4.sql @@ -15,6 +15,7 @@ -- Field Setup Table CREATE TABLE {prefix}custom_fields ( id INT NOT NULL AUTO_INCREMENT, + fid TEXT NOT NULL DEFAULT '', field_name TINYTEXT NOT NULL DEFAULT '', -- Field Name field_type TINYTEXT NOT NULL DEFAULT '', -- Field Type field_order SMALLINT NOT NULL DEFAULT 0, -- Order for Field @@ -37,3 +38,16 @@ CREATE TABLE {prefix}custom_field_data ( INDEX(field_id), INDEX(entity_id) ); + +---- + +-- Picklist Field Options +CREATE TABLE {prefix}custom_field_options ( + id INT NOT NULL AUTO_INCREMENT, + field_id INT NOT NULL DEFAULT 0, -- Pointer to ID of fields in custom_fields table + option_text TINYTEXT NOT NULL DEFAULT '', -- Option's Displayed text + option_value TINYTEXT NOT NULL DEFAULT '', -- Option's value + option_default BOOLEAN NOT NULL DEFAULT false, -- Flag indicating that this option is the default + PRIMARY KEY (id), + INDEX (field_id) +); diff --git a/views/admin/management/fields.html b/views/admin/management/fields.html index fdd0d80..f4e5a44 100644 --- a/views/admin/management/fields.html +++ b/views/admin/management/fields.html @@ -141,7 +141,12 @@ {$t.id}
- {$t.field_name} + {$t.field_name}
@@ -212,23 +217,25 @@ jQuery(document).ready(function($) { var fieldType = $(this).attr('data-fieldType'); var adminSearch = $(this).attr('data-adminSearch'); var required = $(this).attr('data-required'); + + //console.log( fieldType ); $('#editFieldID').val(fieldID); $('#editFieldName').val(fieldName.trim()); $('#editFieldType').val(fieldType); if (adminSearch === '1') { - console.log('setting the checked to true'); + //console.log('setting the checked to true'); $('#editAdminSearch').prop('checked', true); } else { - console.log('setting the checked to false'); + //console.log('setting the checked to false'); $('#editAdminSearch').prop('checked', false); } // check required fields if (required === '1') { $('#editRequired').prop('checked', true); } else { - console.log('setting the checked to false'); + //console.log('setting the checked to false'); $('#editRequired').prop('checked', false); } $("#editFieldDialog").dialog("open");