Index: openacs-4/packages/calendar-portlet/sql/oracle/calendar-full-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/sql/oracle/calendar-full-portlet-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar-portlet/sql/oracle/calendar-full-portlet-create.sql 11 Feb 2002 03:48:42 -0000 1.1 @@ -0,0 +1,220 @@ +-- +-- /calendar-portlet/sql/oracle/calendar-full-portlet-create.sql +-- + +-- Creates calendar portlet + +-- Copyright (C) 2001 OpenForce, Inc. +-- @author Arjun Sanyal (arjun@openforce.net) +-- @author Ben Adida (ben@openforce) +-- @creation-date 2002-02-10 + +-- $Id: calendar-full-portlet-create.sql,v 1.1 2002/02/11 03:48:42 ben Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource.new( + name => 'calendar_full_portlet', + description => 'Displays the calendar ' + ); + + + -- the standard 4 params + + -- shadeable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shadeable_p', + value => 't' +); + + + -- hideable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'hideable_p', + value => 't' +); + + -- user_editable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'user_editable_p', + value => 'f' +); + + -- shaded_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shaded_p', + value => 'f' +); + + -- link_hideable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'link_hideable_p', + value => 't' +); + + + -- calendar-specific params + + -- calendar_id must be configured + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 'f', + key => 'calendar_id', + value => '' +); + + + -- default_view see cal-table-create.sql + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'default_view', + value => 'day' +); + + + -- default_view see cal-table-create.sql + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'group_calendar_id', + value => NULL +); + +-- XXX community calendars + +end; +/ +show errors + +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl.new ( + 'portal_datasource', + 'calendar_full_portlet', + 'calendar_full_portlet' + ); + +end; +/ +show errors + +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'MyName', + 'calendar_full_portlet::my_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'GetPrettyName', + 'calendar_full_portlet::get_pretty_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'Link', + 'calendar_full_portlet::link', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'AddSelfToPage', + 'calendar_full_portlet::add_self_to_page', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'Show', + 'calendar_full_portlet::show', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'Edit', + 'calendar_full_portlet::edit', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'RemoveSelfFromPage', + 'calendar_full_portlet::remove_self_from_page', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'MakeSelfAvailable', + 'calendar_full_portlet::make_self_available', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'calendar_full_portlet', + 'MakeSelfUnavailable', + 'calendar_full_portlet::make_self_unavailable', + 'TCL' + ); + +end; +/ +show errors + +declare + foo integer; +begin + + -- Add the binding + acs_sc_binding.new ( + contract_name => 'portal_datasource', + impl_name => 'calendar_full_portlet' + ); +end; +/ +show errors + Index: openacs-4/packages/calendar-portlet/sql/oracle/calendar-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/sql/oracle/calendar-portlet-create.sql,v diff -u -r1.15 -r1.16 --- openacs-4/packages/calendar-portlet/sql/oracle/calendar-portlet-create.sql 23 Jan 2002 05:09:37 -0000 1.15 +++ openacs-4/packages/calendar-portlet/sql/oracle/calendar-portlet-create.sql 11 Feb 2002 03:48:42 -0000 1.16 @@ -247,4 +247,5 @@ insert into hours_of_the_day values (23); +@calendar-full-portlet-create.sql @calendar-admin-portlet-create.sql Index: openacs-4/packages/calendar-portlet/tcl/calendar-full-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/tcl/calendar-full-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar-portlet/tcl/calendar-full-portlet-procs.tcl 11 Feb 2002 03:48:42 -0000 1.1 @@ -0,0 +1,140 @@ +# calendar-portlet/tcl/calendar-portlet-procs.tcl + +ad_library { + +Procedures to support the calendar portlet + +Copyright Openforce, Inc. +Licensed under GNU GPL v2 + +@creation-date Oct 26 2001 +@author arjun@openforce.net +@cvs-id $Id: calendar-full-portlet-procs.tcl,v 1.1 2002/02/11 03:48:42 ben Exp $ + +} + +namespace eval calendar_full_portlet { + + ad_proc -private my_package_key { + } { + return "calendar-portlet" + } + + ad_proc -private my_name { + } { + return "calendar_full_portlet" + } + + ad_proc -public get_pretty_name { + } { + return [ad_parameter \ + -package_id [apm_package_id_from_key [my_package_key]] \ + "full_portlet_pretty_name"] + } + + ad_proc -public link { + } { + return "calendar" + } + + 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. + + @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 [portal::add_element_or_append_id -portal_id $portal_id \ + -page_id $page_id \ + -portlet_name [my_name] \ + -value_id $calendar_id \ + -key calendar_id] + } + + ad_proc -public remove_self_from_page { + portal_id + package_id + } { + Removes a calendar PE from the given page + + @param portal_id The page to remove self from + @param community_id + @author arjun@openforce.net + @creation-date Sept 2001 + } { + ## 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 $package_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 \ + -template_src "calendar-full-portlet" + } + + 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 + } { + # We're going to have to replace this stuff with real templated stuff + } + + + +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.adp 11 Feb 2002 03:48:42 -0000 1.1 @@ -0,0 +1,4 @@ + +@cal_stuff@ + +@list_of_calendar_ids@ 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 11 Feb 2002 03:48:42 -0000 1.1 @@ -0,0 +1,36 @@ +# www/calendar-portlet.tcl +ad_page_contract { + The display logic for the calendar portlet + + @author Arjun Sanyal (arjun@openforce.net) + @cvs_id $Id: calendar-full-portlet.tcl,v 1.1 2002/02/11 03:48:42 ben Exp $ +} -properties { + +} + +# get stuff out of the config array +array set config $cf +set view $config(default_view) +set list_of_calendar_ids $config(calendar_id) + +# set up some vars +set date [ns_queryget date] +if {[empty_string_p $date]} { + set date [dt_sysdate] +} +set current_date $date +set date_format "YYYY-MM-DD HH24:MI" + +# big switch on the view var +if { $view == "day" } { + + set cal_stuff [calendar::one_day_display \ + -item_template {$item} \ + -hour_template "\$hour" \ + -date $current_date -start_hour 7 -end_hour 22 \ + -calendar_id_list $list_of_calendar_ids] + +} + + +ad_return_template