Index: openacs-4/packages/calendar-portlet/sql/oracle/calendar-list-portlet-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/sql/oracle/calendar-list-portlet-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/sql/oracle/calendar-list-portlet-create.sql 15 May 2002 23:27:31 -0000 1.1
@@ -0,0 +1,215 @@
+--
+-- Copyright (C) 2001, 2002 OpenForce, Inc.
+--
+-- 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.
+--
+
+--
+-- /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-list-portlet-create.sql,v 1.1 2002/05/15 23:27:31 ben Exp $
+
+declare
+ ds_id portal_datasources.datasource_id%TYPE;
+begin
+ ds_id := portal_datasource.new(
+ name => 'calendar_list_portlet',
+ description => 'Displays the calendar list as a schedule'
+ );
+
+
+ -- 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'
+);
+
+ portal_datasource.set_def_param(
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 'f',
+ key => 'scoped_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'
+);
+
+
+-- XXX community calendars
+
+end;
+/
+show errors
+
+declare
+ foo integer;
+begin
+ -- create the implementation
+ foo := acs_sc_impl.new (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'calendar_list_portlet'
+ );
+
+end;
+/
+show errors
+
+declare
+ foo integer;
+begin
+
+ -- add all the hooks
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'GetMyName',
+ 'calendar_list_portlet::get_my_name',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'GetPrettyName',
+ 'calendar_list_portlet::get_pretty_name',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'Link',
+ 'calendar_list_portlet::link',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'AddSelfToPage',
+ 'calendar_list_portlet::add_self_to_page',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'Show',
+ 'calendar_list_portlet::show',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'Edit',
+ 'calendar_list_portlet::edit',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'calendar_list_portlet',
+ 'RemoveSelfFromPage',
+ 'calendar_list_portlet::remove_self_from_page',
+ 'TCL'
+ );
+
+end;
+/
+show errors
+
+declare
+ foo integer;
+begin
+
+ -- Add the binding
+ acs_sc_binding.new (
+ contract_name => 'portal_datasource',
+ impl_name => 'calendar_list_portlet'
+ );
+end;
+/
+show errors
+
Index: openacs-4/packages/calendar-portlet/tcl/calendar-list-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/tcl/calendar-list-portlet-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/tcl/calendar-list-portlet-procs.tcl 15 May 2002 23:27:31 -0000 1.1
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2001, 2002 OpenForce, Inc.
+#
+# 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.
+#
+
+ad_library {
+
+ Procedures to support the "list" calendar portlet. This is the
+ "wide" calendar with the navigation widget and helpful links. Not
+ to be confused with the (regular, narrow) calendar portlet that is titled
+ "Day Summary" by default.
+
+ @creation-date Oct 26 2001
+ @author arjun@openforce.net
+ @cvs-id $Id: calendar-list-portlet-procs.tcl,v 1.1 2002/05/15 23:27:31 ben Exp $
+}
+
+namespace eval calendar_list_portlet {
+
+ ad_proc -private my_package_key {
+ } {
+ return "calendar-portlet"
+ }
+
+ ad_proc -private get_my_name {
+ } {
+ return "calendar_list_portlet"
+ }
+
+ ad_proc -public get_pretty_name {
+ } {
+ return "Schedule"
+ }
+
+ ad_proc -public link {
+ } {
+ return ""
+ }
+
+ ad_proc -public add_self_to_page {
+ {-portal_id:required}
+ {-page_name ""}
+ {-calendar_id:required}
+ } {
+ Adds a "list" calendar PE to the given portal
+
+ @param portal_id The page to add self to
+ @param calendar_id The new calendar_id to add
+
+ @return element_id The new element's id
+ } {
+ return [portal::add_element_or_append_id \
+ -portal_id $portal_id \
+ -page_name $page_name \
+ -portlet_name [get_my_name] \
+ -pretty_name [get_pretty_name] \
+ -value_id $calendar_id \
+ -key calendar_id]
+ }
+
+ ad_proc -public remove_self_from_page {
+ portal_id
+ calendar_id
+ } {
+ Removes a "list" calendar PE from the given page or
+ a calendar_id from its params
+ } {
+ 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 show {
+ cf
+ } {
+ } {
+ portal::show_proc_helper \
+ -package_key [my_package_key] \
+ -config_list $cf \
+ -template_src "calendar-list-portlet"
+ }
+
+}
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.18 -r1.19
--- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 15 May 2002 22:35:04 -0000 1.18
+++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 15 May 2002 23:27:31 -0000 1.19
@@ -125,10 +125,6 @@
if {$view == "list"} {
set sort_by [ns_queryget sort_by]
- if {[empty_string_p $sort_by]} {
- set sort_by "item_type"
- }
-
set cal_stuff [calendar::list_display \
-item_template $item_template \
-date $current_date \
Index: openacs-4/packages/calendar-portlet/www/calendar-list-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-list-portlet.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/www/calendar-list-portlet.adp 15 May 2002 23:27:31 -0000 1.1
@@ -0,0 +1,23 @@
+<%
+
+ #
+ # Copyright (C) 2001, 2002 OpenForce, Inc.
+ #
+ # 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_list@
+
Index: openacs-4/packages/calendar-portlet/www/calendar-list-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-list-portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/www/calendar-list-portlet.tcl 15 May 2002 23:27:31 -0000 1.1
@@ -0,0 +1,86 @@
+#
+# Copyright (C) 2001, 2002 OpenForce, Inc.
+#
+# 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.
+#
+
+# www/calendar-portlet.tcl
+ad_page_contract {
+ The display logic for the calendar portlet
+
+ @author Arjun Sanyal (arjun@openforce.net)
+ @cvs_id $Id: calendar-list-portlet.tcl,v 1.1 2002/05/15 23:27:31 ben Exp $
+} {
+ {view ""}
+ {page_num ""}
+ {date ""}
+ {julian_date ""}
+ {sort_by ""}
+} -properties {
+
+}
+
+# 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 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 [ad_conn user_id]]
+} else {
+ set force_calendar_id [lindex $list_of_calendar_ids 0]
+}
+
+# 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]
+
+# List view only
+set sort_by [ns_queryget sort_by]
+
+set item_template "\$item"
+
+set cal_list [calendar::list_display \
+ -item_template $item_template \
+ -date $current_date \
+ -calendar_id_list $list_of_calendar_ids \
+ -sort_by $sort_by \
+ -url_template "?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]
+
+ad_return_template