Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl 26 Nov 2007 12:52:45 -0000 1.1 +++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/get-foldercontents.tcl 13 Dec 2007 05:33:42 -0000 1.2 @@ -10,6 +10,7 @@ folder_id:optional tag_id:integer,optional {sort "fs_objects.title"} + {package_id:optional} {dir "DESC"} } @@ -23,6 +24,7 @@ # so that we can get a path to prefix to the files set root_package_id [ajaxfs::get_root_folder -folder_id $folder_id] +if {[info exists package_id]} { set root_package_id $package_id } set root_folder_id [fs::get_root_folder -package_id $root_package_id] set folder_name [lang::util::localize [fs::get_object_name -object_id $folder_id]] @@ -86,8 +88,10 @@ } -db_multirow -extend { filename icon last_modified_pretty content_size_pretty download_url object_counter file_list_start file_list_end write_p tags} contents $query_name $query { +db_multirow -extend { filename icon last_modified_pretty content_size_pretty download_url linkurl object_counter file_list_start file_list_end write_p tags symlink_id} contents $query_name $query { + set symlink_id "" + # title of the file if { ![exists_and_not_null title] } { set title $name } @@ -117,8 +121,40 @@ switch -- $type { folder { - set icon "" + set shared_with [db_list get_share_from "select p.instance_name + from cr_folders f, + cr_symlinks s, + cr_items i, + acs_objects o, + apm_packages p, + site_nodes s1, + site_nodes s2 + where o.package_id = s2.object_id + and s1.node_id = s2.parent_id + and s1.object_id = p.package_id + and s.symlink_id = o.object_id + and s.symlink_id = i.item_id + and s.target_id = :object_id + and f.folder_id=i.parent_id"] + if { [llength $shared_with] > 0} { + set shareditems [join ${shared_with} "
  • "] + set qtip "
    ${title} is shared with
    " + set icon "" + } else { + set qtip "${title}" + set icon "" + } } + symlink { + set target_id [db_string get_target_folder "select target_id from cr_symlinks where symlink_id=:object_id"] + set symlink_id $object_id + set object_id $target_id + set target_package_id [ajaxfs::get_root_folder -folder_id $target_id] + set instance_name [db_string get_subsite_name "select instance_name from apm_packages where package_id=(select context_id from acs_objects where object_id = ${target_package_id})"] + set qtip "
    ${title} shared from ${instance_name}
    " + set icon "" + set content_size_pretty "" + } url { set icon "" set download_url $url @@ -153,22 +189,26 @@ } } + # cleanup : + # remove double quotes, replace with single quotes + regsub -all "\"" $title "" title + # filename and download url - set filename " " + if { $type != "folder" && $type != "symlink"} { - if { $type != "folder"} { - if { ![exists_and_not_null download_url] } { set download_url "${fs_url}download/${name}?[export_vars {{file_id $object_id}}]" + set linkurl "${fs_url}download/?[export_vars {{file_id $object_id}}]" } set filename $name - + if { $title == $name } { set filename " "} } else { set download_url "javascript:void(0)" - + set linkurl "javascript:void(0)" + set filename " " } # get the tags for this fs item