Index: openacs-4/packages/dotlrn-forums/dotlrn-forums.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-forums/dotlrn-forums.info,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-forums/dotlrn-forums.info 30 May 2002 06:28:03 -0000 1.1
@@ -0,0 +1,32 @@
+
+
+
+
+ dotLRN Forums Applet
+ dotLRN Forums Applets
+ f
+ t
+
+
+
+ oracle
+ postgresql
+
+ Ben Adida
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-forums/sql/oracle/dotlrn-forums-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-forums/sql/oracle/dotlrn-forums-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-forums/sql/oracle/dotlrn-forums-create.sql 30 May 2002 06:28:03 -0000 1.1
@@ -0,0 +1,157 @@
+--
+-- 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.
+--
+
+
+--
+-- The forums applet for dotLRN
+-- copyright 2001, OpenForce
+-- distributed under GPL v2.0
+--
+--
+-- ben,arjun@openforce.net
+--
+-- 10/05/2001
+-- redone for Forums by Ben 05/29/2002
+--
+
+
+declare
+ foo integer;
+begin
+ -- create the implementation
+ foo := acs_sc_impl.new (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'dotlrn_forums'
+ );
+
+ -- add all the hooks
+
+ -- GetPrettyName
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'GetPrettyName',
+ 'dotlrn_forums::get_pretty_name',
+ 'TCL'
+ );
+
+ -- AddApplet
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'AddApplet',
+ 'dotlrn_forums::add_applet',
+ 'TCL'
+ );
+
+ -- RemoveApplet
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'RemoveApplet',
+ 'dotlrn_forums::remove_applet',
+ 'TCL'
+ );
+
+ -- AddAppletToCommunity
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'AddAppletToCommunity',
+ 'dotlrn_forums::add_applet_to_community',
+ 'TCL'
+ );
+
+ -- RemoveAppletFromCommunity
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'RemoveAppletFromCommunity',
+ 'dotlrn_forums::remove_applet_from_community',
+ 'TCL'
+ );
+ -- AddUser
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'AddUser',
+ 'dotlrn_forums::add_user',
+ 'TCL'
+ );
+
+ -- RemoveUser
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'RemoveUser',
+ 'dotlrn_forums::remove_user',
+ 'TCL'
+ );
+
+ -- AddUserToCommunity
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'AddUserToCommunity',
+ 'dotlrn_forums::add_user_to_community',
+ 'TCL'
+ );
+
+ -- RemoveUserFromCommunity
+ foo := acs_sc_impl.new_alias (
+ 'dotlrn_applet',
+ 'dotlrn_forums',
+ 'RemoveUserFromCommunity',
+ 'dotlrn_forums::remove_user_from_community',
+ 'TCL'
+ );
+
+ -- AddPortlet
+ foo := acs_sc_impl.new_alias (
+ impl_contract_name => 'dotlrn_applet',
+ impl_name => 'dotlrn_forums',
+ impl_operation_name => 'AddPortlet',
+ impl_alias => 'dotlrn_forums::add_portlet',
+ impl_pl => 'TCL'
+ );
+
+ -- RemovePortlet
+ foo := acs_sc_impl.new_alias (
+ impl_contract_name => 'dotlrn_applet',
+ impl_name => 'dotlrn_forums',
+ impl_operation_name => 'RemovePortlet',
+ impl_alias => 'dotlrn_forums::remove_portlet',
+ impl_pl => 'TCL'
+ );
+
+ -- Clone
+ foo := acs_sc_impl.new_alias (
+ impl_contract_name => 'dotlrn_applet',
+ impl_name => 'dotlrn_forums',
+ impl_operation_name => 'Clone',
+ impl_alias => 'dotlrn_forums::clone',
+ impl_pl => 'TCL'
+ );
+
+ -- Add the binding
+ acs_sc_binding.new (
+ contract_name => 'dotlrn_applet',
+ impl_name => 'dotlrn_forums'
+ );
+end;
+/
+show errors
Index: openacs-4/packages/dotlrn-forums/tcl/dotlrn-forums-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-forums/tcl/dotlrn-forums-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-forums/tcl/dotlrn-forums-procs.tcl 30 May 2002 06:28:03 -0000 1.1
@@ -0,0 +1,298 @@
+#
+# 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 {
+
+ Procs to set up the dotLRN Forums applet
+ (redone for Forums, not bboard)
+
+ @author ben@openforce.net,arjun@openforce.net
+ @creation-date 2002-05-29
+ @version $Id: dotlrn-forums-procs.tcl,v 1.1 2002/05/30 06:28:03 ben Exp $
+}
+
+namespace eval dotlrn_forums {
+
+ ad_proc -public applet_key {
+ } {
+ What's my applet key?
+ } {
+ return "dotlrn_forums"
+ }
+
+ ad_proc -public my_package_key {
+ } {
+ What's my package key?
+ } {
+ return "dotlrn-forums"
+ }
+
+ ad_proc -public package_key {
+ } {
+ What package does this applet deal with?
+ } {
+ return "forums"
+ }
+
+ ad_proc -public get_pretty_name {
+ } {
+ } {
+ return "Discussion Forums"
+ }
+
+ ad_proc -public add_applet {
+ } {
+ Add the forums applet to dotlrn - for one-time init
+ Must be repeatable!
+ } {
+ # register/activate self with dotlrn
+ # our service contract is in the db, but we must tell dotlrn
+ # that we exist and want to be active
+ if {![dotlrn_applet::is_applet_mounted -url "forums"]} {
+ dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key]
+
+ # Mount the package
+ dotlrn_applet::mount \
+ -package_key [my_package_key] \
+ -url "forums" \
+ -pretty_name "Forums"
+ }
+ }
+
+ ad_proc -public remove_applet {
+ } {
+ remove the applet from dotlrn
+ } {
+ ad_return_complaint 1 "[applet_key] remove_applet not implemented!"
+ }
+
+ ad_proc -public add_applet_to_community {
+ community_id
+ } {
+ Add the forums applet to a dotlrn community
+ } {
+ #
+ # set up stuff
+ #
+
+ # Create and Mount
+ set package_id [dotlrn::instantiate_and_mount \
+ -mount_point "forums" \
+ $community_id \
+ [package_key]
+ ]
+
+ set auto_create_forum_p [parameter::get_from_package_key \
+ -package_key [my_package_key] \
+ -parameter "auto_create_forum_p"
+ ]
+
+ set auto_create_forum_name [parameter::get_from_package_key \
+ -package_key [my_package_key] \
+ -parameter "auto_create_forum_name"
+ ]
+
+ if {[string equal $auto_create_forum_p "t"]} {
+ forum::new \
+ -name $auto_create_forum_name \
+ -package_id $package_id
+ }
+
+ # Set up permissions for basic members (Admins inherit no problem)
+ set members [dotlrn_community::get_rel_segment_id \
+ -community_id $community_id \
+ -rel_type dotlrn_member_rel
+ ]
+
+ permission::grant -party_id $members -object_id $package_id -privilege forum_read
+ permission::grant -party_id $members -object_id $package_id -privilege forum_post
+
+ #
+ # portlet stuff
+ #
+
+ # set up the admin portlet
+
+ set admin_portal_id [dotlrn_community::get_admin_portal_id \
+ -community_id $community_id
+ ]
+
+ forums_admin_portlet::add_self_to_page \
+ -portal_id $admin_portal_id \
+ -package_id $package_id
+
+ # set up the bboard portlet for this community
+
+ set portal_id [dotlrn_community::get_portal_id \
+ -community_id $community_id
+ ]
+
+ # add the portlet to the comm's portal using add_portlet_helper
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ ns_set put $args display_group_name_p f
+ ns_set put $args param_action "overwrite"
+
+ dotlrn_forums::add_portlet_helper $portal_id $args
+
+ # return the package_id
+ return $package_id
+ }
+
+ ad_proc -public remove_applet_from_community {
+ community_id
+ } {
+ remove the applet from the given community
+ } {
+ ad_return_complaint 1 "[applet_key] remove_applet_from_community not implemented!"
+ }
+
+ ad_proc -public add_user {
+ user_id
+ } {
+ Called when the user is initially added as a dotlrn user.
+ For one-time init stuff.
+ } {
+ # noop
+ }
+
+ ad_proc -public remove_user {
+ user_id
+ } {
+ } {
+ # noop
+ }
+
+ ad_proc -public add_user_to_community {
+ community_id
+ user_id
+ } {
+ Add a user to a specific dotlrn community
+ } {
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+ set package_id [dotlrn_community::get_applet_package_id \
+ $community_id \
+ [applet_key]
+ ]
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ ns_set put $args param_action "append"
+
+ # don't use the cached version
+ dotlrn_forums::add_portlet_helper \
+ [dotlrn::get_portal_id_not_cached -user_id $user_id] \
+ $args
+
+ dotlrn_forums::add_portlet_helper $portal_id $args
+
+ # Set up notifications for all the forums
+ foreach forum [forum::list_forums -package_id $package_id] {
+ set forum_id [ns_set get $forum forum_id]
+
+ notification::request::new \
+ -type_id [notification::type::get_type_id -short_name forums_forum_notif] \
+ -user_id $user_id \
+ -object_id $forum_id \
+ -interval_id [notification::get_interval_id -name instant] \
+ -delivery_method_id [notification::get_delivery_method_id -name email]
+ }
+ }
+
+ ad_proc -public remove_user_from_community {
+ community_id
+ user_id
+ } {
+ Remove a user from a community
+ } {
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+ set package_id [dotlrn_community::get_applet_package_id \
+ $community_id \
+ [applet_key]
+ ]
+
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+
+ remove_portlet $portal_id $args
+
+ # Remove notifications
+ # FIXME: must do this
+ }
+
+ ad_proc -public add_portlet {
+ portal_id
+ } {
+ A helper proc to set up default params for templates.
+
+ @param portal_id
+ } {
+ set args [ns_set create]
+ ns_set put $args package_id 0
+ ns_set put $args display_group_name_p f
+ ns_set put $args param_action "overwrite"
+
+ set type [dotlrn::get_type_from_portal_id -portal_id $portal_id]
+
+ if {[string equal $type "user"]} {
+ # portal_id is a user portal template
+ ns_set put $args display_group_name_p t
+ }
+
+ add_portlet_helper $portal_id $args
+ }
+
+ ad_proc -public add_portlet_helper {
+ portal_id
+ args
+ } {
+ This does the call to add the portlet to the given portal.
+ Params for the portlet are set by the calllers.
+
+ @param portal_id
+ @param args An ns_set of params
+ } {
+ forums_portlet::add_self_to_page \
+ -portal_id $portal_id \
+ -package_id [ns_set get $args "package_id"] \
+ -param_action [ns_set get $args "param_action"] \
+ -display_group_name_p [ns_set get $args "display_group_name_p"]
+ }
+
+ ad_proc -public remove_portlet {
+ portal_id
+ args
+ } {
+ A helper proc to remove the underlying portlet from the given portal.
+
+ @param portal_id
+ @param args An ns_set of args
+ } {
+ set package_id [ns_set get $args "package_id"]
+ forums_portlet::remove_self_from_page $portal_id $package_id
+ }
+
+ ad_proc -public clone {
+ old_community_id
+ new_community_id
+ } {
+ Clone this applet's content from the old community to the new one
+ } {
+ ns_log notice "Cloning: [applet_key]"
+ dotlrn_forums::add_applet_to_community $new_community_id
+ }
+
+
+}
Index: openacs-4/packages/forums-portlet/forums-portlet.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/forums-portlet.info,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/forums-portlet.info 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,36 @@
+
+
+
+
+ Forums Portlet
+ Forums Portlet
+ f
+ t
+
+
+
+ oracle
+ postgresql
+
+ Arjun Sanyal
+ OpenForce, Inc.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/forums-portlet/sql/oracle/forums-admin-portlet-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/sql/oracle/forums-admin-portlet-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/sql/oracle/forums-admin-portlet-create.sql 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,197 @@
+--
+-- 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.
+--
+
+--
+-- packages/forums-portlet/sql/forums-portlets-create.sql
+--
+
+-- Creates forums datasources for portal portlets
+
+-- Copyright (C) 2001 OpenForce, Inc.
+-- @author Arjun Sanyal (arjun@openforce.net)
+-- @creation-date 2001-30-09
+
+-- $Id: forums-admin-portlet-create.sql,v 1.1 2002/05/30 06:27:32 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 => 'forums_admin_portlet',
+ description => 'Displays the forums_admin'
+ );
+
+ -- 4 defaults procs
+
+ -- shadeable_p
+ portal_datasource.set_def_param (
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 't',
+ key => 'shadeable_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'
+);
+
+ -- 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'
+);
+
+ -- 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'
+);
+
+
+ -- forums_admin-specific procs
+
+ -- package_id must be configured
+ portal_datasource.set_def_param (
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 'f',
+ key => 'package_id',
+ value => ''
+);
+
+
+end;
+/
+show errors
+
+
+declare
+ foo integer;
+begin
+ -- create the implementation
+ foo := acs_sc_impl.new (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'forums_admin_portlet'
+ );
+
+end;
+/
+show errors
+
+declare
+ foo integer;
+begin
+
+ -- add all the hooks
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'GetMyName',
+ 'forums_admin_portlet::get_my_name',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'GetPrettyName',
+ 'forums_admin_portlet::get_pretty_name',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'Link',
+ 'forums_admin_portlet::link',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'AddSelfToPage',
+ 'forums_admin_portlet::add_self_to_page',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'Show',
+ 'forums_admin_portlet::show',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'Edit',
+ 'forums_admin_portlet::edit',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_admin_portlet',
+ 'RemoveSelfFromPage',
+ 'forums_admin_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 => 'forums_admin_portlet'
+ );
+end;
+/
+show errors
+
Index: openacs-4/packages/forums-portlet/sql/oracle/forums-portlet-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/sql/oracle/forums-portlet-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/sql/oracle/forums-portlet-create.sql 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,210 @@
+--
+-- 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.
+--
+
+--
+-- packages/forums-portlet/sql/forums-portlets-create.sql
+--
+
+-- Creates forums datasources for portal portlets
+
+-- Copyright (C) 2001 OpenForce, Inc.
+-- @author Arjun Sanyal (arjun@openforce.net)
+-- @creation-date 2001-30-09
+
+-- $Id: forums-portlet-create.sql,v 1.1 2002/05/30 06:27:32 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
+
+@forums-portlet-sc-create.sql
+
+declare
+ ds_id portal_datasources.datasource_id%TYPE;
+begin
+ ds_id := portal_datasource.new(
+ name => 'forums_portlet',
+ description => 'Displays the forums'
+ );
+
+ -- 4 defaults procs
+
+ -- shadeable_p
+ portal_datasource.set_def_param (
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 't',
+ key => 'shadeable_p',
+ value => 't'
+);
+
+ -- shaded_p
+ portal_datasource.set_def_param (
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 't',
+ key => 'shaded_p',
+ value => 'f'
+);
+
+ -- 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'
+);
+
+ -- 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'
+);
+
+
+ -- forums-specific procs
+
+ -- package_id must be configured
+ portal_datasource.set_def_param (
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 'f',
+ key => 'package_id',
+ value => ''
+);
+
+ -- do we show the community name or not?
+ portal_datasource.set_def_param (
+ datasource_id => ds_id,
+ config_required_p => 't',
+ configured_p => 'f',
+ key => 'display_group_name_p',
+ value => 't'
+);
+
+
+end;
+/
+show errors
+
+
+declare
+ foo integer;
+begin
+ -- create the implementation
+ foo := acs_sc_impl.new (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'forums_portlet'
+ );
+
+end;
+/
+show errors
+
+declare
+ foo integer;
+begin
+
+ -- add all the hooks
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'GetMyName',
+ 'forums_portlet::get_my_name',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'GetPrettyName',
+ 'forums_portlet::get_pretty_name',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'Link',
+ 'forums_portlet::link',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'AddSelfToPage',
+ 'forums_portlet::add_self_to_page',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'Show',
+ 'forums_portlet::show',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'Edit',
+ 'forums_portlet::edit',
+ 'TCL'
+ );
+
+ foo := acs_sc_impl.new_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'RemoveSelfFromPage',
+ 'forums_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 => 'forums_portlet'
+ );
+end;
+/
+show errors
+
+@forums-admin-portlet-create.sql
+
Index: openacs-4/packages/forums-portlet/sql/oracle/forums-portlet-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/sql/oracle/forums-portlet-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/sql/oracle/forums-portlet-drop.sql 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,118 @@
+--
+-- 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.
+--
+
+--
+-- packages/forums-portlets/sql/forums-portlets-drop.sql
+--
+
+-- Drops forums datasources for portal portlets
+
+-- Copyright (C) 2001 Openforce, Inc.
+-- @author Arjun Sanyal (arjun@openforce.net)
+-- @creation-date 2001-30-09
+
+-- $Id: forums-portlet-drop.sql,v 1.1 2002/05/30 06:27:32 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
+
+ begin
+ select datasource_id into ds_id
+ from portal_datasources
+ where name = 'forums-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;
+
+
+
+declare
+ foo integer;
+begin
+
+ -- add all the hooks
+ foo := acs_sc_impl.delete_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'GetMyName'
+ );
+
+ foo := acs_sc_impl.delete_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'GetPrettyName'
+ );
+
+
+ foo := acs_sc_impl.delete_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'Link'
+ );
+
+ foo := acs_sc_impl.delete_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'AddSelfToPage'
+ );
+
+ foo := acs_sc_impl.delete_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'Show'
+ );
+
+ foo := acs_sc_impl.delete_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'Edit'
+ );
+
+ foo := acs_sc_impl.delete_alias (
+ 'portal_datasource',
+ 'forums_portlet',
+ 'RemoveSelfFromPage'
+ );
+
+ -- Drop the binding
+ acs_sc_binding.delete (
+ contract_name => 'portal_datasource',
+ impl_name => 'forums_portlet'
+ );
+
+ -- drop the impl
+ foo := acs_sc_impl.delete (
+ 'portal_datasource',
+ 'forums_portlet'
+ );
+end;
+/
+show errors
+
+
Index: openacs-4/packages/forums-portlet/tcl/forums-admin-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/tcl/forums-admin-portlet-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/tcl/forums-admin-portlet-procs.tcl 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,95 @@
+#
+# 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 supports forums admin portlets
+
+ @creation-date September 30 2001
+ @author arjun@openforce.net
+ @version $Id: forums-admin-portlet-procs.tcl,v 1.1 2002/05/30 06:27:32 ben Exp $
+}
+
+namespace eval forums_admin_portlet {
+
+ ad_proc -private get_my_name {
+ } {
+ return "forums_admin_portlet"
+ }
+
+ ad_proc -public get_pretty_name {
+ } {
+ return "Forums Administration"
+ }
+
+ ad_proc -private my_package_key {
+ } {
+ return "forums-portlet"
+ }
+
+ ad_proc -public link {
+ } {
+ return ""
+ }
+
+ ad_proc -public add_self_to_page {
+ {-portal_id:required}
+ {-package_id:required}
+ } {
+ Adds a forums admin PE to the admin portal
+
+ @return new element_id
+ } {
+ # we use "portal::add_element" here since there is no
+ # configuration necessary for this portlet (no params)
+ set element_id [portal::add_element \
+ -pretty_name [get_pretty_name] \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name] \
+ ]
+
+ portal::set_element_param $element_id package_id $package_id
+ return $element_id
+ }
+
+ ad_proc -public remove_self_from_page {
+ {-portal_id:required}
+ } {
+ Removes the forums admin PE from the portal
+ } {
+ portal::remove_element \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name]
+ }
+
+ ad_proc -public show {
+ cf
+ } {
+ } {
+ portal::show_proc_helper \
+ -package_key [my_package_key] \
+ -config_list $cf \
+ -template_src "forums-admin-portlet"
+ }
+
+ ad_proc -public edit {
+ cf
+ } {
+ } {
+ return ""
+ }
+
+}
Index: openacs-4/packages/forums-portlet/tcl/forums-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/tcl/forums-portlet-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/tcl/forums-portlet-procs.tcl 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,95 @@
+#
+# 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 supports forums portlets
+
+ @creation-date September 30 2001
+ @author arjun@openforce.net
+ @version $Id: forums-portlet-procs.tcl,v 1.1 2002/05/30 06:27:32 ben Exp $
+
+}
+
+namespace eval forums_portlet {
+
+ ad_proc -private get_my_name {
+ } {
+ return "forums_portlet"
+ }
+
+ ad_proc -public get_pretty_name {
+ } {
+ return "Forums"
+ }
+
+ ad_proc -private my_package_key {
+ } {
+ return "forums-portlet"
+ }
+
+ ad_proc -public link {
+ } {
+ return ""
+ }
+
+ ad_proc -public add_self_to_page {
+ {-portal_id:required}
+ {-package_id:required}
+ {-display_group_name_p:required}
+ {-param_action:required}
+ } {
+ Adds a forums PE to the given portal or appends the given forums package_id
+ to the forums PE that already on the portal
+ } {
+ return [portal::add_element_parameters \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name] \
+ -pretty_name [get_pretty_name] \
+ -value $package_id \
+ -force_region [parameter::get_from_package_key \
+ -package_key [my_package_key] \
+ -parameter "forums_portlet_region"] \
+ -extra_params [list "display_group_name_p" $display_group_name_p] \
+ -param_action $param_action
+ ]
+ }
+
+
+ ad_proc -public remove_self_from_page {
+ portal_id
+ package_id
+ } {
+ Removes a forums PE from the given page or just the given forums's package_id
+ } {
+ portal::remove_element_parameters \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name] \
+ -value $package_id
+ }
+
+ ad_proc -public show {
+ cf
+ } {
+ } {
+ # no return call required with the helper proc
+ portal::show_proc_helper \
+ -package_key [my_package_key] \
+ -config_list $cf \
+ -template_src "forums-portlet"
+ }
+
+}
Index: openacs-4/packages/forums-portlet/www/forums-admin-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/www/forums-admin-portlet.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/www/forums-admin-portlet.adp 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,32 @@
+<%
+
+ #
+ # 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.
+ #
+
+%>
+
+
+No forums
+
+
+
+
+
+New Forum
Index: openacs-4/packages/forums-portlet/www/forums-admin-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/www/forums-admin-portlet.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/www/forums-admin-portlet.tcl 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,54 @@
+#
+# 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_page_contract {
+ The display logic for the forums admin portlet
+
+ @author Ben Adida (ben@openforce)
+ @cvs_id $Id: forums-admin-portlet.tcl,v 1.1 2002/05/30 06:27:32 ben Exp $
+} -properties {
+
+}
+
+array set config $cf
+
+set list_of_package_ids $config(package_id)
+
+if {[llength $list_of_package_ids] > 1} {
+ # We have a problem!
+ return -code error "There should be only one instance of forums for admin purposes"
+}
+
+set package_id [lindex $list_of_package_ids 0]
+
+db_multirow forums select_forums {
+ select forum_id, name
+ from forums_forums
+ where package_id = :package_id
+}
+
+set url [dotlrn_community::get_url_from_package_id -package_id $package_id]
+
+set package_id [ad_conn package_id]
+set default_name [db_string select_package_name {
+ select instance_name from apm_packages where package_id= :package_id
+}]
+
+append default_name " Forum"
+
+set encoded_default_name [ns_urlencode $default_name]
+
+ad_return_template
Index: openacs-4/packages/forums-portlet/www/forums-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/www/forums-portlet.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/www/forums-portlet.adp 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,62 @@
+<%
+
+ #
+ # 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.
+ #
+
+%>
+
+
+
+
+
+<%
+ set new_package_id ""
+ set old_package_id ""
+%>
+
+
+
+<% set new_package_id $forums(package_id) %>
+
+
+
+
+
+
+
+ @forums.parent_name@
+
+
+
+ @forums.name@
+
+
+<%
+ set old_package_id $new_package_id
+%>
+
+
+
+
+
+ No Forums
+
+
+
+
+
+
Index: openacs-4/packages/forums-portlet/www/forums-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/www/forums-portlet.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums-portlet/www/forums-portlet.tcl 30 May 2002 06:27:32 -0000 1.1
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+
+array set config $cf
+
+set shaded_p $config(shaded_p)
+set list_of_package_ids $config(package_id)
+set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0]
+
+db_multirow forums select_forums "
+ select forums_forums.package_id,
+ (select apm_packages.instance_name
+ from apm_packages
+ where apm_packages.package_id = apm_package.parent_id(forums_forums.forum_id)) as parent_name,
+ (select site_node.url(site_nodes.node_id)
+ from site_nodes
+ where site_nodes.object_id = forums_forums.package_id) as url,
+ forums_forums.forum_id,
+ forums_forums.name
+ from forums_forums
+ where forums_forums.package_id in ([join $list_of_package_ids ,])
+ order by parent_name,
+ forums_forums.name
+"