Index: openacs-4/packages/planner/lib/mini-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/mini-calendar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/mini-calendar.adp 17 Dec 2009 00:20:20 -0000 1.1 @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + #calendar.prev_year# + @curr_month@ @curr_day@ @curr_year@ + #calendar.next_year# + + + #calendar.prev_month# + @curr_month@ @curr_day@ @curr_year@ + #calendar.next_month# + +
@months.name@@months.name@
@days_of_week.day_short@
onMouseOut="hideCalendarTasks()" onMouseOver="showCalendarTasks('@days.date@','@base_url@','#planner.activities#')" class="today" onclick="javascript:location.href='@days.url@#calendar';" onkeypress="javascript:acs_KeypressGoto('@days.url@#calendar',event);"> + @days.day_number@ + onMouseOut="hideCalendarTasks()" onMouseOver="showCalendarTasks('@days.date@','@base_url@','#planner.activities#')" class="active" onclick="javascript:location.href='@days.url@#calendar';" onkeypress="javascript:acs_KeypressGoto('@days.url@#calendar',event);"> + @days.day_number@ + + @days.day_number@ +
+ +

+ + #acs-datetime.Today# + + + #acs-datetime.Today# + + #acs-datetime.is# <%=[dt_ansi_to_pretty]%> +

+ + + Index: openacs-4/packages/planner/lib/mini-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/mini-calendar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/mini-calendar.tcl 17 Dec 2009 00:20:20 -0000 1.1 @@ -0,0 +1,264 @@ +# +# +# mini-calendar +# +# @author Marco Rodriguez (mterodsan@galileo.edu) +# @creation-date 2009-08-04 +# @arch-tag: e4b336b2-45c4-46f0-9225-7a349a449d35 +# @cvs-id $Id: mini-calendar.tcl,v 1.1 2009/12/17 00:20:20 byronl Exp $ + +if {![exists_and_not_null base_url]} { + set base_url [ad_conn url] +} + +if {![exists_and_not_null date]} { + set date [dt_sysdate] +} + +ad_form -name go-to-date -method get -has_submit 1 -action "$base_url" -export [lappend list_of_vars page_num] -html {class inline-form} -form { + {date:text,nospell,optional + {label "[_ acs-datetime.Date]"} + {html {size 10}} + } + {btn_ok:text(submit) + {label "[_ calendar.Go_to_date]"} + } + {view:text(hidden) + {label ""} + {value "day"} + } +} -on_submit { } + + +if {[exists_and_not_null page_num]} { + set page_num_formvar [export_form_vars page_num] + set page_num "&page_num=$page_num" +} else { + set page_num_formvar "" + set page_num "" +} + +# Determine whether we need to pass on the period_days variable from the list view +if {[string equal $view list]} { + if {![exists_and_not_null period_days] || [string equal $period_days [parameter::get -parameter ListView_DefaultPeriodDays -default 31]]} { + set url_stub_period_days "" + } else { + set url_stub_period_days "&period_days=${period_days}" + } +} else { + set url_stub_period_days "" +} + +array set message_key_array { + list #acs-datetime.List# + day #acs-datetime.Day# + week #acs-datetime.Week# + month #acs-datetime.Month# +} + +# Create row with existing views +multirow create views name text active_p url +foreach viewname {list day week month} { + if { [string equal $viewname $view] } { + set active_p t + } else { + set active_p f + } + if {[string equal $viewname list]} { + multirow append views [lang::util::localize $message_key_array($viewname)] $viewname $active_p \ + "[export_vars -base $base_url {date {view $viewname}}]${page_num}${url_stub_period_days}" + } else { + multirow append views [lang::util::localize $message_key_array($viewname)] $viewname $active_p \ + "[export_vars -base $base_url {date {view $viewname}}]${page_num}" + } +} + +set list_of_vars [list] + +# Get the current month, day, and the first day of the month +if {[catch { + dt_get_info $date +} errmsg]} { + set date [dt_sysdate] + dt_get_info $date +} + +set now [clock scan $date] + set date_list [dt_ansi_to_list $date] + set year [dt_trim_leading_zeros [lindex $date_list 0]] + set month [dt_trim_leading_zeros [lindex $date_list 1]] + set day [dt_trim_leading_zeros [lindex $date_list 2]] + +set months_list [dt_month_names] +set curr_month_idx [expr [dt_trim_leading_zeros [clock format $now -format "%m"]]-1] +set curr_day [clock format $now -format "%d"] +set curr_month [clock format $now -format "%B"] +set curr_year [clock format $now -format "%Y"] +if [string equal $view month] { + set prev_year [clock format [clock scan "1 year ago" -base $now] -format "%Y-%m-%d"] + set next_year [clock format [clock scan "1 year" -base $now] -format "%Y-%m-%d"] + set prev_year_url "$base_url?view=$view&date=[ad_urlencode $prev_year]${page_num}${url_stub_period_days}" + set next_year_url "$base_url?view=$view&date=[ad_urlencode $next_year]${page_num}${url_stub_period_days}" + + set now [clock scan $date] + + multirow create months name current_month_p new_row_p url + + for {set i 0} {$i < 12} {incr i} { + + set month [lindex $months_list $i] + + # show 3 months in a row + + set new_row_p [expr $i / 3] +# if {($i != 0) && ([expr $i % 3] == 0)} { +# set new_row_p t +# } else { +# set new_row_p f +# } + + if {$i == $curr_month_idx} { + set current_month_p t + } else { + set current_month_p f + } + set target_date [clock format \ + [clock scan "[expr $i-$curr_month_idx] month" -base $now] -format "%Y-%m-%d"] + multirow append months $month $current_month_p $new_row_p \ + "[export_vars -base $base_url {{date $target_date} view}]${page_num}${url_stub_period_days}" + + } +} else { + set prev_month [clock format [clock scan "1 month ago" -base $now] -format "%Y-%m-%d"] + set next_month [clock format [clock scan "1 month" -base $now] -format "%Y-%m-%d"] + set prev_month_url "$base_url?view=$view&date=[ad_urlencode $prev_month]${page_num}${url_stub_period_days}" + set next_month_url "$base_url?view=$view&date=[ad_urlencode $next_month]${page_num}${url_stub_period_days}" + + set first_day_of_week [lc_get firstdayofweek] + set week_days [lc_get abday] + set long_weekdays [lc_get day] + multirow create days_of_week day_short day_num + for {set i 0} {$i < 7} {incr i} { + multirow append days_of_week \ + [lindex $week_days [expr [expr $i + $first_day_of_week] % 7]] \ + $i + } + + multirow create days day_number beginning_of_week_p end_of_week_p today_p active_p url weekday day_num pretty_date date class + + set day_of_week 1 + + set task_list [list] + set additional_limitations_clause "" + set additional_select_clause "" + set order_by_clause " order by name" + set current_date $date + set community_id [dotlrn_community::get_community_id] + set community_url [dotlrn_community::get_community_url $community_id] + set user_id [ad_conn user_id] + set node_id [site_node::get_node_id -url "${community_url}calendar" ] + set package_id [site_node::get_object_id -node_id $node_id] + set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] + set interval_limitation_clause [db_map dbqd.calendar.www.views.month_interval_limitation] + # Get the beginning and end of the month in the system timezone + set first_date_of_month [dt_julian_to_ansi $first_julian_date_of_month] + set last_date_in_month [dt_julian_to_ansi $last_julian_date_in_month] + + set first_date_of_month_system "$first_date_of_month 00:00:00" + set last_date_in_month_system "$last_date_in_month 23:59:59" + db_foreach dbqd.calendar.www.views.select_all_day_items {} { + set date_task [lindex [split $ansi_start_date " "] 0] + lappend task_list $date_task + } + + # Calculate number of active days + set active_days_before_month [expr [expr [dt_first_day_of_month $year $month]] -1 ] + set active_days_before_month [expr [expr $active_days_before_month + 7 - $first_day_of_week] % 7] + + set calendar_starts_with_julian_date [expr $first_julian_date_of_month - $active_days_before_month] + set day_number [expr $days_in_last_month - $active_days_before_month + 1] + + for {set julian_date $calendar_starts_with_julian_date} {$julian_date <= [expr $last_julian_date + 7]} {incr julian_date} { + if {$julian_date > $last_julian_date_in_month && [string equal $end_of_week_p t] } { + break + } + set today_p f + set active_p t + + if {$julian_date < $first_julian_date_of_month} { + set active_p f + } elseif {$julian_date > $last_julian_date_in_month} { + set active_p f + } + set ansi_date [dt_julian_to_ansi $julian_date] + set pretty_date [lc_time_fmt $ansi_date %Q] + + if {$julian_date == $first_julian_date_of_month} { + set day_number 1 + } elseif {$julian_date == [expr $last_julian_date_in_month +1]} { + set day_number 1 + } + + if {$julian_date == $julian_date_today} { + set today_p t + } + + set day_num [expr { $day_of_week - 1 }] + if { $day_of_week == 1} { + set beginning_of_week_p t + } else { + set beginning_of_week_p f + } + + if { $day_of_week == 7 } { + set day_of_week 0 + set end_of_week_p t + } else { + set end_of_week_p f + } + + set weekday [lindex $long_weekdays $day_of_week] + + if {[lsearch $task_list $ansi_date] eq -1 } { + set class "" + } else { + set class "with_news" + } + + multirow append days $day_number $beginning_of_week_p $end_of_week_p $today_p $active_p \ + "[export_vars -base $base_url {{date $ansi_date} view}]${page_num}${url_stub_period_days}" \ + $weekday \ + $day_num \ + $pretty_date $ansi_date $class + + incr day_number + incr day_of_week + } +} + +set today_url "$base_url?view=day&date=[ad_urlencode [dt_sysdate]]${page_num}${url_stub_period_days}" + +if { $view == "day" && [dt_sysdate] == $date } { + set today_p t +} else { + set today_p f +} + + +set form_vars "" +foreach var $list_of_vars { + append form_vars "" +} + +ad_form -name choose_new_date -show_required_p f -has_edit 0 -has_submit 0 -form { + {new_date:date + {label ""} + {format {MM DD YYYY}}} +} + + +template::head::add_link -rel "stylesheet" -type "text/css" -href "/resources/ajaxhelper/yui/container/assets/skins/sam/container.css" +template::head::add_javascript -src "/resources/ajaxhelper/yui/yahoo-dom-event/yahoo-dom-event.js" -order 1 +template::head::add_javascript -src "/resources/ajaxhelper/yui/container/container-min.js" -order 2 +template::head::add_javascript -src "/resources/ajaxhelper/yui/connection/connection-min.js" -order 2 +template::head::add_javascript -src "/resources/planner/calendar-tasks.js" -order 3 \ No newline at end of file Index: openacs-4/packages/planner/lib/navbar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/navbar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/navbar.adp 17 Dec 2009 00:20:20 -0000 1.1 @@ -0,0 +1,82 @@ + +
+
+
+
#planner.activities#
+
minus
+
+
+ +
+
+
+
#planner.calendar#
+
minus
+
+
+
+ +
+
+ + + + +
+
+
#planner.news#
+
minus
+
+
+ +
+
+
+ Index: openacs-4/packages/planner/lib/navbar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/navbar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/navbar.tcl 17 Dec 2009 00:20:20 -0000 1.1 @@ -0,0 +1,56 @@ +# +# +# navigation bar +# +# @author Marco Rodriguez (mterodsan@galileo.edu) +# @creation-date 2009-08-04 +# @arch-tag: e4b336b2-45c4-46f0-9225-7a349a449d35 +# @cvs-id $Id: navbar.tcl,v 1.1 2009/12/17 00:20:20 byronl Exp $ + +foreach required_param {} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {date return_url} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} +if {![exists_and_not_null return_url]} { + set return_url ".." +} +set user_id [ad_conn user_id] +set community_id [dotlrn_community::get_community_id] +set admin_p [dotlrn::user_can_admin_community_p -user_id $user_id -community_id $community_id] +set community_url [dotlrn_community::get_community_url $community_id] +set pages_p [site_node::exists_p -url "${community_url}pages" ] +set assessment_p [site_node::exists_p -url "${community_url}assessment" ] +set evaluation_p [site_node::exists_p -url "${community_url}evaluation" ] +set chat_p [site_node::exists_p -url "${community_url}chat" ] +set learning_content_p [site_node::exists_p -url "${community_url}learning-content" ] +set forums_p [site_node::exists_p -url "${community_url}forums" ] +set faq_p [site_node::exists_p -url "${community_url}faq" ] +set static_portlet_p [site_node::exists_p -url "${community_url}static-portlet" ] +set news_p [site_node::exists_p -url "${community_url}news" ] +set lorsm_p [site_node::exists_p -url "${community_url}lorsm" ] +set sub_pretty_name [_ dotlrn.subcommunities_pretty_name] + +set portal_id [dotlrn_community::get_portal_id -community_id $community_id ] + +set effectAppear [ah::effects -element "content_'+id+'" -effect "BlindDown" -options "duration: 1"] +set effectPuff [ah::effects -element "content_'+id+'" -effect "BlindUp" -options "duration: 1"] + +set script " +function showMenu(id){ +document.getElementById('img_'+id).src='/resources/planner/minus.gif'; +document.getElementById('link_'+id).href='javascript:hideMenu('+id+')'; +${effectAppear} +} +function hideMenu(id){ +document.getElementById('img_'+id).src='/resources/planner/plus.gif'; +document.getElementById('link_'+id).href='javascript:showMenu('+id+')'; +${effectPuff} +} +" +template::head::add_script -type "text/javascript" -script $script Index: openacs-4/packages/planner/lib/news_info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/news_info.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/news_info.adp 17 Dec 2009 00:20:20 -0000 1.1 @@ -0,0 +1,18 @@ + + + +
+

