From a2078fb8dbeac92550890da3140997e2f435e9be Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 22 Oct 2018 08:35:41 -0400 Subject: [PATCH] New management option for michigan.org required fields. Require the Contact Email and phone fields. --- classes/data/dataEvents.php | 6 +- classes/data/dataManagement.php | 8 + index.php | 2 +- models/admin/events/list.php | 5 + ...V0.1.9.sql => create_database_V0.1.10.sql} | 3 +- setup/databaseScripts/dbVersions.php | 1 + .../update_database_V0.1.10.sql | 9 + views/admin/events/editStatus.html | 263 +++++++++--------- views/admin/management/events.html | 6 + 9 files changed, 162 insertions(+), 141 deletions(-) rename setup/databaseScripts/{create_database_V0.1.9.sql => create_database_V0.1.10.sql} (99%) create mode 100644 setup/databaseScripts/update_database_V0.1.10.sql diff --git a/classes/data/dataEvents.php b/classes/data/dataEvents.php index e02d162..bd213e6 100644 --- a/classes/data/dataEvents.php +++ b/classes/data/dataEvents.php @@ -353,14 +353,14 @@ class GlmDataEvents extends GlmDataAbstract // Contact email 'contact_email' => array ( 'field' => 'contact_email', - 'type' => 'text', + 'type' => 'email', 'use' => 'a' ), // Contact Phone 'contact_phone' => array ( 'field' => 'contact_phone', - 'type' => 'text', + 'type' => 'phone', 'use' => 'a' ), @@ -458,7 +458,7 @@ class GlmDataEvents extends GlmDataAbstract // Admin Contact E-Mail Name 'admin_email' => array ( 'field' => 'admin_email', - 'type' => 'text', + 'type' => 'email', 'required' => false, 'use' => 'a' ), diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php index d3c8d97..2fd5ca3 100644 --- a/classes/data/dataManagement.php +++ b/classes/data/dataManagement.php @@ -271,6 +271,14 @@ class GlmDataEventsManagement extends GlmDataAbstract 'use' => 'a' ), + // Turn on required fields for Michigan.org + 'michigan_org_requirements' => array( + 'field' => 'michigan_org_requirements', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + // Default view file for agenda views 'default_agenda_view' => array ( 'field' => 'default_agenda_view', diff --git a/index.php b/index.php index f4b3975..cb9892e 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ if (!defined('ABSPATH')) { * version from this plugin. */ define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.2'); -define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.9'); +define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.10'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.9.15'); diff --git a/models/admin/events/list.php b/models/admin/events/list.php index 4b77c35..63597c4 100644 --- a/models/admin/events/list.php +++ b/models/admin/events/list.php @@ -152,6 +152,11 @@ class GlmMembersAdmin_events_list extends GlmDataEvents // Check if there's a logged in user who is locked to their own entity $lockedToMember = apply_filters('glm_members_locked_to_member_id', false); + // Check config for michigan_org_requirements + if ( $this->config['settings']['michigan_org_requirements'] ) { + $this->fields['contact_phone']['required'] = true; + $this->fields['contact_email']['required'] = true; + } if ($lockedToMember) { $isModerated = apply_filters('glm_user_is_moderated', $lockedToMember); // Also need to check if the setting for member event moderated is on diff --git a/setup/databaseScripts/create_database_V0.1.9.sql b/setup/databaseScripts/create_database_V0.1.10.sql similarity index 99% rename from setup/databaseScripts/create_database_V0.1.9.sql rename to setup/databaseScripts/create_database_V0.1.10.sql index 7d9bbaa..058bc91 100644 --- a/setup/databaseScripts/create_database_V0.1.9.sql +++ b/setup/databaseScripts/create_database_V0.1.10.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database - Events Add-On -- File Created: 08/18/17 --- Database Version: 0.1.7 +-- Database Version: 0.1.10 -- Database Creation Script -- -- This file is called to create a new set of tables for this @@ -243,6 +243,7 @@ CREATE TABLE {prefix}management ( agenda_container_border_color TINYTEXT NULL, -- Event Container Border Color agenda_view_max_width TINYTEXT NULL, -- Max Width of agenda view detail_ext_links_same_window BOOLEAN DEFAULT '0', -- Turn on to keep from adding target blank to detail page url's + michigan_org_requirements BOOLEAN DEFAULT '0', -- Turn on required fields for Michigan.org PRIMARY KEY (id) ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 4273488..23aa89d 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -45,5 +45,6 @@ $glmMembersEventsDbVersions = array( '0.1.7' => array('version' => '0.1.7', 'tables' => 13, 'date' => '09/14/2018'), '0.1.8' => array('version' => '0.1.8', 'tables' => 13, 'date' => '10/09/2018'), '0.1.9' => array('version' => '0.1.9', 'tables' => 13, 'date' => '10/11/2018'), + '0.1.10' => array('version' => '0.1.10', 'tables' => 13, 'date' => '10/19/2018'), ); diff --git a/setup/databaseScripts/update_database_V0.1.10.sql b/setup/databaseScripts/update_database_V0.1.10.sql new file mode 100644 index 0000000..dd1fd25 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.1.10.sql @@ -0,0 +1,9 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 10/19/18 +-- Database Version: 0.1.10 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +ALTER TABLE {prefix}management ADD COLUMN michigan_org_requirements BOOLEAN NULL; -- Turn on required fields for Michigan.org diff --git a/views/admin/events/editStatus.html b/views/admin/events/editStatus.html index 57fd231..02ddeda 100644 --- a/views/admin/events/editStatus.html +++ b/views/admin/events/editStatus.html @@ -1,37 +1,37 @@ +{* Status and Description *} - - {if $lockedToMember} - - - {if $isModerated} - - {/if} +{if $lockedToMember} + + + {if $isModerated} + {/if} +{/if} - +
- - - - + + + + {if apply_filters('glm-member-db-common-members-enabled', false)} {if $event.fieldData.ref_dest.list|@count > 1} {else} @@ -44,7 +44,7 @@ {/if} {/if} -{if $haveEvent} + {if $haveEvent} @@ -61,77 +61,78 @@ -{/if} - {if !$isModerated} + {/if} + {if !$isModerated} - {/if} - - {if !$lockedToMember} - - - - - {/if} + {/if} + {if !$lockedToMember} - - + + + {/if} + + + + - - - - - - - - - - - - - - - - - - - - - - + {* BEGIN Event Contact Information *} + + + + + + + + + {if $event.fieldFail.contact_phone}

