'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',
}
}
+ // 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'])) {
var fullCalendarLoaded = false;
var recurrencesInited = false;
+ var locationsInited = false;
/*
* Edit area tabs
recurrencesInited = true;
}
+ if (table == 'glm-table-location' && !locationsInited) {
+ initLocations();
+ locationsInited = true;
+ }
+
if (table == 'glm-table-calendar' && !fullCalendarLoaded) {
$('#eventCalendar').fullCalendar({
{if $haveTimes}
$("#newCityDialog").dialog("open");
});
+ // Delete a location
+ $('.delete-location').on( 'click', function() {
+ locID = $(this).attr('data-id');
+ $('#location_' + locID).remove();
+ $('#placeLocationDeletesHere').append('<input type="hidden" name="deleteLocation[' + locID + ']" value="' + locID + '">');
+ 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);
+ })
}
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('<input type="hidden" name="deleteRecur[' + recurID + ']" value="' + recurID + '">');
numbRecurrences--;
})
});
}
-
+
function glmGeocode(locID) {
// Get all address parts
}
});
-
+
}
-
+
});
</script>
<!-- Location forms go here. -->
{if $locations}
{foreach $locations as $loc}
- <tr><td colspan="2"><hr></td></tr>
- <tr id="location_{$loc.id}" class="location_{$r.id} location-form">
+ <tr class="location_{$r.id}"><td colspan="2"><hr></td></tr>
+ <tr id="location_{$loc.id}" data-id="{$loc.id}" class="location_{$r.id} location-form">
<td>
<input type="hidden" name="locID[{$r.id}]" value="{$loc.id}">
- <input type="hidden" name="{$loc.id}_event" value="{$event.id}"> <!-- required to have event id with prefix -->
+ <input type="hidden" name="{$loc.id}_event" value="{$event.fieldData.id}"> <!-- required to have event id with prefix -->
<table width="100%">
<tr>
<th>Location Name:</th>
<tr>
<th>ZIP / Postal Code:</th>
<td>
- <input type="text" name="{$loc.id}_zip" value="{$newLocation.zip}" class="glm-form-text-input-medium">
+ <input type="text" name="{$loc.id}_zip" value="{$loc.zip}" class="glm-form-text-input-medium">
</td>
</tr>
<tr>
<tr>
<th>Contact Name:</th>
<td>
- First: <input type="text" name="{$loc.ID}_contact_fname" value="{$loc.contact_fname}" class="glm-form-text-input-small">
- Last: <input type="text" name="{$loc.ID}_contact_lname" value="{$loc.contact_lname}" class="glm-form-text-input-small">
+ First: <input type="text" name="{$loc.id}_contact_fname" value="{$loc.contact_fname}" class="glm-form-text-input-small">
+ Last: <input type="text" name="{$loc.id}_contact_lname" value="{$loc.contact_lname}" class="glm-form-text-input-small">
</td>
</tr>
<tr>
<th>Contact Phone:</th>
<td>
- <input type="text" name="{$loc.ID}_contact_phone" value="{$loc.contact_phone}" class="glm-form-text-input-medium">
+ <input type="text" name="{$loc.id}_contact_phone" value="{$loc.contact_phone}" class="glm-form-text-input-medium">
</td>
</tr>
<tr>
<th>Contact Email:</th>
<td>
- <input type="text" name="{$loc.ID}_contact_email" value="{$loc.contact_email}" class="glm-form-text-input-medium">
+ <input type="text" name="{$loc.id}_contact_email" value="{$loc.contact_email}" class="glm-form-text-input-medium">
</td>
</tr>
<tr>
<th>Location:</th>
<td>
- <input id="glmLat_{$loc.id}" name="lat" type="hidden" value="{$memberInfo.lat}">
- <input id="glmLng_{$loc.id}" name="lon" type="hidden" value="{$memberInfo.lon}">
+ <input id="glmLat_{$loc.id}" name="{$loc.id}_lat" type="hidden" value="{$loc.lat}">
+ <input id="glmLng_{$loc.id}" name="{$loc.id}_lon" type="hidden" value="{$loc.lon}">
+ <span class="glm-right"><a id="deleteLocation_{$loc.id}" data-id="{$loc.id}" class="button button-primary glm-button glm-right delete-location">Delete Location</a></span>
<div id="glm-estimate-location_{$loc.id}" class="button button-secondary">Map Location Using Above Address</div>
<p>
- <div id="locationMap_{$loc.id}" class="glm-map-edit-small">(map loads here)</div>
- <span id="mapPosition_{$loc.id}">Lat {$newLocation.lat}, Lon {$newLocation.lon}</span>
+ <div id="locationMap_{$loc.id}" class="glm-map-edit">(map loads here)</div>
+ <span id="mapPosition_{$loc.id}">Lat {$loc.lat}, Lon {$loc.lon}</span>
</p>
</td>
</tr>
<tr>
<th>Location:</th>
<td>
- <input id="glmLat_{ newLocID }" name="lat" type="hidden" value="{$newLocation.fieldData.lat}">
- <input id="glmLng_{ newLocID }" name="lon" type="hidden" value="{$newLocation.fieldData.lon}">
+ <input id="glmLat_{ newLocID }" name="{ newLocID }_lat" type="hidden" value="{$newLocation.fieldData.lat}">
+ <input id="glmLng_{ newLocID }" name="{ newLocID }_lon" type="hidden" value="{$newLocation.fieldData.lon}">
+ <span class="glm-right"><a id="deleteLocation_{ newLocID }" data-id="{ newLocID }" class="button button-primary glm-button glm-right delete-location">Delete Location</a></span>
<div id="glm-estimate-location_{ newLocID }" class="button button-secondary">Map Location Using Address</div>
<p>
<div id="locationMap_{ newLocID }" class="glm-map-edit">(map loads here)</div>
<!-- Recurrence forms go here. -->
{if $recurrences}
{foreach $recurrences as $r}
- <tr><td colspan="2"><hr></td></tr>
+ <tr class="recurrence_{$r.id}"><td colspan="2"><hr></td></tr>
<tr id="recurrence_{$r.id}" class="recurrence_{$r.id} recurrence-form">
<td>
<input type="hidden" name="recurID[{$r.id}]" value="{$r.id}">
<input type="hidden" name="{$r.id}_event" value="{$event.fieldData.id}"> <!-- required to have event id with prefix -->
<input id="{$r.id}_recurUpdated" type="hidden" name="recurUpdated[{$r.id}]" value="0">
- <table width="100%">
- <tr><th></th><th>First occurrence for this schedule</th></tr>
+ <table>
+ <tr><th colspan="2">First occurrence for this schedule</th></tr>
<tr>
<th>All Day Event:</th>
<td>
<input data-id="{$r.id}" type="text" name="{$r.id}_event_date" value="{$r.start_time.datetime}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
</td>
</tr>
-
- <tr><th></th><th><p>Date range over which recurring event can take place</p></th></tr>
+ <tr><td colspan="2"> </td></tr>
+ <tr><th colspan="2">Date range over which recurring event can take place</p></th></tr>
<tr>
<th>From Date:</th>
<td>
<tr>
<th></th>
<th>
- <a id="deleteRecurrence_{$r.id}" data-id="{$r.id}" class="button button-primary glm-button glm-right delete-new-recurrence all_dates-checkbox">Delete this Event Schedule</a>
+ <a id="deleteRecurrence_{$r.id}" data-id="{$r.id}" class="button button-primary glm-button glm-right delete-recurrence all_dates-checkbox">Delete this Event Schedule</a>
When the event recurrs
</th>
</tr>
<input type="text" name="{ newRecurID }_event_date" value="{$newRecurrence.fieldData.start_date.date}" class="glm-form-text-input-small glm-date-input" placeholder="Click to Select Date/Time">
</td>
</tr>
-
- <tr><th></th><th><p>Date range over which recurring event can take place</p></th></tr>
+ <tr><td colspan="2"> </td></tr>
+ <tr><th colspan=2">Date range over which recurring event can take place</th></tr>
<tr>
<th>From Date:</th>
<td>
<tr>
<th></th>
<th>
- <a id="deleteRecurrence_{ newRecurID }" data-id="{ newRecurID }" class="button button-primary glm-button glm-right delete-new-recurrence">Delete this Event Schedule</a>
+ <a id="deleteRecurrence_{ newRecurID }" data-id="{ newRecurID }" class="button button-primary glm-button glm-right delete-recurrence">Delete this Event Schedule</a>
When the event recurrs
</th>
</tr>