aboutsummaryrefslogtreecommitdiff
path: root/views/default/js
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/js')
-rw-r--r--views/default/js/event_calendar/event_calendar.php23
1 files changed, 18 insertions, 5 deletions
diff --git a/views/default/js/event_calendar/event_calendar.php b/views/default/js/event_calendar/event_calendar.php
index 65c4d2952..efa1dc1dd 100644
--- a/views/default/js/event_calendar/event_calendar.php
+++ b/views/default/js/event_calendar/event_calendar.php
@@ -10,7 +10,7 @@ elgg.event_calendar.init = function () {
$('.event-calendar-repeating-unselected').live('click',elgg.event_calendar.handleRepeatingSelect);
$('.event-calendar-repeating-selected').live('click',elgg.event_calendar.handleRepeatingUnselect);
$('#event-calendar-edit').submit(elgg.event_calendar.handleEditFormSubmit);
- $('#event-calendar-edit-schedule-type').click(elgg.event_calendar.handleScheduleType);
+ $('input.elgg-input-radio[name="schedule_type"]').click(elgg.event_calendar.handleScheduleType);
elgg.event_calendar.handleScheduleType();
var all_day_field = $('[name="all_day"][type="checkbox"]');
@@ -21,10 +21,16 @@ elgg.event_calendar.init = function () {
$('#event-calendar-end-time-wrapper').attr('disabled','disabled');
}
all_day_field.change(elgg.event_calendar.handleAllDayField);
+
+ $('.elgg-input-date[name="start_date"], .elgg-input-date[name="end_date"]').datepicker({
+ dateFormat: 'yy-mm-dd',
+ numberOfMonths: 3,
+ onSelect: elgg.event_calendar.handleDateRangeSelect,
+ });
}
elgg.event_calendar.handleScheduleType = function(e) {
- var st = $('#event-calendar-edit-schedule-type:checked').val();
+ var st = $('input.elgg-input-radio[name="schedule_type"]:checked').val();
if (st == 'poll') {
$(".event-calendar-edit-date-wrapper").hide();
$(".event-calendar-edit-reminder-wrapper").hide();
@@ -61,6 +67,14 @@ elgg.event_calendar.handleAllDayField = function(e) {
}
}
+elgg.event_calendar.handleDateRangeSelect = function(selectedDate) {
+ if (this.name == 'start_date') {
+ $('.elgg-input-date[name="end_date"]').datepicker("option", "minDate", selectedDate);
+ } else {
+ $('.elgg-input-date[name="start_date"]').datepicker("option", "maxDate", selectedDate);
+ }
+}
+
elgg.event_calendar.handleEditFormSubmit = function(e) {
if ($.trim($('[name="title"]').val()) == '') {
alert(elgg.echo('event_calendar:edit_form:error:missing_title'));
@@ -96,9 +110,8 @@ elgg.event_calendar.handleRegionChange = function(e) {
}
elgg.event_calendar.handleIcalPopup = function(e) {
- var message = elgg.echo('event_calendar:ical_popup_message')+"\n"+this.href;
- alert(message);
- return false;
+ this.href = '#event-calendar-ical';
+ e.preventDefault();
}
elgg.event_calendar.handlePagedPersonalCalendarToggle = function() {