diff options
author | Kevin Jardine <kevinjardine@yahoo.com> | 2012-05-24 20:00:18 +0200 |
---|---|---|
committer | Kevin Jardine <kevinjardine@yahoo.com> | 2012-05-24 20:00:18 +0200 |
commit | b8c3767f8c790febb35141919936d616d3ebe2d4 (patch) | |
tree | 7e137e8482106ffc59ee30063cc8eb2bc4442374 /views | |
parent | fc04fcffb8a03c166467e8633f8195ef48b29f4a (diff) | |
download | elgg-b8c3767f8c790febb35141919936d616d3ebe2d4.tar.gz elgg-b8c3767f8c790febb35141919936d616d3ebe2d4.tar.bz2 |
changed time handling and added more suppport for event polls
Diffstat (limited to 'views')
-rw-r--r-- | views/default/event_calendar/css.php | 7 | ||||
-rw-r--r-- | views/default/event_calendar/datetime_edit.php | 12 | ||||
-rw-r--r-- | views/default/event_calendar/full_calendar_view.php | 2 | ||||
-rw-r--r-- | views/default/event_calendar/personal_manage_section.php | 20 | ||||
-rw-r--r-- | views/default/event_calendar/reminder_section.php | 28 | ||||
-rw-r--r-- | views/default/event_calendar/schedule_section.php | 22 | ||||
-rw-r--r-- | views/default/event_calendar/share_section.php | 26 | ||||
-rw-r--r-- | views/default/forms/event_calendar/edit.php | 110 | ||||
-rw-r--r-- | views/default/input/datepicker_inline.php | 3 | ||||
-rw-r--r-- | views/default/input/timepicker.php | 90 | ||||
-rw-r--r-- | views/default/js/event_calendar/event_calendar.php | 24 |
11 files changed, 191 insertions, 153 deletions
diff --git a/views/default/event_calendar/css.php b/views/default/event_calendar/css.php index 4d68f500f..9461a7fe9 100644 --- a/views/default/event_calendar/css.php +++ b/views/default/event_calendar/css.php @@ -269,4 +269,9 @@ li.event-calendar-filter-menu-show-only { .event-calendar-description { display: none; -}
\ No newline at end of file +} + +.event-calendar-edit-bottom { + clear: both; + margin-bottom: 5px; +} diff --git a/views/default/event_calendar/datetime_edit.php b/views/default/event_calendar/datetime_edit.php index aa3a8f2de..ceceeb20e 100644 --- a/views/default/event_calendar/datetime_edit.php +++ b/views/default/event_calendar/datetime_edit.php @@ -9,16 +9,16 @@ if ($event_calendar_times != 'no') { $body .= '<p><label>'.elgg_echo('event_calendar:from_label').'</label>'; } $body .= elgg_view("event_calendar/input/date_local",array( - 'timestamp'=>TRUE, + //'timestamp'=>TRUE, 'autocomplete'=>'off', 'class'=>'event-calendar-compressed-date', 'name' => 'start_date', 'value'=>$vars['start_date'])); $body .= elgg_view("input/timepicker",array('name' => 'start_time','value'=>$vars['start_time'])); if ($event_calendar_hide_end != 'yes') { - $body .= '</p><p><label>'.elgg_echo('event_calendar:to_label').'</label>'; + $body .= '</p><p id="event-calendar-to-time-wrapper"><label>'.elgg_echo('event_calendar:to_label').'</label>'; $body .= elgg_view("event_calendar/input/date_local",array( - 'timestamp'=>TRUE, + //'timestamp'=>TRUE, 'autocomplete'=>'off', 'class'=>'event-calendar-compressed-date', 'name' => 'end_date', @@ -26,7 +26,7 @@ if ($event_calendar_times != 'no') { )); $body .= elgg_view("input/timepicker",array('name' => 'end_time','value'=>$vars['end_time'])); } - $body .= '</p>'; + $body .= '</p></span>'; } else { $body .= '<p><label>'.elgg_echo("event_calendar:start_date_label").'<br />'; @@ -35,10 +35,10 @@ if ($event_calendar_times != 'no') { $body .= '<p class="description">'.$prefix['start_date'].elgg_echo('event_calendar:start_date_description').'</p>'; if ($event_calendar_hide_end != 'yes') { - $body .= '<p><label>'.elgg_echo("event_calendar:end_date_label").'<br />'; + $body .= '<p id="event-calendar-to-time-wrapper"><label>'.elgg_echo("event_calendar:end_date_label").'<br />'; $body .= elgg_view("event_calendar/input/date_local",array('timestamp'=>TRUE,'autocomplete'=>'off','name' => 'end_date','value'=>$vars['end_date'])); $body .= '</label></p>'; - $body .= '<p class="description">'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'</p>'; + //$body .= '<p class="description">'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'</p>'; } } diff --git a/views/default/event_calendar/full_calendar_view.php b/views/default/event_calendar/full_calendar_view.php index 6c21c42c8..5fffff624 100644 --- a/views/default/event_calendar/full_calendar_view.php +++ b/views/default/event_calendar/full_calendar_view.php @@ -14,7 +14,7 @@ handleEventClick = function(event) { handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) { - if (!confirm("Are you sure about this change?")) { + if (!confirm("<?php echo elgg_echo('event_calendar:are_you_sure'); ?>")) { revertFunc(); } else { elgg.action('event_calendar/modify_full_calendar', diff --git a/views/default/event_calendar/personal_manage_section.php b/views/default/event_calendar/personal_manage_section.php new file mode 100644 index 000000000..9e03db0ab --- /dev/null +++ b/views/default/event_calendar/personal_manage_section.php @@ -0,0 +1,20 @@ +<?php +$fd = $vars['form_data']; +$event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar'); +$body = ''; + +if ($event_calendar_personal_manage == 'by_event') { + $personal_manage_options = array( + elgg_echo('event_calendar:personal_manage:by_event:open') => 'open', + elgg_echo('event_calendar:personal_manage:by_event:closed') => 'closed', + elgg_echo('event_calendar:personal_manage:by_event:private') => 'private', + ); + $body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-membership-block">'; + $body .= '<h2>'.elgg_echo('event_calendar:personal_manage:label').'</h2>'; + $body .= elgg_view("input/radio",array('name' => 'personal_manage','value'=>$fd['personal_manage'],'options'=>$personal_manage_options)); + //$body .= '<p class="event-calendar-description">'.$prefix['personal_manage'].elgg_echo('event_calendar:personal_manage:description').'</p>'; + $body .= '<br clear="both" />'; + $body .= '</div>'; +} + +echo $body; diff --git a/views/default/event_calendar/reminder_section.php b/views/default/event_calendar/reminder_section.php new file mode 100644 index 000000000..fffa6d065 --- /dev/null +++ b/views/default/event_calendar/reminder_section.php @@ -0,0 +1,28 @@ +<?php +$fd = $vars['form_data']; +$event_calendar_reminders = elgg_get_plugin_setting('reminders', 'event_calendar'); +$body = ''; +if ($event_calendar_reminders == 'yes') { + $body .= '<div class="event-calendar-edit-reminder-wrapper">'; + if ($fd['send_reminder']) { + $body .= elgg_view('input/checkbox',array('name'=>'send_reminder','checked' => 'checked','value'=>1)); + } else { + $body .= elgg_view('input/checkbox',array('name'=>'send_reminder','value'=>1)); + } + $body .= elgg_echo('elgg_calendar:send_reminder_label'). ' '; + $numbers = array(); + for ($i=1;$i<60;$i++) { + $numbers[$i] = $i; + } + $intervals = array( + 1 => elgg_echo('event_calendar:interval:minute'), + 60 => elgg_echo('event_calendar:interval:hour'), + 60*24 => elgg_echo('event_calendar:interval:day'), + ); + + $body .= elgg_view('input/dropdown',array('name'=>'reminder_number','options_values'=>$numbers,'value'=>$fd['reminder_number'])); + $body .= elgg_view('input/dropdown',array('name'=>'reminder_interval','options_values'=>$intervals,'value'=>$fd['reminder_interval'])); + $body .= elgg_echo('elgg_calendar:send_reminder_before'); + $body .= '</div>'; +} +echo $body; diff --git a/views/default/event_calendar/schedule_section.php b/views/default/event_calendar/schedule_section.php new file mode 100644 index 000000000..3a74dc789 --- /dev/null +++ b/views/default/event_calendar/schedule_section.php @@ -0,0 +1,22 @@ +<?php +$event = $vars['event']; +$fd = $vars['form_data']; +$event_calendar_repeated_events = elgg_get_plugin_setting('repeated_events', 'event_calendar'); + +$body = '<div class="event-calendar-edit-date-wrapper">'; +$body .= elgg_view('event_calendar/datetime_edit', + array( + 'start_date' => $fd['start_date'], + 'end_date' => $fd['end_date'], + 'start_time' => $fd['start_time'], + 'end_time' => $fd['end_time'], + 'prefix' => $vars['prefix'], +)); +if ($event_calendar_repeated_events == 'yes') { + $body .= elgg_view('event_calendar/repeat_form_element',$vars); +} + +$body .= elgg_view('event_calendar/reminder_section',$vars); +$body .= '</div>'; + +echo $body; diff --git a/views/default/event_calendar/share_section.php b/views/default/event_calendar/share_section.php new file mode 100644 index 000000000..134f07656 --- /dev/null +++ b/views/default/event_calendar/share_section.php @@ -0,0 +1,26 @@ +<?php +$fd = $vars['form_data']; +$event_calendar_hide_access = elgg_get_plugin_setting('hide_access', 'event_calendar'); +$body = '<div class="event-calendar-edit-form-block event-calendar-edit-form-share-block">'; +$body .= '<h2>'.elgg_echo('event_calendar:permissions:header').'</h2>'; +if($event_calendar_hide_access == 'yes') { + $event_calendar_default_access = elgg_get_plugin_setting('default_access', 'event_calendar'); + if($event_calendar_default_access) { + $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>$event_calendar_default_access)); + } else { + $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>ACCESS_DEFAULT)); + } +} else { + $body .= '<p><label>'.elgg_echo('event_calendar:read_access').'</label>'; + $body .= elgg_view("input/access",array('name' => 'access_id','value'=>$fd['access_id'])); + $body .= '</p>'; +} +if (elgg_plugin_exists('entity_admins')) { + $body .= elgg_echo('event_calendar:share_ownership:label'); + $body .= '<br />'; + $body .= elgg_echo('event_calendar:share_ownership:description'); + $body .= elgg_view('input/entity_admins_dropdown',array('entity'=>$vars['event'])); +} +$body .= '</div>'; + +echo $body; diff --git a/views/default/forms/event_calendar/edit.php b/views/default/forms/event_calendar/edit.php index 278fdddce..6ea06a6b4 100644 --- a/views/default/forms/event_calendar/edit.php +++ b/views/default/forms/event_calendar/edit.php @@ -2,17 +2,15 @@ $event = $vars['event']; $fd = $vars['form_data']; -$personal_manage_options = array( - elgg_echo('event_calendar:personal_manage:by_event:open') => 'open', - elgg_echo('event_calendar:personal_manage:by_event:closed') => 'closed', - elgg_echo('event_calendar:personal_manage:by_event:private') => 'private', -); - $schedule_options = array( - elgg_echo('event_calendar:schedule_type:poll')=>'poll', + elgg_echo('event_calendar:all_day_label') => 'all_day', elgg_echo('event_calendar:schedule_type:fixed')=>'fixed', ); +if (elgg_plugin_exists('event_poll')) { + $schedule_options = array_merge(array(elgg_echo('event_calendar:schedule_type:poll')=>'poll'),$schedule_options); +} + $event_calendar_fewer_fields = elgg_get_plugin_setting('fewer_fields', 'event_calendar'); $event_calendar_repeating_events = elgg_get_plugin_setting('repeating_events', 'event_calendar'); @@ -20,12 +18,8 @@ $event_calendar_region_display = elgg_get_plugin_setting('region_display', 'even $event_calendar_type_display = elgg_get_plugin_setting('type_display', 'event_calendar'); $event_calendar_spots_display = elgg_get_plugin_setting('spots_display', 'event_calendar'); //$event_calendar_add_users = elgg_get_plugin_setting('add_users', 'event_calendar'); -$event_calendar_hide_access = elgg_get_plugin_setting('hide_access', 'event_calendar'); $event_calendar_more_required = elgg_get_plugin_setting('more_required', 'event_calendar'); -$event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar'); -$event_calendar_repeated_events = elgg_get_plugin_setting('repeated_events', 'event_calendar'); -$event_calendar_reminders = elgg_get_plugin_setting('reminders', 'event_calendar'); $event_calendar_bbb_server_url = elgg_get_plugin_setting('bbb_server_url', 'event_calendar'); if ($event_calendar_more_required == 'yes') { @@ -49,53 +43,6 @@ foreach ($all_fields as $fn) { } if ($event) { - /*$title = $event->title; - $brief_description = $event->description; - $venue = $event->venue; - // this is a form redisplay, so take the values as submitted - $start_date = $event->start_date; - $end_date = $event->end_date; - - if ($event_calendar_region_display) { - $region = $event->region; - if (!$region) { - $region = '-'; - } - } - - if ($event_calendar_spots_display) { - $spots = trim($event->spots); - } - if ($event_calendar_type_display) { - $event_type = $event->event_type; - if (!$event_type) { - $event_type = '-'; - } - } - $fees = $event->fees; - $contact = $event->contact; - $organiser = $event->organiser; - if ($event->tags) { - $event_tags = $event->tags; - } else { - // old way - $event_tags = $event->event_tags; - } - $reminder_number = $event->reminder_number; - $reminder_interval = $event->reminder_interval; - - $long_description = $event->long_description; - $access = $event->access_id; - if ($event_calendar_times != 'no') { - $start_time = $event->start_time; - $end_time = $event->end_time; - } - if ($event_calendar_personal_manage == 'by_event') { - $personal_manage = $event->personal_manage; - if (!$personal_manage) { - $personal_manage = 'open'; - } - }*/ $event_action = 'manage_event'; $event_guid = $event->guid; } else { @@ -106,8 +53,7 @@ if ($event) { $title = $fd['title']; $brief_description = $fd['description']; $venue = $fd['venue']; -$start_date = $fd['start_date']; -$end_date = $fd['end_date']; + $fees = $fd['fees']; if ($event_calendar_spots_display) { $spots = $fd['spots']; @@ -122,19 +68,16 @@ $contact = $fd['contact']; $organiser = $fd['organiser']; $event_tags = $fd['tags']; $all_day = $fd['all_day']; -$send_reminder = $fd['send_reminder']; -$reminder_number = $fd['reminder_number']; -$reminder_interval = $fd['reminder_interval']; $schedule_type = $fd['schedule_type']; $long_description = $fd['long_description']; -$access = $fd['access_id']; -if ($event_calendar_times != 'no') { + +/*if ($event_calendar_times != 'no') { $start_time = $fd['start_time']; $end_time = $fd['end_time']; } if ($event_calendar_personal_manage == 'by_event') { $personal_manage = $fd['personal_manage']; -} +}*/ $body = '<div class="event-calendar-edit-form">'; @@ -187,15 +130,11 @@ $body .= '</div>'; $body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-schedule-block">'; $body .= '<h2>'.elgg_echo('event_calendar:schedule:header').'</h2>'; -if ($all_day) { - $body .= elgg_view('input/checkbox',array('name'=>'all_day','value'=>1,'checked'=>'checked')); -} else { - $body .= elgg_view('input/checkbox',array('name'=>'all_day','value'=>1)); -} -$body .= elgg_echo('event_calendar:all_day_label'); -if(elgg_plugin_exists('event_poll')) { - $body .= elgg_view('input/radio',array('name'=>'schedule_type','value'=>$schedule_type,'options'=>$schedule_options)); -} +$body .= elgg_view('input/radio',array('id'=>'event-calendar-edit-schedule-type','name'=>'schedule_type','value'=>$schedule_type,'options'=>$schedule_options)); + +$vars['prefix'] = $prefix; + +/* $body .= '<div class="event-calendar-edit-date-wrapper">'; $body .= elgg_view('event_calendar/datetime_edit', array( @@ -230,7 +169,9 @@ if ($event_calendar_reminders == 'yes') { $body .= elgg_view('input/dropdown',array('name'=>'reminder_interval','options_values'=>$intervals,'value'=>$reminder_interval)); $body .= elgg_echo('elgg_calendar:send_reminder_before'); $body .= '</div>'; -} +}*/ + +$body .= elgg_view('event_calendar/schedule_section',$vars); if ($event_calendar_spots_display == 'yes') { $body .= '<p><label>'.elgg_echo("event_calendar:spots_label").'<br />'; @@ -238,7 +179,8 @@ if ($event_calendar_spots_display == 'yes') { $body .= '</label></p>'; $body .= '<p class="event-calendar-description">'.$prefix['spots'].elgg_echo('event_calendar:spots_description').'</p>'; } -$body .= '</div>'; + +$body .= '<div class="event-calendar-edit-bottom"></div>'; $body .= '</div>'; // the following feature has been superceded by the manage subscribers feature @@ -250,23 +192,27 @@ $body .= '</div>'; $body .= '<p class="description">'.elgg_echo('event_calendar:add_user_description').'</p>'; }*/ -if ($event_calendar_personal_manage == 'by_event') { +$body .= elgg_view('event_calendar/personal_manage_section',$vars); + +/*if ($event_calendar_personal_manage == 'by_event') { $body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-membership-block">'; $body .= '<h2>'.elgg_echo('event_calendar:personal_manage:label').'</h2>'; $body .= elgg_view("input/radio",array('name' => 'personal_manage','value'=>$personal_manage,'options'=>$personal_manage_options)); //$body .= '<p class="event-calendar-description">'.$prefix['personal_manage'].elgg_echo('event_calendar:personal_manage:description').'</p>'; $body .= '<br clear="both" />'; $body .= '</div>'; -} +}*/ -$body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-share-block">'; +$body .= elgg_view('event_calendar/share_section',$vars); + +/*$body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-share-block">'; $body .= '<h2>'.elgg_echo('event_calendar:permissions:header').'</h2>'; if($event_calendar_hide_access == 'yes') { $event_calendar_default_access = elgg_get_plugin_setting('default_access', 'event_calendar'); if($event_calendar_default_access) { $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>$event_calendar_default_access)); } else { - $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>ACCESS_PRIVATE)); + $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>ACCESS_DEFAULT)); } } else { $body .= '<p><label>'.elgg_echo('event_calendar:read_access').'</label>'; @@ -279,7 +225,7 @@ if (elgg_plugin_exists('entity_admins')) { $body .= elgg_echo('event_calendar:share_ownership:description'); $body .= elgg_view('input/entity_admins_dropdown',array('entity'=>$event)); } -$body .= '</div>'; +$body .= '</div>';*/ if ($event_calendar_region_display == 'yes' || $event_calendar_type_display == 'yes' || $event_calendar_fewer_fields != 'yes') { $body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-other-block">'; diff --git a/views/default/input/datepicker_inline.php b/views/default/input/datepicker_inline.php index 1d0a0689d..3fd9c37af 100644 --- a/views/default/input/datepicker_inline.php +++ b/views/default/input/datepicker_inline.php @@ -65,7 +65,6 @@ $("#<?php echo $vars['name']; ?>").datepicker({ document.location.href = "<?php echo $link_bit; ?>".replace('%s', date.substring(0,10)); }, dateFormat: "yy-mm-dd", - <?php echo $vars['range_bit']; ?> defaultDate: "<?php echo $vars['start_date'] .' - '.$vars['end_date']; ?>", beforeShowDay: highlightWeek }); @@ -76,7 +75,7 @@ if ("<?php echo $vars['mode'] ?>" == "month") { end_date += 1; } $("#<?php echo $vars['name']; ?>").datepicker("setDate", start_date, end_date); -var done_loading = true; +done_loading = true; }); </script> diff --git a/views/default/input/timepicker.php b/views/default/input/timepicker.php index ccbb88778..2cc95ced7 100644 --- a/views/default/input/timepicker.php +++ b/views/default/input/timepicker.php @@ -1,5 +1,4 @@ <?php -$event_calendar_restricted_times = elgg_get_plugin_setting('restricted_times', 'event_calendar'); $time_format = elgg_get_plugin_setting('timeformat', 'event_calendar'); if (!$time_format) { $time_format = '24'; @@ -9,75 +8,44 @@ $value = $vars['value']; if (is_numeric($value)) { $hour = floor($value/60); $minute = ($value -60*$hour); - $time = $hour*60+$minute; } else { - $time = '-'; + $hour = 0; + $minute = 0; } -$dates = array(); -$dates['-'] = '-'; +$hours = array(); +$minutes = array(); if ($time_format == '12') { - if ($event_calendar_restricted_times == 'yes') { - $h1 = 6; - $h2 = 9; + $meridians = array('am'=>'am','pm'=>'pm'); + if ($hour == 0) { + $hour = 12; + $meridian = 'am'; + } else if ($hour == 12) { + $meridian = 'pm'; + } else if ($hour < 12) { + $meridian = 'am'; } else { - $h1 = 0; - $h2 = 11; + $hour -= 12; + $meridian = 'pm'; } - for($h=$h1;$h<=12;$h++) { - $ht = sprintf("%02d",$h); - for($m=0;$m<60;$m=$m+15) { - $mt = sprintf("%02d",$m); - $t = $h*60+$m; - if ($h < 12) { - $dates[$t] = "$ht:$mt am"; - } else { - $dates[$t] = "$ht:$mt pm"; - } - } - } - for($h=1;$h<$h2;$h++) { - $ht = sprintf("%02d",$h); - for($m=0;$m<60;$m=$m+15) { - $mt = sprintf("%02d",$m); - $t = 12*60+$h*60+$m; - $dates[$t] = "$ht:$mt pm"; - } - } - if ($event_calendar_restricted_times == 'yes') { - $m = 0; - $h = 9; - $ht = sprintf("%02d",$h); - $mt = sprintf("%02d",$m); - $t = 12*60+$h*60+$m; - $dates[$t] = "$ht:$mt pm"; + for($h=1;$h<=12;$h++) { + $hours[$h] = $h; } } else { - if ($event_calendar_restricted_times == 'yes') { - $h1 = 6; - $h2 = 21; - } else { - $h1 = 0; - $h2 = 24; - } - for($h=$h1;$h<$h2;$h++) { - $ht = sprintf("%02d",$h); - for($m=0;$m<60;$m=$m+15) { - $mt = sprintf("%02d",$m); - $t = $h*60+$m; - $dates[$t] = "$ht:$mt"; - } - } - if ($event_calendar_restricted_times == 'yes') { - $m = 0; - $h = 21; - $ht = sprintf("%02d",$h); - $mt = sprintf("%02d",$m); - $t = 12*60+$h*60+$m; - $dates[$t] = "$ht:$mt pm"; + for($h=0;$h<=23;$h++) { + $hours[$h] = $h; } -} +} -echo elgg_view('input/dropdown',array('name'=>$vars['name'],'value'=>$time,'options_values'=>$dates)); +for($m=0;$m<60;$m=$m+5) { + $mt = sprintf("%02d",$m); + $minutes[$m] = $mt; +} +echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_hour','value'=>$hour,'options_values'=>$hours)); +echo " <b>:</b> "; +echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_minute','value'=>$minute,'options_values'=>$minutes)); +if ($time_format == '12') { + echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_meridian','value'=>$meridian,'options_values'=>$meridians)); +} diff --git a/views/default/js/event_calendar/event_calendar.php b/views/default/js/event_calendar/event_calendar.php index b3ca2cc7b..244846f96 100644 --- a/views/default/js/event_calendar/event_calendar.php +++ b/views/default/js/event_calendar/event_calendar.php @@ -10,6 +10,8 @@ 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); + elgg.event_calendar.handleScheduleType(); var all_day_field = $('[name="all_day"][type="checkbox"]'); if (all_day_field.is(':checked')) { @@ -21,6 +23,28 @@ elgg.event_calendar.init = function () { all_day_field.change(elgg.event_calendar.handleAllDayField); } +elgg.event_calendar.handleScheduleType = function(e) { + var st = $('#event-calendar-edit-schedule-type:checked').val(); + if (st == 'poll') { + $(".event-calendar-edit-date-wrapper").hide(); + $(".event-calendar-edit-reminder-wrapper").hide(); + $(".event-calendar-edit-form-membership-block").hide(); + $(".event-calendar-edit-form-share-block").hide(); + } else { + $(".event-calendar-edit-date-wrapper").show(); + $(".event-calendar-edit-reminder-wrapper").show(); + $(".event-calendar-edit-form-membership-block").show(); + $(".event-calendar-edit-form-share-block").show(); + if (st == 'all_day') { + $("[name='start_time']").hide(); + $("#event-calendar-to-time-wrapper").hide(); + } else { + $("[name='start_time']").show(); + $("#event-calendar-to-time-wrapper").show(); + } + } +} + elgg.event_calendar.handleAllDayField = function(e) { var field = $('[name="start_time"]'); if (field.attr('disabled') == 'disabled') { |