Index: openacs-4/packages/dotlrn-expense-tracking/dotlrn-expense-tracking.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-expense-tracking/dotlrn-expense-tracking.info,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-expense-tracking/dotlrn-expense-tracking.info	31 May 2005 22:05:38 -0000	1.1
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!-- Generated by the OpenACS Package Manager -->
+
+<package key="dotlrn-expense-tracking" url="http://openacs.org/repository/apm/packages/dotlrn-expense-tracking" type="apm_application">
+    <package-name>dotLRN Expense Tracking Applet</package-name>
+    <pretty-plural>dotLRn - Expense Tracking Applets</pretty-plural>
+    <initial-install-p>f</initial-install-p>
+    <singleton-p>t</singleton-p>
+    
+    <version name="0.1d" url="http://openacs.org/repository/download/apm/dotlrn-expense-tracking-0.1d.apm">
+        <owner url="mailto:hamilton.chua@gmail.com">Hamilton Chua</owner>
+        <summary>Expense Tracking Package</summary>
+
+        <!-- No dependency information -->
+        <provides url="dotlrn-expense-tracking" version="0.1d"/>
+        <requires url="dotlrn" version="1.0"/>
+
+        <parameters>
+        <!-- No version parameters -->
+        </parameters>
+
+    </version>
+</package>
Index: openacs-4/packages/dotlrn-expense-tracking/sql/postgresql/dotlrn-expense-tracking-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-expense-tracking/sql/postgresql/dotlrn-expense-tracking-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-expense-tracking/sql/postgresql/dotlrn-expense-tracking-create.sql	31 May 2005 22:05:38 -0000	1.1
@@ -0,0 +1,133 @@
+
+-- create the implementation
+
+select acs_sc_impl__new (
+		'dotlrn_applet',
+		'dotlrn_expense_tracking',
+		'dotlrn_expense_tracking'
+);
+
+
+-- add all the hooks
+
+-- GetPrettyName
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'GetPrettyName',
+	       'dotlrn_expense_tracking::get_pretty_name',
+	       'TCL'
+);
+
+-- AddApplet
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddApplet',
+	       'dotlrn_expense_tracking::add_applet',
+	       'TCL'
+);
+
+-- RemoveApplet
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveApplet',
+	       'dotlrn_expense_tracking::remove_applet',
+	       'TCL'
+);
+
+-- AddAppletToCommunity
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddAppletToCommunity',
+	       'dotlrn_expense_tracking::add_applet_to_community',
+	       'TCL'
+);
+
+-- RemoveAppletFromCommunity
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveAppletFromCommunity',
+	       'dotlrn_expense_tracking::remove_applet_from_community',
+	       'TCL'
+);
+
+-- AddUser
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddUser',
+	       'dotlrn_expense_tracking::add_user',
+	       'TCL'
+);
+
+-- RemoveUser
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveUser',
+	       'dotlrn_expense_tracking::remove_user',
+	       'TCL'
+);
+
+-- AddUserToCommunity
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddUserToCommunity',
+	       'dotlrn_expense_tracking::add_user_to_community',
+	       'TCL'
+);
+
+-- RemoveUserFromCommunity
+select acs_sc_impl_alias__new (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveUserFromCommunity',
+	       'dotlrn_expense_tracking::remove_user_from_community',
+	       'TCL'
+);
+
+-- AddPortlet
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_expense_tracking',
+        'AddPortlet',
+        'dotlrn_expense_tracking::add_portlet',
+        'TCL'
+);
+
+-- RemovePortlet
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_expense_tracking',
+        'RemovePortlet',
+        'dotlrn_expense_tracking::remove_portlet',
+        'TCL'
+);
+
+-- Clone
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_expense_tracking',
+        'Clone',
+        'dotlrn_expense_tracking::clone',
+        'TCL'
+);
+
+select acs_sc_impl_alias__new (
+        'dotlrn_applet',
+        'dotlrn_expense_tracking',
+        'ChangeEventHandler',
+        'dotlrn_expense_tracking::change_event_handler',
+        'TCL'
+);
+
+-- Add the binding
+select acs_sc_binding__new (
+	    'dotlrn_applet',
+	    'dotlrn_expense_tracking'
+);
Index: openacs-4/packages/dotlrn-expense-tracking/sql/postgresql/dotlrn-expense-tracking-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-expense-tracking/sql/postgresql/dotlrn-expense-tracking-drop.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-expense-tracking/sql/postgresql/dotlrn-expense-tracking-drop.sql	31 May 2005 22:05:38 -0000	1.1
@@ -0,0 +1,100 @@
+
+-- delete the implementation
+
+select acs_sc_impl__delete (
+		'dotlrn_applet',
+		'dotlrn_expense_tracking'
+);
+
+
+
+
+-- GetPrettyName
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'GetPrettyName'
+);
+
+-- AddApplet
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddApplet'
+);
+
+-- RemoveApplet
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveApplet'
+);
+
+-- AddAppletToCommunity
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddAppletToCommunity'
+);
+
+-- RemoveAppletFromCommunity
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveAppletFromCommunity'
+);
+
+-- AddUser
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddUser'
+);
+
+-- RemoveUser
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveUser'
+);
+
+-- AddUserToCommunity
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'AddUserToCommunity'
+);
+
+-- RemoveUserFromCommunity
+select acs_sc_impl_alias__delete (
+	       'dotlrn_applet',
+	       'dotlrn_expense_tracking',
+	       'RemoveUserFromCommunity'
+);
+
+-- AddPortlet
+select acs_sc_impl_alias__delete (
+        'dotlrn_applet',
+        'dotlrn_expense_tracking',
+        'AddPortlet'
+);
+
+-- RemovePortlet
+select acs_sc_impl_alias__delete (
+        'dotlrn_applet',
+        'dotlrn_expense_tracking',
+        'RemovePortlet'
+);
+
+-- Clone
+select acs_sc_impl_alias__delete (
+        'dotlrn_applet',
+        'dotlrn_expense_tracking',
+        'Clone'
+);
+
+-- Add the binding
+select acs_sc_binding__delete (
+	    'dotlrn_applet',
+	    'dotlrn_expense_tracking'
+);
Index: openacs-4/packages/dotlrn-expense-tracking/tcl/dotlrn-expense-tracking-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-expense-tracking/tcl/dotlrn-expense-tracking-procs-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-expense-tracking/tcl/dotlrn-expense-tracking-procs-postgresql.xql	31 May 2005 22:05:38 -0000	1.1
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<queryset>
+<rdbms><type>postgresql</type><version>7.1</version></rdbms>
+
+<fullquery name="dotlrn_expense_tracking::clone.call_expense_tracking_clone">
+  <querytext>
+    select expense_tracking__clone ( 
+        :old_package_id,
+        :new_package_id
+      );
+  </querytext>
+</fullquery>
+
+
+</queryset>
Index: openacs-4/packages/dotlrn-expense-tracking/tcl/dotlrn-expense-tracking-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-expense-tracking/tcl/dotlrn-expense-tracking-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-expense-tracking/tcl/dotlrn-expense-tracking-procs.tcl	31 May 2005 22:05:38 -0000	1.1
@@ -0,0 +1,175 @@
+ad_library {
+    
+    Procs to set up the dotLRN expense tracking applet
+    
+    @author Hamilton Chua (hamilton.chua@gmail.com)
+    @version $Id: dotlrn-expense-tracking-procs.tcl,v 1.1 2005/05/31 22:05:38 hamiltonc Exp $
+
+}
+
+namespace eval dotlrn_expense_tracking {
+
+    ad_proc -public get_pretty_name {
+    } {
+        get the pretty name
+    } {
+        return "Expense Tracking"
+    }
+
+    ad_proc -public applet_key {} {
+        return "dotlrn_expense_tracking"
+    }
+
+    ad_proc -public my_package_key {
+    } {
+        What's my package key?
+    } {
+        return "dotlrn-expense-tracking"
+    }
+
+    ad_proc -public package_key {
+    } {
+        What package is associated with this applet?
+    } {
+        return "expense-tracking"
+    }
+
+    ad_proc -public add_applet {
+    } {
+        Add the expense tracking applet to dotlrn - one time init - must be repeatable!
+    } {
+        dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key]
+    }
+
+    ad_proc -public remove_applet {
+        community_id
+        package_id
+    } {
+        remove the applet
+    } {
+        ad_return_complaint 1 "[applet_key] remove_applet not implimented!"
+    }
+
+    ad_proc -public add_applet_to_community {
+        community_id
+    } {
+        Add the expense tracking applet to a specifc community
+    } {
+        set portal_id [dotlrn_community::get_portal_id \
+                           -community_id $community_id
+        ]
+
+        # create the package instance (all in one, I've mounted it)
+        set package_id [dotlrn::instantiate_and_mount \
+                            $community_id \
+                            [package_key]
+        ]
+        # return the package_id
+        return $package_id
+    }
+
+    ad_proc -public remove_applet_from_community {
+        community_id
+    } {
+        Drops the expense tracking applet from the given community
+    } {
+        ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!"
+    }
+
+    ad_proc -public add_user {
+        user_id
+    } {
+        For one time user-specfic init
+    } {
+        # noop
+    }
+
+    ad_proc -public remove_user {
+        user_id
+    } {
+        Remove the user from dotlrn.
+    } {
+        # noop
+    }
+
+    ad_proc -public add_user_to_community {
+        community_id
+        user_id
+    } {
+        Called when a user is added to a specific dotlrn community
+    } {
+	# noop
+    }
+
+    ad_proc -public remove_user_from_community {
+        community_id
+        user_id
+    } {
+        Remove a user from a community
+    } {
+	# noop
+    }
+
+    ad_proc -public add_portlet {
+        portal_id
+    } {
+        A helper proc to add the underlying portlet to the given portal.
+
+        @portal_id
+    } {
+	# noop
+    }
+
+    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
+    } {
+	#noop
+    }
+
+    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
+    } {
+	#noop
+    }
+
+    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]"
+        set new_package_id [add_applet_to_community $new_community_id]
+        set old_package_id [dotlrn_community::get_applet_package_id \
+            -community_id $old_community_id \
+            -applet_key [applet_key]
+        ]
+
+        db_exec_plsql call_expense_tracking_clone {}
+        return $new_package_id
+    }
+
+    ad_proc -public change_event_handler {
+        community_id
+        event
+        old_value
+        new_value
+    } { 
+        listens for the following events: 
+    } { 
+    }   
+
+}