Index: openacs-4/packages/file-storage/file-storage.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/file-storage.info,v diff -u -r1.45 -r1.46 --- openacs-4/packages/file-storage/file-storage.info 15 May 2007 20:14:36 -0000 1.45 +++ openacs-4/packages/file-storage/file-storage.info 15 Jun 2007 17:40:28 -0000 1.46 @@ -1,4 +1,3 @@ - @@ -8,15 +7,15 @@ f f - + OpenACS Collaborative document storage 2005-09-30 OpenACS Provides a versioned document store with storage in the filesystem or database (depending on configuration). Documents and folders can be permissioned and folders downloaded. 0 - + @@ -37,6 +36,7 @@ + Index: openacs-4/packages/file-storage/catalog/file-storage.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/catalog/file-storage.en_US.ISO-8859-1.xml,v diff -u -r1.37 -r1.38 --- openacs-4/packages/file-storage/catalog/file-storage.en_US.ISO-8859-1.xml 15 May 2007 20:14:36 -0000 1.37 +++ openacs-4/packages/file-storage/catalog/file-storage.en_US.ISO-8859-1.xml 15 Jun 2007 17:40:28 -0000 1.38 @@ -1,5 +1,5 @@ - + Revision Action @@ -14,6 +14,7 @@ Back to folder view Back to project bytes + Categories Change Name Change upload limit Choose a destination folder @@ -40,6 +41,7 @@ Download checked items as a ZIP file Edit edit + Edit File Edit Folder Edit URL File Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v diff -u -r1.60 -r1.61 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 27 Mar 2007 06:32:16 -0000 1.60 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 15 Jun 2007 17:40:28 -0000 1.61 @@ -1550,3 +1550,39 @@ return $new_file_id } } + +ad_proc -private fs::category_links { + {-object_id:required} + {-folder_id:required} + {-selected_category_id ""} + {-fs_url ""} + {-joinwith ", "} +} { + @param object_id the file storage object_id whose category list we creating + @param folder_id the folder the category link should shearch on + @param selected_category_id the category that has been selected and for which a link to return to the folder without that category limitation should exist + @param fs_url is the file storage url for which these links will be created - defaults to the current package_url + @param joinwith allows you to join the link list with something other than the default ", " + + @return a list of category_links to filter the supplied folder for a given category +} { + if { $fs_url eq "" } { + set fs_url [ad_conn package_url] + } + set selected_found_p 0 + set categories [list] + foreach category_id [category::get_mapped_categories $object_id] { + if { $category_id eq $selected_category_id } { + set selected_found_p 1 + lappend categories "[category::get_name $category_id] (x)" + } else { + lappend categories "[category::get_name $category_id]" + } + } + if { [string is false $selected_found_p] && $selected_category_id ne "" } { + # we need to show the link to remove this category file at the + # top of the folder + lappend categories "[category::get_name $selected_category_id] (x)" + } + return [join $categories $joinwith] +} Index: openacs-4/packages/file-storage/www/file-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file-add.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/file-storage/www/file-add.tcl 15 May 2007 20:14:37 -0000 1.15 +++ openacs-4/packages/file-storage/www/file-add.tcl 15 Jun 2007 17:40:28 -0000 1.16 @@ -126,6 +126,19 @@ {unpack_p:boolean(checkbox),optional {label \#file-storage.Multiple_files\#} {html {onclick "javascript:UnpackChanged(this);"}} {options { {\#file-storage.lt_This_is_a_ZIP\# t} }} } } } +if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + if { [exists_and_not_null file_id] } { + set categorized_object_id $file_id + } else { + # pre-populate with categories from the folder + set categorized_object_id $folder_id + } + + category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id $categorized_object_id \ + -form_name file-add +} ad_form -extend -form {} -select_query_name {get_file} -new_data { @@ -224,6 +237,12 @@ -package_id $package_id \ -mime_type $mime_type + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $this_file_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } + file delete $tmpfile incr i if {$i < $number_upload_files} { @@ -248,6 +267,11 @@ -description $description \ -package_id $package_id + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $file_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } } -after_submit { if {[exists_and_not_null return_url]} { Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/file-edit-2-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/file-edit-2-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/file-edit-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/file-edit-2.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/file-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file-edit-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/file-storage/www/file-edit-oracle.xql 29 Jun 2004 10:18:25 -0000 1.3 +++ openacs-4/packages/file-storage/www/file-edit-oracle.xql 15 Jun 2007 17:40:29 -0000 1.4 @@ -15,4 +15,30 @@ + + + + begin + file_storage.rename_file ( + file_id => :file_id, + title => :title + ); + end; + + + + + + + + + select count(*) + from cr_items + where name = :title + and parent_id = content_item.get_parent_folder(:file_id) + + + + + Index: openacs-4/packages/file-storage/www/file-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file-edit-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/file-storage/www/file-edit-postgresql.xql 22 Sep 2001 05:48:26 -0000 1.2 +++ openacs-4/packages/file-storage/www/file-edit-postgresql.xql 15 Jun 2007 17:40:29 -0000 1.3 @@ -13,5 +13,29 @@ + + + + + select file_storage__rename_file ( + :file_id, -- file_id + :title -- title + ); + + + + + + + + select count(*) + from cr_items + where name = :title + and parent_id = content_item__get_parent_folder(:file_id) + + + + + Index: openacs-4/packages/file-storage/www/file-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file-edit.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/file-storage/www/file-edit.tcl 26 May 2005 08:28:46 -0000 1.8 +++ openacs-4/packages/file-storage/www/file-edit.tcl 15 Jun 2007 17:40:29 -0000 1.9 @@ -31,11 +31,45 @@ set page_title [_ file-storage.file_edit_page_title] set title_help [_ file-storage.lt_Please_enter_the_new_] -set submit_label [_ file-storage.Change_Name] -ad_form -action file-edit-2 -export file_id -form { +ad_form -export file_id -form { {title:text(text) {help_text $title_help} {label \#file-storage.Name\#}} +} + +set package_id [ad_conn package_id] +if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id $file_id \ + -form_name file-edit + set submit_label [_ file-storage.Save] +} else { + set submit_label [_ file-storage.Change_Name] +} + +ad_form -extend -form { {submit:text(submit) {label $submit_label}} -} -has_submit 1 +} -on_request { +} -on_submit { + if [catch { + db_dml edit_title {} + } errmsg] { + if { [db_string duplicate_check {}] } { + ad_return_complaint 1 "[_ file-storage.lt_It_appears_that_there]" + } else { + ad_return_complaint 1 "[_ file-storage.lt_We_got_an_error_that_] +
$errmsg
" + } + ad_script_abort + } + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $file_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } +} -after_submit { + ad_returnredirect "file?file_id=$file_id" +} + ad_return_template Index: openacs-4/packages/file-storage/www/file-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file-edit.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/www/file-edit.xql 15 Jun 2007 17:40:29 -0000 1.1 @@ -0,0 +1,12 @@ + + + + + + + update cr_revisions set title=:title + where revision_id=(select live_revision from cr_items + where item_id=:file_id) + + + Index: openacs-4/packages/file-storage/www/file-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-postgresql.xql,v diff -u -r1.14 -r1.15 --- openacs-4/packages/file-storage/www/file-postgresql.xql 17 May 2004 15:15:14 -0000 1.14 +++ openacs-4/packages/file-storage/www/file-postgresql.xql 15 Jun 2007 17:40:29 -0000 1.15 @@ -14,6 +14,7 @@ select person__name(o.creation_user) as owner, f.name as title, + f.parent_id, coalesce(f.url,f.file_upload_name) as name, acs_permission__permission_p(:file_id,:user_id,'write') as write_p, acs_permission__permission_p(:file_id,:user_id,'delete') as delete_p, Index: openacs-4/packages/file-storage/www/file.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file.adp,v diff -u -r1.23 -r1.24 --- openacs-4/packages/file-storage/www/file.adp 15 May 2007 20:14:37 -0000 1.23 +++ openacs-4/packages/file-storage/www/file.adp 15 Jun 2007 17:40:29 -0000 1.24 @@ -15,7 +15,7 @@ #file-storage.show_all_versions# - +

#file-storage.Categories#: @category_links;noquote@

#file-storage.lt_Comments_on_this_file# Index: openacs-4/packages/file-storage/www/file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/packages/file-storage/www/file.tcl 15 Dec 2006 22:45:33 -0000 1.28 +++ openacs-4/packages/file-storage/www/file.tcl 15 Jun 2007 17:40:29 -0000 1.29 @@ -42,10 +42,18 @@ } else { set show_versions [db_map show_live_version] } + set return_url [ad_conn url]?[export_vars file_id] +set categories_p [parameter::get -parameter CategoriesP -package_id [ad_conn package_id] -default 0] +if { $categories_p } { + set rename_name [_ file-storage.Edit_File] +} else { + set rename_name [_ file-storage.Rename_File] +} + set actions [list "[_ file-storage.Upload_Revision]" file-add?[export_vars [list file_id return_url]] "Upload a new version of this file" \ - "[_ file-storage.Rename_File]" file-edit?[export_vars file_id] "Rename file" \ + "$rename_name" file-edit?[export_vars file_id] "Rename file" \ "[_ file-storage.Copy_File]" file-copy?[export_vars file_id] "Copy file" \ "[_ file-storage.Move_File]" move?object_id=$file_id "Move file" \ "[_ file-storage.Delete_File]" file-delete?[export_vars file_id] "Delete file"] @@ -125,3 +133,7 @@ set folder_id [db_string get_folder ""] set folder_view_url "index?folder_id=$folder_id" + +if { $categories_p } { + set category_links [fs::category_links -object_id $file_id -folder_id $folder_id] +} Index: openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql,v diff -u -r1.14 -r1.15 --- openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 8 Aug 2006 21:26:49 -0000 1.14 +++ openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 15 Jun 2007 17:40:29 -0000 1.15 @@ -35,6 +35,7 @@ where m.object_id = fs_objects.object_id and m.party_id = :viewing_user_id and m.privilege = 'read') + $categories_limitation $orderby Index: openacs-4/packages/file-storage/www/folder-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk.adp,v diff -u -r1.27 -r1.28 --- openacs-4/packages/file-storage/www/folder-chunk.adp 16 Jan 2007 17:44:55 -0000 1.27 +++ openacs-4/packages/file-storage/www/folder-chunk.adp 15 Jun 2007 17:40:29 -0000 1.28 @@ -1,3 +1,5 @@ +

#file-storage.Categories#: @category_links;noquote@

+ 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.39 -r1.40 --- openacs-4/packages/file-storage/www/folder-chunk.tcl 15 May 2007 20:14:37 -0000 1.39 +++ openacs-4/packages/file-storage/www/folder-chunk.tcl 15 Jun 2007 17:40:29 -0000 1.40 @@ -20,7 +20,9 @@ if {![exists_and_not_null allow_bulk_actions]} { set allow_bulk_actions "0" } - +if { ![exists_and_not_null category_id] } { + set category_id "" +} set viewing_user_id [ad_conn user_id] permission::require_permission -party_id $viewing_user_id -object_id $folder_id -privilege "read" @@ -99,6 +101,13 @@ 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] + } + 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] \ @@ -137,10 +146,16 @@ [list label "" \ link_url_col download_url \ link_html { title "[_ file-storage.Download]" }] \ - views \ - [list label "Views" ] - ] + ] + +if { $categories_p } { + lappend elements categories [list label [_ file-storage.Categories] display_col "categories;noquote"] +} +lappend elements views [list label "Views" ] + + + if {[apm_package_installed_p views]} { concat $elements [list views [list label "Views"]] } @@ -198,7 +213,14 @@ set orderby " order by fs_objects.sort_key, fs_objects.name asc" } -db_multirow -extend {label alt_icon icon last_modified_pretty content_size_pretty properties_link properties_url download_link download_url new_version_link new_version_url views} contents select_folder_contents {} { +if { $categories_p && [exists_and_not_null category_id] } { + set categories_limitation [db_map categories_limitation] + set categories_limitation " and fs_objects.object_id in ( select object_id from category_object_map where category_id = $category_id )" +} else { + set categories_limitation {} +} + +db_multirow -extend {label alt_icon icon last_modified_pretty content_size_pretty properties_link properties_url download_link download_url new_version_link new_version_url views categories} contents select_folder_contents {} { set last_modified_ansi [lc_time_system_to_conn $last_modified_ansi] set last_modified_pretty [lc_time_fmt $last_modified_ansi "%x %X"] @@ -309,8 +331,15 @@ } } + 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 "
"] + } - # We need to encode the hashes in any i18n message keys (.LRN plays this trick on some of its folders). # If we don't, the hashes will cause the path to be chopped off (by ns_conn url) at the leftmost hash. regsub -all \# $file_url {%23} file_url Index: openacs-4/packages/file-storage/www/folder-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-create.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/file-storage/www/folder-create.tcl 26 May 2005 08:28:46 -0000 1.6 +++ openacs-4/packages/file-storage/www/folder-create.tcl 15 Jun 2007 17:40:29 -0000 1.7 @@ -52,7 +52,24 @@ folder_id:key {folder_name:text,optional {label \#file-storage.Title\#} {html {size 30}} } {description:text(textarea),optional {label \#file-storage.Description\#} {html "rows 5 cols 35"}} -} -edit_request { +} + +set package_id [ad_conn package_id] +if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + if { [exists_and_not_null folder_id] } { + set categorized_object_id $folder_id + } elseif { [exists_and_not_null parent_id] } { + set categorized_object_id $parent_id + } else { + set categorized_object_id "" + } + category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id $categorized_object_id \ + -form_name folder-ae +} + +ad_form -extend -name "folder-ae" -edit_request { #For now I'm using the bCSM proc. We need to move it to somewhere its more accessible. #But I hope we can avoid repeating the code in 2 places. # array set folder [bcms::folder::get_folder -folder_id $folder_id] @@ -90,13 +107,24 @@ ad_script_abort } + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $folder_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } + ad_returnredirect "?folder_id=$folder_id" ad_script_abort } -edit_data { db_transaction { fs::rename_folder -folder_id $folder_id -name $folder_name fs::set_folder_description -folder_id $folder_id -description $description } + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $folder_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } ad_returnredirect "?folder_id=$folder_id" ad_script_abort } Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/folder-edit-2-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/folder-edit-2-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/folder-edit-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/folder-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/folder-edit-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/www/folder-edit-oracle.xql 15 Jun 2007 17:40:29 -0000 1.1 @@ -0,0 +1,17 @@ + + + + oracle8.1.6 + + + + begin + content_folder.edit_name ( + folder_id => :folder_id, + label => :folder_name + ); + end; + + + + Index: openacs-4/packages/file-storage/www/folder-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/folder-edit-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/www/folder-edit-postgresql.xql 15 Jun 2007 17:40:29 -0000 1.1 @@ -0,0 +1,17 @@ + + + + postgresql7.1 + + + + select content_folder__edit_name ( + :folder_id, + null, -- name + :folder_name, -- label + null -- description + ); + + + + Index: openacs-4/packages/file-storage/www/folder-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-edit.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/file-storage/www/folder-edit.adp 15 May 2007 20:14:37 -0000 1.4 +++ openacs-4/packages/file-storage/www/folder-edit.adp 15 Jun 2007 17:40:29 -0000 1.5 @@ -4,26 +4,4 @@

