Index: openacs-4/packages/dotlrn-catalog/dotlrn-catalog.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/dotlrn-catalog.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/dotlrn-catalog.info 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,34 @@
+
+
+
+
+ dotLRN Catalog
+ dotLRN Catalog's
+ f
+ t
+ dotlrn-catalog
+
+
+ Miguel Marin
+ 2005-02-02
+ Viaro Networks
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,89 @@
+
+
+
+ Add this course to one category.
+ Manage Category Tree
+ and has
+ Assessment
+ Associate
+ Associate this course
+ Associate to this class
+ Associate to this community
+ Already Associated
+ Categories
+ Categorize
+ Categorized Courses
+ Class
+ Class Name
+ Community Name:
+ Community
+ Confirm Delete Of
+ Course Administration
+ DotLRN Catalog Index
+ Course Info:
+ Course Key:
+ Your Course List
+ Course Name:
+ Courses
+ Create a new version of
+ Delete
+ Delete Course
+ Delete This Course
+ Department Name
+ Description
+ Do you Still want to delete it?
+ DotLRN
+ DotLRN Classes
+ DotLRN Communities
+ DotLRN List
+ New Course Version
+ Email:
+ Enroll
+ Enroll Not Available
+ Grant
+ Grant List
+ Grant Permissions
+ Grant permissions to other users
+ Granted
+ Grant/Revoke
+ and has <b>No</b> associations to dotLRN class or community
+ has one association to dotLRN class or community
+ is associated to:
+ Check/uncheck all rows
+ Make This Course Live
+ Manage Permissions
+ <b>The course key is already taken</b>
+ New Course
+ New Course Version
+ No
+ Not Allowed
+ Not Associate
+ Not Associated
+ One Course Information
+ Permission:
+ Revision List
+ Revisions
+ Revoke
+ Revoke Permissions
+ search for entire email or just part of it
+ search for one first name or last name.
+ Search Users
+ Search User Name:
+ Search for user Email:
+ Search Users To Grant Permissions On
+ See All Versions
+ Subject Name
+ Term Name
+ This course has
+ Check/uncheck this row, and select an action to perform below
+ To
+ associations to dotLRN classes or communities
+ Uncategorized Courses
+ User Name:
+ users to grant permissions that match that search
+ Version
+ Versions
+ Watch
+ Watch Association
+ Yes
+
Index: openacs-4/packages/dotlrn-catalog/lib/community-chunk.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/community-chunk.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/community-chunk.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,5 @@
+
+
Index: openacs-4/packages/dotlrn-catalog/lib/community-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/community-chunk.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/community-chunk.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,10 @@
+ad_page_contract {
+ Displays the information of one dotLRN community
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 08-01-2005
+} {
+
+}
+
+db_1row get_community_info { }
Index: openacs-4/packages/dotlrn-catalog/lib/community-chunk.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/community-chunk.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/community-chunk.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+
+
+
+ select pretty_name, description, url from dotlrn_clubs_full
+ where community_id = :community_id
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/lib/course-chunk.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/course-chunk.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/course-chunk.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,91 @@
+
+
Index: openacs-4/packages/dotlrn-catalog/lib/course-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/course-chunk.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/course-chunk.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,25 @@
+ad_page_contract {
+ Displays the information of one course
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 08-01-2005
+} {
+
+}
+
+set dotlrn_url [dotlrn::get_url]
+if { ![info exists index] } {
+ set index ""
+}
+
+if { ![info exists asmid] } {
+ set asmid "-1"
+}
+
+set category_p [db_string get_category { } -default -1]
+
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+set tree_id [db_string get_tree_id { } -default "-1"]
+
+# Get the category name
+set category_name "[category::get_name [category::get_mapped_categories $course_id]]"
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+
+
+ select 1 from category_object_map where object_id = :course_id
+
+
+
+
+
+ select tree_id from category_tree_map where object_id = :cc_package_id
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,8 @@
+
+#dotlrn-catalog.dep_name#: @department_name;noquote@
+#dotlrn-catalog.term_name#: @term_name;noquote@
+#dotlrn-catalog.subject_name#: @class_name;noquote@
+#dotlrn-catalog.class_name#: @pretty_name;noquote@
+#dotlrn-catalog.description#: @description;noquote@
+
+
Index: openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,10 @@
+ad_page_contract {
+ Displays the information of one dotLRN class
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 08-01-2005
+} {
+
+}
+
+db_1row get_class_info { }
Index: openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/dotlrn-chunk.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+
+
+
+ select department_name, term_name, class_name, pretty_name, description, url
+ from dotlrn_class_instances_full
+ where class_instance_id = :class_id
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/lib/tree-chunk.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/tree-chunk.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/tree-chunk.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,11 @@
+#dotlrn-catalog.categorized#:
+@tree_view;noquote@
+
+
+ #dotlrn-catalog.uncategorized#:
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/tree-chunk.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,42 @@
+ad_page_contract {
+ Display an ident tree of categories and courses.
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 11-02-2005
+
+} {
+
+}
+
+
+set tree_list [category_tree::get_tree -all $tree_id]
+set tree_view ""
+
+set cat_obj_list [dotlrn_catalog::get_categories_from_tree -tree_id $tree_id]
+
+# Display all courses associated to one category
+foreach element $tree_list {
+ set level [lindex $element 3]
+ set spacer ""
+ for { set i 0 } { $i < $level } { incr i } {
+ append spacer " "
+ }
+ if { [string equal $level 1] } {
+ append tree_view "${spacer}[lindex $element 1] "
+ } else {
+ append tree_view "${spacer}[lindex $element 1] "
+ }
+ foreach item $cat_obj_list {
+ if { [string equal [lindex $item 0] [lindex $element 0] ]} {
+ set course_id "[lindex $item 1]"
+ db_0or1row get_course_info { }
+ append tree_view "${spacer}   ($course_key) $course_name "
+ }
+ }
+}
+
+# Display courses without category
+set uncat_p 0
+db_multirow uncat get_courses_uncat { } {
+ set uncat_p 1
+}
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/lib/tree-chunk.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/tree-chunk.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/lib/tree-chunk.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,26 @@
+
+
+
+
+
+ select dc.course_id, dc.course_key, dc.course_name
+ from dotlrn_catalog dc, cr_items ci
+ where dc.course_id = ci.live_revision and dc.course_id = :course_id
+
+
+
+
+
+
+ select dc.course_id, dc.course_key, dc.course_name
+ from dotlrn_catalog dc, cr_items ci
+ where dc.course_id = ci.live_revision and dc.course_id not in (
+ select object_id from category_object_map where category_id in (
+ select category_id from categories where tree_id =:tree_id
+ )
+ )
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/sql/oracle/dotlrn-catalog-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/sql/oracle/dotlrn-catalog-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/sql/oracle/dotlrn-catalog-create.sql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,13 @@
+-- dotLRN Catalog Data Model
+-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+-- creation-date 2005-01-31
+
+begin
+ acs_rel_type.create_role(''d_catalog_role'', ''DotLRN Course Catalog Role'', ''DotLRN Course Catalog Role'');
+ acs_rel_type.create_role(''dotlrn_class_role'', ''dotLRN Class Role'', ''dotLRN Class Role'');
+ acs_rel_type.create_role(''dotlrn_com_role'', ''dotLRN Community Role'', ''dotLRN Community Role'');
+
+ commit;
+end;
+/
+show errors
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/sql/oracle/dotlrn-catalog-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/sql/oracle/dotlrn-catalog-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/sql/oracle/dotlrn-catalog-drop.sql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,10 @@
+--
+-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+-- creation-date 2005-01-31
+--
+
+begin
+ acs_rel_type.drop_type('dotlrn_catalog_rel');
+end;
+/
+show errors
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/sql/postgresql/dotlrn-catalog-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/sql/postgresql/dotlrn-catalog-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/sql/postgresql/dotlrn-catalog-create.sql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,18 @@
+-- DotLRN Catalog Relation Model
+-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+-- creation-date 2005-01-31
+
+
+create function inline_0 ()
+returns integer as '
+begin
+ PERFORM acs_rel_type__create_role(''d_catalog_role'', ''DotLRN Catalog Role'', ''DotLRN Catalog Role'');
+ PERFORM acs_rel_type__create_role(''dotlrn_class_role'', ''dotLRN Class Role'', ''dotLRN Class Role'');
+ PERFORM acs_rel_type__create_role(''dotlrn_com_role'', ''dotLRN Community Role'', ''dotLRN Community Role'');
+
+ return 0;
+end;' language 'plpgsql';
+
+select inline_0 ();
+
+drop function inline_0 ();
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/sql/postgresql/dotlrn-catalog-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/sql/postgresql/dotlrn-catalog-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/sql/postgresql/dotlrn-catalog-drop.sql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,8 @@
+--
+--
+-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+-- creation-date 2005-01-31
+--
+
+drop table c_catalog;
+select acs_rel_type__drop_type('dotlrn_catalog_rel', 'f');
Index: openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,105 @@
+# packages/course-catalog/tcl/apm-callbacks-procs.tcl
+
+ad_library {
+
+ APM callback for dotlrn catalog
+
+ @author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-27
+}
+
+namespace eval dotlrn-catalog {}
+
+ad_proc -private dotlrn-catalog::package_install {
+} {
+ create the CR type datamodel for the course catalog
+
+ @author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-27
+} {
+
+ # lets create the CR type tables to support the course catalog
+
+ content::type::new -content_type "dotlrn_catalog" \
+ -pretty_name "DotLRN Catalog" \
+ -pretty_plural "DotLRN Catalog" \
+ -table_name "dotlrn_catalog" \
+ -id_column "course_id"
+
+ # now set up the attributes that by default we need for the course
+ content::type::attribute::new \
+ -content_type "dotlrn_catalog" \
+ -attribute_name "course_key" \
+ -datatype "string" \
+ -pretty_name "Course Key" \
+ -pretty_plural "Course Key" \
+ -sort_order 1 \
+ -column_spec "varchar(50)"
+
+ content::type::attribute::new \
+ -content_type "dotlrn_catalog" \
+ -attribute_name "course_name" \
+ -datatype "string" \
+ -pretty_name "Course Name" \
+ -sort_order 2 \
+ -column_spec "varchar(200)"
+
+ content::type::attribute::new \
+ -content_type "dotlrn_catalog" \
+ -attribute_name "course_info" \
+ -datatype "text" \
+ -pretty_name "Course Information" \
+ -sort_order 3 \
+ -column_spec "text"
+
+ content::type::attribute::new \
+ -content_type "dotlrn_catalog" \
+ -attribute_name "assessment_id" \
+ -datatype "integer" \
+ -pretty_name "Assessment ID" \
+ -sort_order 4 \
+ -column_spec "integer"
+
+ # To store the courses in the content repository
+ set folder_id [content::folder::new -name "DotLRN Catalog" -label "DotLRN Catalog"]
+ content::folder::register_content_type -folder_id $folder_id -content_type "dotlrn_catalog"
+
+ # To associate one course to dotlrn class
+ rel_types::new -role_one d_catalog_role -role_two dotlrn_class_role dotlrn_catalog_class_rel \
+ "DotLRN Catalog Class" "DotLRN Catalog Class" dotlrn_catalog 0 1 dotlrn_class_instance 0 1
+ # To associate one course to dotrln community
+ rel_types::new -role_one d_catalog_role -role_two dotlrn_com_role dotlrn_catalog_dotcom_rel \
+ "DotLRN Catalog Community" "DotLRN Catalog Community" dotlrn_catalog 0 1 dotlrn_club 0 1
+}
+
+
+ad_proc -private dotlrn-catalog::package_mount {
+ -package_id
+ -node_id
+} {
+ create the category tree for dotlrn catalog
+
+ @author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 11-02-2005
+} {
+ # To categorize courses
+ set tree_id [category_tree::add -name "dotlrn-course-catalog"]
+ category_tree::map -tree_id $tree_id -object_id $package_id -assign_single_p "t"
+}
+
+ad_proc -private dotlrn-catalog::package_uninstall {
+} {
+ drops the CR type datamodel for the course catalog
+
+ @author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 2005-01-27
+} {
+ content::type::attribute::delete -content_type "dotlrn_catalog" -attribute_name "course_key"
+ content::type::attribute::delete -content_type "dotlrn_catalog" -attribute_name "course_name"
+ content::type::attribute::delete -content_type "dotlrn_catalog" -attribute_name "course_info"
+ content::type::attribute::delete -content_type "dotlrn_catalog" -attribute_name "assessment_id"
+ set folder_id [dotlrn_catalog::get_folder_id]
+ content::folder::unregister_content_type -folder_id $folder_id -content_type "dotlrn_catalog"
+ content::folder::delete -folder_id $folder_id -cascade_p "t"
+ content::type::delete -content_type "dotlrn_catalog"
+}
Index: openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs-oracle.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,26 @@
+
+
+oracle 8.1.6
+
+
+
+ begin
+ :1 := acs_rel.new (
+ rel_type => :type,
+ object_id_one => :course_id,
+ object_id_two => :class_id);
+ end;
+
+
+
+
+
+ begin
+ :1 := acs_rel.delete (
+ rel_id => :rel_id);
+ end;
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs-postgresql.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,29 @@
+
+
+postgresql 7.4
+
+
+
+ select acs_rel__new (
+ null,
+ :type,
+ :course_id,
+ :object_id,
+ null,
+ null,
+ null
+ )
+
+
+
+
+
+
+ select acs_rel__delete (
+ :rel_id
+ )
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,244 @@
+ad_library {
+
+ Tcl API for dotlrn_catalog store and manipulation
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @Viaro Networks (href=www.viaro.net>www.viaro.net)
+}
+
+namespace eval dotlrn_catalog {}
+
+ad_proc -private dotlrn_catalog::get_folder_id { } {
+ Returns the folder_id of the folder with the name "DotLRN Catalog"
+} {
+ return [db_string check_folder_name { } ]
+}
+
+ad_proc -private dotlrn_catalog::get_item_id {
+ -revision_id:required
+ } {
+ Returns the item_id in the CR with the name @name@ under folder dotlrn_catalog
+ @revision_id@ The revision_id to get the item id in the CR
+} {
+ return [db_string get_item_from_revision { } ]
+}
+
+ad_proc -public dotlrn_catalog::get_creation_user {
+ -object_id:required
+} {
+ Returns the creation_user of the object_id, returns -1 otherwise
+ @object_id@
+} {
+ return [db_string get_creation_user { } -default -1]
+}
+
+ad_proc -private dotlrn_catalog::set_live {
+ -revision_id:required
+} {
+ Sets the live_revision to @revision_id@.
+ @revision_id@ The revision to set as live
+} {
+ db_transaction {
+ db_dml set_live_revision { }
+ }
+}
+
+
+ad_proc -private dotlrn_catalog::check_name {
+ -name:required
+} {
+ Checks if @name@ already exists in dotlrn_catalog table
+ @name@ The name of the course_key
+} {
+ if { [string equal [db_string check_item_name { } -default -1] "-1"] } {
+ return 1
+ } else {
+ return 0
+ }
+}
+
+
+ad_proc -private dotlrn_catalog::add_relation {
+ -course_id:required
+ -object_id:required
+ -type:required
+} {
+ Add a new relation between course_id from dotlrn_catalog and object_id where relation type is type
+ @course_id The id of the course in dotlrn_catalog
+ @class_id The class_instance_id of the class in dotlrn
+ @type@ The type of the relation
+} {
+ db_exec_plsql add_relation { }
+}
+
+ad_proc -private dotlrn_catalog::has_relation_rel_id {
+ -course_id:required
+} {
+ Returns the class_id of dotlrn_class_instance related to course_id, returns 0 otherwise.
+ @course_id The id of the course in dotlrn_catalog
+} {
+ return [db_string has_relation_rel_id { } -default 0]
+}
+
+ad_proc -private dotlrn_catalog::has_relation {
+ -course_id:required
+} {
+ Returns 1 if there is a class_id of dotlrn_class_instance related to course_id, returns 0 otherwise.
+ @course_id The id of the course in dotlrn_catalog
+} {
+ if { [db_string has_relation { } -default 0] == 0 } {
+ return 0
+ } else {
+ return 1
+ }
+}
+
+ad_proc -private dotlrn_catalog::relation_between {
+ -object_one:required
+ -object_two:required
+} {
+ Returns 1 if object_one is related to object_two, returns 0 otherwise.
+ @object_one
+ @object_two
+} {
+ if { [db_string relation_between { } -default 0] == 0 } {
+ return 0
+ } else {
+ return 1
+ }
+}
+
+
+ad_proc -private dotlrn_catalog::com_has_relation {
+ -community_id:required
+} {
+ Returns 1 if there is a community of dotlrn related to course_id, returns 0 otherwise.
+ @community_id The id of the community in dotlrn
+} {
+ if { [db_string com_has_relation { } -default 0] == 0 } {
+ return 0
+ } else {
+ return 1
+ }
+}
+
+
+ad_proc -private dotlrn_catalog::check_live_latest {
+ -revision_id:required
+} {
+ Checks if @revision_id@ is the live revision or the latest revision in cr_items
+ @revision_id@
+} {
+ set live [db_string check_live { } -default 0]
+ set latest [db_string check_latest { } -default 0]
+ if { [string equal $live "0"] && [string equal $latest "0"] } {
+ return 1
+ } else {
+ return 0
+ }
+}
+
+ad_proc -private dotlrn_catalog::delete_row {
+ -course_id:required
+} {
+ Deletes the row of dotlrn_catalog table and cr_revisions table where revision_id = @course_id@
+ @course_id The id of the course in dotlrn_catalog
+} {
+ if { [dotlrn_catalog::check_live_latest -revision_id $course_id] } {
+ db_transaction {
+ db_dml delete_row { }
+ db_dml delete_rev { }
+ }
+ dotlrn_catalog::delete_relation -course_id $course_id
+ }
+}
+
+ad_proc -private dotlrn_catalog::delete_relation {
+ -rel_id:required
+} {
+ Deletes the relation of dotlrn_catalog and dotrln class or community
+ @rel_id The id of the realtion
+} {
+ db_exec_plsql remove_relation { }
+}
+
+ad_proc -private dotlrn_catalog::grant_permissions {
+ -party_id:required
+ -object_id:required
+ -creation_user:required
+} {
+ Gives admin permission to @party_id@ over @object_id@ and over all assessment_id created
+ by @creation_user@
+ @party_id@ The user_id to give permissions
+ @object_id@ The course_id that the @party_id@ will have permissions on
+ @creation_user@ The user_id of the user that creates the course_id
+} {
+ permission::grant -party_id $party_id -object_id $object_id -privilege "admin"
+ set asm_package_id [apm_package_id_from_key assessment]
+
+ db_foreach assessment { } {
+ if {[permission::permission_p -party_id $creation_user -object_id $assessment_id -privilege "admin"] == 1} {
+ permission::grant -party_id $party_id -object_id $assessment_id -privilege "admin"
+ }
+ }
+}
+
+ad_proc -private dotlrn_catalog::revoke_permissions {
+ -party_id:required
+ -object_id:required
+ -creation_user:required
+} {
+ Revokes admin permission to @party_id@ over @object_id@ and over all assessment_id created
+ by @creation_user@
+ @party_id@ The user_id to revoke permissions
+ @object_id@ The course_id over wich @party_id@ has permissions on
+ @creation_user@ The user_id of the user that creates the course_id
+} {
+ permission::revoke -party_id $party_id -object_id $object_id -privilege "admin"
+ set asm_package_id [apm_package_id_from_key assessment]
+
+ db_foreach assessment { } {
+ if { [permission::permission_p -party_id $creation_user -object_id $assessment_id -privilege admin] == 1 } {
+ permission::revoke -party_id $party_id -object_id $assessment_id -privilege "admin"
+ }
+ }
+}
+
+ad_proc -private dotlrn_catalog::check_rev_assoc {
+ -item_id:required
+} {
+ Returns a list with number of revisions, number of associations to item_id
+ @item_id@ The item_id to check
+} {
+ set rev_num [db_string revision_count { } -default 0]
+ set assoc_num [db_string association_count { } -default 0]
+ set return_list [list]
+ lappend return_list $rev_num
+ lappend return_list $assoc_num
+ return $return_list
+}
+
+ad_proc -private dotlrn_catalog::course_delete {
+ -item_id:required
+} {
+ Deletes item_id and all the associations to that item_id (revisions, relations)
+ @item_id@ The item_id to delete
+} {
+ db_foreach relation { } {
+ dotlrn_catalog::delete_relation -rel_id $rel_id
+ }
+ content::item::delete -item_id $item_id
+}
+
+ad_proc -private dotlrn_catalog::get_categories_from_tree {
+ -tree_id:required
+} {
+ Returns a list of all objects associated to one category under tree_id
+ @tree_id@ The tree_id that holds the objects
+} {
+ set return_list ""
+ db_foreach get_categories { } {
+ lappend return_list "[list "$category_id" "$object_id"]"
+ }
+ return $return_list
+}
Index: openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,145 @@
+
+
+
+
+
+ select folder_id from cr_folders
+ where label = 'DotLRN Catalog'
+
+
+
+
+
+ select item_id from cr_revisions
+ where revision_id = :revision_id
+
+
+
+
+
+ select creation_user from acs_objects
+ where object_id = :object_id
+
+
+
+
+
+
+ update cr_items
+ set live_revision = :revision_id
+ where item_id = ( select item_id from cr_revisions where revision_id = :revision_id )
+
+
+
+
+
+ select course_id from dotlrn_catalog where course_key = :name
+
+
+
+
+
+ select count (rel_id)
+ from acs_rels where object_id_one = :course_id
+
+
+
+
+
+ select rel_id
+ from acs_rels where object_id_one = :object_one and object_id_two = :object_two
+
+
+
+
+
+
+ select count (rel_id)
+ from acs_rels where rel_type = 'dotlrn_catalog_com_rel'
+ and object_id_two = :community_id
+
+
+
+
+
+
+ select rel_id
+ from acs_rels where
+ (rel_type = 'dotlrn_catalog_class_rel' or rel_type = 'dotlrn_catalog_com_rel')
+ and object_id_one = :course_id
+
+
+
+
+
+
+ delete from dotlrn_catalog where course_id = :course_id
+
+
+
+
+
+ delete from cr_revisions where revision_id = :course_id
+
+
+
+
+
+ select 1 from cr_items where live_revision = :revision_id
+
+
+
+
+
+ select 1 from cr_items where latest_revision = :revision_id
+
+
+
+
+
+ select ci.item_id as assessment_id from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id
+
+
+
+
+
+ select ci.item_id as assessment_id from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id
+
+
+
+
+
+ select count(revision_id) from cr_revisions where item_id = :item_id
+
+
+
+
+
+ select count(rel_id) from acs_rels where object_id_one in (
+ select revision_id from cr_revisions where item_id = :item_id )
+
+
+
+
+
+ select rel_id from acs_rels where object_id_one in (
+ select revision_id from cr_revisions where item_id = :item_id )
+
+
+
+
+
+ select om.category_id, om.object_id from category_object_map om where
+ om.category_id in (select category_id from categories where tree_id =:tree_id)
+ and om.object_id in (select live_revision from cr_items where content_type = 'dotlrn_catalog')
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/course-info.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/course-info.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/course-info.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,6 @@
+
+@page_title@
+@context;noquote@
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/course-info.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/course-info.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/course-info.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,23 @@
+ad_page_contract {
+ Displays information of one course
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 09-02-2005
+} {
+ course_id:notnull
+ course_key:notnull
+ course_name:notnull
+}
+set page_title "$course_key [_ dotlrn-catalog.course_info]"
+set context [list "[_ dotlrn-catalog.one_course_info]"]
+
+set return_url "index"
+set asm_package_id [apm_package_id_from_key assessment]
+
+db_1row get_course_info { }
+
+set asm_name [db_string get_asm_name { } -default "[_ dotlrn-catalog.not_associated]"]
+set item_id [dotlrn_catalog::get_item_id -revision_id $course_id]
+set creation_user [dotlrn_catalog::get_creation_user -object_id $item_id]
+set rel [dotlrn_catalog::has_relation -course_id $course_id]
+
Index: openacs-4/packages/dotlrn-catalog/www/course-info.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/course-info.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/course-info.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,23 @@
+
+
+
+
+
+ select dc.course_info, dc.assessment_id, cr.item_id
+ from dotlrn_catalog dc, cr_revisions cr
+ where cr.revision_id = :course_id and dc.course_id = :course_id
+
+
+
+
+
+ select cr.title from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id and
+ ci.item_id = :assessment_id order by cr.title
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/index.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/index.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,8 @@
+
+@page_title@
+@context;noquote@
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/index.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/index.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,29 @@
+ad_page_contract {
+ Index for course administration
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 31-01-2005
+
+} {
+
+}
+set page_title "[_ dotlrn-catalog.course_catalog]"
+set context ""
+set return_url "cc-admin/course-list"
+
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+
+set user_id [ad_conn user_id]
+
+if {[permission::permission_p -party_id $user_id -object_id $cc_package_id -privilege "create"]} {
+ set create_p 1
+} else {
+ set create_p 0
+}
+
+set tree_id [db_string get_tree_id { } -default "-1"]
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/index.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/index.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+
+
+
+ select tree_id from category_tree_map where object_id = :cc_package_id
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/admin/grant-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/grant-list.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/admin/grant-list.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,5 @@
+
+@page_title@
+@context;noquote@
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/admin/grant-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/grant-list.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/admin/grant-list.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,97 @@
+ad_page_contract {
+ Displays a list of all users to grant permissions
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 28-01-2005
+} {
+ { return_url "" }
+ { user_name "" }
+ { user_email "" }
+
+}
+
+set user_id [ad_conn user_id]
+# dotlrn-catalog package_id
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+
+set page_title "[_ dotlrn-catalog.grant_list]"
+if {[string equal $return_url ""]} {
+ set return_url "grant-list"
+}
+
+set context [list [list "../cc-admin/course-list" "[_ dotlrn-catalog.course_list]"] $page_title]
+
+# To search for users
+ad_form -name search_user -form {
+ {user_name:text(text),optional
+ {label "[_ dotlrn-catalog.search_user]"}
+ {help_text "[_ dotlrn-catalog.search_help]"}
+ }
+ {user_email:text(text),optional
+ {label "[_ dotlrn-catalog.search_user_email]"}
+ {help_text "[_ dotlrn-catalog.search_email_help]"}
+ }
+}
+
+
+# Establish what query to use in order to the values of the form elements
+if {![string equal $user_name ""]} {
+ set query select_users_name
+ if {![string equal $user_email ""]} {
+ set query select_users_name_email
+ }
+} else {
+ set query select_users
+ if {![string equal $user_email ""]} {
+ set query select_users_email
+ }
+}
+
+db_multirow -extend { privilege email } grant_list $query {} {
+ set privilege [permission::permission_p -party_id $p_user_id -object_id $cc_package_id -privilege "create"]
+ if { [catch { set email [email_image::get_user_email -user_id $p_user_id] } errmsg] } {
+ set email $db_email
+ } else {
+ set email [email_image::get_user_email -user_id $p_user_id]
+ }
+}
+
+template::list::create \
+ -name grant_list \
+ -multirow grant_list \
+ -key p_user_id \
+ -bulk_actions {"\#dotlrn-catalog.grant\#" "grant-users?" "\#dotlrn-catalog.grant_per\#"\
+ "\#dotlrn-catalog.revoke\#" "revoke-users?" "\#dotlrn-catalog.revoke_per\#" }\
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ user_name
+ user_email
+ }\
+ -row_pretty_plural "[_ dotlrn-catalog.users_to_grant]" \
+ -elements {
+ name {
+ label "[_ dotlrn-catalog.user_name]"
+ display_template {
+ @grant_list.first_names@ @grant_list.last_name@
+ }
+ }
+ email {
+ label "[_ dotlrn-catalog.email]"
+ display_template {
+ @grant_list.email;noquote@
+ }
+ }
+ permission {
+ label "[_ dotlrn-catalog.permission]"
+ display_template {
+
+ [_ dotlrn-catalog.granted]
+
+
+ [_ dotlrn-catalog.not_allowed]
+
+ }
+ }
+ }
+
Index: openacs-4/packages/dotlrn-catalog/www/admin/grant-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/grant-list.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/admin/grant-list.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,41 @@
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id in (
+ select grantee_id from acs_permissions where object_id = :cc_package_id
+ and privilege = 'create')
+
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id <> :user_id and lower(first_names) like lower('%$user_name%')
+ or lower(last_name) like lower('%$user_name%') order by first_names, last_name
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id <> :user_id and lower(email) like lower('%$user_email%')
+ order by email
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id <> :user_id and (
+ lower(first_names) like lower('%$user_name%') or lower(last_name) like lower('%$user_name%'))
+ and lower(email) like lower('%$user_email%')
+ order by email
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/admin/grant-users.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/grant-users.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/admin/grant-users.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,33 @@
+ad_page_contract {
+ Gives users admin permissions on dotlrn_catalog
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 29-01-2005
+} {
+ p_user_id:multiple
+ { user_name "" }
+ { user_email "" }
+}
+
+# dotlrn_catalog package_id
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+
+# The tree id from categories
+set tree_list [category_tree::get_mapped_trees $cc_package_id]
+if { [string equal [lindex [lindex $tree_list 0] 1] "dotlrn-course-catalog"] } {
+ set tree_id [lindex [lindex $tree_list 0] 0]
+} else {
+ set tree_id ""
+}
+
+
+# Grants Permission for all the users in p_user_id
+foreach user $p_user_id {
+ permission::grant -party_id $user -object_id $cc_package_id -privilege "create"
+ permission::grant -party_id $user -object_id $tree_id -privilege category_tree_read
+ permission::grant -party_id $user -object_id $tree_id -privilege category_tree_write
+}
+
+
+ad_returnredirect "grant-list?user_name=$user_name&user_email=$user_email"
Index: openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,33 @@
+ad_page_contract {
+ Revokes users admin permissions on dotlrn_catalog
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 29-01-2005
+} {
+ p_user_id:multiple
+ { user_name "" }
+ { user_email "" }
+}
+
+# dotlrn_catalog package_id
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+
+# The tree id from categories
+set tree_list [category_tree::get_mapped_trees $cc_package_id]
+if { [string equal [lindex [lindex $tree_list 0] 1] "dotlrn-course-catalog"] } {
+ set tree_id [lindex [lindex $tree_list 0] 0]
+} else {
+ set tree_id ""
+}
+
+
+# Grants Permission for all the users in p_user_id
+foreach user $p_user_id {
+ permission::revoke -party_id $user -object_id $cc_package_id -privilege "create"
+ permission::revoke -party_id $user -object_id $tree_id -privilege "category_tree_read"
+ permission::revoke -party_id $user -object_id $tree_id -privilege "category_tree_write"
+}
+
+
+ad_returnredirect "grant-list?user_name=$user_name&user_email=$user_email"
Index: openacs-4/packages/dotlrn-catalog/www/doc/index.html
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/doc/index.html,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/doc/index.html 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,17 @@
+
+
+Course Catalog Documentation
+
+
+
+
+
+Course-Catalog:
+
+"Under Construction"
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,28 @@
+ad_page_contract {
+ Associates dotlrn_catalog's course_id with dotlrn's class_instance_id or community
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 31-01-2005
+} {
+ course_id:notnull
+ type:notnull
+ object_id:multiple
+ { return_url ""}
+}
+
+if { [string equal $type "class"] } {
+ set type "dotlrn_catalog_class_rel"
+} else {
+ set type "dotlrn_catalog_dotcom_rel"
+}
+
+foreach object $object_id {
+ dotlrn_catalog::add_relation -course_id $course_id -object_id $object -type $type
+}
+
+if { [string equal $return_url ""] } {
+ ad_returnredirect "dotlrn-list?course_id=$course_id"
+} else {
+ ad_returnredirect "$return_url"
+}
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,5 @@
+
+@page_title@
+@context;noquote@
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,169 @@
+ad_page_contract {
+ Displays a form to add a course or add a new revision of a course (edit)
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 27-01-2005
+
+} {
+ course_id:optional
+ mode:optional
+ { return_url "" }
+}
+
+if { [string equal $return_url ""]} {
+ set return_url "course-list"
+}
+
+set page_title ""
+set context ""
+
+set user_id [ad_conn user_id]
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+
+# Check for create permissions over dotlrn-catalog package
+permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create"
+
+if { [info exists mode] } {
+ # Check if users has admin permission to edit the course
+ permission::require_permission -object_id $course_id -privilege "create"
+ # To disable the element course_key
+ set mode display
+} else {
+ set mode edit
+}
+
+
+# Get assessments
+set asm_package_id [apm_package_id_from_key assessment]
+set asm_list [list [list "[_ dotlrn-catalog.not_associate]" "-1"]]
+db_foreach assessment { } {
+ if { [permission::permission_p -object_id $assessment_id -privilege "admin"] == 1 } {
+ lappend asm_list [list $title $assessment_id]
+ }
+}
+
+# Get a list of all the attributes asociated to dotlrn_catalog
+set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog]
+set elements ""
+
+
+# Creates the elements to show with ad_form
+
+foreach attribute $attribute_list {
+ set element_mode ""
+ set aditional_type ""
+ set aditional_elements ""
+ switch [lindex $attribute 4] {
+ string {
+ if { [string equal [lindex $attribute 2] "assessment_id"]} {
+ set aditional_type "(select)"
+ set aditional_elements [list options $asm_list]
+ } else {
+ if { [string equal [lindex $attribute 2] "course_key"]} {
+ set element_mode [list mode edit]
+ }
+ }
+ }
+ text {
+ set aditional_type "(textarea)"
+ set aditional_elements "{html {rows 7 cols 35}}"
+ }
+ integer {
+ if { [string equal [lindex $attribute 2] "assessment_id"]} {
+ set aditional_type "(select)"
+ set aditional_elements [list options $asm_list]
+ }
+ }
+ }
+ set element [list [lindex $attribute 2]:text${aditional_type} [list label [lindex $attribute 3]] $aditional_elements $element_mode]
+
+ lappend elements $element
+
+}
+
+
+# Create the form
+ad_form -name add_course -export {return_url $return_url } -form {
+ course_id:key
+}
+
+
+ad_form -extend -name add_course -form $elements
+
+ad_form -extend -name add_course -form {
+ {category_ids:integer(category),multiple,optional
+ {label "[_ dotlrn-catalog.categories]"}
+ {html {size 4}}
+ {value "-1"}
+ }
+}
+
+ad_form -extend -name add_course -validate {
+ { course_key
+ { [dotlrn_catalog::check_name -name $course_key] }
+ "[_ dotlrn-catalog.name_already]"
+ }
+} -new_data {
+ # New item and revision in the CR
+ set folder_id [dotlrn_catalog::get_folder_id]
+ set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog]
+ set form_attributes [list]
+ foreach attribute $attribute_list {
+ set attr_name [lindex $attribute 2]
+ lappend form_attributes [list $attr_name [set $attr_name]]
+ }
+
+ set item_id [content::item::new -name $course_key -parent_id $folder_id \
+ -content_type "dotlrn_catalog" -creation_user $user_id \
+ -attributes $form_attributes -is_live t]
+
+ # Grant admin privileges to the user over the item in the CR
+ permission::grant -party_id $user_id -object_id $item_id -privilege "admin"
+
+ set revision_id [db_string get_revision_id { } -default "-1"]
+ if { ![string equal $category_ids "-1"] } {
+ category::map_object -object_id $revision_id $category_ids
+ }
+} -edit_data {
+ # New revision in the CR
+ set folder_id [dotlrn_catalog::get_folder_id]
+ set item_id [dotlrn_catalog::get_item_id -revision_id $course_id]
+ set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog]
+ set form_attributes [list]
+ foreach attribute $attribute_list {
+ set attr_name [lindex $attribute 2]
+ lappend form_attributes [list $attr_name [set $attr_name]]
+ }
+
+ set course_id [content::revision::new -item_id $item_id -attributes $form_attributes -content_type "dotlrn_catalog"]
+
+ # Set the new revision live
+ dotlrn_catalog::set_live -revision_id $course_id
+ if { ![string equal $category_ids "-1"] } {
+ category::map_object -object_id $course_id $category_ids
+ }
+} -new_request {
+ set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.new_course]"]
+ set page_title "[_ dotlrn-catalog.new_course]"
+ set return_url "$return_url"
+
+} -edit_request {
+ set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.edit_course]"]
+ set page_title "[_ dotlrn-catalog.edit_course]"
+ set return_url "$return_url"
+ db_1row get_course_info { }
+ db_string get_course_assessment { } -default "[_ dotlrn-catalog.not_associated]"
+
+} -after_submit {
+ ad_returnredirect "$return_url"
+}
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,36 @@
+
+
+
+
+
+ select cr.title ,ci.item_id as assessment_id from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id order by cr.title
+
+
+
+
+
+ select * from dotlrn_catalog where course_id = :course_id
+
+
+
+
+
+ select cr.title from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id and
+ ci.item_id = :assessment_id order by cr.title
+
+
+
+
+
+ select revision_id from cr_revisions where item_id = :item_id
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,7 @@
+
+@page_title@
+@context;noquote@
+
+#dotlrn-catalog.add_course_to#
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,34 @@
+ad_page_contract {
+ Categorize one course
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 10-02-2005
+} {
+ course_id:notnull
+ name:notnull
+}
+
+# Check for create permissions over dotlrn-catalog
+set user_id [ad_conn user_id]
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create"
+
+set context [list "[_ dotlrn-catalog.categorize] $name"]
+set page_title "[_ dotlrn-catalog.categorize] $name"
+set return_url "course-list"
+
+
+ad_form -export { name } -name course_categorize -cancel_url "course-list" -form {
+ {course_id:text(hidden)
+ { value $course_id }
+ }
+ {category_ids:integer(category),multiple
+ {label "[_ dotlrn-catalog.categories]"}
+ {html {size 4}}
+ {value "-1"}
+ }
+} -on_submit {
+ category::map_object -remove_old -object_id $course_id $category_ids
+} -after_submit {
+ ad_returnredirect "course-list"
+}
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,27 @@
+
+@page_title@
+@context;noquote@
+
+#dotlrn-catalog.this_course# @rev_num@
+
+ #dotlrn-catalog.version#
+
+
+ #dotlrn-catalog.versions#
+
+
+
+ #dotlrn-catalog.has_no#
+
+
+
+ #dotlrn-catalog.and_has_one#
+
+
+ #dotlrn-catalog.and_has# @assoc_num@ #dotlrn-catalog.to_dotlrn#
+
+
+
+#dotlrn-catalog.do_you_still#
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,33 @@
+ad_page_contract {
+ Displays a delete confirmation message and deletes the course
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 09-02-2005
+} {
+ object_id:notnull
+ course_key:notnull
+ creation_user:notnull
+}
+
+set page_title "[_ dotlrn-catalog.confirm_delete] $course_key"
+set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.delete_course]"]
+
+# Check for create permissions over dotlrn-catalog
+set user_id [ad_conn user_id]
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create"
+
+
+set rev_assoc [dotlrn_catalog::check_rev_assoc -item_id $object_id]
+set rev_num [lindex $rev_assoc 0]
+set assoc_num [lindex $rev_assoc 1]
+
+ad_form -name delete_course -export {course_key $course_key creation_user $creation_user } -cancel_url "course-list" -form {
+ {object_id:text(hidden)
+ { value $object_id }
+ }
+} -on_submit {
+ dotlrn_catalog::course_delete -item_id $object_id
+} -after_submit {
+ ad_returnredirect "course-list"
+}
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,14 @@
+
+@page_title@
+@context;noquote@
+ #dotlrn-catalog.new_course#
+
+| #dotlrn-catalog.admin_categories#
+
+
+| #dotlrn-catalog.grant_per#
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,49 @@
+ad_page_contract {
+ Displays a list of all courses
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 28-01-2005
+} {
+
+}
+
+set user_id [ad_conn user_id]
+set context [list "[_ dotlrn-catalog.course_list]"]
+set page_title "[_ dotlrn-catalog.course_list]"
+set return_url "course-list"
+
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+
+permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create"
+
+if {[permission::permission_p -party_id $user_id -object_id $cc_package_id -privilege "admin"]} {
+ set admin_p 1
+} else {
+ set admin_p 0
+}
+
+# The tree id from categories
+set tree_list [category_tree::get_mapped_trees $cc_package_id]
+if { [string equal [lindex [lindex $tree_list 0] 1] "dotlrn-course-catalog"] } {
+ set tree_id [lindex [lindex $tree_list 0] 0]
+} else {
+ set tree_id ""
+}
+
+
+set asm_package_id [apm_package_id_from_key assessment]
+
+if { [acs_user::site_wide_admin_p] } {
+ set query get_course_info_site_wide
+} else {
+ set query get_course_info
+}
+
+
+db_multirow -extend { asm_name rel item_id creation_user } course_list $query {} {
+ set asm_name [db_string get_asm_name { } -default "[_ dotlrn-catalog.not_associated]"]
+ set item_id [dotlrn_catalog::get_item_id -revision_id $course_id]
+ set creation_user [dotlrn_catalog::get_creation_user -object_id $item_id]
+ set rel [dotlrn_catalog::has_relation -course_id $course_id]
+}
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,35 @@
+
+
+
+
+
+ select cc.course_id, cc.course_key, cc.course_name, cc.course_info, cc.assessment_id, ci.item_id
+ from dotlrn_catalog cc, cr_items ci
+ where cc.course_id = ci.live_revision and
+ ci.item_id in (
+ select object_id from acs_permissions where grantee_id = :user_id and
+ privilege = 'admin')
+
+
+
+
+
+
+ select cc.course_id, cc.course_key, cc.course_name, cc.course_info, cc.assessment_id, ci.item_id
+ from dotlrn_catalog cc, cr_items ci
+ where cc.course_id = ci.live_revision
+
+
+
+
+
+ select cr.title from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id and
+ ci.item_id = :assessment_id order by cr.title
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,20 @@
+
+@page_title@
+@context;noquote@
+
+
+ #dotlrn-catalog.associate# @course_key@ (@course_name@) #dotlrn-catalog.to# #dotlrn-catalog.class#:
+
+
+ #dotlrn-catalog.associate# #dotlrn-catalog.to# #dotlrn-catalog.class#:
+
+
+
+
+
+ #dotlrn-catalog.associate# @course_key@ (@course_name@) #dotlrn-catalog.to# #dotlrn-catalog.community#:
+
+
+ #dotlrn-catalog.associate# #dotlrn-catalog.to# #dotlrn-catalog.community#:
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,144 @@
+ad_page_contract {
+ Displays a list of all dotlrn classes to associate to a dotlrn_catalog(course_id)
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 31-01-2005
+} {
+ course_id:notnull
+ { course_key ""}
+ { return_url "" }
+ { course_name ""}
+}
+
+set page_title "[_ dotlrn-catalog.dotlrn_list]"
+if {[string equal $return_url ""]} {
+ set return_url "dotlrn-catalog-list"
+}
+set user_id [ad_conn user_id]
+
+# Check if users has admin permission to edit dotlrn_catalog
+permission::require_permission -party_id $user_id -object_id $course_id -privilege "admin"
+
+set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.dotlrn_list]"]
+
+set asm_package_id [apm_package_id_from_key assessment]
+
+db_multirow -extend { rel type } classes_list get_dotlrn_classes {} {
+ set rel [dotlrn_catalog::relation_between -object_one $course_id -object_two $object_id]
+ set type "class"
+}
+
+template::list::create \
+ -name dotlrn_classes \
+ -multirow classes_list \
+ -key object_id \
+ -has_checkboxes\
+ -bulk_actions {"\#dotlrn-catalog.associate\#" "associate-course" "\#dotlrn-catalog.associate_to_class\#" }\
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ course_id
+ type
+ }\
+ -row_pretty_plural "[_ dotlrn-catalog.dotlrn_classes]" \
+ -elements {
+ check_box {
+ class "list-narrow"
+ label " "
+ display_template {
+
+
+
+
+
+
+ }
+ }
+ class {
+ label "[_ dotlrn-catalog.class_name]"
+ display_template {
+ @classes_list.pretty_name@
+ }
+ }
+ dep_name {
+ label "[_ dotlrn-catalog.dep_name]"
+ display_template {
+ @classes_list.department_name@
+ }
+ }
+ term_name {
+ label "[_ dotlrn-catalog.term_name]"
+ display_template {
+ @classes_list.term_name@
+ }
+ }
+ subject {
+ label "[_ dotlrn-catalog.subject_name]"
+ display_template {
+ @classes_list.class_name@
+ }
+ }
+ associate {
+ display_template {
+
+ #dotlrn-catalog.associate#
+
+
+ #dotlrn-catalog.associated#
+
+ }
+ }
+ }
+
+db_multirow -extend { rel type } com_list get_dotlrn_communities { } {
+ set rel [dotlrn_catalog::relation_between -object_one $course_id -object_two $object_id]
+ set type "community"
+}
+
+template::list::create \
+ -name dotlrn_communities \
+ -multirow com_list \
+ -key object_id \
+ -has_checkboxes \
+ -bulk_actions {"\#dotlrn-catalog.associate\#" "associate-course" "\#dotlrn-catalog.associate_to_com\#" }\
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ course_id
+ type
+ }\
+ -row_pretty_plural "[_ dotlrn-catalog.dotlrn_com]" \
+ -elements {
+ check_box {
+ class "list-narrow"
+ label " "
+ display_template {
+
+
+
+
+
+
+ }
+ }
+ community {
+ label "[_ dotlrn-catalog.com_name]"
+ display_template {
+ @com_list.pretty_name@
+ }
+ }
+ associate {
+ display_template {
+
+ #dotlrn-catalog.associate#
+
+
+ #dotlrn-catalog.associated#
+
+ }
+ }
+ }
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/dotlrn-list.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,18 @@
+
+
+
+
+
+ select class_instance_id as object_id, department_name, term_name, class_name, pretty_name, url
+ from dotlrn_class_instances_full
+ order by department_name, term_name, class_name, pretty_name
+
+
+
+
+
+ select community_id as object_id, pretty_name, url from dotlrn_clubs_full order by pretty_name
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/go-live.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/go-live.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/go-live.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,13 @@
+ad_page_contract {
+ Makes one revision live
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 29-01-2005
+} {
+ revision_id:notnull
+}
+
+dotlrn_catalog::set_live -revision_id $revision_id
+
+ad_returnredirect "/dotlrn-catalog/cc-admin/course-list"
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-permission.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-permission.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-permission.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,21 @@
+ad_page_contract {
+ Gives users the same permissions that creation_users has over course_id and assessment_id
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 03-02-2005
+} {
+ p_user_id:multiple
+ { user_name "" }
+ { user_email "" }
+ object_id:notnull
+ creation_user:notnull
+ course_key:notnull
+}
+
+# Grants Permission for all the users in p_user_id
+foreach user $p_user_id {
+ dotlrn_catalog::grant_permissions -party_id $user -object_id $object_id -creation_user $creation_user
+}
+
+ad_returnredirect "grant-user-list?user_name=$user_name&user_email=$user_email&object_id=$object_id&creation_user=$creation_user&course_key=$course_key"
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,5 @@
+
+@page_title@
+@context;noquote@
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,111 @@
+ad_page_contract {
+ Displays a list of all users that have create privile under dotlrn_catalog
+ to give them admin privileges over course_id and assessment_id
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 03-01-2005
+} {
+ { return_url "" }
+ { user_name "" }
+ { user_email "" }
+ course_key:notnull
+ object_id:notnull
+ creation_user:notnull
+}
+
+# Check for create permissions over dotlrn-catalog
+set user_id [ad_conn user_id]
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create"
+
+set page_title "[_ dotlrn-catalog.search_users_to] $course_key"
+set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.search_u]"]
+if {[string equal $return_url ""]} {
+ set return_url "grant-user-list"
+}
+
+# To search for users
+ad_form -name search_user -form {
+ {object_id:text(hidden)
+ {value "$object_id"}
+ }
+ {creation_user:text(hidden)
+ {value "$creation_user"}
+ }
+ {course_key:text(hidden)
+ {value "$course_key"}
+ }
+ {user_name:text(text),optional
+ {label "[_ dotlrn-catalog.search_user]"}
+ {help_text "[_ dotlrn-catalog.search_help]"}
+ }
+ {user_email:text(text),optional
+ {label "[_ dotlrn-catalog.search_user_email]"}
+ {help_text "[_ dotlrn-catalog.search_email_help]"}
+ }
+}
+
+# Establish what query to use in order to the values of the form elements
+if {![string equal $user_name ""]} {
+ set query select_users_name
+ if {![string equal $user_email ""]} {
+ set query select_users_name_email
+ }
+} else {
+ set query select_users
+ if {![string equal $user_email ""]} {
+ set query select_users_email
+ }
+}
+
+db_multirow -extend { privilege email } grant_list $query {} {
+ set privilege [permission::permission_p -party_id $p_user_id -object_id $object_id -privilege "admin"]
+ if { [catch { set email [email_image::get_user_email -user_id $p_user_id] } errmsg] } {
+ set email $db_email
+ } else {
+ set email [email_image::get_user_email -user_id $p_user_id]
+ }
+}
+
+template::list::create \
+ -name grant_list \
+ -multirow grant_list \
+ -key p_user_id \
+ -bulk_actions {"\#dotlrn-catalog.grant\#" "grant-permission" "\#dotlrn-catalog.grant_per\#"\
+ "\#dotlrn-catalog.revoke\#" "revoke-permission" "\#dotlrn-catalog.revoke_per\#" }\
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ user_name
+ user_email
+ object_id
+ creation_user
+ course_key
+ }\
+ -row_pretty_plural "[_ dotlrn-catalog.users_to_grant]" \
+ -elements {
+ name {
+ label "[_ dotlrn-catalog.user_name]"
+ display_template {
+ @grant_list.first_names@ @grant_list.last_name@
+ }
+ }
+ email {
+ label "[_ dotlrn-catalog.email]"
+ display_template {
+ @grant_list.email;noquote@
+ }
+ }
+ permission {
+ label "[_ dotlrn-catalog.permission]"
+ display_template {
+
+ [_ dotlrn-catalog.granted]
+
+
+ [_ dotlrn-catalog.not_allowed]
+
+ }
+ }
+ }
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,39 @@
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id in (
+ select grantee_id from acs_permissions where object_id = :object_id
+ and privilege = 'admin') and user_id <> :user_id
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id <> :user_id
+ and (lower(first_names) like '%$user_name%'
+ or lower(last_name) like '%$user_name%') order by first_names, last_name
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id <> :user_id
+ and lower(email) like '%$user_email%' order by email
+
+
+
+
+
+ select first_names, last_name, user_id as p_user_id, email as db_email
+ from cc_users where user_id <> :user_id
+ lower(first_names) like '%$user_name%' or lower(last_name) like '%$user_name%')
+ and lower(email) like '%$user_email%' order by email
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,9 @@
+
+@page_title@
+@context;noquote@
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,40 @@
+ad_page_contract {
+ Displays a list of all revisions for one course
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 28-01-2005
+} {
+ { return_url "" }
+ course_key:notnull
+ course_id:notnull
+}
+
+set page_title "[_ dotlrn-catalog.rev_list]"
+set context [list [list "course-list" "[_ dotlrn-catalog.course_list]" ] $page_title]
+if {[string equal $return_url ""]} {
+ set return_url "course-list"
+}
+
+set user_id [ad_conn user_id]
+set cc_package_id [apm_package_id_from_key "dotlrn-catalog"]
+
+# Check for create permissions over dotlrn-catalog
+permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create"
+
+
+
+# Check if users has admin permission to edit the course
+set item_id [dotlrn_catalog::get_item_id -revision_id $course_id]
+permission::require_permission -party_id $user_id -object_id $course_id -privilege "admin"
+
+
+set context [list [list "course-list" "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.rev_list]"]
+
+set asm_package_id [apm_package_id_from_key assessment]
+
+db_multirow -extend { asm_name rel } course_list get_course_info { } {
+ set asm_name [db_string get_asm_name { } -default "[_ dotlrn-catalog.not_associated]"]
+ set rel [dotlrn_catalog::has_relation -course_id $course_id]
+}
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,31 @@
+
+
+
+
+
+ select dc.course_id, dc.course_key, dc.course_name, dc.course_info, dc.assessment_id, ci.live_revision
+ from dotlrn_catalog dc, cr_items ci
+ where ci.item_id = :item_id and
+ dc.course_id in (select revision_id from cr_revisions where item_id = :item_id )
+
+
+
+
+
+ select cr.title from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id and
+ ci.item_id = :assessment_id order by cr.title
+
+
+
+
+
+ select pretty_name, url
+ from dotlrn_class_instances_full
+ where class_instance_id = :class_id
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revoke-permission.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revoke-permission.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revoke-permission.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,23 @@
+ad_page_contract {
+ Revokes users the same permissions that creation_users has over course_id and assessment_id
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 03-01-2005
+} {
+ p_user_id:multiple
+ { user_name "" }
+ { user_email "" }
+ object_id:notnull
+ creation_user:notnull
+ course_key:notnull
+}
+
+
+# Revokes Permission for all the users in p_user_id
+foreach user $p_user_id {
+ dotlrn_catalog::revoke_permissions -party_id $user -object_id $object_id -creation_user $creation_user
+}
+
+
+ad_returnredirect "grant-user-list?user_name=$user_name&user_email=$user_email&object_id=$object_id&creation_user=$creation_user&course_key=$course_key"
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/watch-association.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/Attic/watch-association.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/watch-association.adp 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,16 @@
+
+@page_title@
+@context;noquote@
+
+
+@course_key;noquote@ (@course_name@) #dotlrn-catalog.is_assoc#
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/watch-association.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/Attic/watch-association.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/watch-association.tcl 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,29 @@
+ad_page_contract {
+ Shows all associations that course_id has
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation date 28-01-2005
+} {
+ { return_url "" }
+ course_id:notnull
+ course_key:notnull
+ { course_name "" }
+}
+
+if { [string equal $return_url "index"] } {
+ set context [list [list ../course-info?course_id=$course_id&course_key=$course_key&course_name=$course_name "[_ dotlrn-catalog.one_course_info]"] "[_ dotlrn-catalog.watch_assoc]"]
+} else {
+ set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.watch_assoc]"]
+}
+
+set page_title "[_ dotlrn-catalog.watch_assoc]"
+set user_id [ad_conn user_id]
+
+# Allows that an unregiser user watch this page
+if { ![string equal $user_id "0"] } {
+ # Check if users has admin permission to edit dotlrn_catalog
+ permission::require_permission -party_id $user_id -object_id $course_id -privilege "admin"
+}
+
+db_multirow relations relation { }
+
Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/watch-association.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/Attic/watch-association.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-catalog/www/dt-admin/watch-association.xql 14 Feb 2005 22:46:11 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+
+
+ select department_name, term_name, class_name, pretty_name, description, url
+ from dotlrn_class_instances_full
+ where class_instance_id = :class_id
+
+
+
+
+
+ select object_id_two as object_id, rel_type as type from acs_rels
+ where object_id_one = :course_id order by type
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-catalog/www/images/admin.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/images/admin.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/dotlrn-catalog/www/images/golive.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/images/golive.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/dotlrn-catalog/www/images/live.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/images/live.gif,v
diff -u
Binary files differ