Index: openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info,v diff -u -r1.47 -r1.48 --- openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 30 Jan 2006 02:56:08 -0000 1.47 +++ openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 21 Feb 2006 12:49:08 -0000 1.48 @@ -24,6 +24,7 @@ + Index: openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl 30 Jan 2006 02:56:08 -0000 1.21 +++ openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl 21 Feb 2006 12:49:09 -0000 1.22 @@ -25,48 +25,94 @@ @error } { - # add new rel types for student and instructors - # Roel: Figure out why this is failing but dc_student_rel - # is being created - catch { - rel_types::new -supertype dotlrn_member_rel -role_two instructor dc_instructor_rel "dotLRN Club Instructor" "dotLRN Club Instructors" dotlrn_club 0 "" user 0 "" - rel_types::new -supertype dotlrn_member_rel -role_two student dc_student_rel "dotLRN Club Student" "dotLRN Club Students" dotlrn_club 0 "" user 0 "" - } + # add new rel types for student and instructors + # Roel: Figure out why this is failing but dc_student_rel + # is being created + catch { + rel_types::new -supertype dotlrn_member_rel -role_two instructor dc_instructor_rel "dotLRN Club Instructor" "dotLRN Club Instructors" dotlrn_club 0 "" user 0 "" + rel_types::new -supertype dotlrn_member_rel -role_two student dc_student_rel "dotLRN Club Student" "dotLRN Club Students" dotlrn_club 0 "" user 0 "" + } + + rel_types::new -role_one user -role_two user patron_rel "Patron" "Patrons" user 0 65535 user 0 65535 + + # Associate a dotlrn_catalog course to an assessment session result + rel_types::new -role_one d_catalog_role -role_two as_session_role d_catalog_as_session_rel "dotLRN Catalog Course to Assessment Session" "dotLRN Catalog Courses to Assessment Sessions" dotlrn_catalog 0 1 as_sessions 0 1 + + # Associate an ecommerce product to an assessment session result + rel_types::new -role_one as_session_role -role_two ec_product_role as_session_ec_product_rel "Assessment Session to ECommerce Product" "Assessment Sessions to ECommerce Products" as_sessions 0 1 ec_product 0 1 + + rel_types::new -role_one member_rel_role -role_two user membership_patron_rel "Membership Patron" "Membership Patrons" dotlrn_member_rel 0 65535 user 0 65535 + + set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog] + set sort_order [expr [llength $attribute_list] + 1] + + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "community_id" \ + -datatype "integer" \ + -pretty_name "Template Community" \ + -sort_order $sort_order \ + -column_spec integer + + incr sort_order + + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "display_p" \ + -datatype "boolean" \ + -pretty_name "Flag to display or hide course" \ + -sort_order $sort_order \ + -default_value "true" \ + -column_spec "boolean" + + # I think default_value does not set the default for the column so we do a db_dml + db_dml "update_default" "alter table dotlrn_catalog alter display_p set default 'true'" - rel_types::new -role_one user -role_two user patron_rel "Patron" "Patrons" user 0 65535 user 0 65535 +} - # Associate a dotlrn_catalog course to an assessment session result - rel_types::new -role_one d_catalog_role -role_two as_session_role d_catalog_as_session_rel "dotLRN Catalog Course to Assessment Session" "dotLRN Catalog Courses to Assessment Sessions" dotlrn_catalog 0 1 as_sessions 0 1 +ad_proc -private dotlrn_ecommerce::after_mount { + -package_id +} { + After mount callback + + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-23 + + @return + + @error +} { - # Associate an ecommerce product to an assessment session result - rel_types::new -role_one as_session_role -role_two ec_product_role as_session_ec_product_rel "Assessment Session to ECommerce Product" "Assessment Sessions to ECommerce Products" as_sessions 0 1 ec_product 0 1 + # create instructor and assistant community + # and set the parameters + + set community_id [dotlrn_community::new \ + -community_type dotlrn_club \ + -object_type dotlrn_club \ + -community_key "instructorcommunity" \ + -pretty_name "Instructors Community"] + parameter::set_value -package_id $package_id -parameter "InstructorCommunityId" -value $community_id + + # change the "member" role to "instructor" + + dotlrn_community::set_role_pretty_data -community_id $community_id \ + -rel_type "dotlrn_member_rel" -role "member" -pretty_name "Instructor" \ + -pretty_plural "Instructors" + + set community_id [dotlrn_community::new \ + -community_type dotlrn_club \ + -object_type dotlrn_club \ + -community_key "assistantcommunity" \ + -pretty_name "Assistants Community"] + parameter::set_value -package_id $package_id -parameter "AssistantCommunityId" -value $community_id + + # change the "member" role to "assistant" + + dotlrn_community::set_role_pretty_data -community_id $community_id \ + -rel_type "dotlrn_member_rel" -role "member" -pretty_name "Assistant Instructor" \ + -pretty_plural "Assistant Instructors" - rel_types::new -role_one member_rel_role -role_two user membership_patron_rel "Membership Patron" "Membership Patrons" dotlrn_member_rel 0 65535 user 0 65535 - set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog] - set sort_order [expr [llength $attribute_list] + 1] - - content::type::attribute::new \ - -content_type "dotlrn_catalog" \ - -attribute_name "community_id" \ - -datatype "integer" \ - -pretty_name "Template Community" \ - -sort_order $sort_order \ - -column_spec integer - - incr sort_order - - content::type::attribute::new \ - -content_type "dotlrn_catalog" \ - -attribute_name "display_p" \ - -datatype "boolean" \ - -pretty_name "Flag to display or hide course" \ - -sort_order $sort_order \ - -default_value "true" \ - -column_spec "boolean" - - # I think default_value does not set the default for the column so we do a db_dml - db_dml "update_default" "alter table dotlrn_catalog alter display_p set default 'true'" } ad_proc -private dotlrn_ecommerce::after_upgrade {