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.10 -r1.11 --- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.adp 24 May 2002 21:04:46 -0000 1.10 +++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.adp 3 Jun 2002 06:30:58 -0000 1.11 @@ -25,7 +25,7 @@ @cal_nav@

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.19 -r1.20 --- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 15 May 2002 23:27:31 -0000 1.19 +++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 3 Jun 2002 06:30:58 -0000 1.20 @@ -77,8 +77,8 @@ } if {$create_p} { - set hour_template "\$hour" - set item_add_template "ADD" + set hour_template "\$hour" + set item_add_template "ADD" } else { set hour_template "\$hour" set item_add_template "" @@ -99,7 +99,7 @@ if {$view == "week"} { set cal_stuff [calendar::one_week_display \ -item_template $item_template \ - -day_template "\$day - \$pretty_date     (Add Item)" \ + -day_template "\$day - \$pretty_date     (Add Item)" \ -date $current_date \ -calendar_id_list $list_of_calendar_ids \ -url_stub_callback "calendar_portlet_display::get_url_stub" \ 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.15 -r1.16 --- openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 10 May 2002 20:21:58 -0000 1.15 +++ openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 3 Jun 2002 06:30:58 -0000 1.16 @@ -58,8 +58,8 @@ set item_template "\$item" if {$create_p} { - set hour_template "\$hour" - set item_add_template "ADD" + set hour_template "\$hour" + set item_add_template "ADD" } else { set hour_template "\$hour" set item_add_template "" Index: openacs-4/packages/dotlrn-calendar/dotlrn-calendar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-calendar/dotlrn-calendar.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn-calendar/dotlrn-calendar.info 31 May 2002 13:04:51 -0000 1.5 +++ openacs-4/packages/dotlrn-calendar/dotlrn-calendar.info 3 Jun 2002 06:30:49 -0000 1.6 @@ -26,6 +26,7 @@ + Index: openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl,v diff -u -r1.57 -r1.58 --- openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 29 May 2002 23:00:25 -0000 1.57 +++ openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 3 Jun 2002 06:30:49 -0000 1.58 @@ -59,10 +59,17 @@ # FIXME: won't work with multiple dotlrn instances # Use the package_key for the -url param - "/" are not allowed! if {![dotlrn::is_package_mounted -package_key [package_key]]} { - dotlrn::mount_package \ + set package_id [dotlrn::mount_package \ -package_key [package_key] \ -url [package_key] \ - -directory_p "t" + -directory_p "t"] + + # We have to store this package_id! + # This is the package_id for the calendar instantiation of dotLRN + parameter::set_from_package_key \ + -package_key [my_package_key] \ + -parameter main_calendar_package_id \ + -value $package_id } dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] @@ -77,29 +84,36 @@ ad_proc -public calendar_create_helper { {-community_id:required} + {-package_id:required} } { A helper proc to create a calendar for a comm, returns the new calendar_id } { # create the community's calendar, the "f" is for a public calendar set community_name [dotlrn_community::get_community_name $community_id] - return [calendar_create [ad_conn "user_id"] "f" $community_name] + # return [calendar_create [ad_conn "user_id"] "f" $community_name] + + # New calendar proc + return [calendar::new \ + -owner_id [ad_conn user_id] \ + -private_p "f" \ + -calendar_name $community_name \ + -package_id $package_id] } ad_proc -public add_applet_to_community { community_id } { Add the calendar applet to a specific dotlrn community } { - set calendar_id [calendar_create_helper -community_id $community_id] - return [add_applet_to_community_helper \ - -community_id $community_id \ - -calendar_id $calendar_id - ] + set results [add_applet_to_community_helper \ + -community_id $community_id + ] + + return [lindex $results 0] } ad_proc -public add_applet_to_community_helper { {-community_id:required} - {-calendar_id:required} } { Add the calendar applet to a specific dotlrn community @@ -119,6 +133,9 @@ -url [package_key] \ -directory_p "t"] + # Here we create the calendar + set calendar_id [calendar_create_helper -community_id $community_id -package_id $package_id] + # Here we have both the calendar ID and the node ID # We associate content using portal mapping (ben) # This SHOULD NOT work, but it does cause we're @@ -223,7 +240,14 @@ set calendar_id [calendar_have_private_p -return_id 1 $user_id] if {$calendar_id == 0} { - set calendar_id [calendar_create $user_id "t" "Personal"] + # HERE we need to find the package ID for the calendar instance at the top level + # How we do this is a tad tricky + # set calendar_id [calendar_create $user_id "t" "Personal"] + set calendar_id [calendar::new \ + -owner_id $user_id \ + -private_p "t" \ + -calendar_name "Personal" \ + -package_id [parameter::get_from_package_key -package_key [my_package_key] -parameter main_calendar_package_id]] # Here we map the calendar to the main dotlrn package set node_id [site_nodes::get_node_id_from_child_name \ @@ -367,14 +391,13 @@ -community_id $old_community_id ] - set calendar_id [calendar_create_helper -community_id $new_community_id] + set results [add_applet_to_community_helper \ + -community_id $new_community_id + ] - db_dml copy_cal_item_types {} + set calendar_id [lindex $results 1] - return [add_applet_to_community_helper \ - -community_id $new_community_id \ - -calendar_id $calendar_id - ] + db_dml copy_cal_item_types {} } #