{$event.fieldFail.contact_phone}

{/if}
+ +
+ + + + + {if $event.fieldFail.contact_email}

{$event.fieldFail.contact_email}

{/if}
+ +
+ {* END Event Contact Information *} + + + +
Event Name: - - {if $event.fieldFail.name}

{$event.fieldFail.name}

{/if}
-
Event Name: + + {if $event.fieldFail.name}

{$event.fieldFail.name}

{/if}
+
{$terms.term_member_cap}: - {if $haveMember} + {if $haveMember} {$memberData.name} - {else} + {else} - {/if} + {/if}
Name for URLs: {$event.fieldData.name_slug}Last Approved: {$event.fieldData.approved.datetime}
Status: {if $event.fieldFail.status}

{$event.fieldFail.status}

{/if}
Options: -  Featured Event   -  Include in Slideshow   - -
Categories -
- -
Please Enter a Reason
- -
- - +
Options: +  Featured Event   +  Include in Slideshow   + +
Categories +
+ +
Please Enter a Reason
+ +
+ + {* Add new category dialog *} -
Add a new Category
-
- - - - - - - - + +
Category Name: - -
-
Parent Category: - + + + + + + + - -
Category Name: + +
+
Parent Category: + -
OR
- -
-

* Required

- Cancel - - + +
OR
+ +
+

* Required

+ Cancel + +
- + {* Category Selection *}
{$settings.term_event_amenities_plural} - + {* Add new amenity dialog *}
Add a new {$settings.term_event_amenities_singular}
@@ -182,7 +183,7 @@
- + {* Amenity Selection *}
Image: - {if $event.fieldData.image} - - - - - {/if} + {if $event.fieldData.image} + + + + + {/if}
-
- -
-
- Delete Image
- {$event.fieldData.image}
-
+
+ +
+
+ Delete Image
+ {$event.fieldData.image}
+
New image:
@@ -268,66 +269,56 @@

Web Address (URL): - + {if $event.fieldFail.url}

{$event.fieldFail.url}

{/if}
Ticketing Address (URL): - + {if $event.fieldFail.ticket_url}

{$event.fieldFail.ticket_url}

{/if}
Registration (URL): - + {if $event.fieldFail.registration_url}

{$event.fieldFail.registration_url}

{/if}
Contact Name: - -
Contact Phone: - -
Contact Email: - -
Free: - - Mark event as Free (no cost) and don't provide "Description of Cost:". -
Contact Name: + +
Contact Phone:
Contact Email:
Free: + + Mark event as Free (no cost) and don't provide "Description of Cost:". +
Description of Cost: diff --git a/views/admin/management/events.html b/views/admin/management/events.html index 0f5334d..41b7e81 100644 --- a/views/admin/management/events.html +++ b/views/admin/management/events.html @@ -144,6 +144,12 @@
+ + Admin Options + +

+ +

{$terms.term_member_cap} Message

-- 2.17.1