#file-storage.Edit_Folder#

-
- -
- -
-
- -
- -
- -
-
- -
- -
-
- -
- + Index: openacs-4/packages/file-storage/www/folder-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-edit.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/file-storage/www/folder-edit.tcl 26 May 2005 08:28:46 -0000 1.3 +++ openacs-4/packages/file-storage/www/folder-edit.tcl 15 Jun 2007 17:40:29 -0000 1.4 @@ -23,6 +23,40 @@ set context_bar [fs_context_bar_list -final "[_ file-storage.Edit]" $folder_id] -set folder_name [fs_get_folder_name $folder_id] +set submit_label [_ file-storage.Save] +ad_form -export folder_id -form { + {folder_name:text(text) {label "\#file-storage.Folder_Name\#"}} +} + + +set package_id [ad_conn package_id] +if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id $folder_id \ + -form_name folder-edit +} + + +ad_form -extend -form { + {submit:text(submit) {label $submit_label}} +} -on_request { + set folder_name [fs_get_folder_name $folder_id] +} -on_submit { + + db_exec_plsql folder_rename {} + + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $folder_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } + + callback fs::folder_edit -package_id [ad_conn package_id] -folder_id $folder_id + +} -after_submit { + ad_returnredirect "?folder_id=$folder_id" +} + ad_return_template Index: openacs-4/packages/file-storage/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/index.adp,v diff -u -r1.33 -r1.34 --- openacs-4/packages/file-storage/www/index.adp 15 May 2007 20:14:37 -0000 1.33 +++ openacs-4/packages/file-storage/www/index.adp 15 Jun 2007 17:40:29 -0000 1.34 @@ -18,7 +18,7 @@
+ n_past_days="@n_past_days@" allow_bulk_actions="1" return_url="@return_url@" category_id="@category_id@">

