Index: openacs-4/packages/dotlrn-project-manager/dotlrn-project-manager.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-project-manager/dotlrn-project-manager.info,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-project-manager/dotlrn-project-manager.info	10 Jun 2005 14:41:00 -0000	1.1
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!-- Generated by the OpenACS Package Manager -->
+
+<package key="dotlrn-project-manager" url="http://openacs.org/repository/apm/packages/dotlrn-project-manager" type="apm_service">
+    <package-name>Dotlrn Project Manager Applet</package-name>
+    <pretty-plural>Dotlrn Project Manager Applets</pretty-plural>
+    <initial-install-p>f</initial-install-p>
+    <singleton-p>f</singleton-p>
+    
+    <version name="0.1d" url="http://openacs.org/repository/download/apm/dotlrn-project-manager-01.d.apm">
+        <owner url="mailto:kiesbye@theservice.de">Bjoern Kiesbye</owner>
+        <owner url="mailto:sussdorff@sussdorff.org">Malte Sussdorff</owner>
+        <summary>Dotlrn Applet for the Project Manager.</summary>
+        <vendor url="http://www.cognovis.de">Cognovis</vendor>
+        <description format="text/plain">Dotlrn Applet for the Project Manager.</description>
+        <maturity>0</maturity>
+
+        <provides url="dotlrn-project-manager" version="0.1d"/>
+        <requires url="project-manager-portlet" version="0.1d"/>
+
+        <callbacks>
+        </callbacks>
+        <parameters>
+        <!-- No version parameters -->
+        </parameters>
+
+    </version>
+</package>
Index: openacs-4/packages/dotlrn-project-manager/sql/postgresql/dotlrn-project-manager-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-project-manager/sql/postgresql/dotlrn-project-manager-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-project-manager/sql/postgresql/dotlrn-project-manager-create.sql	10 Jun 2005 14:43:17 -0000	1.1
@@ -0,0 +1,162 @@
+--
+--  Copyright (C) 2005 Cognovis
+--
+--  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 dotlrn-project-manager applet's implimentation of the dotlrn applet contract
+--
+-- 
+--
+-- $Id: dotlrn-project-manager-create.sql
+--
+
+create function inline_0()
+returns integer as '
+declare
+	foo integer;
+begin
+	-- create the implementation
+	foo := acs_sc_impl__new (
+		''dotlrn_applet'',
+		''dotlrn_project_manager'',
+		''dotlrn_project_manager''
+	);
+
+	-- GetPrettyName
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''GetPrettyName'',
+	       ''dotlrn_project_manager::get_pretty_name'',
+	       ''TCL''
+	);
+
+	-- AddApplet
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''AddApplet'',
+	       ''dotlrn_project_manager::add_applet'',
+	       ''TCL''
+	);
+
+	-- RemoveApplet
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''RemoveApplet'',
+	       ''dotlrn_project_manager::remove_applet'',
+	       ''TCL''
+	);
+
+	-- AddAppletToCommunity
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''AddAppletToCommunity'',
+	       ''dotlrn_project_manager::add_applet_to_community'',
+	       ''TCL''
+	);
+
+	-- RemoveAppletFromCommunity
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''RemoveAppletFromCommunity'',
+	       ''dotlrn_project_manager::remove_applet_from_community'',
+	       ''TCL''
+	);
+
+	-- AddUser
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''AddUser'',
+	       ''dotlrn_project_manager::add_user'',
+	       ''TCL''
+	);
+
+	-- RemoveUser
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''RemoveUser'',
+	       ''dotlrn_project_manager::remove_user'',
+	       ''TCL''
+	);
+
+	-- AddUserToCommunity
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''AddUserToCommunity'',
+	       ''dotlrn_project_manager::add_user_to_community'',
+	       ''TCL''
+	);
+
+	-- RemoveUserFromCommunity
+	foo := acs_sc_impl_alias__new (
+	       ''dotlrn_applet'',
+	       ''dotlrn_project_manager'',
+	       ''RemoveUserFromCommunity'',
+	       ''dotlrn_project_manager::remove_user_from_community'',
+	       ''TCL''
+	);
+
+    -- AddPortlet
+    foo := acs_sc_impl_alias__new (
+        ''dotlrn_applet'',
+        ''dotlrn_project_manager'',
+        ''AddPortlet'',
+        ''dotlrn_project_manager::add_portlet'',
+        ''TCL''
+    );
+
+    -- RemovePortlet
+    foo := acs_sc_impl_alias__new (
+        ''dotlrn_applet'',
+        ''dotlrn_project_manager'',
+        ''RemovePortlet'',
+        ''dotlrn_project_manager::remove_portlet'',
+        ''TCL''
+    );
+
+    -- Clone
+    foo := acs_sc_impl_alias__new (
+        ''dotlrn_applet'',
+        ''dotlrn_project_manager'',
+        ''Clone'',
+        ''dotlrn_project_manager::clone'',
+        ''TCL''
+    );
+
+    foo := acs_sc_impl_alias__new (
+        ''dotlrn_applet'',
+        ''dotlrn_project_manager'',
+        ''ChangeEventHandler'',
+        ''dotlrn_project_manager::change_event_handler'',
+        ''TCL''
+    );
+
+	-- Add the binding
+	perform acs_sc_binding__new (
+	    ''dotlrn_applet'',
+	    ''dotlrn_project_manager''
+	);
+
+	return 0;
+
+end;' language 'plpgsql';
+select inline_0();
+drop function inline_0();
Index: openacs-4/packages/dotlrn-project-manager/tcl/dotlrn-project-manager-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-project-manager/tcl/dotlrn-project-manager-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-project-manager/tcl/dotlrn-project-manager-procs.tcl	10 Jun 2005 14:41:01 -0000	1.1
@@ -0,0 +1,277 @@
+#
+#  Copyright (C) 2001, 2002 MIT
+#
+#  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 {
+
+    the dotlrn applet for calendar
+
+    @author ben@openforce.net,arjun@openforce.net
+    @version $Id: dotlrn-project-manager-procs.tcl,v 1.1 2005/06/10 14:41:01 maltes Exp $
+}
+
+namespace eval dotlrn_project_manager {}
+
+ad_proc -public dotlrn_project_manager::package_key {
+} {
+    What package does this applet deal with?
+} {
+    return "project-manager"
+}
+
+ad_proc -public dotlrn_project_manager::my_package_key {
+} {
+    What's my package key?
+} {
+    return "dotlrn-project-manager"
+}
+
+ad_proc -public dotlrn_project_manager::applet_key {
+} {
+    What's my applet key?
+} {
+    return "dotlrn_project_manager"
+}
+
+ad_proc -public dotlrn_project_manager::get_pretty_name {
+} {
+} {
+    return "Project Manager"
+}
+
+ad_proc -public dotlrn_project_manager::add_applet {
+} {
+    Called for one time init - must be repeatable!
+    @return new pkg_id or 0 on failure
+} {
+    # FIXME: won't work with multiple dotlrn instances
+    # Use the package_key for the -url param - "/" are not allowed!
+    if {![dotlrn::is_package_mounted -package_key [package_key]]} {
+	set package_id [dotlrn::mount_package \
+                -package_key [package_key] \
+                -url [package_key] \
+                -directory_p "t"]
+
+    }
+
+    dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key]
+}
+
+ad_proc -public dotlrn_project_manager::remove_applet {
+} {
+    One-time destroy for when the entire applet is removed from dotlrn. 
+} {
+    ad_return_complaint 1 "[applet_key] remove_applet not implimented!"
+}
+
+ad_proc -public dotlrn_project_manager::project_manager_create_helper {
+    {-community_id:required}
+    {-package_id:required}
+} {
+    A helper proc to create a calendar for a comm, returns the new calendar_id
+} {
+  return "00"
+}
+
+ad_proc -public dotlrn_project_manager::add_applet_to_community {
+    community_id
+} {
+    Add the calendar applet to a specific dotlrn community
+} {
+    set results [add_applet_to_community_helper \
+	    -community_id $community_id
+    ]
+    
+    return [lindex $results 0]
+}
+
+ad_proc -public dotlrn_project_manager::add_applet_to_community_helper {
+    {-community_id:required}
+} {
+    Add the calendar applet to a specific dotlrn community
+
+    @params community_id 
+} {
+
+ 
+        # Create and Mount the Project Manager Package
+        set package_id [dotlrn::instantiate_and_mount \
+            -mount_point "project-manager" \
+            $community_id \
+            [package_key] \
+        ]
+
+	# Set up the project manager portlet for this portal/community
+
+	set portal_id [dotlrn_community::get_portal_id \
+			   -community_id $community_id \
+			  ]
+
+
+	# Add all portlets to the Portal.
+
+  	project_manager_portlet::add_self_to_page -portal_id $portal_id -project_manager_id $package_id
+	
+  	project_manager_task_portlet::add_self_to_page -portal_id $portal_id -project_manager_id $package_id
+
+    }
+
+	
+    # this should return the package_id
+    return $package_id
+}
+
+ad_proc -public dotlrn_project_manager::remove_applet_from_community {
+    community_id
+} {
+    remove the applet from the community
+} {        
+    ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!"
+}
+
+ad_proc -public dotlrn_project_manager::add_user {
+    user_id
+} {
+    Called once when a user is added as a dotlrn user.
+    Create a private, personal, global Project Manager for the User if they don't have one and add it to the user's portal
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::remove_user {
+    user_id
+} {
+    Remove a user from dotlrn
+
+
+} {
+ # Not yet implemented.
+}
+
+ad_proc -public dotlrn_project_manager::add_user_to_community {
+    community_id
+    user_id
+} {
+    Add a user to a community
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::remove_user_from_community {
+    community_id
+    user_id
+} {
+    Remove a user from a community
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::add_portlet {
+    portal_id
+} {
+    Set up default params for templates about to call add_portlet_helper
+    
+    @param portal_id
+} {
+
+    
+      	project_manager_portlet::add_self_to_page -portal_id $portal_id -project_manager_id 0
+
+#    add_portlet_helper $portal_id $args
+}
+
+#ad_proc -private dotlrn_project_manager::add_portlet_helper {
+#    portal_id 
+#    args        
+#} {
+#    Does the call to add the portlet to the portal. 
+#    Params for the portlet are sent to this proc by the caller.
+#} {
+#    calendar_portlet::add_self_to_page \
+            -portal_id $portal_id \
+            -pretty_name [ns_set get $args "pretty_name"] \
+            -calendar_id [ns_set get $args "calendar_id"]  \
+            -scoped_p [ns_set get $args "scoped_p"] \
+            -param_action [ns_set get $args "param_action"]
+
+#    calendar_full_portlet::add_self_to_page \
+            -portal_id $portal_id \
+            -page_name [ns_set get $args "full_portlet_page_name"] \
+            -calendar_id [ns_set get $args "calendar_id"]  \
+            -scoped_p [ns_set get $args "scoped_p"] \
+            -param_action [ns_set get $args "param_action"]
+#}
+
+ad_proc -public dotlrn_project_manager::remove_portlet {
+    portal_id
+    args
+} {
+    A helper proc to remove the underlying portlet from the given portal. 
+    This is alot simpler than add_portlet.
+
+    @param portal_id
+    @param args An ns_set with the project_manager_id. 
+} { 
+    project_manager_portlet::remove_self_from_page \
+            -portal_id $portal_id \
+            -project_manager_id [ns_set get $args "project_manager_id"] 
+
+
+    project_manager_portlet::remove_self_from_page \
+            -portal_id $portal_id \
+            -project_manager_id [ns_set get $args "project_manager_id"] 
+
+#    calendar_full_portlet::remove_self_from_page \
+            -portal_id $portal_id \
+            -calendar_id [ns_set get $args "calendar_id"] 
+}
+
+ad_proc -public dotlrn_project_manager::clone {
+    old_community_id
+    new_community_id
+} {
+    Clone this applet's content from the old community to the new one
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::change_event_handler {
+    community_id
+    event
+    old_value
+    new_value
+} { 
+    listens for the following events: rename
+} { 
+    switch $event {
+	rename {
+#	    handle_rename -community_id $community_id -old_value $old_value -new_value $new_value
+	}
+    }
+}   
+
+ad_proc -private dotlrn_project_manager::handle_rename {
+    {-community_id:required}
+    {-old_value:required}
+    {-new_value:required}
+} {
+    what to do in calendar when a dotlrn community is renamed
+} {
+#    calendar::rename -calendar_id [get_group_calendar_id -community_id $community_id] -calendar_name $new_value
+}
+
+#
+# Some dotlrn_project_manager specific procs
+#
Index: openacs-4/packages/dotlrn-project-manager/tcl/dotlrn-project-manager-procs.tcl~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-project-manager/tcl/Attic/dotlrn-project-manager-procs.tcl~,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-project-manager/tcl/dotlrn-project-manager-procs.tcl~	10 Jun 2005 14:41:01 -0000	1.1
@@ -0,0 +1,276 @@
+#
+#  Copyright (C) 2001, 2002 MIT
+#
+#  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 {
+
+    the dotlrn applet for calendar
+
+    @author ben@openforce.net,arjun@openforce.net
+    @version $Id: dotlrn-project-manager-procs.tcl~,v 1.1 2005/06/10 14:41:01 maltes Exp $
+}
+
+namespace eval dotlrn_project_manager {}
+
+ad_proc -public dotlrn_project_manager::package_key {
+} {
+    What package does this applet deal with?
+} {
+    return "project-manager"
+}
+
+ad_proc -public dotlrn_project_manager::my_package_key {
+} {
+    What's my package key?
+} {
+    return "dotlrn-project-manager"
+}
+
+ad_proc -public dotlrn_project_manager::applet_key {
+} {
+    What's my applet key?
+} {
+    return "dotlrn_project_manager"
+}
+
+ad_proc -public dotlrn_project_manager::get_pretty_name {
+} {
+} {
+    return "Project Manager"
+}
+
+ad_proc -public dotlrn_project_manager::add_applet {
+} {
+    Called for one time init - must be repeatable!
+    @return new pkg_id or 0 on failure
+} {
+    # FIXME: won't work with multiple dotlrn instances
+    # Use the package_key for the -url param - "/" are not allowed!
+    if {![dotlrn::is_package_mounted -package_key [package_key]]} {
+	set package_id [dotlrn::mount_package \
+                -package_key [package_key] \
+                -url [package_key] \
+                -directory_p "t"]
+
+    }
+
+    dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key]
+}
+
+ad_proc -public dotlrn_project_manager::remove_applet {
+} {
+    One-time destroy for when the entire applet is removed from dotlrn. 
+} {
+    ad_return_complaint 1 "[applet_key] remove_applet not implimented!"
+}
+
+ad_proc -public dotlrn_project_manager::project_manager_create_helper {
+    {-community_id:required}
+    {-package_id:required}
+} {
+    A helper proc to create a calendar for a comm, returns the new calendar_id
+} {
+    # create the community's calendar, the "f" is for a public calendar
+    set community_name [dotlrn_community::get_community_name $community_id]
+    # return [calendar_create [ad_conn "user_id"] "f" $community_name]
+
+    # New calendar proc
+    return [calendar::new \
+	    -owner_id [ad_conn user_id] \
+	    -private_p "f" \
+	    -calendar_name $community_name \
+	    -package_id $package_id]
+}
+
+ad_proc -public dotlrn_project_manager::add_applet_to_community {
+    community_id
+} {
+    Add the calendar applet to a specific dotlrn community
+} {
+    set results [add_applet_to_community_helper \
+	    -community_id $community_id
+    ]
+    
+    return [lindex $results 0]
+}
+
+ad_proc -public dotlrn_project_manager::add_applet_to_community_helper {
+    {-community_id:required}
+} {
+    Add the calendar applet to a specific dotlrn community
+
+    @params community_id 
+} {
+
+ 
+        # Create and Mount the Project Manager Package
+        set package_id [dotlrn::instantiate_and_mount \
+            -mount_point "project-manager" \
+            $community_id \
+            [package_key] \
+        ]
+
+	# Set up the project manager portlet for this portal/community
+
+	set portal_id [dotlrn_community::get_portal_id \
+			   -community_id $community_id \
+			  ]
+
+
+  	project_manager_portlet::add_self_to_page -portal_id $portal_id -project_manager_id $package_id
+    }
+
+	
+    # this should return the package_id
+    return $package_id
+}
+
+ad_proc -public dotlrn_project_manager::remove_applet_from_community {
+    community_id
+} {
+    remove the applet from the community
+} {        
+    ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!"
+}
+
+ad_proc -public dotlrn_project_manager::add_user {
+    user_id
+} {
+    Called once when a user is added as a dotlrn user.
+    Create a private, personal, global Project Manager for the User if they don't have one and add it to the user's portal
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::remove_user {
+    user_id
+} {
+    Remove a user from dotlrn
+
+
+} {
+ # Not yet implemented.
+}
+
+ad_proc -public dotlrn_project_manager::add_user_to_community {
+    community_id
+    user_id
+} {
+    Add a user to a community
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::remove_user_from_community {
+    community_id
+    user_id
+} {
+    Remove a user from a community
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::add_portlet {
+    portal_id
+} {
+    Set up default params for templates about to call add_portlet_helper
+    
+    @param portal_id
+} {
+
+    
+      	project_manager_portlet::add_self_to_page -portal_id $portal_id -project_manager_id 0
+
+#    add_portlet_helper $portal_id $args
+}
+
+#ad_proc -private dotlrn_project_manager::add_portlet_helper {
+#    portal_id 
+#    args        
+#} {
+#    Does the call to add the portlet to the portal. 
+#    Params for the portlet are sent to this proc by the caller.
+#} {
+#    calendar_portlet::add_self_to_page \
+            -portal_id $portal_id \
+            -pretty_name [ns_set get $args "pretty_name"] \
+            -calendar_id [ns_set get $args "calendar_id"]  \
+            -scoped_p [ns_set get $args "scoped_p"] \
+            -param_action [ns_set get $args "param_action"]
+
+#    calendar_full_portlet::add_self_to_page \
+            -portal_id $portal_id \
+            -page_name [ns_set get $args "full_portlet_page_name"] \
+            -calendar_id [ns_set get $args "calendar_id"]  \
+            -scoped_p [ns_set get $args "scoped_p"] \
+            -param_action [ns_set get $args "param_action"]
+#}
+
+ad_proc -public dotlrn_project_manager::remove_portlet {
+    portal_id
+    args
+} {
+    A helper proc to remove the underlying portlet from the given portal. 
+    This is alot simpler than add_portlet.
+
+    @param portal_id
+    @param args An ns_set with the calendar_id. 
+} { 
+    project_manager_portlet::remove_self_from_page \
+            -portal_id $portal_id \
+            -project_manager_id [ns_set get $args "project_manager_id"] 
+
+#    calendar_full_portlet::remove_self_from_page \
+            -portal_id $portal_id \
+            -calendar_id [ns_set get $args "calendar_id"] 
+}
+
+ad_proc -public dotlrn_project_manager::clone {
+    old_community_id
+    new_community_id
+} {
+    Clone this applet's content from the old community to the new one
+} {
+
+}
+
+ad_proc -public dotlrn_project_manager::change_event_handler {
+    community_id
+    event
+    old_value
+    new_value
+} { 
+    listens for the following events: rename
+} { 
+    switch $event {
+	rename {
+#	    handle_rename -community_id $community_id -old_value $old_value -new_value $new_value
+	}
+    }
+}   
+
+ad_proc -private dotlrn_project_manager::handle_rename {
+    {-community_id:required}
+    {-old_value:required}
+    {-new_value:required}
+} {
+    what to do in calendar when a dotlrn community is renamed
+} {
+#    calendar::rename -calendar_id [get_group_calendar_id -community_id $community_id] -calendar_name $new_value
+}
+
+#
+# Some dotlrn_project_manager specific procs
+#