{else}
<input type="hidden" name="option" value="insert">
{/if}
+ <input type="hidden" name="currentTab" value="{$currentTab}">
<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
- <a id="glm-event-descr" data-show-table="glm-table-descr" class="glm-event-tab nav-tab nav-tab-active">Event Description</a>
- <a id="glm-event-location" data-show-table="glm-table-location" class="glm-event-tab nav-tab">Location</a>
- <a id="glm-event-recurrence" data-show-table="glm-table-recurrence" class="glm-event-tab nav-tab">Dates</a>
- <a id="glm-event-calendar" data-show-table="glm-table-calendar" class="glm-event-tab nav-tab">Summary Calendar</a>
- <a id="glm-event-admin" data-show-table="glm-table-settings" class="glm-event-tab nav-tab">Administrative Contact</a>
- <a id="glm-event-files" data-show-table="glm-table-files" class="glm-event-tab nav-tab">Attach Files</a>
+ <a id="glm-event-descr" data-show-table="glm-table-descr" class="glm-event-tab nav-tab nav-tab{if $currentTab == 'glm-table-descr'} nav-tab-active{/if}">Event Description</a>
+ <a id="glm-event-location" data-show-table="glm-table-location" class="glm-event-tab nav-tab{if $currentTab == 'glm-table-location'} nav-tab-active{/if}">Location</a>
+ <a id="glm-event-recurrence" data-show-table="glm-table-recurrence" class="glm-event-tab nav-tab{if $currentTab == 'glm-table-recurrence'} nav-tab-active{/if}">Dates</a>
+ <a id="glm-event-calendar" data-show-table="glm-table-calendar" class="glm-event-tab nav-tab{if $currentTab == 'glm-table-calendar'} nav-tab-active{/if}">Summary Calendar</a>
+ <a id="glm-event-admin" data-show-table="glm-table-settings" class="glm-event-tab nav-tab{if $currentTab == 'glm-table-settings'} nav-tab-active{/if}">Administrative Contact</a>
+ <a id="glm-event-files" data-show-table="glm-table-files" class="glm-event-tab nav-tab{if $currentTab == 'glm-table-files'} nav-tab-active{/if}">Attach Files</a>
</h2>
<!-- Status and Description -->
<!-- Calendar -->
- <table id="glm-table-calendar" class="glm-admin-table glm-hidden glm-event-table">
+ <table id="glm-table-calendar" class="glm-admin-table glm-event-table{if $currentTab != 'glm-table-calendar'} glm-hidden{/if}">
<tr>
<td>
<div id="eventCalendar"></div>
*/
$('.glm-event-tab').click( function() {
- // Clear tabl highlights and hide all tables
+ // Clear table highlights and hide all tables
$('.glm-event-tab').removeClass('nav-tab-active');
$('.glm-event-table').addClass('glm-hidden');
var table = $(this).attr('data-show-table');
$('#' + table).removeClass('glm-hidden');
+ // Set the hidden input field with current tab value
+ $('input[name=currentTab]').val(table);
+
if (table == 'glm-table-recurrence' && !recurrencesInited) {
initRecurrence();
recurrencesInited = true;
// Make sure there's at least one location
{if !$locations}
- addNewLocationForm();
+ addNewLocationForm();
{/if}
initLocations();
}
- // Check Use Member Location checkbox
- memberID = $('#memberSelect').val();
- otherMemberID = $('#useOtherRefDest').val();
- if (memberID == '') {
+ initMemberLocationCheckbox();
+ }
- // No member selected - Clear checkbox, Dissable checkbox, Show location
- $('#useMemberLocationCheckbox').prop('checked', false);
- $('#useMemberLocationCheckbox').prop('disabled', true);
- $('#useMemberMessage').addClass('glm-hidden');
- $('#notUseMemberMessage').removeClass('glm-hidden');
- if ( otherMemberID == '' ) {
- $('#locationContainer').removeClass('glm-hidden');
- }
+ if (table == 'glm-table-calendar' && !fullCalendarLoaded) {
- } else {
+ initFullCalendar();
- // Member set - Enable checkbox
- $('#useMemberLocationCheckbox').prop('disabled', false);
- $('#useMemberMessage').removeClass('glm-hidden');
- $('#notUseMemberMessage').addClass('glm-hidden');
+ fullCalendarLoaded = true;
- }
}
- if (table == 'glm-table-calendar' && !fullCalendarLoaded) {
+ });
- // **** Should probably move all this to a function and check if it's been initialized already
- $('#eventCalendar').fullCalendar({
- {if $haveTimes}
- events: [
- {$sep = ''}
- {foreach $times as $t}
- {$sep}{
- title : '{$t.recur_name|replace:"'":"\'"}',
- start : '{$t.start_time.datetime}',
- end : '{$t.end_time.datetime}',
- allday : {$t.all_day.value}
- }
- {$sep = ','}
- {/foreach}
- ],
- defaultDate : '{$firstTime.start_time.datetime}',
- timeFormat : 'h:mma',
- fixedWeekCount : false,
- eventClick: function(calEvent, jsEvent, view) {
- $("#occurrences").dialog();
- $(this).css('border-color', 'red');
- }
-/* ,
- dayClick: function(date, allDay, jsEvent, view) {
+ function initCurrentTab(){
+ // Clear table highlights and hide all tables
+ //$('.glm-event-tab').removeClass('nav-tab-active');
+ //$('.glm-event-table').addClass('glm-hidden');
- if (allDay) {
- alert('Clicked on the entire day: ' + date);
- }else{
- alert('Clicked on the slot: ' + date);
- }
+ // Get the table name for the currentTab
+ var table = $('input[name=currentTab]').val();
+ // Show the currentTab
+ //$('#' + table).removeClass('glm-hidden');
+ // Highlight selected tab
+ $('a[data-show-table="' + table + '"]').addClass('nav-tab-active');
- alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
- alert('Current view: ' + view.name);
+ if (table == 'glm-table-recurrence' && !recurrencesInited) {
+ initRecurrence();
+ recurrencesInited = true;
+ }
- // change the day's background color just for fun
- $(this).css('background-color', 'red');
+ if (table == 'glm-table-location') {
- alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
- alert('Current view: ' + view.name);
+ if (!locationsInited) {
+ // Make sure there's at least one location
+ {if !$locations}
+ addNewLocationForm();
+ {/if}
+
+ initLocations();
+ initNewCity();
+ locationsInited = true;
+ }
- }
-*/
- {/if}
- });
+ initMemberLocationCheckbox();
+ }
+
+ if (table == 'glm-table-calendar' && !fullCalendarLoaded) {
+
+ initFullCalendar();
fullCalendarLoaded = true;
}
+ }
- // Count remaining characters in field
- $('.glm-char-count').keyup( function() {
- glmCharsRemaining($(this));
- });
+ // Count remaining characters in field
+ $('.glm-char-count').keyup( function() {
+ glmCharsRemaining($(this));
});
/*
}
+ /*
+ * Initialize the Member Location Checkbox
+ */
+ function initMemberLocationCheckbox() {
+ // Check Use Member Location checkbox
+ memberID = $('#memberSelect').val();
+ otherMemberID = $('#useOtherRefDest').val();
+ if (memberID == '') {
+
+ // No member selected - Clear checkbox, Disable checkbox, Show location
+ $('#useMemberLocationCheckbox').prop('checked', false);
+ $('#useMemberLocationCheckbox').prop('disabled', true);
+ $('#useMemberMessage').addClass('glm-hidden');
+ $('#notUseMemberMessage').removeClass('glm-hidden');
+ if ( otherMemberID == '' ) {
+ $('#locationContainer').removeClass('glm-hidden');
+ }
+
+ } else {
+
+ // Member set - Enable checkbox
+ $('#useMemberLocationCheckbox').prop('disabled', false);
+ $('#useMemberMessage').removeClass('glm-hidden');
+ $('#notUseMemberMessage').addClass('glm-hidden');
+
+ }
+ }
+
+ /*
+ * Initialize the Full Calendar
+ */
+ function initFullCalendar(){
+ $('#eventCalendar').fullCalendar({
+ {if $haveTimes}
+ events: [
+ {$sep = ''}
+ {foreach $times as $t}
+ {$sep}{
+ title : '{$t.recur_name|replace:"'":"\'"}',
+ start : '{$t.start_time.datetime}',
+ end : '{$t.end_time.datetime}',
+ allday : {$t.all_day.value}
+ }
+ {$sep = ','}
+ {/foreach}
+ ],
+ defaultDate : '{$firstTime.start_time.datetime}',
+ timeFormat : 'h:mma',
+ fixedWeekCount : false,
+ eventClick: function(calEvent, jsEvent, view) {
+ $("#occurrences").dialog();
+ $(this).css('border-color', 'red');
+ }
+ {/if}
+ });
+ }
+
/*
* Recurrences
*/
}
// Make sure there's at least one recurrence
- {if !$recurrences}
- addNewRecurrenceForm();
- {/if}
+ {if !$recurrences}
+ addNewRecurrenceForm();
+ {/if}
// When adding a new recurrence is requested
$("#addRecurrence").click( function() {
// Flash certain elements for a short time after display
$(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+ if ( $('input[name=currentTab]').val() != 'glm-table-descr' ) {
+ initCurrentTab();
+ }
+
});
</script>
<!-- Recurrences - Event Schedule -->
-<table id="glm-table-recurrence" class="glm-admin-table glm-hidden glm-event-table">
+<table id="glm-table-recurrence" class="glm-admin-table glm-event-table{if $currentTab != 'glm-table-recurrence'} glm-hidden{/if}">
<tr>
<td id="placeRecurDeletesHere" colspan="2">
<h2 {if !$haveTimes}class="glm-error"{/if}><b>Event Occurrences:</b> {$timesCount}</h2>
<tr><td colspan="3"> </td></tr>
<tr><td colspan="3"><hr width="50%"></td></tr>
<tr><td colspan="3"><h2 style="text-align: center;">Add Specific Dates that Don't Fit Schedule Above</h2></td></tr>
- <tr><td colspan="3">Use this section to enter specific additional dates that don't fit into a regular monthly, weekly or daily schedule above.
+ <tr><td colspan="3">Use this section to enter specific additional dates that don't fit into a regular monthly, weekly or daily schedule above.
If all your dates don't fit a recurring schedule above, you may click "None" for all of the options above and select all specific dates for your event here.</td></tr>
<tr><td colspan="3"> </td></tr>
<tr>
</tr><tr>
{/if}
<td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_month_of_year[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name} </td>
- {/foreach}
+ {/foreach}
</tr>
</table>
</td>
<tr>
{foreach $newRecurrence.fieldData.week_of_month.bitmap as $v}
<td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_week_of_month[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name} </td>
- {/foreach}
+ {/foreach}
</tr>
</table>
</td>
<tr><td colspan="3"> </td></tr>
<tr><td colspan="3"><hr width="50%"></td></tr>
<tr><td colspan="3"><h2 style="text-align: center;">Add Specific Dates that Don't Fit Schedule Above</h2></td></tr>
- <tr><td colspan="3">Use this section to enter specific additional dates that don't fit into a regular monthly, weekly or daily schedule above.
+ <tr><td colspan="3">Use this section to enter specific additional dates that don't fit into a regular monthly, weekly or daily schedule above.
If all your dates don't fit a recurring schedule above, you may click "None" for all of the options above and select all specific dates for your event here.
You may set dates here that are not from "First date" to "Last Date".</td></tr>
<tr><td colspan="2"> </td></tr>
<div data-id="{ newRecurID }" class="button glm-button-small glm-set-none recur-calendar">Custom Dates</div>
</td>
<td>
-
+
<div id="recurCalendarDialog_{ newRecurID }" class="glm-dialog-box" title="">
<p>Click on Dates to select/remove those dates for this schedule.</p>
<div id="recurCalendar_{ newRecurID }"></div>