From 9bda7d81f43e15b4533d6ff817c042307d4f102f Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Wed, 23 Mar 2016 13:09:49 -0400 Subject: [PATCH] Various fixes and minor updates to locations, recurrences, and calendar --- classes/data/dataLocations.php | 2 ++ classes/data/dataRecurrences.php | 17 ++++++++++------ classes/data/dataTimes.php | 11 ++++++++++ index.php | 2 +- models/admin/events/list.php | 6 +++--- ..._V0.0.4.sql => create_database_V0.0.7.sql} | 6 ++++-- setup/databaseScripts/dbVersions.php | 4 +++- .../update_database_V0.0.6.sql | 12 +++++++++++ .../update_database_V0.0.7.sql | 12 +++++++++++ views/admin/events/edit.html | 20 ++++++++++++++----- views/admin/events/editLocation.html | 6 +++--- views/admin/events/editSchedule.html | 16 +++++++++++++-- 12 files changed, 91 insertions(+), 23 deletions(-) rename setup/databaseScripts/{create_database_V0.0.4.sql => create_database_V0.0.7.sql} (96%) create mode 100644 setup/databaseScripts/update_database_V0.0.6.sql create mode 100644 setup/databaseScripts/update_database_V0.0.7.sql diff --git a/classes/data/dataLocations.php b/classes/data/dataLocations.php index cd7b9e6..1b4d90d 100644 --- a/classes/data/dataLocations.php +++ b/classes/data/dataLocations.php @@ -241,11 +241,13 @@ class GlmDataEventsLocations extends GlmDataAbstract ), // Contact Reference Placeholder if no Contacts Add-On (see below) +/* not currently in use 'contact_addon_id' => array( 'field' => 'contact_addon_id', 'type' => 'integer', 'use' => 'a' ), +*/ /* * Using first and last name for compatibility with contacts add-on data diff --git a/classes/data/dataRecurrences.php b/classes/data/dataRecurrences.php index 048febf..718d468 100644 --- a/classes/data/dataRecurrences.php +++ b/classes/data/dataRecurrences.php @@ -130,23 +130,28 @@ class GlmDataEventsRecurrences extends GlmDataAbstract 'use' => 'a' ), + // Schedule Name + 'name' => array( + 'field' => 'name', + 'type' => 'text', + 'use' => 'a' + ), + // Start Date & Time 'start_time' => array ( 'field' => 'start_time', 'type' => 'datetime', - 'format' => 'm/d/Y H:i', + 'format' => 'm/d/Y h:i a', 'required' => true, 'use' => 'a' ), // Start Date (for all-day events) 'start_date' => array ( - 'field' => 'start_time', - 'as' => 'start_date', + 'field' => 'start_date', 'type' => 'date', 'default' => time(), - 'required' => true, - 'use' => 'negil' + 'use' => 'a' ), // Start Time Only Flag @@ -161,7 +166,7 @@ class GlmDataEventsRecurrences extends GlmDataAbstract 'end_time' => array ( 'field' => 'end_time', 'type' => 'datetime', - 'format' => 'm/d/Y H:i', + 'format' => 'm/d/Y h:i a', 'use' => 'a' ), diff --git a/classes/data/dataTimes.php b/classes/data/dataTimes.php index 5640df8..4748ff5 100644 --- a/classes/data/dataTimes.php +++ b/classes/data/dataTimes.php @@ -130,6 +130,17 @@ class GlmDataEventsTimes extends GlmDataAbstract 'use' => 'glei' ), + // Recurrence (schedule) Name + 'recur_name' => array ( + 'field' => 'recur_id', + 'as' => 'recur_name', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences', + 'p_field' => 'name', + 'p_static' => true, + 'use' => 'gled' + ), + // Event Name 'event_name' => array ( 'field' => 'event', diff --git a/index.php b/index.php index 8b6b7e9..e05fa89 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.5'); +define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.7'); // 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/models/admin/events/list.php b/models/admin/events/list.php index 666095b..784cc67 100644 --- a/models/admin/events/list.php +++ b/models/admin/events/list.php @@ -328,10 +328,10 @@ class GlmMembersAdmin_events_list extends GlmDataEvents // first check if the event is an all-day event if (isset($_REQUEST[$recurID.'_all_day'])) { - // Then take the event date (date only) and stick it into the start time - $red = explode(' ', $_REQUEST[$recurID.'_event_date']); + // Then take the start date (date only) and stick it into the start time + $red = explode(' ', $_REQUEST[$recurID.'_start_date']); $_REQUEST[$recurID.'_start_time'] = $red[0]." 00:00"; - $_REQUEST[$recurID.'_end_time'] = $$red[0]." 00:00"; + $_REQUEST[$recurID.'_end_time'] = $red[0]." 00:00"; } diff --git a/setup/databaseScripts/create_database_V0.0.4.sql b/setup/databaseScripts/create_database_V0.0.7.sql similarity index 96% rename from setup/databaseScripts/create_database_V0.0.4.sql rename to setup/databaseScripts/create_database_V0.0.7.sql index 9c511d1..1196594 100644 --- a/setup/databaseScripts/create_database_V0.0.4.sql +++ b/setup/databaseScripts/create_database_V0.0.7.sql @@ -39,12 +39,14 @@ CREATE TABLE {prefix}event_categories ( 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 + 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_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (informational only) 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) diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index ec69524..ceb9573 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -18,6 +18,8 @@ $glmMembersEventsDbVersions = array( '0.0.2' => array('version' => '0.0.2', 'tables' => 7), '0.0.3' => array('version' => '0.0.3', 'tables' => 7), '0.0.4' => array('version' => '0.0.4', 'tables' => 7), - '0.0.5' => array('version' => '0.0.5', 'tables' => 7) + '0.0.5' => array('version' => '0.0.5', 'tables' => 7), + '0.0.6' => array('version' => '0.0.6', 'tables' => 7), + '0.0.7' => array('version' => '0.0.7', 'tables' => 7) ); diff --git a/setup/databaseScripts/update_database_V0.0.6.sql b/setup/databaseScripts/update_database_V0.0.6.sql new file mode 100644 index 0000000..af1cb8a --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.6.sql @@ -0,0 +1,12 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 12/09/14 15:27:15 +-- Database Version: 0.0.6 +-- 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 use end time +ALTER TABLE {prefix}recurrences ADD COLUMN name TINYTEXT; + diff --git a/setup/databaseScripts/update_database_V0.0.7.sql b/setup/databaseScripts/update_database_V0.0.7.sql new file mode 100644 index 0000000..ef060ef --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.7.sql @@ -0,0 +1,12 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 12/09/14 15:27:15 +-- Database Version: 0.0.6 +-- 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 use end time +ALTER TABLE {prefix}recurrences ADD COLUMN start_date DATE; + diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index 075ee80..f765bee 100644 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -152,6 +152,7 @@ {$sep = ''} {foreach $times as $t} {$sep}{ + title : '{$t.recur_name}', start : '{$t.start_time.datetime}', end : '{$t.end_time.datetime}', allday : {$t.all_day.value} @@ -211,7 +212,10 @@ // New location ID's start at 0 (have "n" for "new" appended to them in the template) var newLocID = 0; - + // Get location template and clear it from HTML so it doesn't get submitted + locTemplate = $('#addLocationTemplate').html(); + $('#addLocationTemplate').html(''); + // When adding a new location is requested $("#addLocation").click( function() { addNewLocationForm(); @@ -233,7 +237,7 @@ numbLocations++; } - locTemp = locTemp + $('#addLocationTemplate').html(); + locTemp = locTemp + locTemplate; locTemp = locTemp.replace(/{ newLocID }/g, 'n' + newLocID); // Include "n" to indicate "new" // Append the new location form to the container @@ -299,6 +303,10 @@ // New recurrence ID's start at 0 (have "n" for "new" appended to them in the template) var newRecurID = 0; + // Get recurrence template and clear it from HTML so it doesn't get submitted + recurTemplate = $('#addRecurrenceTemplate').html(); + $('#addRecurrenceTemplate').html(''); + function addNewRecurrenceForm() { // Tick the new recurrence ID counter and build new HTML from the addRecurrenceTemplate @@ -314,7 +322,7 @@ numbRecurrences++; } - recurTemp = recurTemp + $('#addRecurrenceTemplate').html(); + recurTemp = recurTemp + recurTemplate; recurTemp = recurTemp.replace(/{ newRecurID }/g, 'n' + newRecurID); // Include "n" to indicate "new" // Append the new recurrence form to the container @@ -337,10 +345,12 @@ // Date / Time Pickers $('.glm-datetime-input').datetimepicker({ - format: 'm/d/Y H:i', + format: 'm/d/Y h:i a', lang: 'en', step: 15, - closeOnWithoutClick: true + closeOnWithoutClick: true, + pick12HourFormat: true, + formatTime:'h:i a' }); // Date Only Pickers diff --git a/views/admin/events/editLocation.html b/views/admin/events/editLocation.html index 60278c9..097af02 100644 --- a/views/admin/events/editLocation.html +++ b/views/admin/events/editLocation.html @@ -16,10 +16,10 @@ {if $locations} {foreach $locations as $loc} -
- +
+ - + diff --git a/views/admin/events/editSchedule.html b/views/admin/events/editSchedule.html index 4e18847..15068bc 100644 --- a/views/admin/events/editSchedule.html +++ b/views/admin/events/editSchedule.html @@ -20,6 +20,12 @@
+ + + + @@ -48,7 +54,7 @@ @@ -180,6 +186,12 @@
Schedule Name: + +
First occurrence for this schedule
All Day Event:
Event Date: - +
 
+ + + + @@ -207,7 +219,7 @@ -- 2.17.1
Schedule Name: + +
New Schedule First ocurrence of eventEvent Date: - +