# # Outputs an html file in the format used by netscape/mozilla # for it's bookmarks menu # # index.vuh created from the original registered proc # because registered procs seem not to play with server # 404s # Mark Aufflick (mark@pumptheory.com) # 26 September 2003 # $Id: index.vuh,v 1.4 2014/04/18 06:41:09 gustafn Exp $ auth::require_login set user_id [ad_conn user_id] set package_id [ad_conn package_id] set root_folder_id [bm_get_root_folder_id $package_id $user_id] set name [db_string name " select first_names||' '||last_name as name from cc_users where user_id = :user_id"] set folder_list 0 set previous_folder_p "f" set indent 1 set indent_str " " set i_str [string repeat $indent_str $indent] db_foreach bm_info { } { if {$folder_list eq "0"} { lappend folder_list $parent_id } else { set previous_parent_id [lindex $folder_list end] if {$parent_id != $previous_parent_id} { set parent_location [lsearch -exact $folder_list $parent_id] if {$parent_location==-1} { lappend folder_list $parent_id append bookmark_html "$i_str
\n" incr indent set i_str [string repeat $indent_str $indent] } else { set drop [expr {[llength $folder_list]-$parent_location}] set folder_list [lrange $folder_list 0 $parent_location] for {set i 1} {$i<$drop} {incr i} { incr indent -1 set i_str [string repeat $indent_str $indent] append bookmark_html "$i_str
\n\n" } } } elseif { $folder_p == "t" && $previous_folder_p == "t" } { # The previous folder was empty append bookmark_html "$i_str
\n$i_str
\n" } } if {$folder_p=="t"} { if {$local_title eq "Personal Toolbar Folder"} { # Maintain special tags for Personal Toolbar Folder append bookmark_html "$i_str
$bookmark_html
" doc_return 200 text/html $html