From c2b2766497e810ff2a25fd25831a515990468540 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Wed, 16 Mar 2016 10:23:45 -0400 Subject: [PATCH] Event Locations now appear to be working. --- classes/data/dataLocations.php | 12 ---------- models/admin/events/list.php | 12 ++++++++++ views/admin/events/edit.html | 36 +++++++++++++++++++++++----- views/admin/events/editLocation.html | 30 ++++++++++++----------- views/admin/events/editSchedule.html | 18 +++++++------- 5 files changed, 67 insertions(+), 41 deletions(-) diff --git a/classes/data/dataLocations.php b/classes/data/dataLocations.php index 0ae6985..cd7b9e6 100644 --- a/classes/data/dataLocations.php +++ b/classes/data/dataLocations.php @@ -240,18 +240,6 @@ class GlmDataEventsLocations extends GlmDataAbstract 'use' => 'a' ), - // Contact Reference - Points to Contacts add-on contacts table - 'region' => array ( - 'field' => 'region', - 'type' => 'pointer', - 'p_table' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . 'regions', - 'p_field' => 'name', - 'p_orderby' => 'name', - 'p_blank' => true, - // 'force_list' => true, - 'use' => 'a' - ), - // Contact Reference Placeholder if no Contacts Add-On (see below) 'contact_addon_id' => array( 'field' => 'contact_addon_id', diff --git a/models/admin/events/list.php b/models/admin/events/list.php index f1a77c3..92c74e8 100644 --- a/models/admin/events/list.php +++ b/models/admin/events/list.php @@ -240,6 +240,18 @@ class GlmMembersAdmin_events_list extends GlmDataEvents } } + // Look for location deletes + if (isset($_REQUEST['deleteLocation']) && count($_REQUEST['deleteLocation'] > 0)) { + foreach ($_REQUEST['deleteLocation'] as $d) { + + // If this was not a new entry that was deleted (in which case it was never added) + if ($d[0] != 'n') { + $Locations->deleteEntry($d, true); + } + + } + } + // Look for location data if (isset($_REQUEST['locID'])) { diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index 95ce313..a3bcab4 100644 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -98,6 +98,7 @@ var fullCalendarLoaded = false; var recurrencesInited = false; + var locationsInited = false; /* * Edit area tabs @@ -121,6 +122,11 @@ recurrencesInited = true; } + if (table == 'glm-table-location' && !locationsInited) { + initLocations(); + locationsInited = true; + } + if (table == 'glm-table-calendar' && !fullCalendarLoaded) { $('#eventCalendar').fullCalendar({ {if $haveTimes} @@ -234,8 +240,27 @@ $("#newCityDialog").dialog("open"); }); + // Delete a location + $('.delete-location').on( 'click', function() { + locID = $(this).attr('data-id'); + $('#location_' + locID).remove(); + $('#placeLocationDeletesHere').append(''); + numbLocations--; + }) + initMap(locID); + } + + /* + * This is used to initialize all of the locations when the location tab is first clicked. + */ + function initLocations() { + + $('.location-form').each( function() { + locID = $(this).attr('data-id'); + initLocation(locID); + }) } @@ -304,11 +329,10 @@ timepicker: false }); - // Delete a recurrence - $('.delete-new-recurrence').on( 'click', function() { + $('.delete-recurrence').on( 'click', function() { recurID = $(this).attr('data-id'); - $('.recurrence_' + recurID).remove(); + $('#recurrence_' + recurID).remove(); $('#placeRecurDeletesHere').append(''); numbRecurrences--; }) @@ -661,7 +685,7 @@ }); } - + function glmGeocode(locID) { // Get all address parts @@ -700,9 +724,9 @@ } }); - + } - + }); diff --git a/views/admin/events/editLocation.html b/views/admin/events/editLocation.html index 9d18ce0..60278c9 100644 --- a/views/admin/events/editLocation.html +++ b/views/admin/events/editLocation.html @@ -16,11 +16,11 @@ {if $locations} {foreach $locations as $loc} -
- +
+ - + @@ -80,7 +80,7 @@ @@ -127,20 +127,20 @@ @@ -151,12 +151,13 @@ @@ -308,8 +309,9 @@ +
Location Name:
ZIP / Postal Code: - +
Contact Name: - First: - Last: + First: + Last:
Contact Phone: - +
Contact Email: - +
Location: - - + + + Delete Location
Map Location Using Above Address

-

(map loads here)
- Lat {$newLocation.lat}, Lon {$newLocation.lon} +
(map loads here)
+ Lat {$loc.lat}, Lon {$loc.lon}

Location: - - + + + Delete Location
Map Location Using Address

(map loads here)
diff --git a/views/admin/events/editSchedule.html b/views/admin/events/editSchedule.html index 0530222..f93ee1a 100644 --- a/views/admin/events/editSchedule.html +++ b/views/admin/events/editSchedule.html @@ -13,14 +13,14 @@ {if $recurrences} {foreach $recurrences as $r} -


- - +
First occurrence for this schedule
+ - - + + @@ -205,8 +205,8 @@ - - + + -- 2.17.1
First occurrence for this schedule
All Day Event: @@ -46,8 +46,8 @@

Date range over which recurring event can take place

 
Date range over which recurring event can take place

From Date: @@ -69,7 +69,7 @@
- Delete this Event Schedule + Delete this Event Schedule When the event recurrs

Date range over which recurring event can take place

 
Date range over which recurring event can take place
From Date: @@ -228,7 +228,7 @@
- Delete this Event Schedule + Delete this Event Schedule When the event recurrs