Index: openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl 18 May 2005 17:19:46 -0000 1.7 +++ openacs-4/packages/lors/tcl/lors-imscp-blackboard6-procs.tcl 17 Nov 2008 13:35:03 -0000 1.8 @@ -1,7 +1,7 @@ ad_library { IMS Content Packaging functions - for Blackboard 6 + for Blackboard 6 @creation-date 2003-10-13 @author Ernie Ghiglione (ErnieG@mm.st) @@ -40,12 +40,12 @@ @author Ernie Ghiglione (ErnieG@mm.st) } { - return [file exists $tmp_dir/.bb-package-info] + return [file exists $tmp_dir/.bb-package-info] } ad_proc -public lors::imscp::bb6::getItems { - {tree} + {tree} {parent ""} } { Extracts data from Items @@ -59,36 +59,32 @@ set itemx [$tree child all item] if { ![empty_string_p $itemx] } { - if {[empty_string_p $parent]} { set parent 0 } - set it_list "" + set it_list "" foreach itemx [$tree child all item] { - set cc "" - #{$parent}" + # gets item identifier set cc "[lors::imsmd::getAtt $itemx identifier]" # gets item identifierref set cc [concat $cc "[lors::imsmd::getAtt $itemx identifierref]"] - # gets xml node - set cc [concat $cc $itemx] + # gets xml node + set cc [concat $cc $itemx] + set it_list [concat $it_list [list $cc]] - set it_list [concat $it_list [list $cc]] - set itemxx [$itemx child all item] if { ![empty_string_p $itemxx] } { - set it_list [concat $it_list [getItems $itemx]] - } + set it_list [concat $it_list [getItems $itemx]] + } set items [concat $items $cc] } } return $it_list - #$items } @@ -109,6 +105,7 @@ } } + ad_proc -public lors::imscp::bb6::getDescription { -node:required } { @@ -138,7 +135,8 @@ if {![empty_string_p dates_node]} { set created [$dates_node child all CREATED] set updated [$dates_node child all UPDATED] - return [list [lors::imsmd::getAtt $created value] [lors::imsmd::getAtt $updated value]] + return [list \ + [lors::imsmd::getAtt $created value] [lors::imsmd::getAtt $updated value]] } else { return "" } @@ -163,7 +161,6 @@ } else { return "" } - } else { return "" } @@ -176,7 +173,7 @@ @option name Name of the attribute to get @option node XML node - + @author Ernie Ghiglione (ErnieG@mm.st) } { set navigation [$node child all [string toupper NAVIGATION]] @@ -212,7 +209,7 @@ # coursetoc set coursetoc [$doc documentElement] - set list_items [list] + set list_items [list] # gets coursetoc elements and values lappend list_items {id} [lors::imsmd::getAtt $coursetoc id] @@ -231,7 +228,6 @@ # return list return $list_items - } @@ -245,11 +241,11 @@ } { # open xml file set doc [dom parse [::tDOM::xmlReadFile $file]] + # content set content [$doc documentElement] + set list_items [list] - set list_items [list] - # gets content elements and values lappend list_items {id} [lors::imsmd::getAtt $content id] lappend list_items {TITLE} [lors::imsmd::getAtt [$content getElementsByTagName TITLE] value] @@ -275,28 +271,22 @@ set files [list] foreach file [[$content selectNodes /CONTENT/FILES] childNodes] { + set file_list [list] + lappend file_list {file_id} [lors::imsmd::getAtt $file id] + lappend file_list {NAME} [lors::imsmd::getElement [$file getElementsByTagName NAME]] + lappend file_list {FILEACTION} [lors::imsmd::getAtt [$file getElementsByTagName FILEACTION] value] + lappend file_list {LINKNAME} [lors::imsmd::getAtt [$file getElementsByTagName LINKNAME] value] + lappend file_list {SIZE} [lors::imsmd::getAtt [$file getElementsByTagName SIZE] value] + lappend file_list {CREATED} [lors::imsmd::getAtt [$file getElementsByTagName CREATED] value] + lappend file_list {UPDATED} [lors::imsmd::getAtt [$file getElementsByTagName UPDATED] value] - set file_list [list] - lappend file_list {file_id} [lors::imsmd::getAtt $file id] - lappend file_list {NAME} [lors::imsmd::getElement [$file getElementsByTagName NAME]] - lappend file_list {FILEACTION} [lors::imsmd::getAtt [$file getElementsByTagName FILEACTION] value] - lappend file_list {LINKNAME} [lors::imsmd::getAtt [$file getElementsByTagName LINKNAME] value] - lappend file_list {SIZE} [lors::imsmd::getAtt [$file getElementsByTagName SIZE] value] - lappend file_list {CREATED} [lors::imsmd::getAtt [$file getElementsByTagName CREATED] value] - lappend file_list {UPDATED} [lors::imsmd::getAtt [$file getElementsByTagName UPDATED] value] + foreach registryentry [[$file getElementsByTagName REGISTRY] childNodes] { + if {[$registryentry getAttribute key] == "entry_point"} { + lappend file_list {REGISTRY_ENTRY_POINT} [lors::imsmd::getAtt $registryentry value] + } + } - foreach registryentry [[$file getElementsByTagName REGISTRY] childNodes] { - - if {[$registryentry getAttribute key] == "entry_point"} { - - lappend file_list {REGISTRY_ENTRY_POINT} [lors::imsmd::getAtt $registryentry value] - - } - - } - - lappend files $file_list - + lappend files $file_list } lappend list_items {FILES} $files @@ -325,27 +315,26 @@ # check if directory exists if { ![file exists $dirname] } { - # create dir - file mkdir $dirname + file mkdir $dirname } # transforms text into html if {[lors::imscp::bb6::looks_like_html_p -text $txt]} { -# set txt [ad_text_to_html -includes_html $txt] + # set txt [ad_text_to_html -includes_html $txt] } else { - set txt [ad_text_to_html -includes_html $txt] -# set txt [ad_html_text_convert -from "text/plain" -to "text/html" $txt] + set txt [ad_text_to_html -includes_html $txt] + # set txt [ad_html_text_convert -from "text/plain" -to "text/html" $txt] } # saves it on a new html file set f_handler [open $filename w+] fconfigure $f_handler -encoding utf-8 - puts -nonewline $f_handler " \ $txt \" + puts -nonewline $f_handler " \ $txt \" close $f_handler # returns what is is an href for resources return $filename - } @@ -360,10 +349,12 @@ @author Ernie Ghiglione (ErnieG@mm.st) } { - if { [regexp -nocase {
} $text] || [regexp -nocase {
} $text] || [regexp -nocase {} $text] || [regexp -nocase {