+ @news.publish_title@
+ @news.publish_body@

+
+
+
+ +
+

+ @news.publish_title@
+ @news.publish_body@

+
+
+
\ No newline at end of file Index: openacs-4/packages/planner/lib/news_info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/news_info.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/news_info.tcl 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,32 @@ +# +# +# show news of a community_id +# +# @author Marco Rodriguez (mterodsan@galileo.edu) +# @creation-date 2009-08-04 +# @arch-tag: cda5af75-9c4b-49af-9d70-f624a91f3fcb +# @cvs-id $Id: news_info.tcl,v 1.1 2009/12/17 00:20:21 byronl Exp $ + +foreach required_param {community_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {max} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +set community_url [dotlrn_community::get_community_url $community_id] +set news_p [site_node::exists_p -url "${community_url}news" ] +if { $news_p } { + set news_package_id [site_node::get_object_id -node_id [site_node::get_node_id -url "${community_url}news"]] + db_multirow news news {*SQL*} { + set publish_body [string_truncate -len 60 $publish_body] + } +} + +if {![exists_and_not_null max]} { + set max [multirow size news] +} \ No newline at end of file Index: openacs-4/packages/planner/lib/news_info.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/news_info.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/news_info.xql 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,18 @@ + + + + + + + + + + + + select * + from news_item_full_active + where package_id=:news_package_id + order by item_id desc + + + \ No newline at end of file Index: openacs-4/packages/planner/lib/view-one-day-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/view-one-day-display.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/view-one-day-display.adp 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
@pretty_date@
#calendar.Hours##calendar.Events#
+
+ +

