Index: openacs-4/packages/lors/tcl/lors-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-procs.tcl,v diff -u -N -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/lors/tcl/lors-procs.tcl 5 May 2006 17:23:14 -0000 1.1.2.1 +++ openacs-4/packages/lors/tcl/lors-procs.tcl 7 Jun 2006 13:50:59 -0000 1.1.2.2 @@ -1 +1,63 @@ +# packages/lors/tcl/lors-procs.tcl + +ad_library { + + Helper procedures for LORS + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2006-06-06 + @cvs-id $Id$ +} + +namespace eval lors:: {} + +ad_proc -public lors::object_url { + -object_id + + {-url "view"} +} { + Generate a URL for an acs_object as a learning object + + @author Dave Bauer (dave@thedesignexperience.org) + @creation-date 2006-06-06 + + @param object_id + + @param url + + @return + + @error +} { + + #view is easy + set object_type [acs_object_type $object_id] + if {$object_type eq "content_item"} { + set object_type [content::item::content_type -item_id $object_id] + } + switch $url { + admin { + + switch $object_type { + as_sections { + # FIXME either 1) make this magically work + # or 2) find the assessment_id and use + # page anchor + return [export_vars \ + -base ../assessment/asm-admin/one-a \ + {{section_id $object_id}}] + } + "::xowiki::Page" { + return [export_vars \ + -base /wiki/edit \ + {{item_id $object_id}}] + } + } + + } + default { + return "/o/${object_id}" + } + + } +}