Index: openacs-4/packages/calendar-portlet/www/calendar-full-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-full-portlet.adp,v diff -u -r1.15 -r1.16 --- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.adp 24 Jun 2003 00:23:10 -0000 1.15 +++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.adp 12 Aug 2003 23:41:47 -0000 1.16 @@ -19,19 +19,56 @@ %> - + +
+ - + + -
- @cal_nav;noquote@ -

-

+
+ + +

+ #calendar.Add_Item##calendar.Add_Item# +

+ + +

+ + + + + + + + + + + + + + + + + + - @cal_stuff;noquote@ -
Index: openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 29 May 2003 18:05:21 -0000 1.24 +++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 12 Aug 2003 23:41:47 -0000 1.25 @@ -37,197 +37,22 @@ } } - # get stuff out of the config array array set config $cf if {[empty_string_p $view]} { set view $config(default_view) } set list_of_calendar_ids $config(calendar_id) +set base_url [calendar_portlet_display::get_url_stub $list_of_calendar_ids] + set scoped_p $config(scoped_p) if {$scoped_p == "t"} { set show_calendar_name_p 1 } else { set show_calendar_name_p 0 } -if {[llength $list_of_calendar_ids] > 1} { - set force_calendar_id [calendar_have_private_p -return_id 1 -calendar_id_list $list_of_calendar_ids [ad_conn user_id]] -} else { - set force_calendar_id [lindex $list_of_calendar_ids 0] -} +set calendar_list [calendar::calendar_list] -# permissions -set create_p [ad_permission_p $force_calendar_id cal_item_create] -set edit_p [ad_permission_p $force_calendar_id cal_item_edit] -set admin_p [ad_permission_p $force_calendar_id calendar_admin] - -# set up some vars -if {[empty_string_p $date]} { - if {[empty_string_p $julian_date]} { - set date [dt_sysdate] - } else { - set date [db_string select_from_julian "select to_date(:julian_date ,'J') from dual"] - } -} - -set current_date $date -set date_format "YYYY-MM-DD HH24:MI" -set return_url "[ns_conn url]?[ns_conn query]" -set encoded_return_url [ns_urlencode $return_url] - -set cal_nav [dt_widget_calendar_navigation "" $view $date "page_num=$page_num"] - -set item_template "\$item" - - -if {$create_p} { - set hour_template "\$hour" - set item_add_template "+" -} else { - set hour_template "\$hour" - set item_add_template "" -} - -if {$view == "day"} { - - # Check that the previous and next days are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set yest [clock format [clock scan "1 day ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $yest}]} { - set previous_link "" - } else { - set previous_link "\"back" - } - } - - if {[catch {set tomor [clock format [clock scan "1 day" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $tomor}]} { - set next_link "" - } else { - set next_link "\"forward" - } - } - - - set cal_stuff [calendar::one_day_display \ - -prev_nav_template $previous_link \ - -next_nav_template $next_link \ - -item_template $item_template \ - -hour_template $hour_template \ - -date $current_date -start_hour 7 -end_hour 22 \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -show_calendar_name_p $show_calendar_name_p] -} - -if {$view == "week"} { - - # Check that the previous and next weeks are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set last_w [clock format [clock scan "1 week ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $last_w}]} { - set previous_link "" - } else { - set previous_link "\"back" - } - } - - if {[catch {set next_w [clock format [clock scan "1 week" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $next_w}]} { - set next_link "" - } else { - set next_link "\"forward" - } - } - - set cal_stuff [calendar::one_week_display \ - -item_template $item_template \ - -day_template "\"Add\$day - \$pretty_date" \ - -date $current_date \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -prev_week_template "\"back" \ - -next_week_template "\"forward" \ - -show_calendar_name_p $show_calendar_name_p - ] -} - -if {$view == "month"} { - - # Check that the previous and next months are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set prev_m [clock format [clock scan "1 month ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $prev_m}]} { - set previous_link "" - } else { - set previous_link "\"back" - } - } - - if {[catch {set next_m [clock format [clock scan "1 month" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $next_m}]} { - set next_link "" - } else { - set next_link "\"forward" - } - } - - - set cal_stuff [calendar::one_month_display \ - -item_template "$item_template" \ - -day_template "\$day_number" \ - -date $current_date \ - -item_add_template "$item_add_template" \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -prev_month_template $previous_link \ - -next_month_template $next_link \ - -show_calendar_name_p $show_calendar_name_p] -} - -if {$view == "list"} { - set sort_by [ns_queryget sort_by] - - set thirty_days [expr 60*60*24*30] - set start_date [ns_fmttime [expr [ns_time] - $thirty_days] "%Y-%m-%d 00:00"] - set end_date [ns_fmttime [expr [ns_time] + $thirty_days] "%Y-%m-%d 00:00"] - - set cal_stuff [calendar::list_display \ - -item_template $item_template \ - -date $current_date \ - -start_date $start_date \ - -end_date $end_date \ - -calendar_id_list $list_of_calendar_ids \ - -sort_by $sort_by \ - -url_template "?view=list&sort_by=\$order_by&page_num=$page_num" \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -show_calendar_name_p $show_calendar_name_p] -} - -if {$view == "year"} { - set cal_stuff "" -} - ad_return_template - - - - - - - - Index: openacs-4/packages/calendar-portlet/www/calendar-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-portlet.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/calendar-portlet/www/calendar-portlet.adp 24 Jun 2003 00:23:10 -0000 1.8 +++ openacs-4/packages/calendar-portlet/www/calendar-portlet.adp 12 Aug 2003 23:41:47 -0000 1.9 @@ -1,26 +1,34 @@ -<% + + + + - # - # Copyright (C) 2001, 2002 MIT - # - # This file is part of dotLRN. - # - # dotLRN is free software; you can redistribute it and/or modify it under the - # terms of the GNU General Public License as published by the Free Software - # Foundation; either version 2 of the License, or (at your option) any later - # version. - # - # dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - # details. - # -%> + + + - -@cal_stuff;noquote@ + + + + + + + + -  +
Index: openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 29 May 2003 18:05:21 -0000 1.20 +++ openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 12 Aug 2003 23:41:47 -0000 1.21 @@ -1,3 +1,4 @@ + # # Copyright (C) 2001, 2002 MIT # @@ -36,8 +37,32 @@ } } } +############### +ad_page_contract { + + Viewing Calendar Information. Currently offers list, day, week, month view. + + @author Dirk Gomez (openacs@dirkgomez.de) + @author Ben Adida (ben@openforce.net) + @creation-date May 29, 2002 + @cvs-id $Id$ +} { + {view day} + {date ""} + {julian_date ""} + {sort_by ""} + {start_date ""} + {period_days:integer "31"} +} -validate { + valid_date -requires { date } { + if {![string equal $date ""]} { + if {[catch {set date [clock format [clock scan $date] -format "%Y-%m-%d"]} err]} { + ad_complain "Your input was not valid. It has to be in the form YYYYMMDD." + } + } + } +} - # get stuff out of the config array array set config $cf set view $config(default_view) @@ -70,133 +95,19 @@ set current_date $date set date_format "YYYY-MM-DD HH24:MI" -set item_template "\$item" +set calendar_list [calendar::calendar_list] +set date [calendar::adjust_date -date $date -julian_date $julian_date] -if {$create_p} { - set hour_template "\$hour" - set item_add_template "ADD" -} else { - set hour_template "\$hour" - set item_add_template "" -} - -# big switch on the view var -if { $view == "day" } { - - # Check that the previous and next days are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set yest [clock format [clock scan "1 day ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $yest}]} { - set previous_link "" - } else { - set previous_link "\"back" - } +if {$view == "list"} { + if {[empty_string_p $start_date]} { + set start_date $date } - if {[catch {set tomor [clock format [clock scan "1 day" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $tomor}]} { - set next_link "" - } else { - set next_link "\"forward" - } - } - - - set cal_stuff [calendar::one_day_display \ - -prev_nav_template $previous_link \ - -next_nav_template $next_link \ - -item_template $item_template \ - -hour_template $hour_template \ - -date $current_date -start_hour 7 -end_hour 22 \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -show_calendar_name_p $show_calendar_name_p] - + 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]] } -if {$view == "week"} { - - # Check that the previous and next weeks are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set last_w [clock format [clock scan "1 week ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $last_w}]} { - set previous_link "" - } else { - set previous_link "\"back" - } - } - - if {[catch {set next_w [clock format [clock scan "1 week" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $next_w}]} { - set next_link "" - } else { - set next_link "\"forward" - } - } - - set cal_stuff [calendar::one_week_display \ - -item_template $item_template \ - -date $current_date \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -prev_week_template $previous_link \ - -next_week_template $next_link \ - -show_calendar_name_p $show_calendar_name_p] -} - -if {$view == "month"} { - - # Check that the previous and next months are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set prev_m [clock format [clock scan "1 month ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $prev_m}]} { - set previous_link "" - } else { - set previous_link "\"back" - } - } - - if {[catch {set next_m [clock format [clock scan "1 month" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $next_m}]} { - set next_link "" - } else { - set next_link "\"forward" - } - } - - - set cal_stuff [calendar::one_month_display \ - -item_template $item_template \ - -day_template "\$day_number" \ - -date $current_date \ - -item_add_template $item_add_template \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -show_calendar_name_p $show_calendar_name_p] -} - -if {$view == "list"} { - set cal_stuff [calendar::list_display \ - -item_template $item_template \ - -date $current_date \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -prev_month_template $previous_link \ - -next_month_template $next_link \ - -show_calendar_name_p $show_calendar_name_p] -} - - -ad_return_template +ad_return_template