@items.event_name@

+
+
+
+
Index: openacs-4/packages/planner/lib/view-one-day-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/lib/view-one-day-display.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/lib/view-one-day-display.tcl 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,280 @@ +# FIXME from sloanspace calendar, they have added a system_type attribute to +# cal_items table, which can be null, class, community, or personal +# this is used to figure out which CSS class to use, for now we set to +# empty string to use generic cal-Item css class DAVEB 20070121 +set system_type "" + +#Expects: +# date (required but empty string okay): YYYY-MM-DD +# show_calendar_name_p (optional): 0 or 1 +# start_display_hour (optional): 0-23 +# end_display_hour (optional): 0-23 +# url_stub_callback (optional): + +#Display constants, should match up with default styles in calendar.css. +set hour_height_inside 43 +set hour_height_sep 3 +set hour_height_units px +set bump_right_base 0 +set bump_right_delta 155 +set bump_right_units px + +if {[info exists url_stub_callback]} { + # This parameter is only set if this file is called from .LRN. + # This way I make sure that for the time being this adp/tcl + # snippet is backwards-compatible. + set portlet_mode_p 1 +} else { + set portlet_mode_p 0 +} + +set current_date $date +set pretty_date [lc_time_fmt $current_date %Q] + +if {[info exists portlet_mode_p] && $portlet_mode_p} { + set event_url_template "\${url_stub}cal-item-view?show_cal_nav=0&return_url=[ad_urlencode "../"]&action=edit&cal_item_id=\$item_id" + set url_stub_callback "calendar_portlet_display::get_url_stub" + set hour_template "calendar/cal-item-new?date=$current_date&start_time=\$grid_hour" +} else { + set event_url_template "../calendar/cal-item-view?cal_item_id=\$item_id" + set url_stub_callback "" + set hour_template {../calendar/cal-item-new?date=$current_date&start_time=$grid_hour} +} + +if { ![info exists show_calendar_name_p] } { + set show_calendar_name_p 1 +} + +if { ![info exists start_display_hour]} { + set start_display_hour 0 +} + +if { ![info exists end_display_hour]} { + set end_display_hour 23 +} + +if {[exists_and_not_null calendar_id_list]} { + set calendars_clause [db_map dbqd.calendar.www.views.openacs_in_portal_calendar] +} else { + set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] +} + +if {[empty_string_p $date]} { + # Default to todays date in the users (the connection) timezone + set server_now_time [dt_systime] + set user_now_time [lc_time_system_to_conn $server_now_time] + set date [lc_time_fmt $user_now_time "%F"] +} + +if { ![info exists package_id]} { + set package_id [ad_conn package_id] +} +set user_id [ad_conn user_id] + + +multirow create items \ + all_day_p \ + style_class \ + event_name \ + event_url \ + description \ + calendar_name \ + weekday \ + start_date \ + end_date \ + start_time \ + end_time \ + top \ + height \ + style \ + num_attachments + +set previous_intervals [list] + +# Loop through the items without time + +set additional_limitations_clause " and to_char(start_date, 'HH24:MI') = to_char(end_date, 'HH24:MI')" +if { [exists_and_not_null cal_system_type] } { + append additional_limitations_clause " and system_type = :cal_system_type " +} +set additional_select_clause "" +set order_by_clause " order by name" +set interval_limitation_clause [db_map dbqd.calendar.www.views.day_interval_limitation] + +#AG: the "select_all_day_items" query is identical to "select_items" +#just without the Oracle +ORDERED hint, which speeds every other +#query but slows this one. +db_foreach dbqd.calendar.www.views.select_all_day_items {} { + + # Localize + set pretty_weekday [lc_time_fmt $ansi_start_date "%A"] + set pretty_start_date [lc_time_fmt $ansi_start_date "%x"] + set pretty_end_date [lc_time_fmt $ansi_end_date "%x"] + set pretty_start_time [lc_time_fmt $ansi_start_date "%X"] + set pretty_end_time [lc_time_fmt $ansi_end_date "%X"] + + # In case we need to dispatch to a different URL (ben). + # The calculated url_stub is fed back into the event_url_template. + set url_stub "" + if {![empty_string_p $url_stub_callback]} { + # Cache the url stub lookup. + if {![info exists url_stubs($calendar_id)]} { + set url_stubs($calendar_id) [$url_stub_callback $calendar_id] + } + + set url_stub $url_stubs($calendar_id) + } + + #height will be overwritten once we know how the vertical hour span. + multirow append items 1 "calendar-${system_type}Item" \ + $name \ + [subst $event_url_template] \ + $description \ + $calendar_name \ + $pretty_weekday \ + $pretty_start_date \ + $pretty_end_date \ + $pretty_start_time \ + $pretty_end_time \ + 0 \ + 0 \ + "left: ${bump_right_base}${bump_right_units};" \ + $num_attachments + + incr bump_right_base $bump_right_delta +} + +set additional_limitations_clause " and to_char(start_date, 'HH24:MI') <> to_char(end_date, 'HH24:MI')" +if { [exists_and_not_null cal_system_type] } { + append additional_limitations_clause " and system_type = :cal_system_type " +} +set order_by_clause " order by to_char(start_date,'HH24:MI')" +set day_items_per_hour {} + +set adjusted_start_display_hour $start_display_hour +set adjusted_end_display_hour $end_display_hour + +db_foreach dbqd.calendar.www.views.select_items {} { + + + set ansi_start_date [lc_time_system_to_conn $ansi_start_date] + set ansi_end_date [lc_time_system_to_conn $ansi_end_date] + + # Localize + set pretty_weekday [lc_time_fmt $ansi_start_date "%A"] + set pretty_start_date [lc_time_fmt $ansi_start_date "%x"] + set pretty_end_date [lc_time_fmt $ansi_end_date "%x"] + set pretty_start_time [lc_time_fmt $ansi_start_date "%X"] + set pretty_end_time [lc_time_fmt $ansi_end_date "%X"] + + set start_time [lc_time_fmt $ansi_start_date "%X"] + set end_time [lc_time_fmt $ansi_end_date "%X"] + + scan [lc_time_fmt $ansi_start_date "%H"] %d start_hour + scan [lc_time_fmt $ansi_end_date "%H"] %d end_hour + + if { $start_hour < $adjusted_start_display_hour && \ + [string equal \ + [string range $ansi_start_date 0 9] \ + [string range $ansi_end_date 0 9]] } { + set adjusted_start_display_hour $start_hour + } + + if { $end_hour > $adjusted_end_display_hour && \ + [string equal \ + [string range $ansi_start_date 0 9] \ + [string range $ansi_end_date 0 9]] } { + set adjusted_end_display_hour $end_hour + } + + set top [expr ($start_hour * ($hour_height_inside+$hour_height_sep)) \ + + ($start_minutes*$hour_height_inside/60)] + set bottom [expr ($end_hour * ($hour_height_inside+$hour_height_sep)) \ + + ($end_minutes*$hour_height_inside/60)] + set height [expr $bottom - $top - 2] + + set bump_right $bump_right_base + foreach {previous_start previous_end} $previous_intervals { + if { ($start_seconds >= $previous_start && $start_seconds < $previous_end) || ($previous_start >= $start_seconds && $previous_start < $end_seconds) } { + incr bump_right $bump_right_delta + } + } + + # In case we need to dispatch to a different URL (ben). + # The calculated url_stub is fed back into the event_url_template. + set url_stub "" + if {![empty_string_p $url_stub_callback]} { + # Cache the url stub lookup. + if {![info exists url_stubs($calendar_id)]} { + set url_stubs($calendar_id) [$url_stub_callback $calendar_id] + } + + set url_stub $url_stubs($calendar_id) + } + + multirow append items 0 "calendar-${system_type}Item" \ + "$name ($start_time - $end_time)" \ + [subst $event_url_template] \ + $description \ + $calendar_name \ + $pretty_weekday \ + $pretty_start_date \ + $pretty_end_date \ + $pretty_start_time \ + $pretty_end_time \ + $top \ + $height \ + "left: ${bump_right}${bump_right_units};" \ + $num_attachments + + lappend previous_intervals $start_seconds $end_seconds +} + +#Now correct the top attribute for the adjusted start. +if { $adjusted_start_display_hour != 0 } { + set num_items [multirow size items] + for {set i 1} {$i <= $num_items } {incr i} { + if { [multirow get items $i all_day_p] } { + multirow set items $i height \ + [expr ($adjusted_end_display_hour-$adjusted_start_display_hour+1)*($hour_height_inside+$hour_height_sep)] + } else { + set currval [multirow get items $i top] + multirow set items $i top \ + [expr $currval - ($adjusted_start_display_hour*($hour_height_inside+$hour_height_sep))] + } + } +} + +db_1row dbqd.calendar.www.views.select_day_info {} + +if {$portlet_mode_p} { + set previous_week_url "?page_num=$page_num&date=[ns_urlencode $yesterday]" + set next_week_url "?page_num=$page_num&&date=[ns_urlencode $tomorrow]" +} else { + set previous_week_url "view?view=day&date=[ns_urlencode $yesterday]" + set next_week_url "view?view=day&date=[ns_urlencode $tomorrow]" +} +set dates [lc_time_fmt $date "%q"] +set curr_day_name [lc_time_fmt $date "%A"] +set curr_month [lc_time_fmt $date "%B"] +set curr_day [lc_time_fmt $date "%d"] +set curr_year [lc_time_fmt $date "%Y"] + +#Calendar grid. +set grid_start $adjusted_start_display_hour +set grid_first_hour [lc_time_fmt "$current_date $grid_start:00:00" "%X"] +set grid_hour $grid_start +set grid_first_add_url [subst $hour_template] +incr grid_start + +multirow create grid hour add_url +for { set grid_hour $grid_start } { $grid_hour <= $adjusted_end_display_hour } { incr grid_hour } { + set localized_grid_hour [lc_time_fmt "$current_date $grid_hour:00:00" "%X"] + multirow append grid $localized_grid_hour [subst $hour_template] +} + +if { [info exists export] && [string equal $export print] } { + set print_html [template::adp_parse [acs_root_dir]/packages/calendar/www/view-print-display [list &items items show_calendar_name_p $show_calendar_name_p]] + ns_return 200 text/html $print_html + ad_script_abort +} Index: openacs-4/packages/planner/www/calendar-tasks-ajax.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/calendar-tasks-ajax.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/calendar-tasks-ajax.adp 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,12 @@ +
+ + +- @items.event_name@
+
+
+ +#calendar.No_Items# + +
+ + Index: openacs-4/packages/planner/www/calendar-tasks-ajax.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/calendar-tasks-ajax.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/calendar-tasks-ajax.tcl 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,45 @@ +# + +ad_page_contract { + + show calendar task information + + @author Marco Rodriguez (mterodsan@galileo.edu) + @creation-date 2009-08-05 + @arch-tag: 3c92e666-f02d-4dc6-ac74-1299628000c8 + @cvs-id $Id: calendar-tasks-ajax.tcl,v 1.1 2009/12/17 00:20:21 byronl Exp $ +} { + date +} -properties { +} -validate { +} -errors { +} + +set current_date $date +set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] + +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] +set node_id [site_node::get_node_id -url "${community_url}calendar" ] +set package_id [site_node::get_object_id -node_id $node_id] + +set user_id [ad_conn user_id] + +multirow create items \ + event_name \ + description \ + calendar_name + +set additional_limitations_clause "" +set additional_select_clause "" +set order_by_clause " order by name" +set interval_limitation_clause [db_map dbqd.calendar.www.views.day_interval_limitation] + +db_foreach dbqd.calendar.www.views.select_all_day_items {} { + set name [string map {"Due date: " ""} $name] + set name [string_truncate -len 20 $name] + multirow append items \ + $name \ + $description \ + $calendar_name \ +} Index: openacs-4/packages/planner/www/view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/view.adp 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,23 @@ + + @title;noquote@ + + + + + +

