Index: openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl 16 Apr 2002 05:16:28 -0000 1.25 +++ openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl 9 May 2002 23:59:51 -0000 1.26 @@ -14,19 +14,14 @@ # details. # -# calendar-portlet/tcl/calendar-portlet-procs.tcl - ad_library { + + Procedures to support the (normal, narrow) calendar portlet a.k.a. + "Day Summary". Not to be confused with the "full" calendar portlet. -Procedures to support the calendar portlet + @author arjun@openforce.net + @cvs-id $Id$ -Copyright Openforce, Inc. -Licensed under GNU GPL v2 - -@creation-date Oct 26 2001 -@author arjun@openforce.net -@cvs-id $Id$ - } namespace eval calendar_portlet { @@ -36,170 +31,68 @@ return "calendar-portlet" } - ad_proc -private my_name { + ad_proc -private get_my_name { } { return "calendar_portlet" } ad_proc -public get_pretty_name { } { - return [ad_parameter \ - -package_id [apm_package_id_from_key [my_package_key]] \ - "pretty_name"] + return [ad_parameter "pretty_name" [my_package_key]] } ad_proc -public link { } { - return [get_pretty_name] + return "" } ad_proc -public add_self_to_page { {-page_id ""} portal_id calendar_id } { - Adds a calendar PE to the given page with the community_id. + Adds a (normal) calendar PE to the given page or appends a + calendar_id to the current calendar portlet - @return element_id The new element's id @param portal_id The page to add self to @param calendar_id The new calendar_id to add - @author arjun@openforce.net - @creation-date Sept 2001 + @return element_id The new element's id } { - return [portal::add_element_or_append_id -portal_id $portal_id \ + return [portal::add_element_or_append_id \ + -portal_id $portal_id \ -page_id $page_id \ - -portlet_name [my_name] \ + -portlet_name [get_my_name] \ -pretty_name [get_pretty_name] \ -value_id $calendar_id \ - -force_region 2 \ - -key calendar_id] + -force_region [ad_parameter "force_region" [my_package_key]] \ + -key calendar_id + ] } ad_proc -public remove_self_from_page { portal_id calendar_id } { - Removes a calendar PE from the given page + Removes a calendar PE from the given page or just + the given calendar_id @param portal_id The page to remove self from - @param community_id - @author arjun@openforce.net - @creation-date Sept 2001 + @param calendar_id } { - ## YOWSA (ben) - # calendar portlet should NOT be creating and deleting calendars! - # I've taken out a chunk of code here that was removing calendars. No way! (ben). - - # get rid of this portal element - # This automatically removes all element params - portal::remove_element_or_remove_id -portal_id $portal_id -portlet_name [my_name] -key calendar_id -value_id $calendar_id + portal::remove_element_or_remove_id \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -key calendar_id \ + -value_id $calendar_id } - - ad_proc -public make_self_available { - page_id - } { - Wrapper for the portal:: proc - - @param page_id - @author arjun@openforce.net - @creation-date Nov 2001 - } { - portal::make_datasource_available \ - $page_id [portal::get_datasource_id [my_name]] - } - - ad_proc -public make_self_unavailable { - page_id - } { - Wrapper for the portal:: proc - - @param page_id - @author arjun@openforce.net - @creation-date Nov 2001 - } { - portal::make_datasource_unavailable \ - $page_id [portal::get_datasource_id [my_name]] - } - - ad_proc -public show { cf } { - Display the PE - - @return HTML string - @param cf A config array - @author arjun@openforce.net - @creation-date Sept 2001 } { - # no return call required with the helper proc portal::show_proc_helper \ -package_key [my_package_key] \ -config_list $cf } - ad_proc -public edit { - element_id - } { - Display the PE's edit page - - @return HTML string - @param cf A config array - @author arjun@openforce.net - @creation-date Nov 2001 - } { - - set calendar_id [portal::get_element_param $element_id "calendar_id"] - set current_view [portal::get_element_param $element_id "default_view"] - - switch $current_view { - "day" { - set html "Set default view to:

- - - day - week - month - list - " - } - "week" { - set html "Set default view to:

- - - day - week - month - list - " - } - "month" { - set html "Set default view to:

- - - day - week - month - list - " - - } - "list" { - set html "Set default view to:

- - - day - week - month - list - " - } - - return $html - } - } - - - }