From: Chuck Scott Date: Wed, 6 Apr 2016 18:25:35 +0000 (-0400) Subject: Preliminary look at Event edit updates. X-Git-Tag: v1.0.0^2~115 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=597c0cca78fbfccb92f8ae93104e5456b9f6fa16;p=WP-Plugins%2Fglm-member-db-events.git Preliminary look at Event edit updates. --- diff --git a/classes/data/dataRecurrences.php b/classes/data/dataRecurrences.php index 0ecf4d7..eef4ca9 100644 --- a/classes/data/dataRecurrences.php +++ b/classes/data/dataRecurrences.php @@ -140,8 +140,8 @@ class GlmDataEventsRecurrences extends GlmDataAbstract // Start Date & Time 'start_time' => array ( 'field' => 'start_time', - 'type' => 'datetime', - 'format' => 'm/d/Y h:i a', + 'type' => 'time', + 'format' => 'h:i a', 'required' => true, 'use' => 'a' ), @@ -165,8 +165,8 @@ class GlmDataEventsRecurrences extends GlmDataAbstract // End Date & Time 'end_time' => array ( 'field' => 'end_time', - 'type' => 'datetime', - 'format' => 'm/d/Y h:i a', + 'type' => 'time', + 'format' => 'h:i a', 'use' => 'a' ), diff --git a/index.php b/index.php index a123fa6..950b250 100644 --- a/index.php +++ b/index.php @@ -39,7 +39,7 @@ * version from this plugin. */ define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.10'); +define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.11'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58'); diff --git a/setup/databaseScripts/create_database_V0.0.10.sql b/setup/databaseScripts/create_database_V0.0.10.sql deleted file mode 100644 index 9dde6be..0000000 --- a/setup/databaseScripts/create_database_V0.0.10.sql +++ /dev/null @@ -1,175 +0,0 @@ --- Gaslight Media Members Database - Events Add-On --- File Created: 12/02/15 15:27:15 --- Database Version: 0.0.1 --- Database Creation Script --- --- This file is called to create a new set of tables for this --- add-on for the most recent database version for this add-on. --- --- There should only be one such file in this directory --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashes - --- Categories - Categories for events -CREATE TABLE {prefix}categories ( - id INT NOT NULL AUTO_INCREMENT, - name TINYTEXT NULL, -- Name of event category - descr TINYTEXT NULL, -- Description of this category - parent INT NULL, -- Parent category, null or 0 if this is a top level category - PRIMARY KEY (id), - INDEX(parent) -); - ----- - --- Event-Category - Categories for specific event records -CREATE TABLE {prefix}event_categories ( - id INT NOT NULL AUTO_INCREMENT, - event INT NULL, -- Pointer to the event - category INT NULL, -- Pointer to the category - PRIMARY KEY (id), - INDEX(event), - INDEX(category) -); - ----- - --- Event Recurrence - Defines how an event recurs -CREATE TABLE {prefix}recurrences ( - id INT NOT NULL AUTO_INCREMENT, - event INTEGER NULL, -- Pointer to event - name TINYTEXT NULL, -- Name of this recurrence schedule - used on admin calendar - start_time DATETIME NULL, -- Start of first occurrence (date and time) - start_time_only BOOLEAN NULL, -- Use end of first occurrence flag - end_time DATETIME NULL, -- End of first occurrence (date and time) - all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (informational only) - start_date DATE NULL, -- Starting Date (if all_day is selected) Used instead of start_time - from_date DATE NULL, -- From Date for recurrences - to_date DATE NULL, -- To Date for recurrences - all_dates BOOLEAN NULL, -- Flag indicating that event recurs on all dates from from_date through to_date - month_of_year SMALLINT UNSIGNED NULL, -- Month of year (bitmap) - week_of_month TINYINT UNSIGNED NULL, -- Week of the month (bitmap) - day_of_week TINYINT UNSIGNED NULL, -- Day of the week (bitmap) - by_day_of_month BOOLEAN NULL, -- Flag indicating if selecting by days of the month - day_of_month INTEGER UNSIGNED NULL, -- Day of the month (bitmap) - last_day_of_month BOOLEAN NULL, -- Last day of the month - holiday INT NULL, -- Pointer to holidays list (for future development) - holiday_offset TINYINT, -- Offset from holiday (from -128 to +127 days) - PRIMARY KEY (id), - INDEX(event) -); - ----- - --- Times - List of actual event times for single and recurring events -CREATE TABLE {prefix}times ( - id INT NOT NULL AUTO_INCREMENT, - event INT NULL, -- Pointer to the primary record for the event - custom_event INT NULL, -- Pointer to a customized copy of the event record (if set) - recur_id INT NULL, -- Pointer to recurrence entry - active BOOLEAN NULL, -- Active flag - normally set but used to temporarily disable a specific date - start_time DATETIME NULL, -- Date and time event starts - end_time DATETIME NULL, -- Date and time event ends - all_day BOOLEAN NULL, -- All Day flag - PRIMARY KEY (id), - INDEX(event), - INDEX(start_time), - INDEX(end_time) -); - ----- - --- Locations - Locations for event - If there's no location pointing to an event try to use the referenced entity in events table -CREATE TABLE {prefix}locations ( - id INT NOT NULL AUTO_INCREMENT, - event INT NULL, -- Pointer to the primary or custom event record - name TINYTEXT NULL, -- Name of location - address TINYTEXT NULL, -- Street Address - city INT NULL, -- Pointer to city - references main plugin city table - state TINYTEXT NULL, -- Two character state abbreviation - zip TINYTEXT NULL, -- ZIP/Postal code - country TINYTEXT NULL, -- Country Code - lat FLOAT NULL, -- Latitude of location - lon FLOAT NULL, -- Longitude of location - region INT NULL, -- Pointer to Region - references main plugin region table - phone TINYTEXT NULL, -- Location Phone # - url TINYTEXT NULL, -- Location URL - email TINYTEXT NULL, -- Location E-Mail Address - contact_addon_id INT NULL, -- ID of Contact from contact add-on (optional and if available) - contact_fname TINYTEXT NULL, -- Contact first name for this location (optional) - contact_lname TINYTEXT NULL, -- Contact last name for this location (optional) - contact_phone TINYTEXT NULL, -- Contact phone for this location (optional) - contact_email TINYTEXT NULL, -- Contact E-Mail address (optional) - PRIMARY KEY (id) -); - ----- - --- Events - Base event information - May also be entries here referenced by the "times" table for a custom date. -CREATE TABLE {prefix}events ( - id INT NOT NULL AUTO_INCREMENT, - status INT NULL, -- Status for this event, see config['status'] - custom_time INT NULL, -- If this is a custom record for a specific instance (date) this points to that times table entry - root_event INT NULL, -- Root event pointer if this is a custom record for a specific instance (date) (if custom_time is set) - created DATETIME NULL, -- Date/Time event was created or date custom event record was created if custom record - updated DATETIME NULL, -- Date/Time this event record was last updated - approved DATETIME NULL, -- Date/Ttime this event record was approved - ref_type INT NULL, -- Type of entity this contact is associated with - See config['ref_type'] - ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with - hide_address BOOLEAN NULL, -- Option to hide address on front-end - featured BOOLEAN NULL, -- Option to mark as featured event - slideshow BOOLEAN NULL, -- Option to mark for use in slide show - major BOOLEAN NULL, -- Option to mark as a major event - name TINYTEXT NULL, -- Name of this event - name_slug TINYTEXT NULL, -- Slug for this event - header TINYTEXT NULL, -- Header text for front-end display - NOT CURRENTLY USED - intro TINYTEXT NULL, -- Intro text for front-end display - descr TEXT NULL, -- Full description text - image TINYTEXT NULL, -- Image file name - url TINYTEXT NULL, -- Event URL - ticket_url TINYTEXT NULL, -- Ticket URL - cost TINYTEXT NULL, -- Description of event cost - admin_ref_type INT NULL, -- Type of admin contact if using a member contact - admin_ref_dest INT NULL, -- Pointer to admin contact record if using a member contact - admin_name TINYTEXT NULL, -- Admin Contact Name if not using a member contact - admin_org TINYTEXT NULL, -- Admin Contact Organization if not using a member contact - admin_email TINYTEXT NULL, -- Admin Contact E-Mail if not using a member contact - admin_phone TINYTEXT NULL, -- Admin Contact Phone if not using a member contact - free BOOLEAN NULL, -- Event is Free - contact_email TINYTEXT NULL, -- Contact E-mail address - contact_name TINYTEXT NULL, -- Contact name - contact_phone TINYTEXT NULL, -- Event Phone - use_member_location BOOLEAN NULL, -- Use location of the member (if provided) rather than location table data - old_event_id INT NULL, -- ID of event from old site for reference - notes TEXT NULL, -- Internal notes for this event - PRIMARY KEY (id), - INDEX(custom_time), - INDEX(root_event), - INDEX(ref_type), - INDEX(ref_dest), - INDEX(featured), - INDEX(slideshow), - INDEX(major) -); - ----- - --- Event Management Settings -CREATE TABLE {prefix}management ( - id INT NOT NULL AUTO_INCREMENT, - canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail - pdf_logo TINYTEXT NULL, -- Image for the Top of the PDF - footer_text TINYTEXT NULL, -- Image for the Top of the PDF - PRIMARY KEY (id) -); - ----- - --- Set default event management entry -INSERT INTO {prefix}management - ( id, canonical_event_page ) - VALUES - ( 1, 'event-detail' ) -; - diff --git a/setup/databaseScripts/create_database_V0.0.11.sql b/setup/databaseScripts/create_database_V0.0.11.sql new file mode 100644 index 0000000..462e1c9 --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.11.sql @@ -0,0 +1,175 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 12/02/15 15:27:15 +-- Database Version: 0.0.1 +-- Database Creation Script +-- +-- This file is called to create a new set of tables for this +-- add-on for the most recent database version for this add-on. +-- +-- There should only be one such file in this directory +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Categories - Categories for events +CREATE TABLE {prefix}categories ( + id INT NOT NULL AUTO_INCREMENT, + name TINYTEXT NULL, -- Name of event category + descr TINYTEXT NULL, -- Description of this category + parent INT NULL, -- Parent category, null or 0 if this is a top level category + PRIMARY KEY (id), + INDEX(parent) +); + +---- + +-- Event-Category - Categories for specific event records +CREATE TABLE {prefix}event_categories ( + id INT NOT NULL AUTO_INCREMENT, + event INT NULL, -- Pointer to the event + category INT NULL, -- Pointer to the category + PRIMARY KEY (id), + INDEX(event), + INDEX(category) +); + +---- + +-- Event Recurrence - Defines how an event recurs +CREATE TABLE {prefix}recurrences ( + id INT NOT NULL AUTO_INCREMENT, + event INTEGER NULL, -- Pointer to event + name TINYTEXT NULL, -- Name of this recurrence schedule - used on admin calendar + start_time TIME NULL, -- Start time of day for event + start_time_only BOOLEAN NULL, -- Use end of first occurrence flag + end_time TIME NULL, -- End time of day for event - If less than start time, assume a date boundry + all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (informational only) + start_date DATE NULL, -- Starting Date (if all_day is selected) Used instead of start_time + from_date DATE NULL, -- From Date for recurrences + to_date DATE NULL, -- To Date for recurrences + all_dates BOOLEAN NULL, -- Flag indicating that event recurs on all dates from from_date through to_date + month_of_year SMALLINT UNSIGNED NULL, -- Month of year (bitmap) + week_of_month TINYINT UNSIGNED NULL, -- Week of the month (bitmap) + day_of_week TINYINT UNSIGNED NULL, -- Day of the week (bitmap) + by_day_of_month BOOLEAN NULL, -- Flag indicating if selecting by days of the month + day_of_month INTEGER UNSIGNED NULL, -- Day of the month (bitmap) + last_day_of_month BOOLEAN NULL, -- Last day of the month + holiday INT NULL, -- Pointer to holidays list (for future development) + holiday_offset TINYINT, -- Offset from holiday (from -128 to +127 days) + PRIMARY KEY (id), + INDEX(event) +); + +---- + +-- Times - List of actual event times for single and recurring events +CREATE TABLE {prefix}times ( + id INT NOT NULL AUTO_INCREMENT, + event INT NULL, -- Pointer to the primary record for the event + custom_event INT NULL, -- Pointer to a customized copy of the event record (if set) + recur_id INT NULL, -- Pointer to recurrence entry + active BOOLEAN NULL, -- Active flag - normally set but used to temporarily disable a specific date + start_time DATETIME NULL, -- Date and time event starts + end_time DATETIME NULL, -- Date and time event ends + all_day BOOLEAN NULL, -- All Day flag + PRIMARY KEY (id), + INDEX(event), + INDEX(start_time), + INDEX(end_time) +); + +---- + +-- Locations - Locations for event - If there's no location pointing to an event try to use the referenced entity in events table +CREATE TABLE {prefix}locations ( + id INT NOT NULL AUTO_INCREMENT, + event INT NULL, -- Pointer to the primary or custom event record + name TINYTEXT NULL, -- Name of location + address TINYTEXT NULL, -- Street Address + city INT NULL, -- Pointer to city - references main plugin city table + state TINYTEXT NULL, -- Two character state abbreviation + zip TINYTEXT NULL, -- ZIP/Postal code + country TINYTEXT NULL, -- Country Code + lat FLOAT NULL, -- Latitude of location + lon FLOAT NULL, -- Longitude of location + region INT NULL, -- Pointer to Region - references main plugin region table + phone TINYTEXT NULL, -- Location Phone # + url TINYTEXT NULL, -- Location URL + email TINYTEXT NULL, -- Location E-Mail Address + contact_addon_id INT NULL, -- ID of Contact from contact add-on (optional and if available) + contact_fname TINYTEXT NULL, -- Contact first name for this location (optional) + contact_lname TINYTEXT NULL, -- Contact last name for this location (optional) + contact_phone TINYTEXT NULL, -- Contact phone for this location (optional) + contact_email TINYTEXT NULL, -- Contact E-Mail address (optional) + PRIMARY KEY (id) +); + +---- + +-- Events - Base event information - May also be entries here referenced by the "times" table for a custom date. +CREATE TABLE {prefix}events ( + id INT NOT NULL AUTO_INCREMENT, + status INT NULL, -- Status for this event, see config['status'] + custom_time INT NULL, -- If this is a custom record for a specific instance (date) this points to that times table entry + root_event INT NULL, -- Root event pointer if this is a custom record for a specific instance (date) (if custom_time is set) + created DATETIME NULL, -- Date/Time event was created or date custom event record was created if custom record + updated DATETIME NULL, -- Date/Time this event record was last updated + approved DATETIME NULL, -- Date/Ttime this event record was approved + ref_type INT NULL, -- Type of entity this contact is associated with - See config['ref_type'] + ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with + hide_address BOOLEAN NULL, -- Option to hide address on front-end + featured BOOLEAN NULL, -- Option to mark as featured event + slideshow BOOLEAN NULL, -- Option to mark for use in slide show + major BOOLEAN NULL, -- Option to mark as a major event + name TINYTEXT NULL, -- Name of this event + name_slug TINYTEXT NULL, -- Slug for this event + header TINYTEXT NULL, -- Header text for front-end display - NOT CURRENTLY USED + intro TINYTEXT NULL, -- Intro text for front-end display + descr TEXT NULL, -- Full description text + image TINYTEXT NULL, -- Image file name + url TINYTEXT NULL, -- Event URL + ticket_url TINYTEXT NULL, -- Ticket URL + cost TINYTEXT NULL, -- Description of event cost + admin_ref_type INT NULL, -- Type of admin contact if using a member contact + admin_ref_dest INT NULL, -- Pointer to admin contact record if using a member contact + admin_name TINYTEXT NULL, -- Admin Contact Name if not using a member contact + admin_org TINYTEXT NULL, -- Admin Contact Organization if not using a member contact + admin_email TINYTEXT NULL, -- Admin Contact E-Mail if not using a member contact + admin_phone TINYTEXT NULL, -- Admin Contact Phone if not using a member contact + free BOOLEAN NULL, -- Event is Free + contact_email TINYTEXT NULL, -- Contact E-mail address + contact_name TINYTEXT NULL, -- Contact name + contact_phone TINYTEXT NULL, -- Event Phone + use_member_location BOOLEAN NULL, -- Use location of the member (if provided) rather than location table data + old_event_id INT NULL, -- ID of event from old site for reference + notes TEXT NULL, -- Internal notes for this event + PRIMARY KEY (id), + INDEX(custom_time), + INDEX(root_event), + INDEX(ref_type), + INDEX(ref_dest), + INDEX(featured), + INDEX(slideshow), + INDEX(major) +); + +---- + +-- Event Management Settings +CREATE TABLE {prefix}management ( + id INT NOT NULL AUTO_INCREMENT, + canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail + pdf_logo TINYTEXT NULL, -- Image for the Top of the PDF + footer_text TINYTEXT NULL, -- Image for the Top of the PDF + PRIMARY KEY (id) +); + +---- + +-- Set default event management entry +INSERT INTO {prefix}management + ( id, canonical_event_page ) + VALUES + ( 1, 'event-detail' ) +; + diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 0a9f83d..369e087 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -24,5 +24,6 @@ $glmMembersEventsDbVersions = array( '0.0.8' => array('version' => '0.0.8', 'tables' => 7), '0.0.9' => array('version' => '0.0.9', 'tables' => 7), '0.0.10' => array('version' => '0.0.10', 'tables' => 7), + '0.0.11' => array('version' => '0.0.11', 'tables' => 7) ); diff --git a/setup/databaseScripts/update_database_V0.0.11.sql b/setup/databaseScripts/update_database_V0.0.11.sql new file mode 100644 index 0000000..9107d33 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.11.sql @@ -0,0 +1,17 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 12/09/14 15:27:15 +-- Database Version: 0.0.11 +-- 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 dashses + + +-- Add new Start time field +ALTER TABLE {prefix}recurrences CHANGE start_time start_time TIME; + +---- + +-- Add new End time field +ALTER TABLE {prefix}recurrences CHANGE end_time end_time TIME; + diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index 291c964..e74fe28 100644 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -421,6 +421,17 @@ timepicker: false }); + // Time Only Pickers + $('.glm-time-input').datetimepicker({ + format: 'h:i A', + lang: 'en', + step: 15, + closeOnWithoutClick: true, + pick12HourFormat: true, + formatTime:'h:i A', + datepicker: false + }); + // Delete a recurrence $('.delete-recurrence').on( 'click', function() { recurID = $(this).attr('data-id'); @@ -446,9 +457,10 @@ } }); - function startTimeOnlyInit() { + // Start time only checkbox operations + function startTimeOnlySetup() { // Start Time only selection - $('.start-time-only-checkbox').click( function() { + $('.start-time-only-checkbox').each( function() { recurID = $(this).attr('data-id'); if ($(this)[0].checked) { $("#endTimeRow_" + recurID).addClass('glm-hidden'); @@ -457,6 +469,13 @@ } }); } + function startTimeOnlyInit() { + // Start Time only selection + $('.start-time-only-checkbox').click( function() { + startTimeOnlySetup(); + }); + startTimeOnlySetup(); + } startTimeOnlyInit(); // All Dates Event selection @@ -902,6 +921,7 @@ $('#locationContainer').addClass('glm-hidden'); } else { $('#locationContainer').removeClass('glm-hidden'); + initLocations(); } }); diff --git a/views/admin/events/editSchedule.html b/views/admin/events/editSchedule.html index 890b44b..38fe85a 100644 --- a/views/admin/events/editSchedule.html +++ b/views/admin/events/editSchedule.html @@ -36,34 +36,14 @@ Start Time: - + Start time only End Time: - + -   Date range over which recurring event can take place

@@ -214,7 +194,7 @@ New Schedule - First ocurrence of event +   All Day Event: @@ -223,23 +203,16 @@ - Start Date & Time: + Start Time: - + + Start time only - - End Date & Time: - - - - - - - Event Date: + + End Time: - - +