<% require "SimpleDateFormat.pm"; $screenTitle="Schedule Event"; $config = $main::Config; unless ($event) { $event_id = $main::in{'EVENT_id'}; $db_events = new DBFile($main::events_db); $event = $db_events->getRecord( {'event_id'=>$event_id} ); } $db_schedule = new DBFile($main::schedule_db); $schedule = $db_schedule->getRecord( {'event_id'=>$event->{'id'}} ); if ($schedule) { if ($schedule->{'recurring_schedule'} ne "") { my ($s,$e,$type,$mm,$dd,$wday,$which) = split(/\|/,$schedule->{'recurring_schedule'}); $_recurring_start_date = &SimpleDateFormat::formatDate($s,$Config->get("date_format")); $_recurring_end_date = &SimpleDateFormat::formatDate($e,$Config->get("date_format")); $schedule->{'date'} = $dd; $schedule->{'month'} = $mm; $schedule->{'which'} = $which; $schedule->{'wday'} = $wday; $schedule->{'bounded'} = 1; } else { $schedule->{'wday'} = $schedule->{'day'}; } } if (!$schedule) { $schedule = {}; $_bounded="CHECKED"; } else { if ($schedule->{'recurrence_type'} ne "") { if ($schedule->{'bounded'}) { $_bounded="CHECKED"; } if ($schedule->{'recurrence_type'} eq "weekly") { $_recurrence_type_weekly="CHECKED"; foreach (split(',',$schedule->{'wday'})) { $tmp = "_recurring_weekly_".$_; ${$tmp}="CHECKED"; } } elsif ($schedule->{'recurrence_type'} eq "monthly") { $_recurrence_type_monthly="CHECKED"; if ($schedule->{'which'} eq "") { $_recurrence_monthly_absolute="CHECKED"; $_recurring_monthly_date=$schedule->{'date'}; } else { $_recurrence_monthly_relative="CHECKED"; $_recurring_monthly_occurrence=$schedule->{'which'}; $_recurring_monthly_day=$schedule->{'wday'}; } } elsif ($schedule->{'recurrence_type'} eq "yearly") { $_recurrence_type_yearly="CHECKED"; if ($schedule->{'which'} eq "") { $_recurrence_yearly_absolute="CHECKED"; $_recurring_yearly_every_month=$schedule->{'month'}; $_recurring_yearly_date=$schedule->{'date'}; } else { $_recurrence_yearly_relative="CHECKED"; $_recurring_yearly_occurrence=$schedule->{'which'}; $_recurring_yearly_day=$schedule->{'wday'}; $_recurring_yearly_month=$schedule->{'month'}; } } if ($schedule->{'static_start_date'} ne "") { if ($schedule->{'static_start_date'} =~ /,/) { $_static_multiple = "CHECKED"; } else { $_static_single = "CHECKED"; } } if ($schedule->{'all_day'}) { $_all_day = "CHECKED"; $schedule->{'start_time'} = ""; $schedule->{'end_time'} = ""; } } } $time_format = $config->get("time_format"); $week_start_day = $config->get("week_start_day"); if ($main::in{'SCHEDULE_type'} eq "static") { # Coming from Non-Recurring screen $_start_hh = $main::in{'SCHEDULE_start_time_hh'}; $_start_mm = $main::in{'SCHEDULE_start_time_mm'}; if($main::in{'SCHEDULE_start_time_ampm'} eq "am") { $_start_am="SELECTED"; } if($main::in{'SCHEDULE_start_time_ampm'} eq "pm") { $_start_pm="SELECTED"; } $_end_hh = $main::in{'SCHEDULE_end_time_hh'}; $_end_mm = $main::in{'SCHEDULE_end_time_mm'}; if($main::in{'SCHEDULE_end_time_ampm'} eq "am") { $_end_am="SELECTED"; } if($main::in{'SCHEDULE_end_time_ampm'} eq "pm") { $_end_pm="SELECTED"; } if ($main::in{'SCHEDULE_all_day'}) { $_all_day="CHECKED"; } } else { # Coming from Add/Edit screen ($_start_hh,$_start_mm) = ($schedule->{'start_time'} =~ /(\d\d)(\d\d)/); ($_end_hh,$_end_mm) = ($schedule->{'end_time'} =~ /(\d\d)(\d\d)/); if ($time_format eq "12") { if ($_start_hh eq "00") { $_start_hh = "12"; $_start_am="SELECTED"; } elsif ($_start_hh > 12) { $_start_hh -= 12; $_start_pm="SELECTED"; } elsif ($_start_hh == 12) { $_start_pm="SELECTED"; } else { $_start_am="SELECTED"; } if ($_end_hh eq "00") { $_end_hh = "12"; $_start_am="SELECTED"; } elsif ($_end_hh > 12) { $_end_hh -= 12; $_end_pm="SELECTED"; } elsif ($_end_hh == 12) { $_end_pm="SELECTED"; } else { $_end_am="SELECTED"; } } } $monthnames = $config->get("month_names"); $monthnamearray = join("," , map {"'".$_."'"} @$monthnames); $daynames = $config->get("day_names"); $dayabbreviations = $config->get("day_abbreviations"); %> Calendar Administration : <%= $screenTitle %> ">
">
Event: <%= $event->{'title'} %> (ID: <%= $event->{'id'} %>)

Start Time: : <% if ($Config->get("time_format") eq "12") { %><% } else { %>(24-Hr)<% } %>
End Time: : <% if ($Config->get("time_format") eq "12") { %><% } else { %>(24-Hr)<% } %>
All Day: onClick=";clickAllDay(this);" VALUE="1"> (No Time)
 Date Format: <%= $config->get("date_format")%>
NAME="SCHEDULE_recurring_bounds" VALUE="1"> Repeat only between these dates
(Recommended for faster performance)
  Start:   End By:   (Inclusive)
VALUE="weekly" onClick="set_options('weekly','')"> Weekly
  Days: VALUE="0" onClick="set_options('weekly','')"><%=$dayabbreviations->[0]%> VALUE="1" onClick="set_options('weekly','')"><%=$dayabbreviations->[1]%> VALUE="2" onClick="set_options('weekly','')"><%=$dayabbreviations->[2]%> VALUE="3" onClick="set_options('weekly','')"><%=$dayabbreviations->[3]%> VALUE="4" onClick="set_options('weekly','')"><%=$dayabbreviations->[4]%> VALUE="5" onClick="set_options('weekly','')"><%=$dayabbreviations->[5]%> VALUE="6" onClick="set_options('weekly','')"><%=$dayabbreviations->[6]%>
VALUE="monthly" onClick="set_options('monthly','')"> Monthly
  VALUE="absolute" onClick="set_options('monthly','absolute')"> Day of the month
  VALUE="relative" onClick="set_options('monthly','relative')"> The of the month
VALUE="yearly" onClick="set_options('yearly','')"> Yearly
  VALUE="absolute" onClick="set_options('yearly','absolute')"> Every
  VALUE="relative" onClick="set_options('yearly','relative')"> The of
  - OR -