# # 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.1.4.1 2004/05/06 05:11:58 gabrielb Exp $ set user_id [ad_maybe_redirect_for_registration] 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 { [string equal $folder_list 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 { [string equal $folder_p "t"] && [string equal $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

$local_title

\n" } else { append bookmark_html "$i_str

$local_title

\n" } } else { append bookmark_html "$i_str
$local_title\n" } set previous_folder_p $folder_p } set html " Bookmarks for $name

Bookmarks for $name

$bookmark_html

" doc_return 200 text/html $html