#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]
+}