Index: openacs-4/packages/dotlrn-news/dotlrn-news.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news/dotlrn-news.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news/dotlrn-news.info 11 Nov 2001 18:59:54 -0000 1.1 @@ -0,0 +1,31 @@ + + + + + dotLRN News Applet + dotLRN News Applets + f + t + + + + oracle + + Arjun Sanyal + Ben Adida + dotlrn news + + + + + + + + + + + + + + + Index: openacs-4/packages/dotlrn-news/sql/oracle/dotlrn-news-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news/sql/oracle/dotlrn-news-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news/sql/oracle/dotlrn-news-create.sql 11 Nov 2001 18:59:54 -0000 1.1 @@ -0,0 +1,78 @@ + +-- +-- The news applet for dotLRN +-- copyright 2001, OpenForce +-- distributed under GPL v2.0 +-- +-- +-- ben,arjun@openforce.net +-- +-- 10/05/2001 +-- + + +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl.new ( + 'dotlrn_applet', + 'dotlrn_news', + 'dotlrn_news' + ); + + -- add all the hooks + + -- GetPrettyName + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_news', + 'GetPrettyName', + 'dotlrn_news::get_pretty_name', + 'TCL' + ); + + -- AddApplet + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_news', + 'AddApplet', + 'dotlrn_news::add_applet', + 'TCL' + ); + + -- RemoveApplet + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_news', + 'RemoveApplet', + 'dotlrn_news::remove_applet', + 'TCL' + ); + + -- AddUser + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_news', + 'AddUser', + 'dotlrn_news::add_user', + 'TCL' + ); + + -- RemoveUser + foo := acs_sc_impl.new_alias ( + 'dotlrn_applet', + 'dotlrn_news', + 'RemoveUser', + 'dotlrn_news::remove_user', + 'TCL' + ); + + -- Add the binding + acs_sc_binding.new ( + contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_news' + ); +end; +/ +show errors Index: openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs.tcl 11 Nov 2001 18:59:54 -0000 1.1 @@ -0,0 +1,119 @@ +# Procs for DOTLRN news Applet +# Copyright 2001 OpenForce, inc. +# Distributed under the GNU GPL v2 +# +# Nov 2001 +# + +ad_library { + + Procs to set up the dotLRN news applet + + @author ben@openforce.net,arjun@openforce.net + @creation-date 2001-11-11 + +} + +namespace eval dotlrn_news { + + ad_proc -public package_key { + } { + get the package_key this applet deals with + } { + return "news" + } + + ad_proc portal_element_key { + } { + return the portal element key + } { + return "news-portlet" + } + + ad_proc -public get_pretty_name { + } { + returns the pretty name + } { + return "dotLRN News" + } + + ad_proc -public add_applet { + community_id + } { + Add the news applet + } { + # Callback to get node_id from community + # REVISIT this (ben) + set node_id [site_node_id [ad_conn url]] + + # create the news package instance (all in one, I've mounted it) + set package_key [package_key] + set package_id [site_node_mount_application -return package_id $node_id $package_key $package_key $package_key] + + # return the package_id + return $package_id + } + + ad_proc -public remove_applet { + community_id + package_id + } { + remove the applet from the community + } { + # Remove all instances of the news portlet! (this is some serious stuff!) + + # Dropping all messages, forums + + # Killing the package + + } + + ad_proc -public add_user { + community_id + user_id + } { + Add a user to a community + } { + +# ad_return_complaint 1 "$community_id $user_id" + # Get the page_id by callback + set page_id [dotlrn_community::get_page_id $community_id $user_id] + + # Get the package_id by callback + set package_id [dotlrn_community::get_applet_package_id $community_id dotlrn_news] + + # Allow user to see the news folders + # nothing for now + + # Call the portal element to be added correctly + + + # Make news DS available to this page + news_portlet::make_self_available $page_id + + news_portlet::add_self_to_page $page_id $package_id + } + + ad_proc -public remove_user { + community_id + user_id + } { + Remove a user from a community + } { + # Get the page_id + set page_id [dotlrn_community::get_page_id $community_id $user_id] + + # Get the package_id by callback + set package_id [dotlrn_community::get_package_id $community_id] + + # Remove the portal element + news_portlet::remove_self_from_page $page_id $package_id + + # Buh Bye. + news_portlet::make_self_unavailable $page_id + + # remove user permissions to see news folders + # nothing to do here + } + +}