ben
committed
on 16 Apr 02
added URL callback
openacs-4/.../www/calendar-portlet.tcl (+11 -11)
31 31
32 32 if {[llength $list_of_calendar_ids] > 1} {
33 33     set force_calendar_id [calendar_have_private_p -return_id 1 [ad_conn user_id]]
34 34 } else {
35 35     set force_calendar_id [lindex $list_of_calendar_ids 0]
36 36 }
37 37
38 38 # permissions
39 39 set create_p [ad_permission_p $force_calendar_id cal_item_create]
40 40 set edit_p [ad_permission_p $force_calendar_id cal_item_edit]
41 41 set admin_p [ad_permission_p $force_calendar_id calendar_admin]
42 42
43 43 # set up some vars
44 44 set date [ns_queryget date]
45 45 if {[empty_string_p $date]} {
46 46     set date [dt_sysdate]
47 47 }
48 48 set current_date $date
49 49 set date_format "YYYY-MM-DD HH24:MI"
50 50
51   if {$create_p} {
52       set item_template "<a href=calendar/?show_cal_nav=0&return_url=[ns_urlencode "../"]&action=edit&cal_item_id=\$item_id>\$item</a>"
53   } else {
54       set item_template "\$item"
55   }
  51 set item_template "<a href=\${url_stub}cal-item-view?show_cal_nav=0&return_url=[ns_urlencode "../"]&action=edit&cal_item_id=\$item_id>\$item</a>"
56 52
57 53 if {$create_p} {
58 54     set hour_template "<a href=calendar/?show_cal_nav=0&date=$current_date&force_calendar_id=$force_calendar_id&action=add&return_url=[ns_urlencode "../"]&start_time=\$start_time&end_time=\$end_time>\$hour</a>"
59 55     set item_add_template "<a href=calendar/?return_url=../&show_cal_nav=0&action=add&force_calendar_id=$force_calendar_id&start_time=&end_time=&julian_date=\$julian_date>ADD</a>"
60 56 } else {
61 57     set hour_template "\$hour"
62 58     set item_add_template ""
63 59 }
64 60
65 61 # big switch on the view var
66 62 if { $view == "day" } {
67 63    
68 64     set cal_stuff [calendar::one_day_display \
69 65             -item_template $item_template \
70 66             -hour_template $hour_template \
71 67             -date $current_date -start_hour 7 -end_hour 22 \
72               -calendar_id_list $list_of_calendar_ids]
  68             -calendar_id_list $list_of_calendar_ids \
  69             -url_stub_callback "calendar_portlet_display::get_url_stub"]
73 70    
74 71 }
75 72
76 73 if {$view == "week"} {
77 74     set cal_stuff [calendar::one_week_display \
78 75             -item_template $item_template \
79 76             -date $current_date \
80               -calendar_id_list $list_of_calendar_ids]
  77             -calendar_id_list $list_of_calendar_ids \
  78             -url_stub_callback "calendar_portlet_display::get_url_stub"]
81 79 }
82 80
83 81 if {$view == "month"} {
84 82     set cal_stuff [calendar::one_month_display \
85 83             -item_template $item_template \
86 84             -day_template "<a href=?julian_date=\$julian_date>\$day_number</a>" \
87 85             -date $current_date \
88 86             -item_add_template $item_add_template \
89               -calendar_id_list $list_of_calendar_ids]
  87             -calendar_id_list $list_of_calendar_ids \
  88             -url_stub_callback "calendar_portlet_display::get_url_stub"]
90 89 }
91 90
92 91 if {$view == "list"} {
93 92     set cal_stuff [calendar::list_display \
94               -item_template {<a href=calendar/?show_cal_nav=0&return_url=../&action=edit&cal_item_id=$item_id>$item</a>} \
  93             -item_template $item_template \
95 94             -date $current_date \
96               -calendar_id_list $list_of_calendar_ids]
  95             -calendar_id_list $list_of_calendar_ids \
  96             -url_stub_callback "calendar_portlet_display::get_url_stub"]
97 97 }
98 98
99 99
100 100 ad_return_template