Index: openacs-4/packages/dotlrn-portlet/dotlrn-portlet.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/dotlrn-portlet.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-portlet/dotlrn-portlet.info 8 Oct 2001 20:56:19 -0000 1.1
@@ -0,0 +1,34 @@
+
+
+
+
+ dotLRNportlet
+ dotLRN portlets
+ f
+ t
+
+
+
+ oracle
+
+ url="mailto:arjun@openforce.net">Arjun Sanyal
+ Creates a dotLRN portlet.
+ OpenForce, Inc.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-portlet/sql/oracle/dotlrn-portlet-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/sql/oracle/dotlrn-portlet-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-portlet/sql/oracle/dotlrn-portlet-create.sql 8 Oct 2001 20:56:19 -0000 1.1
@@ -0,0 +1,41 @@
+--
+-- packages/bboard-portlet/sql/bboard-portlets-create.sql
+--
+
+-- Creates bboard datasources for portal portlets
+
+-- Copyright (C) 2001 OpenForce, Inc.
+-- @author Arjun Sanyal (arjun@openforce.net)
+-- @creation-date 2001-30-09
+
+-- $Id: dotlrn-portlet-create.sql,v 1.1 2001/10/08 20:56:19 oracle 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(
+ data_type => 'tcl_proc',
+ mime_type => 'text/html',
+ name => 'bboard-portlet',
+ description => 'Displays the bboard for a given instance_id ',
+ content => 'bboard_portlet::show',
+ configurable_p => 't'
+ );
+
+ -- Instance_id must be configured
+ portal_datasource.set_def_param (
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 'f',
+ key => 'instance_id',
+ value => ''
+);
+
+end;
+/
+show errors
+
Index: openacs-4/packages/dotlrn-portlet/sql/oracle/dotlrn-portlet-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/sql/oracle/dotlrn-portlet-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-portlet/sql/oracle/dotlrn-portlet-drop.sql 8 Oct 2001 20:56:19 -0000 1.1
@@ -0,0 +1,36 @@
+--
+-- packages/bboard-portlets/sql/bboard-portlets-drop.sql
+--
+
+-- Drops bboard datasources for portal portlets
+
+-- Copyright (C) 2001 Openforce, Inc.
+-- @author Arjun Sanyal (arjun@openforce.net)
+-- @creation-date 2001-30-09
+
+-- $Id: dotlrn-portlet-drop.sql,v 1.1 2001/10/08 20:56:19 oracle 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
+
+ begin
+ select datasource_id into ds_id
+ from portal_datasources
+ where name = 'bboard-portlet';
+ exception when no_data_found then
+ ds_id := null;
+ end;
+
+ if ds_id is not null then
+ portal_datasource.delete(ds_id);
+ end if;
+
+end;
+/
+show errors;
+
Index: openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl 8 Oct 2001 20:56:19 -0000 1.1
@@ -0,0 +1,142 @@
+# /packages/bboard-portlets/tcl/bboard-portlets-procs.tcl
+ad_library {
+
+Procedures to supports bboard portlets
+
+Copyright Openforce, Inc.
+Licensed under GNU GPL v2
+
+@creation-date September 30 2001
+@author arjun@openforce.net
+@cvs-id $Id: dotlrn-portlet-procs.tcl,v 1.1 2001/10/08 20:56:19 oracle Exp $
+
+}
+
+namespace eval bboard_portlet {
+
+ ad_proc -private my_name {
+ } {
+ return "bboard-portlet"
+ }
+
+ ad_proc -public add_self_to_page {
+ page_id
+ instance_id
+ } {
+ Adds a bboard PE to the given page with the instance key being
+ opaque data in the portal configuration.
+
+ @return element_id The new element's id
+ @param page_id The page to add self to
+ @param instance_id The bboard instace to show
+ @author arjun@openforce.net
+ @creation-date Sept 2001
+ } {
+ # Tell portal to add this element to the page
+ set element_id [portal::add_element $page_id [my_name]]
+
+ # The default param "instance_id" must be configured
+ set key "instance_id"
+ set value [portal::get_element_param $element_id $key]
+
+ portal::set_element_param $element_id $key $instance_id
+
+ return $element_id
+ }
+
+ ad_proc -public show {
+ cf
+ } {
+ Display the PE
+
+ @return HTML string
+ @param cf A config array
+ @author arjun@openforce.net
+ @creation-date Sept 2001
+ } {
+
+ array set config $cf
+
+ set query "
+ select message_id,
+ title,
+ num_replies,
+ first_names||' '||last_name as full_name,
+ to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated
+ from bboard_messages_all b, persons, acs_objects ao
+ where b.forum_id = ao.object_id
+ and ao.context_id = $config(instance_id)
+ and person_id = sender
+ and reply_to is null
+ order by sent_date desc"
+
+ set data ""
+ set rowcount 0
+
+ db_foreach select_messages $query {
+ append data "
$title | $full_name | $num_replies | $last_updated | "
+ incr rowcount
+ }
+
+ set template "
+
+
+ Subject |
+ Author |
+ Replies |
+ Last update |
+
+ $data
+
"
+
+ ns_log notice "AKS31 got here $rowcount"
+
+ if {!$rowcount} {
+ set template "No messages"
+ }
+
+ set code [template::adp_compile -string $template]
+
+ set output [template::adp_eval code]
+ ns_log notice "AKS32 got here $output"
+
+ return $output
+
+ }
+
+ ad_proc -public remove_self_from_page {
+ portal_id
+ instance_id
+ } {
+ Removes a bboard PE from the given page
+
+ @param page_id The page to remove self from
+ @param instance_id
+ @author arjun@openforce.net
+ @creation-date Sept 2001
+ } {
+ # Find out the element_id that corresponds to this instance_id
+ if { [db0or1row get_element_id "
+ select pem.element_id as element_id
+ from portal_element_parameters pep, portal_element_map pem
+ where pem.portal_id = $portal_id and
+ pep.element_id = pem.element_id and
+ pep.key = 'instance_id' and
+ pep.value = $instance_id"] } {
+
+ # delete the params
+ # delete the element from the map
+ ns_log Notice "foo"
+
+ } else {
+ ad_return_complaint 1 "bboard_portlet::remove_self_from_page: Invalid portal_id and/or instance_id given."
+ ad_script_abort
+ }
+
+ # this call removes the PEs params too
+ set element_id [portal::remove_element {$portal_id $element_id}]
+ }
+ }
+
+
+
Index: openacs-4/packages/dotlrn-portlet/www/show.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/www/Attic/show.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-portlet/www/show.adp 8 Oct 2001 20:56:19 -0000 1.1
@@ -0,0 +1,20 @@
+AKS28: instance_id is @instance_id@
+
+ There are no messages available.
+
+
+
+
+
+ @messages.title@ |
+ @messages.full_name@ |
+ <%= [expr @messages.num_replies@-1] %> |
+
+ @messages.sent_date@ |
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-portlet/www/show.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/www/Attic/show.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-portlet/www/show.tcl 8 Oct 2001 20:56:19 -0000 1.1
@@ -0,0 +1,32 @@
+# /packages/portal-creator/www/datasources/bboard/summarize.tcl
+
+ad_page_contract {
+ Summarizes all bboard applications mounted directly below this node
+
+ @author Arjun Sanyal (arjun@openforce.net)
+ @creation-date Sept 2001
+ @cvs-id $Id: show.tcl,v 1.1 2001/10/08 20:56:19 oracle Exp $
+} {
+ instance_id:integer,notnull
+} -properties {}
+
+#db_0or1row forum_info forum_info_select {
+# select short_name, moderated_p, bboard_id
+# from bboard_forums
+# where forum_id = :forum_id
+#}
+#
+db_multirow messages messages_select {
+# select message_id, title, num_replies,
+# first_names||' '||last_name as full_name,
+# to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated
+# from bboard_messages_all b, persons
+# where forum_id = :forum_id
+# and sent_date > decode(:last_n_days, 0, '1976-01-01', sysdate - :last_n_days)
+# and person_id = sender
+# and reply_to is null
+# order by sent_date desc
+#
+}
+
+ad_return_template