+ +
+
+ + + +
\ No newline at end of file Index: openacs-4/packages/planner/www/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/view.tcl 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,71 @@ +# + +ad_page_contract { + + show calendar info + + @author Marco Rodriguez (mterodsan@galileo.edu) + @creation-date 2009-08-03 + @arch-tag: 3028bd87-e24b-435e-abe3-768e06d5c06e + @cvs-id $Id: view.tcl,v 1.1 2009/12/17 00:20:21 byronl Exp $ +} { + view + date + {page_num ""} +} -properties { +} -validate { +} -errors { +} + +set title "Calendario" + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +set ad_conn_url [ad_conn url] + +set export [ns_queryget export] + +if {$export == "print"} { + set view "list" +} + +set return_url [ad_urlencode [ad_return_url]] +set add_item_url [export_vars -base "cal-item-new" {{return_url [ad_return_url]} view date}] +set url_stub_callback "../" + +set admin_p [permission::permission_p -object_id $package_id -privilege calendar_admin] + +set show_calendar_name_p [parameter::get -parameter Show_Calendar_Name_p -default 1] + +set date [calendar::adjust_date -date $date] + +if {$view == "list"} { + if {[empty_string_p $start_date]} { + set start_date $date + } + + set ansi_list [split $start_date "- "] + set ansi_year [lindex $ansi_list 0] + set ansi_month [string trimleft [lindex $ansi_list 1] "0"] + set ansi_day [string trimleft [lindex $ansi_list 2] "0"] + set end_date [dt_julian_to_ansi [expr [dt_ansi_to_julian $ansi_year $ansi_month $ansi_day ] + $period_days]] +} +set calendar_personal_p [calendar::personal_p -calendar_id [lindex [lindex [calendar::calendar_list -package_id $package_id ] 0] 1] ] + +set notification_chunk [notification::display::request_widget \ + -type calendar_notif \ + -object_id $package_id \ + -pretty_name [ad_conn instance_name] \ + -url [ad_conn url] \ + ] + +# Header stuff +template::head::add_css -href "/resources/calendar/calendar.css" -media all +template::head::add_css -alternate -href "/resources/calendar/calendar-hc.css" -title "highContrast" +template::head::add_css -href "/resources/planner/navbar.css" -media all + +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] +set node_id [site_node::get_node_id -url "${community_url}calendar" ] +set calendar_package_id [site_node::get_object_id -node_id $node_id] \ No newline at end of file Index: openacs-4/packages/planner/www/resources/calendar-tasks.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/calendar-tasks.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/calendar-tasks.js 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,44 @@ +var old_date; +var panel; +var title=""; +var tasksArray = new Array(); +function showCalendarTasks(date,url,_title){ + title=_title; + var body=document.getElementsByTagName("body")[0]; + body.className ="yui-skin-sam"; + if(old_date!=date){ + old_date="d"+date; + if(!tasksArray[old_date]){ + var sUrl = url+'/../calendar-tasks-ajax?date='+date; + var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, {success: show_calendar_tasks}); + }else{ + panel.setBody(tasksArray[old_date]); + panel.cfg.setProperty("context",[document.getElementById(old_date),"bl","tr"]); + } + } + if(panel) + panel.show(); +} + +function show_calendar_tasks(res) { + tasksArray[old_date]=res.responseText; + if(!panel){ + panel = new YAHOO.widget.Panel("wait", + { context:[old_date,"bl","tr"], + close:false, + draggable:false, + visible:true + }); + panel.setHeader(title); + panel.setBody(res.responseText); + panel.render(document.body); + }else{ + panel.setHeader(title); + panel.setBody(res.responseText); + panel.cfg.setProperty("context",[document.getElementById(old_date),"bl","tr"]); + } +} + +function hideCalendarTasks(){ + if(panel) panel.hide(); +} Index: openacs-4/packages/planner/www/resources/minus.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/minus.gif,v diff -u Binary files differ Index: openacs-4/packages/planner/www/resources/navbar.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/navbar.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/planner/www/resources/navbar.css 17 Dec 2009 00:20:21 -0000 1.1 @@ -0,0 +1,52 @@ +#bar .header{ + border: thin solid #989898; + padding: 5px; + margin-top: 5px; + text-align: left; +} +#bar .sub_bar{ + padding: 5px; +} +#bar .header .title_bar{ +font-size: 12px; +font-family: Arial, Helvetica, sans-serif; +color:#000000; +font-weight:bold; +float:left; +height:''; +} + +#bar .header .image{ +float:right; +height: 11px; +width: 11px; +margin-top: 0.25em; +} +#bar ul { + list-style-type:disc; +} +#bar .content{ + border-right-width: thin; + border-bottom-width: thin; + border-left-width: thin; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #989898; + border-right-color: #989898; + border-bottom-color: #989898; + border-left-color: #989898; + margin-bottom: 8px; +} + +#bar .news{ + margin: 8px; +} + +#bar .with_news{ + color: #119911; +} + +#bar .bottomnews { + border-bottom: 1px dashed #989898; +} \ No newline at end of file Index: openacs-4/packages/planner/www/resources/plus.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/planner/www/resources/plus.gif,v diff -u Binary files differ