Index: openacs-4/packages/file-storage/www/folder-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk.tcl,v diff -u -r1.46 -r1.47 --- openacs-4/packages/file-storage/www/folder-chunk.tcl 9 Nov 2008 23:29:26 -0000 1.46 +++ openacs-4/packages/file-storage/www/folder-chunk.tcl 9 Jun 2009 11:30:46 -0000 1.47 @@ -98,55 +98,56 @@ lappend actions "#file-storage.Edit_Folder#" "${fs_url}folder-edit?folder_id=$folder_id" "#file-storage.Rename_this_folder#" lappend actions "#file-storage.lt_Modify_permissions_on_1#" "${fs_url}permissions?[export_vars -override {{object_id $folder_id}} {{return_url "[ad_conn url]"}}]" "#file-storage.lt_Modify_permissions_on_1#" if { $expose_rss_p } { - lappend actions "Configure RSS" "${fs_url}admin/rss-subscrs?folder_id=$folder_id" "Configure RSS" + lappend actions "Configure RSS" "${fs_url}admin/rss-subscrs?folder_id=$folder_id" "Configure RSS" } } set categories_p [parameter::get -parameter CategoriesP -package_id $package_id -default 0] if { $categories_p } { if { [permission::permission_p -party_id $viewing_user_id -object_id $package_id -privilege "admin"] } { - lappend actions [_ categories.cadmin] [export_vars -base "/categories/cadmin/object-map" -url {{object_id $package_id}}] [_ categories.cadmin] + lappend actions [_ categories.cadmin] [export_vars -base "/categories/cadmin/object-map" -url {{object_id $package_id}}] [_ categories.cadmin] } set category_links [fs::category_links -object_id $folder_id -folder_id $folder_id -selected_category_id $category_id -fs_url $fs_url] } #set n_past_filter_values [list [list "Yesterday" 1] [list [_ file-storage.last_week] 7] [list [_ file-storage.last_month] 30]] -set elements [list type [list label [_ file-storage.Type] \ +set elements [list type \ + [list label [_ file-storage.Type] \ display_template {@contents.alt_icon@@contents.pretty_type@} \ - orderby_desc {sort_key_desc,fs_objects.pretty_type desc} \ - orderby_asc {fs_objects.sort_key, fs_objects.pretty_type asc}] \ + orderby_desc {sort_key_desc,fs_objects.pretty_type desc} \ + orderby_asc {fs_objects.sort_key, fs_objects.pretty_type asc}] \ name \ - [list label [_ file-storage.Name] \ + [list label [_ file-storage.Name] \ display_template {@contents.name@@contents.title@
@contents.name@
} \ - orderby_desc {fs_objects.name desc} \ - orderby_asc {fs_objects.name asc}] \ - short_name \ - [list label [_ file-storage.Name] \ - hide_p 1 \ - display_template {@contents.title@} \ - orderby_desc {fs_objects.name desc} \ - orderby_asc {fs_objects.name asc}] \ - content_size_pretty \ - [list label [_ file-storage.Size] \ - display_template {@contents.content_size_pretty;noquote@} \ - orderby_desc {content_size desc} \ - orderby_asc {content_size asc}] \ - last_modified_pretty \ - [list label [_ file-storage.Last_Modified] \ - orderby_desc {last_modified_ansi desc} \ - orderby_asc {last_modified_ansi asc}] \ - properties_link \ - [list label "" \ - link_url_col properties_url \ - link_html { title "[_ file-storage.properties]" }] \ + orderby_desc {fs_objects.name desc} \ + orderby_asc {fs_objects.name asc}] \ + short_name \ + [list label [_ file-storage.Name] \ + hide_p 1 \ + display_template {@contents.title@} \ + orderby_desc {fs_objects.name desc} \ + orderby_asc {fs_objects.name asc}] \ + content_size_pretty \ + [list label [_ file-storage.Size] \ + display_template {@contents.content_size_pretty;noquote@} \ + orderby_desc {content_size desc} \ + orderby_asc {content_size asc}] \ + last_modified_pretty \ + [list label [_ file-storage.Last_Modified] \ + orderby_desc {last_modified_ansi desc} \ + orderby_asc {last_modified_ansi asc}] \ + properties_link \ + [list label "" \ + link_url_col properties_url \ + link_html { title "[_ file-storage.properties]" }] \ new_version_link \ - [list label "" \ - link_url_col new_version_url \ - link_html { title "[_ file-storage.Upload_a_new_version]" }] \ + [list label "" \ + link_url_col new_version_url \ + link_html { title "[_ file-storage.Upload_a_new_version]" }] \ download_link \ - [list label "" \ - link_url_col download_url \ - link_html { title "[_ file-storage.Download]" }] \ - ] + [list label "" \ + link_url_col download_url \ + link_html { title "[_ file-storage.Download]" }] \ + ] if { $categories_p } { @@ -168,9 +169,9 @@ if {$allow_bulk_actions} { set bulk_actions [list "[_ file-storage.Move]" "${fs_url}move" "[_ file-storage.lt_Move_Checked_Items_to]" "[_ file-storage.Copy]" "${fs_url}copy" "[_ file-storage.lt_Copy_Checked_Items_to]" "[_ file-storage.Delete]" "${fs_url}delete" "[_ file-storage.Delete_Checked_Items]" "[_ file-storage.Download_ZIP]" "${fs_url}download-zip" "[_ file-storage.Download_ZIP_Checked_Items]"] callback fs::folder_chunk::add_bulk_actions \ - -bulk_variable "bulk_actions" \ - -folder_id $folder_id \ - -var_export_list "vars_to_export" + -bulk_variable "bulk_actions" \ + -folder_id $folder_id \ + -var_export_list "vars_to_export" } else { set bulk_actions "" } @@ -196,14 +197,14 @@ label List layout list template { - - + - } } } \ -pass_properties [list target_attr] \ -filters { - folder_id {hide_p 1} - page_num + folder_id {hide_p 1} + page_num } \ -elements $elements @@ -225,16 +226,16 @@ set last_modified_pretty [lc_time_fmt $last_modified_ansi "%x %X"] if {[string equal $type "folder"]} { set content_size_pretty [lc_numeric $content_size] - append content_size_pretty " [_ file-storage.items]" - set pretty_type "#file-storage.Folder#" + append content_size_pretty " [_ file-storage.items]" + set pretty_type "#file-storage.Folder#" } else { if { $content_size eq "" } { - set content_size_pretty "" - } elseif {$content_size < 1024} { - set content_size_pretty "[lc_numeric $content_size] [_ file-storage.bytes]" - } else { - set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]] [_ file-storage.kb]" - } + set content_size_pretty "" + } elseif {$content_size < 1024} { + set content_size_pretty "[lc_numeric $content_size] [_ file-storage.bytes]" + } else { + set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]] [_ file-storage.kb]" + } } @@ -246,99 +247,99 @@ set views "" if {[apm_package_installed_p views]} { - array set views_arr [views::get -object_id $object_id] - if {$views_arr(views_count) ne ""} { - set views " $views_arr(views_count) / $views_arr(unique_views)" - } + array set views_arr [views::get -object_id $object_id] + if {$views_arr(views_count) ne ""} { + set views " $views_arr(views_count) / $views_arr(unique_views)" + } } set name [lang::util::localize $name] switch -- $type { - folder { - set properties_link "" - set properties_url "" - set new_version_link {} - set new_version_url {} - set icon "/resources/file-storage/folder.gif" - set alt_icon #file-storage.folder# - set file_url "${fs_url}index?[export_vars {{folder_id $object_id}}]" - set download_link [_ file-storage.Download] + folder { + set properties_link "" + set properties_url "" + set new_version_link {} + set new_version_url {} + set icon "/resources/file-storage/folder.gif" + set alt_icon #file-storage.folder# + set file_url "${fs_url}index?[export_vars {{folder_id $object_id}}]" + set download_link [_ file-storage.Download] set download_url "[export_vars -base "${fs_url}download-zip" -url {object_id}]" - } - url { - set properties_link [_ file-storage.properties] - set properties_url "${fs_url}simple?[export_vars object_id]" - set new_version_link [_ acs-kernel.common_New] - set new_version_url "${fs_url}file-add?[export_vars {{file_id $object_id}}]" - set icon "/resources/acs-subsite/url-button.gif" - # DRB: This alt text somewhat sucks, but the message key already exists in - # the language catalog files we care most about and we want to avoid a new - # round of translation work for this minor release if possible ... - set alt_icon #file-storage.link# - set file_url ${url} + } + url { + set properties_link [_ file-storage.properties] + set properties_url "${fs_url}simple?[export_vars object_id]" + set new_version_link [_ acs-kernel.common_New] + set new_version_url "${fs_url}file-add?[export_vars {{file_id $object_id}}]" + set icon "/resources/acs-subsite/url-button.gif" + # DRB: This alt text somewhat sucks, but the message key already exists in + # the language catalog files we care most about and we want to avoid a new + # round of translation work for this minor release if possible ... + set alt_icon #file-storage.link# + set file_url ${url} set download_url {} - set download_link {} - - } - symlink { - # save the original object_id to set it later back (see below) - set original_object_id $object_id - set properties_link [_ file-storage.properties] - set target_object_id [content::symlink::resolve -item_id $object_id] - db_1row file_info {select * from fs_objects where object_id = :target_object_id} - # because of the side effect that SQL sets TCL variables, set object_id back to the original value + set download_link {} + + } + symlink { + # save the original object_id to set it later back (see below) + set original_object_id $object_id + set properties_link [_ file-storage.properties] + set target_object_id [content::symlink::resolve -item_id $object_id] + db_1row file_info {select * from fs_objects where object_id = :target_object_id} + # because of the side effect that SQL sets TCL variables, set object_id back to the original value set object_id $original_object_id - if {[string equal $type "folder"]} { - set content_size_pretty [lc_numeric $content_size] - append content_size_pretty " [_ file-storage.items]" - set pretty_type "#file-storage.Folder#" - } else { - if {$content_size < 1024} { - set content_size_pretty "[lc_numeric $content_size] [_ file-storage.bytes]" - } else { - set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]] [_ file-storage.kb]" - } - - } - set properties_url "${fs_url}file?[export_vars {{file_id $object_id}}]" - set new_version_link [_ acs-kernel.common_New] - set new_version_url "${fs_url}file-add?[export_vars {{file_id $object_id}}]" - set icon "/resources/file-storage/file.gif" - set alt_icon #file-storage.file# - set file_url "${fs_url}view/${file_url}" - set download_link [_ file-storage.Download] - if {$like_filesystem_p} { - set download_url "${fs_url}download/$title?[export_vars {{file_id $target_object_id}}]" - set file_url $download_url - } else { - set download_url "${fs_url}download/$name?[export_vars {{file_id $target_object_id}}]" - } - } - default { - set properties_link [_ file-storage.properties] - set properties_url "${fs_url}file?[export_vars {{file_id $object_id}}]" - set new_version_link [_ acs-kernel.common_New] - set new_version_url "${fs_url}file-add?[export_vars {{file_id $object_id}}]" - set icon "/resources/file-storage/file.gif" - set alt_icon "#file-storage.file#" - set file_url "${fs_url}view/${file_url}" - set download_link [_ file-storage.Download] - if {$like_filesystem_p} { - set file_url "${fs_url}download/$title?[export_vars {{file_id $object_id}}]" - set download_url "/file/$object_id/${title}[file extension $name]" - } else { - set download_url "/file/$object_id/$name" - } - } + if {[string equal $type "folder"]} { + set content_size_pretty [lc_numeric $content_size] + append content_size_pretty " [_ file-storage.items]" + set pretty_type "#file-storage.Folder#" + } else { + if {$content_size < 1024} { + set content_size_pretty "[lc_numeric $content_size] [_ file-storage.bytes]" + } else { + set content_size_pretty "[lc_numeric [expr $content_size / 1024 ]] [_ file-storage.kb]" + } + + } + set properties_url "${fs_url}file?[export_vars {{file_id $object_id}}]" + set new_version_link [_ acs-kernel.common_New] + set new_version_url "${fs_url}file-add?[export_vars {{file_id $object_id}}]" + set icon "/resources/file-storage/file.gif" + set alt_icon #file-storage.file# + set file_url "${fs_url}view/${file_url}" + set download_link [_ file-storage.Download] + if {$like_filesystem_p} { + set download_url "${fs_url}download/$title?[export_vars {{file_id $target_object_id}}]" + set file_url $download_url + } else { + set download_url "${fs_url}download/$name?[export_vars {{file_id $target_object_id}}]" + } + } + default { + set properties_link [_ file-storage.properties] + set properties_url "${fs_url}file?[export_vars {{file_id $object_id}}]" + set new_version_link [_ acs-kernel.common_New] + set new_version_url "${fs_url}file-add?[export_vars {{file_id $object_id}}]" + set icon "/resources/file-storage/file.gif" + set alt_icon "#file-storage.file#" + set file_url "${fs_url}view/${file_url}" + set download_link [_ file-storage.Download] + if {$like_filesystem_p} { + set file_url "${fs_url}download/$title?[export_vars {{file_id $object_id}}]" + set download_url "/file/$object_id/${title}[file extension $name]" + } else { + set download_url "/file/$object_id/$name" + } + } } if { $categories_p } { - if { $type eq "folder" } { - set cat_folder_id $object_id - } else { - set cat_folder_id $folder_id - } - set categories [fs::category_links -object_id $object_id -folder_id $cat_folder_id -selected_category_id $category_id -fs_url $fs_url -joinwith "
"] + if { $type eq "folder" } { + set cat_folder_id $object_id + } else { + set cat_folder_id $folder_id + } + set categories [fs::category_links -object_id $object_id -folder_id $cat_folder_id -selected_category_id $category_id -fs_url $fs_url -joinwith "
"] } # We need to encode the hashes in any i18n message keys (.LRN plays this trick on some of its folders).