Index: dotlrn_packages/README_lamsdotlrn_packages.txt
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/README_lamsdotlrn_packages.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/README_lamsdotlrn_packages.txt 12 Sep 2007 06:31:54 -0000 1.1
@@ -0,0 +1,91 @@
+LAMS 2 and .LRN 2.3 Integration packages
+----------------------------------------
+@creation-date 2007-09-12
+@cvs-id README_lamsdotlrn_packages.txt,v 1.1 2007/09/12 06:31:54 ernieg Exp
+
+These packages are released under GNU GPL version 2.0 (http://lamsfoundation.org/license/lams/2.0/)
+
+Packages:
+
+* dotlrn-lams2int
+
+ LAMS2 dotLRN portlet
+
+* lams2conf
+
+ Configuration settings
+
+* lams2int
+
+ Integration logic
+
+* lams2int-portlet
+
+ dotLRN portlet
+
+
+These packages have to be places in your /packages
+
+
+Installation Steps - .LRN Side
+-----------------------------
+
+ 1. Download lams2-dotLRN packages from the downloads page.
+ 2. Place the lams2 packages in your packages folder under your .LRN instance folder
+ 3. Navigate to Administration > Install Packages > Install from Local
+ 4. Select the dotLRN LAMS Integration Applet
+ 5. And install the four packages
+ 6. Once installed, reboot your AOLServer and go to the Site Map to configure the lams2conf parameters
+
+
+Configuring the LAMS Side
+-------------------------
+
+ 1. Follow the instructions to install LAMS. You can either build LAMS from source or follow the instructions for Window Installers or Unix Installers.
+ 2. Login to LAMS as sysadmin.
+ 3. Goto Sys Admin->Maintain integrated servers->Add New Server.
+ 4. Setup the fields to match those that you put on the .LRN side
+ 5. The id, key and name should map to the "LAMS SERVER URL", "LAMS SERVER ID" and "LAMS SERVER SECRET KEY" respectively on the LAMS properties page in .LRN (see above).
+ 6. Fill in a description of the .LRN server.
+ 7. The "Prefix" field denotes a prefix that will be added to all users from .LRN, for example if you put lrn as the prefix and accessed LAMS with a user called "user", their name in LAMS would be "lrn_user".
+ 8. The 'disabled' checkbox disables this integration, you can select this later if you wish to disable the connection.
+ 9. You can select an existing group to add .LRN users to, or add a new one.
+ 10. Enter the User Information URL, this corresponds to the "USER DATA CALLBACK URL". In .LRN these usually is http:///lams2conf/userinfo?ts=%timestamp%&un=%username%&hs=%hash%
+ 11. You can specify a timeout page that LAMS will go to if there is an error.
+
+
+Help?
+---
+
+LAMS Wiki:
+
+ http://wiki.lamsfoundation.org/display/lams
+
+LAMS Documentation
+
+ http://wiki.lamsfoundation.org/display/lamsdocs
+
+LAMS dotLRN Integration
+
+ http://wiki.lamsfoundation.org/display/lams/dotLRN
+ http://wiki.lamsfoundation.org/display/lams/Integrations
+
+Further help:
+
+ http://lamscommunity.org
+
+
+
+Contact Details:
+---------------
+
+Tech Info: Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+
+LAMS Foundation Limited
+Level 1, Dow Corning Building
+3 Innovation Road
+Macquarie University
+NSW 2109
+Australia
+Email: info@lamsfoundation.org for general enquiries and information.
+Phone +61 2 9850 7522 for LAMS Foundation.
Index: dotlrn_packages/dotlrn-lams2int/dotlrn-lams2int.info
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/dotlrn-lams2int/dotlrn-lams2int.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/dotlrn-lams2int/dotlrn-lams2int.info 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,29 @@
+
+
+
+
+ dotLRN LAMS Integration Applet
+ dotLRN LAMS Integration Applets
+ f
+ t
+
+
+ Ernie Ghiglione
+ LAMS Foundation
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: dotlrn_packages/dotlrn-lams2int/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/dotlrn-lams2int/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/dotlrn-lams2int/tcl/apm-callback-procs.tcl 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,60 @@
+# packages/dotlrn-lams2int/tcl/apm-callback-procs.tcl
+
+ad_library {
+
+ Procedures for registering implementations for the
+ dotlrn lams2int package.
+
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+ @creation-date 2007-04-17
+ @cvs-id apm-callback-procs.tcl,v 1.1 2007/09/12 06:37:01 ernieg Exp
+}
+
+namespace eval dotlrn_lams2int {}
+
+ad_proc -public dotlrn_lams2int::install {} {
+ dotLRN LAMS2INT package install proc
+} {
+ register_portal_datasource_impl
+}
+
+ad_proc -public dotlrn_lams2int::uninstall {} {
+ dotLRN LAMS2INT package uninstall proc
+} {
+ unregister_portal_datasource_impl
+}
+
+ad_proc -public dotlrn_lams2int::register_portal_datasource_impl {} {
+ Register the service contract implementation for the dotlrn_applet service contract
+} {
+ set spec {
+ name "dotlrn_lams2int"
+ contract_name "dotlrn_applet"
+ owner "dotlrn_lams2int"
+ aliases {
+ GetPrettyName dotlrn_lams2int::get_pretty_name
+ AddApplet dotlrn_lams2int::add_applet
+ RemoveApplet dotlrn_lams2int::remove_applet
+ AddAppletToCommunity dotlrn_lams2int::add_applet_to_community
+ RemoveAppletFromCommunity dotlrn_lams2int::remove_applet_from_community
+ AddUser dotlrn_lams2int::add_user
+ RemoveUser dotlrn_lams2int::remove_user
+ AddUserToCommunity dotlrn_lams2int::add_user_to_community
+ RemoveUserFromCommunity dotlrn_lams2int::remove_user_from_community
+ AddPortlet dotlrn_lams2int::add_portlet
+ RemovePortlet dotlrn_lams2int::remove_portlet
+ Clone dotlrn_lams2int::clone
+ ChangeEventHandler dotlrn_lams2int::change_event_handler
+ }
+ }
+
+ acs_sc::impl::new_from_spec -spec $spec
+}
+
+ad_proc -public dotlrn_lams2int::unregister_portal_datasource_impl {} {
+ Unregister service contract implementations
+} {
+ acs_sc::impl::delete \
+ -contract_name "dotlrn_applet" \
+ -impl_name "dotlrn_lams2int"
+}
\ No newline at end of file
Index: dotlrn_packages/dotlrn-lams2int/tcl/dotlrn-lams2int-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/dotlrn-lams2int/tcl/dotlrn-lams2int-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/dotlrn-lams2int/tcl/dotlrn-lams2int-procs.tcl 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,210 @@
+# packages/dotlrn-lams2int/tcl/dotlrn-lams2int-procs.tcl
+
+ad_library {
+
+ Procs to set up the dotLRN Lamsint applet
+
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+ @creation-date 2007-04-17
+ @cvs-id dotlrn-lams2int-procs.tcl,v 1.1 2007/09/12 06:37:01 ernieg Exp
+}
+
+namespace eval dotlrn_lams2int {
+
+ ad_proc -public applet_key {
+ } {
+ What's my applet key?
+ } {
+ return "dotlrn_lams2int"
+ }
+
+ ad_proc -public package_key {
+ } {
+ What package do I deal with?
+ } {
+ return "lams2int"
+ }
+
+ ad_proc -public my_package_key {
+ } {
+ What's my package key?
+ } {
+ return "dotlrn-lams2int"
+ }
+
+ ad_proc -public get_pretty_name {
+ } {
+ returns the pretty name
+ } {
+ return "LAMS Integration"
+ }
+
+ ad_proc -public add_applet {
+ } {
+ Add the lams2int 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 implemented!"
+ }
+
+ ad_proc -public add_applet_to_community {
+ community_id
+ } {
+ Add the lams2int applet to a specifc dotlrn community
+ } {
+ set portal_id [dotlrn_community::get_portal_id -community_id $community_id]
+
+ # create the lams2int package instance (all in one, I've
+ # mounted it)
+ set package_id [dotlrn::instantiate_and_mount $community_id [package_key]]
+
+ # set up the admin portal
+ set admin_portal_id [dotlrn_community::get_admin_portal_id \
+ -community_id $community_id
+ ]
+
+ lams2int_admin_portlet::add_self_to_page \
+ -portal_id $admin_portal_id \
+ -package_id $package_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
+ add_portlet_helper $portal_id $args
+
+ return $package_id
+ }
+ ad_proc -public remove_applet_from_community {
+ community_id
+ } {
+ remove the applet from the community
+ } {
+ ad_return_complaint 1 "[applet_key] remove_applet_from_community not implemented!"
+ }
+
+ ad_proc -public add_user {
+ user_id
+ } {
+ one time user-specifuc init
+ } {
+ # 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 specifc dotlrn community
+ } {
+ set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+
+ # use "append" here since we want to aggregate
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ ns_set put $args param_action append
+ add_portlet_helper $portal_id $args
+ }
+ ad_proc -public remove_user_from_community {
+ community_id
+ user_id
+ } {
+ Remove a user from a community
+ } {
+ set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+
+ remove_portlet $portal_id $args
+ }
+
+ ad_proc -public add_portlet {
+ portal_id
+ } {
+ A helper proc to add the underlying portlet to the given
+ # portal.
+
+ @param portal_id
+ } {
+ # simple, no type specific stuff, just set some dummy values
+
+ set args [ns_set create]
+ ns_set put $args package_id 0
+ ns_set put $args param_action overwrite
+ add_portlet_helper $portal_id $args
+ }
+ ad_proc -public add_portlet_helper {
+ portal_id
+ args
+ } {
+ A helper proc to add the underlying portlet to the given
+ # portal.
+
+ @param portal_id
+ @param args an ns_set
+ } {
+ lams2int_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]
+ }
+
+ 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 A list of key-value pairs (possibly user_id, community_id, and more)
+ } {
+ lams2int_portlet::remove_self_from_page \
+ -portal_id $portal_id \
+ -package_id [ns_set get $args 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]"
+ 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]
+ ]
+
+ return $new_package_id
+ }
+ ad_proc -public change_event_handler {
+ community_id
+ event
+ old_value
+ new_value
+ } {
+ listens for the following events:
+ } {
+ }
+
+}
\ No newline at end of file
Index: dotlrn_packages/lams2conf/lams2conf.info
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2conf/lams2conf.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2conf/lams2conf.info 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,34 @@
+
+
+
+
+ LAMS Integration Configuration
+ LAMS Integration Configurations
+ f
+ t
+ lams2conf
+
+
+ Ernie Ghiglione
+ LAMS Foundation
+ This package serves two purposes:
+
+* User data exchange between LAMS2.x and .LRN
+* Configuration setting holder for .LRN
+
+See more details in the LAMS Community or LAMS/.LRN integration webpage (http://lamsfoundation.org/wiki)
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: dotlrn_packages/lams2conf/www/userinfo.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2conf/www/userinfo.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2conf/www/userinfo.tcl 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,55 @@
+# packages/lams2conf/www/userinfo.tcl
+
+ad_page_contract {
+
+ This page return user info in CSV format to LAMS server.
+
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+ @creation-date 2007-04-16
+ @cvs-id userinfo.tcl,v 1.1 2007/09/12 06:37:01 ernieg Exp
+} {
+ ts
+ un
+ hs
+} -properties {
+} -validate {
+} -errors {
+}
+
+set timestamp $ts
+set username $un
+set hash $hs
+
+set datetime $timestamp
+
+ns_log Notice "LAMS2int: LAMS requestimestamp userinfo for user_id $username (datetime: $timestamp hash: $hash)"
+
+set lams_server_url [parameter::get -parameter lams_server_url -package_id [ad_conn package_id]]
+set server_key [parameter::get -parameter server_key -package_id [ad_conn package_id]]
+set server_id [parameter::get -parameter server_id -package_id [ad_conn package_id]]
+
+
+
+set plaintext [string tolower [concat $timestamp$username$server_id$server_key]]
+set hashValue [string tolower [ns_sha1 $plaintext]]
+
+if {![string equal [string tolower $hash] $hashValue]} {
+
+ ns_log Warning "LAMSint: userinfo request hash authentication failed. localhash: $hashValue requesthash: $hash"
+ ns_write "HTTP/1.1 401 Usernameauthenticated"
+
+}
+
+# get the user info we need to pass to LAMS
+set first_name [acs_user::get_element -user_id $username -element first_names]
+set last_name [acs_user::get_element -user_id $username -element last_name]
+set email [acs_user::get_element -user_id $username -element email]
+
+ns_log Notice "LAMSint: userinfo transfered to LAMS (user_id $username)"
+
+# send it to LAMS
+ReturnHeaders "text/plain"
+ns_write "'',$first_name,$last_name,'','','','','','','','',$email,'',''"
+
+
+
Index: dotlrn_packages/lams2int/lams2int.info
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/lams2int.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/lams2int.info 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,26 @@
+
+
+
+
+ .LRN LAMS2.x Integration
+ .LRN LAMS2.x Integration
+ f
+ t
+
+
+ Ernie Ghiglione
+ .LRN LAMS2.x integration package
+ LAMS Foundation
+ .LRN LAMS2.x integration package
+ 0
+
+
+
+
+
+
+
+
+
+
+
Index: dotlrn_packages/lams2int/lib/user-lams2int.adp
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/lib/user-lams2int.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/lib/user-lams2int.adp 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
Index: dotlrn_packages/lams2int/lib/user-lams2int.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/lib/user-lams2int.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/lib/user-lams2int.tcl 12 Sep 2007 06:37:01 -0000 1.1
@@ -0,0 +1,48 @@
+# packages/lams2int/lib/user-lams2int.tcl
+#
+# @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+# @creation-date 2007-04-17
+# @cvs-id user-lams2int.tcl,v 1.1 2007/09/12 06:37:01 ernieg Exp
+
+template::list::create \
+ -name d_lesson \
+ -multirow d_lesson \
+ -html {width 100%} \
+ -key lesson_id \
+ -no_data "No lessons available" \
+ -elements {
+ lesson_name {
+ label "Title"
+ display_eval {[string_truncate -len 25 -ellipsis "..." $display_title]}
+ link_url_eval {[export_vars -base $comm_url/lams2int/ lesson_id]}
+ html { width 50% }
+ link_html {title "View lesson"}
+ }
+ subject {
+ label "Subject"
+ display_eval {[dotlrn_community::get_community_name $community_id]}
+ html { align center width 50% }
+ link_url_eval {[dotlrn_community::get_community_url $community_id]}
+ link_html {title "Access Course"}
+ }
+ }
+
+set user_id [ad_conn user_id]
+
+foreach package $package_id {
+
+ db_multirow -extend {comm_url Community} -append d_lesson select_d_lesson {
+ select
+ lesson_id, display_title, introduction, hide, start_time, community_id
+ from
+ lams_lessons
+ where
+ package_id = :package
+ and
+ hide = 'f'
+ order by start_time desc
+ } {
+ set comm_url [dotlrn_community::get_community_url $community_id]
+ }
+
+}
\ No newline at end of file
Index: dotlrn_packages/lams2int/sql/postgresql/lams2int-create.sql
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/sql/postgresql/lams2int-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/sql/postgresql/lams2int-create.sql 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,61 @@
+--
+-- packages/lams2int/sql/postgresql/lams2int-create.sql
+--
+-- @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+-- @creation-date 2007-04-16
+-- @cvs-id lams2int-create.sql,v 1.1 2007/09/12 06:37:02 ernieg Exp
+--
+-- Copyright (C) 2007 LAMS Foundation
+--
+-- This package 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; version 2 of the License,
+--
+-- It 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.
+--
+
+
+-- Configuration items table for LAMS/.LRN integration
+
+CREATE TABLE lams_lessons (
+ lesson_id int
+ constraint lams_lessons_lesson_id_pk
+ references acs_objects (object_id)
+ primary key,
+ user_id int
+ constraint lams_lessons_user_id_fk
+ references users (user_id),
+ package_id int
+ constraint lams_lessons_pack_id_fk
+ references apm_packages (package_id),
+ community_id int
+ constraint lams_lessons_comm_id_fk
+ references dotlrn_communities_all (community_id),
+ learning_session_id int,
+ display_title varchar(250),
+ introduction text,
+ hide boolean default 'f' not null,
+ start_time timestamptz not null default current_timestamp,
+ end_time timestamptz
+);
+
+
+begin;
+select acs_object_type__create_type (
+ 'lams_lesson', -- object_type
+ 'LAMS Lesson', -- pretty_name
+ 'LAMS Lessons', -- pretty_plural
+ 'acs_object', -- supertype
+ 'lams_lessons', -- table_name
+ 'seq_id', -- id_column
+ null, -- name_method
+ 'f',
+ null,
+ null
+ );
+end;
+
+\i lams2int-package-create.sql
\ No newline at end of file
Index: dotlrn_packages/lams2int/sql/postgresql/lams2int-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/sql/postgresql/lams2int-package-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/sql/postgresql/lams2int-package-create.sql 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,63 @@
+--
+-- packages/lams2int/sql/postgresql/lams2int-package-create.sql
+--
+-- @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+-- @creation-date 2007-04-16
+-- @cvs-id lams2int-package-create.sql,v 1.1 2007/09/12 06:37:02 ernieg Exp
+--
+
+create or replace function lams_lesson__new (
+ integer, -- learning_session_id
+ varchar, -- display_title
+ varchar, -- introduction
+ boolean, -- hide
+ timestamp with time zone, -- creation_date
+ integer, -- creation_user
+ varchar, -- creation_ip
+ integer, -- package_id
+ integer -- community_id
+)
+returns integer as '
+declare
+ p_learning_session_id alias for $1;
+ p_display_title alias for $2;
+ p_introduction alias for $3;
+ p_hide alias for $4;
+ p_creation_date alias for $5;
+ p_creation_user alias for $6;
+ p_creation_ip alias for $7;
+ p_package_id alias for $8;
+ p_community_id alias for $9;
+
+ v_lesson_id integer;
+begin
+ v_lesson_id := acs_object__new (
+ v_lesson_id, -- object_id
+ ''lams_lesson'', -- object_type
+ p_creation_date, -- creation_date
+ p_creation_user, -- creation_user
+ p_creation_ip, -- creation_ip
+ p_package_id, -- context_id
+ ''t'' -- security_inherit_p
+ );
+
+ insert into lams_lessons
+ (lesson_id, user_id, community_id, learning_session_id, display_title, introduction, hide, start_time, package_id)
+ values
+ (v_lesson_id, p_creation_user, p_community_id, p_learning_session_id, p_display_title, p_introduction, p_hide, p_creation_date, p_package_id);
+ return v_lesson_id;
+end;
+' language 'plpgsql';
+
+create or replace function lams_lesson__delete (
+ integer -- lesson_id
+)
+returns integer as '
+declare
+ p_lesson_id alias for $1;
+begin
+ perform acs_object__delete(p_lesson_id);
+ delete from lams_lessons where lesson_id = p_lesson_id;
+ return 0;
+end;
+' language 'plpgsql';
\ No newline at end of file
Index: dotlrn_packages/lams2int/tcl/lams2int-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/tcl/lams2int-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/tcl/lams2int-procs.tcl 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,139 @@
+# packages/lams2int/tcl/lams2int-procs.tcl
+
+ad_library {
+
+ LAMS2.x Integration Procedures
+
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+ @creation-date 2007-04-16
+ @cvs-id lams2int-procs.tcl,v 1.1 2007/09/12 06:37:02 ernieg Exp
+}
+
+#
+# Copyright (C) 2005 LAMS Foundation
+#
+# This package 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; version 2 of the License
+#
+# It 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.
+#
+
+namespace eval lams2int {}
+
+ad_proc -public lams2int::add {
+ {-learning_session_id:required}
+ {-display_title:required}
+ {-introduction ""}
+ {-hide "f"}
+ {-start_date ""}
+ {-creation_user}
+ {-package_id}
+ {-community_id}
+} {
+ Adds a new LAMS lesson to .LRN
+
+ @param learning_session_id LAMS learning session id
+ @param display_title title for the lesson to be displayed in .LRN
+ @param introduction Introduction to be displayed in .LRN
+ @param hide boolean, whether the lesson should be hiden to students or not
+ @param start_date start date to show the lesson to students
+ @param creation_user creation user
+ @param package_id package id
+ @param community_id the community where this lesson will live.
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+
+} {
+
+ # this should kick in *after* we get a learning_session_id from
+ # LAMS
+
+ set creation_ip [ad_conn peeraddr]
+
+ db_transaction {
+ set lesson_id [db_exec_plsql new_seq {
+ select lams_lesson__new (
+ :learning_session_id,
+ :display_title,
+ :introduction,
+ :hide,
+ current_timestamp,
+ :creation_user,
+ :creation_ip,
+ :package_id,
+ :community_id
+ );
+
+ }
+ ]
+
+ }
+
+ return $lesson_id
+
+}
+
+ad_proc -public lams2int::get_datetime {
+
+} {
+ Generates the datetime for the hash
+
+} {
+
+ set user_now_time [lc_time_system_to_conn [dt_systime]]
+ return [lc_time_fmt $user_now_time "%B %d,%Y %r"]
+
+}
+
+ad_proc -public lams2int::get_lams_server_url {
+
+} {
+ Gets the lams_server_url from the LAMS Configuration package
+
+} {
+
+ set lams2conf_package_id [db_string pack_id_lams2_conf {select package_id from apm_packages where package_key = 'lams2conf'}]
+ return [parameter::get -parameter lams_server_url -package_id $lams2conf_package_id]
+
+
+}
+
+
+ad_proc -public lams2int::get_server_id {
+
+} {
+ Gets the lams_server_id from the LAMS2.x Configuration package (parameter)
+
+} {
+
+ set lams2conf_package_id [db_string pack_id_lams_conf {select package_id from apm_packages where package_key = 'lams2conf'}]
+ return [parameter::get -parameter server_id -package_id $lams2conf_package_id]
+
+}
+
+ad_proc lams2int::get_server_key {
+
+} {
+ Gets the lams_server_key from the LAMS Configuration package (parameter)
+
+} {
+
+ set lams2conf_package_id [db_string pack_id_lams_conf {select package_id from apm_packages where package_key = 'lams2conf'}]
+ return [parameter::get -parameter server_key -package_id $lams2conf_package_id]
+
+}
+
+ad_proc lams2int::get_request_source {
+
+} {
+ Gets the request_source from the LAMS Configuration package (parameter)
+
+} {
+
+ set lams2conf_package_id [db_string pack_id_lams_conf {select package_id from apm_packages where package_key = 'lams2conf'}]
+ return [parameter::get -parameter request_source -package_id $lams2conf_package_id]
+
+}
\ No newline at end of file
Index: dotlrn_packages/lams2int/tcl/lams2int-ws-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/tcl/lams2int-ws-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/tcl/lams2int-ws-procs.tcl 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,66 @@
+# packages/lams2int/tcl/lams2int-ws-procs.tcl
+
+ad_library {
+
+ LAMS2.x Web Services Library
+
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+ @creation-date 2007-04-16
+ @cvs-id lams2int-ws-procs.tcl,v 1.1 2007/09/12 06:37:02 ernieg Exp
+}
+namespace eval lams2int::ws {}
+
+ad_proc -public lams2int::ws::generate_hash {
+ {-datetime ""}
+ {-username ""}
+ {-method ""}
+ {-server_id ""}
+ {-server_key ""}
+} {
+ Returns the validation hash. If method is not passed, it will not
+ be included in the hash
+
+ @param datetime
+ @param username
+ @param method (author, monitor, learner)
+ @param server_id
+ @param server_key
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+
+} {
+
+
+ if {[empty_string_p $datetime]} {
+
+ set datetime [lams2int::get_datetime]
+
+ }
+
+ if {[empty_string_p $username]} {
+ set username [ad_conn user_id]
+
+ }
+
+ if {[empty_string_p $server_id]} {
+ set server_id [string trim [lams2int::get_server_id]]
+ }
+
+ if {[empty_string_p $server_key]} {
+ set server_key [string trim [lams2int::get_server_key]]
+ }
+
+ if {[empty_string_p $method]} {
+ # we don't have a method, therefore we just create the
+ # rawstring without it
+
+ set rawstring [string tolower [concat $datetime$username$server_id$server_key]]
+ } else {
+
+ set rawstring [string tolower [concat $datetime$username$method$server_id$server_key]]
+ }
+
+ ns_log Notice "Hash string: [string tolower [ns_sha1 $rawstring]] $datetime $server_key --- $rawstring"
+
+ return [string tolower [ns_sha1 $rawstring]]
+
+}
\ No newline at end of file
Index: dotlrn_packages/lams2int/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/www/index.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/www/index.adp 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,58 @@
+
+@title@
+@context@
+
+@display_title@
+
+
+Learner's Introduction:
+
+
+@introduction;noquote@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+ @the_comments;noquote@
+
+
+
+ |
+
+
Index: dotlrn_packages/lams2int/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/www/index.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/www/index.tcl 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,50 @@
+# packages/lams2int/www/index.tcl
+
+ad_page_contract {
+
+ Jumps directly to a LAMS sequence
+
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+ @creation-date 2007-04-17
+ @cvs-id index.tcl,v 1.1 2007/09/12 06:37:02 ernieg Exp
+} {
+ lesson_id
+} -properties {
+} -validate {
+} -errors {
+}
+
+
+set lams_server_url [lams2int::get_lams_server_url]
+set username [ad_verify_and_get_user_id]
+set datetime [lams2int::get_datetime]
+set server_id [lams2int::get_server_id]
+set hashValue [lams2int::ws::generate_hash -datetime $datetime -username $username -method "learner"]
+set course_id [dotlrn_community::get_community_id]
+
+
+# LAMS Sequence info
+
+db_1row seq_info {select display_title, introduction, learning_session_id, user_id from lams_lessons where lesson_id = :lesson_id}
+
+set introduction [ad_convert_to_html $introduction]
+
+set title $display_title
+set context [list "View Lesson: $display_title"]
+
+
+# if the user that started the sequence is the same as the user
+# trying to access the sequence, we give him admin access
+if {[string equal $user_id $username]} {
+ set admin_p 1
+
+ set hashmonitor [lams2int::ws::generate_hash -datetime $datetime -username $username -method "monitor"]
+
+} else {
+ set admin_p 0
+}
+
+
+# General comments
+set the_comments [general_comments_get_comments -print_content_p 1 $lesson_id]
+set general_comments_link [general_comments_create_link -object_name "$display_title" -link_text "Add comments to $display_title" -link_attributes {style="font:85% arial; border: solid 1px black; background-color: \\#e1e1e1; text-align: center; padding: 1px; padding-left: 8px; padding-right: 8px; color: black; text-decoration: none; white-space: nowrap;"} $lesson_id [ns_conn url]?[ns_conn query]]
Index: dotlrn_packages/lams2int/www/admin/add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/www/admin/add-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/www/admin/add-2.tcl 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,55 @@
+# packages/lams2int/www/admin/add-2.tcl
+
+ad_page_contract {
+
+ Creates a new instance of LAMS sequence and adds a new lesson to a course
+
+ @author Ernie Ghiglione (ErnieG@melcoe.mq.edu.au)
+ @creation-date 2007-04-16
+ @cvs-id add-2.tcl,v 1.1 2007/09/12 06:37:02 ernieg Exp
+} {
+ name
+ lesson_id:integer
+ sequence_id:integer
+ introduction:optional
+} -properties {
+} -validate {
+} -errors {
+}
+
+
+# get parameters data
+set datetime [lams2int::get_datetime]
+set lams_server_url [lams2int::get_lams_server_url]
+set server_id [lams2int::get_server_id]
+set username [ad_verify_and_get_user_id]
+
+# get course data
+set course_id [dotlrn_community::get_community_id]
+
+
+# methods
+
+# start, schedule, delete
+
+set method "start"
+
+set hashSeq [lams2int::ws::generate_hash -datetime $datetime -username $username]
+
+set lesson_url "$lams_server_url/services/xml/LessonManager?method=$method&serverId=$server_id&ldId=$sequence_id&datetime=[ad_urlencode $datetime]&hashValue=$hashSeq&username=$username&courseId=$course_id&title=$name&desc=$introduction&country=AU&lang=en"
+
+
+set xml [lindex [ad_httpget -url $lesson_url -timeout 30] 1]
+
+set xml [encoding convertfrom utf-8 $xml]
+set doc [dom parse $xml]
+set content [$doc documentElement]
+
+
+set lesson_id [$content getAttribute lessonId]
+
+set seq_id [lams2int::add -learning_session_id $lesson_id -display_title $name -introduction $introduction \
+ -hide "f" -creation_user $username -package_id [ad_conn package_id] -community_id $course_id]
+
+ad_returnredirect -message "Your lesson $name is now available" -html [dotlrn_community::get_community_url $course_id]
+
Index: dotlrn_packages/lams2int/www/admin/add.adp
===================================================================
RCS file: /usr/local/cvsroot/dotlrn_packages/lams2int/www/admin/add.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dotlrn_packages/lams2int/www/admin/add.adp 12 Sep 2007 06:37:02 -0000 1.1
@@ -0,0 +1,232 @@
+
+@title@
+@context@
+
+
+
+
+
+