@notification_chunk;noquote@

Index: openacs-4/packages/file-storage/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/index.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/packages/file-storage/www/index.tcl 8 Aug 2006 21:26:49 -0000 1.29 +++ openacs-4/packages/file-storage/www/index.tcl 15 Jun 2007 17:40:29 -0000 1.30 @@ -9,6 +9,7 @@ {folder_id:integer [fs_get_root_folder]} {n_past_days:integer "99999"} {orderby:optional} + {category_id:integer ""} {return_url ""} } -validate { valid_folder -requires {folder_id:integer} { Index: openacs-4/packages/file-storage/www/simple-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple-add.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/file-storage/www/simple-add.tcl 26 May 2005 08:28:46 -0000 1.11 +++ openacs-4/packages/file-storage/www/simple-add.tcl 15 Jun 2007 17:40:29 -0000 1.12 @@ -46,9 +46,7 @@ set page_title [_ file-storage.simple_add_page_title] -ad_form -action simple-add-2 -export {folder_id type} -form { - {dummy:text(hidden)} -} -has_submit 1 +ad_form -export {folder_id type} if {$lock_title_p} { ad_form -extend -form { @@ -66,5 +64,43 @@ ad_form -extend -form { {url:text(text) {label \#file-storage.URL\#} {value "http://"}} {description:text(textarea),optional {html {rows 5 cols 50}} {label \#file-storage.Description\#}} +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id $folder_id \ + -form_name simple-add +} + +ad_form -extend -form { {submit:text(submit) {label $submit_label}} +} -on_request { +} -on_submit { + set item_id [content_extlink::new -url $url -label $title -description $description -parent_id $folder_id] + + # Analogous as for files (see file-add-2) we know the user has write permission to this folder, + # but they may not have admin privileges. + # They should always be able to admin their own url (item) by default, so they can delete it, control + # who can read it, etc. + + if { [string is false [permission::permission_p -party_id $user_id -object_id $folder_id -privilege admin]] } { + permission::grant -party_id $user_id -object_id $item_id -privilege admin + } + + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $item_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } + + + fs::do_notifications -folder_id $folder_id -filename $url -item_id $item_id -action "new_url" + +} -after_submit { + + ad_returnredirect "?folder_id=$folder_id" + } Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/simple-edit-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/simple-edit-2.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/simple-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple-edit.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/file-storage/www/simple-edit.tcl 15 Dec 2006 22:45:33 -0000 1.8 +++ openacs-4/packages/file-storage/www/simple-edit.tcl 15 Jun 2007 17:40:29 -0000 1.9 @@ -19,10 +19,25 @@ {url:text {label "#file-storage.URL#"} {html {size 50} } } {description:text(textarea),optional {label "#file-storage.Description#" } {html { rows 5 cols 50 } } } {folder_id:text(hidden)} -} -edit_request { +} + +set package_id [ad_conn package_id] +if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id $object_id \ + -form_name simple-edit +} + +ad_form -extend -edit_request { db_1row extlink_data "" } -edit_data { content_extlink::edit -extlink_id $object_id -url $url -label $name -description $description + if { [parameter::get -parameter CategoriesP -package_id $package_id -default 0] } { + category::map_object -remove_old -object_id $object_id [category::ad_form::get_categories \ + -container_object_id $package_id \ + -element_name category_id] + } ad_returnredirect "?[export_vars folder_id]" } Index: openacs-4/packages/file-storage/www/simple.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/file-storage/www/simple.adp 27 Mar 2004 17:46:47 -0000 1.1 +++ openacs-4/packages/file-storage/www/simple.adp 15 Jun 2007 17:40:29 -0000 1.2 @@ -6,6 +6,7 @@

@url@

@description@

+

#file-storage.Categories#: @category_links;noquote@

#acs-kernel.common_edit# #acs-kernel.common_delete# Index: openacs-4/packages/file-storage/www/simple.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/file-storage/www/simple.tcl 26 May 2005 08:28:46 -0000 1.2 +++ openacs-4/packages/file-storage/www/simple.tcl 15 Jun 2007 17:40:29 -0000 1.3 @@ -19,4 +19,8 @@ set pretty_name $name set context [fs_context_bar_list -final [_ file-storage.link] $folder_id] +set categories_p [parameter::get -parameter CategoriesP -package_id [ad_conn package_id] -default 0] +if { $categories_p } { + set category_links [fs::category_links -object_id $object_id -folder_id $folder_id] +}