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.29.2.9 -r1.29.2.10 --- openacs-4/packages/file-storage/file-storage.info 9 Jul 2004 13:40:20 -0000 1.29.2.9 +++ openacs-4/packages/file-storage/file-storage.info 21 Jul 2004 22:37:17 -0000 1.29.2.10 @@ -7,14 +7,14 @@ f f - + OpenACS Collaborative document storage - 2004-04-03 + 2004-07-21 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. - + 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.23.2.4 -r1.23.2.5 --- openacs-4/packages/file-storage/catalog/file-storage.en_US.ISO-8859-1.xml 12 May 2004 02:35:25 -0000 1.23.2.4 +++ openacs-4/packages/file-storage/catalog/file-storage.en_US.ISO-8859-1.xml 21 Jul 2004 22:37:17 -0000 1.23.2.5 @@ -28,6 +28,7 @@ Edit Folder Edit URL file + link Delete %title% Rename %title% Edit %pretty_name% @@ -37,6 +38,7 @@ This folder is available via WebDAV at %webdav_url% Delete %folder_name% Folder ID + This folder is available via WebDAV at %webdav_url% Folder Name: folder Up to %up_name% Index: openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql,v diff -u -r1.16 -r1.16.2.1 --- openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql 8 Dec 2003 21:51:26 -0000 1.16 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql 21 Jul 2004 22:37:17 -0000 1.16.2.1 @@ -70,6 +70,7 @@ text => ' @title;noquote@ @context;noquote@ +@item_id;noquote@ \@text;noquote@' ); @@ -90,3 +91,5 @@ @ file-storage-package-create.sql @ file-storage-views-create.sql + +@ file-storage-notifications-create.sql Index: openacs-4/packages/file-storage/sql/oracle/file-storage-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/file-storage-drop.sql,v diff -u -r1.10 -r1.10.4.1 --- openacs-4/packages/file-storage/sql/oracle/file-storage-drop.sql 30 Sep 2003 12:10:07 -0000 1.10 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-drop.sql 21 Jul 2004 22:37:17 -0000 1.10.4.1 @@ -53,3 +53,5 @@ end; / show errors + +@ file-storage-notifications-drop.sql Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-5.1.0a4-5.1.0a5.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql,v diff -u -r1.18 -r1.18.2.1 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql 8 Dec 2003 21:51:26 -0000 1.18 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql 21 Jul 2004 22:37:18 -0000 1.18.2.1 @@ -70,6 +70,7 @@ '' @title;noquote@ @context;noquote@ +@item_id;noquote@ @text;noquote@'', -- text true -- is_live ); @@ -93,3 +94,5 @@ \i file-storage-package-create.sql \i file-storage-views-create.sql + +\i file-storage-notifications-create.sql Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-drop.sql,v diff -u -r1.10 -r1.10.2.1 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-drop.sql 15 Dec 2003 11:21:04 -0000 1.10 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-drop.sql 21 Jul 2004 22:37:18 -0000 1.10.2.1 @@ -50,6 +50,10 @@ 'f' -- drop_table_p ); +-- this data model added by file-storage patch number 146 from +-- openacs.org bugtracker +\i file-storage-notifications-drop.sql + -- this content type is created incorrectly tying the file_storage_root_folders -- table to file_storage_object -- so we drop these directly Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.1.0a4-5.1.0a5.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql,v diff -u -r1.25.2.4 -r1.25.2.5 --- openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 26 May 2004 18:13:02 -0000 1.25.2.4 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 21 Jul 2004 22:37:18 -0000 1.25.2.5 @@ -142,6 +142,22 @@ + + + select person.name(o.creation_user) as owner + from acs_objects o where o.object_id = :file_id + + + + + + select site_node.url(node_id) as path1 from site_nodes + where object_id = (select package_id + from fs_root_folders where + fs_root_folders.folder_id = :root_folder) + + + select content Index: openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql,v diff -u -r1.38.2.1 -r1.38.2.2 --- openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 26 May 2004 18:13:03 -0000 1.38.2.1 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 21 Jul 2004 22:37:18 -0000 1.38.2.2 @@ -129,6 +129,22 @@ + + + select person__name(o.creation_user) as owner from + acs_objects o where o.object_id = :file_id + + + + + + select site_node__url(node_id) as path1 from site_nodes + where object_id = (select package_id + from fs_root_folders where + fs_root_folders.folder_id = :root_folder) + + + select lob 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.42.2.5 -r1.42.2.6 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 12 May 2004 15:14:06 -0000 1.42.2.5 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 21 Jul 2004 22:37:18 -0000 1.42.2.6 @@ -777,4 +777,95 @@ return "" } -} \ No newline at end of file +} + +ad_proc -public fs::do_notifications { + {-folder_id:required} + {-filename:required} + {-file_id ""} + {-url_id ""} + -action + {-version_id ""} +} { + Send notifications for file-storage operations. + + Note that not all possible operations are implemented, e.g. move, copy etc. See documentation. + + @param action The kind of operation. One of: new_file, new_version, new_url, delete_file, delete_url +} { + set root_folder [fs_get_root_folder] + + if {[string equal $action "new_file"]} { + set action_type {New File Uploaded} + } elseif {[string equal $action "new_url"]} { + set action_type {New URL Uploaded} + set file_id $url_id + } elseif {[string equal $action "new_version"]} { + set action_type {New version of file uploaded} + } elseif {[string equal $action "delete_file"]} { + set action_type {File deleted} + } elseif {[string equal $action "delete_url"]} { + set action_type {URL deleted} + } else { + error "Unknown file-storage notification action: $action" + } + + set url "[ad_url]" + set new_content "" + if {[string equal $action "new_file"] || [string equal $action "new_url"] || [string equal $action "new_version"]} { + db_1row get_owner_name { } + + if {[string equal $action "new_version"]} { + set sql "select description as description from cr_revisions + where cr_revisions.revision_id = :version_id" + } else { + set sql "select description as description from cr_revisions + where cr_revisions.item_id = :file_id" + } + + db_0or1row description $sql + + } + db_1row path1 { } + + # Set email message body - "text only" for now + set text_version "" + append text_version "Notification for: File-Storage: $action_type\n" + append text_version "File-Storage folder: [fs_get_folder_name $folder_id]\n" + + if {[string equal $action "new_version"]} { + append text_version "New Version Uploaded for file: $filename\n" + } else { + append text_version "Name of the $action_type: $filename\n" + } + if {[info exists owner]} { + append text_version "Uploaded by: $owner\n" + } + if {[info exists description]} { + append text_version "Version Notes: $description\n" + } + + append text_version "View folder contents: $url$path1?folder_id=$folder_id \n\n" + set new_content $text_version + # Do the notification for the file-storage + + notification::new \ + -type_id [notification::type::get_type_id \ + -short_name fs_fs_notif] \ + -object_id $folder_id \ + -notif_subject {File Storage Notification} \ + -notif_text $new_content + + # walk through all folders up to the root folder + while {$folder_id != $root_folder} { + set parent_id [db_string parent_id " + select parent_id from cr_items where item_id = :folder_id"] + notification::new \ + -type_id [notification::type::get_type_id \ + -short_name fs_fs_notif] \ + -object_id $parent_id \ + -notif_subject {File Storage Notification} \ + -notif_text $new_content + set folder_id $parent_id + } +} 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.8.2.2 -r1.8.2.3 --- openacs-4/packages/file-storage/www/file-add.tcl 28 Apr 2004 16:07:42 -0000 1.8.2.2 +++ openacs-4/packages/file-storage/www/file-add.tcl 21 Jul 2004 22:37:18 -0000 1.8.2.3 @@ -153,8 +153,7 @@ } - ad_returnredirect "./?[export_url_vars folder_id]" - ad_script_abort + fs::do_notifications -folder_id $folder_id -filename $title -file_id $file_id -action "new_file" } -edit_data { @@ -169,8 +168,13 @@ -description $description \ -package_id $package_id + fs::do_notifications -folder_id $folder_id -filename $title -file_id $file_id -action "new_version" + +} -after_submit { + ad_returnredirect "./?[export_url_vars folder_id]" ad_script_abort + } # if title isn't passed in ignore lock_title_p @@ -180,4 +184,4 @@ set unpack_available_p [expr ![empty_string_p [string trim [parameter::get -parameter UnzipBinary]]]] -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/file-storage/www/file-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-delete.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/file-storage/www/file-delete.tcl 16 Dec 2003 04:05:54 -0000 1.9 +++ openacs-4/packages/file-storage/www/file-delete.tcl 21 Jul 2004 22:37:18 -0000 1.9.2.1 @@ -52,7 +52,8 @@ file_storage.delete_file(:file_id); end;" - + fs::do_notifications -folder_id $parent_id -filename $title -file_id $file_id -action "delete_file" + ad_returnredirect "?folder_id=$parent_id" ad_script_abort 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.26.2.2 -r1.26.2.3 --- openacs-4/packages/file-storage/www/index.adp 10 May 2004 19:30:43 -0000 1.26.2.2 +++ openacs-4/packages/file-storage/www/index.adp 21 Jul 2004 22:37:18 -0000 1.26.2.3 @@ -3,12 +3,15 @@ @folder_name@ @context;noquote@ - #file-storage.index_page_navigate_up_folder# +

#file-storage.index_page_navigate_up_folder#

+ +

@notification_chunk;noquote@

+

#file-storage.Folder_available_via_WebDAV_at#

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.23.2.1 -r1.23.2.2 --- openacs-4/packages/file-storage/www/index.tcl 10 May 2004 19:30:43 -0000 1.23.2.1 +++ openacs-4/packages/file-storage/www/index.tcl 21 Jul 2004 22:37:18 -0000 1.23.2.2 @@ -76,6 +76,14 @@ -widget hidden \ -value $folder_id + +set notification_chunk [notification::display::request_widget \ + -type fs_fs_notif \ + -object_id $folder_id \ + -pretty_name $folder_name \ + -url [ad_conn url]?folder_id=$folder_id \ +] + if {[form is_valid n_past_days_form]} { form get_values n_past_days_form n_past_days folder_id } Index: openacs-4/packages/file-storage/www/simple-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple-add-2.tcl,v diff -u -r1.4 -r1.4.4.1 --- openacs-4/packages/file-storage/www/simple-add-2.tcl 17 May 2003 10:39:54 -0000 1.4 +++ openacs-4/packages/file-storage/www/simple-add-2.tcl 21 Jul 2004 22:37:18 -0000 1.4.4.1 @@ -34,5 +34,7 @@ permission::grant -party_id $user_id -object_id $item_id -privilege admin } +fs::do_notifications -folder_id $folder_id -filename $url -url_id $item_id -action "new_url" + ad_returnredirect "?folder_id=$folder_id" Index: openacs-4/packages/file-storage/www/simple-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple-delete.tcl,v diff -u -r1.4 -r1.4.4.1 --- openacs-4/packages/file-storage/www/simple-delete.tcl 17 May 2003 10:39:54 -0000 1.4 +++ openacs-4/packages/file-storage/www/simple-delete.tcl 21 Jul 2004 22:37:18 -0000 1.4.4.1 @@ -13,7 +13,15 @@ ad_require_permission $object_id delete # Delete -content_extlink::delete -extlink_id $object_id +db_transaction { + + fs::do_notifications -folder_id $folder_id -filename [content_extlink::extlink_name -item_id $object_id] -url_id $object_id -action "delete_url" + + content_extlink::delete -extlink_id $object_id + +} + + ad_returnredirect "./?folder_id=$folder_id" Index: openacs-4/packages/file-storage/www/version-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/version-add-2.tcl,v diff -u -r1.5 -r1.5.4.1 --- openacs-4/packages/file-storage/www/version-add-2.tcl 17 May 2003 10:39:54 -0000 1.5 +++ openacs-4/packages/file-storage/www/version-add-2.tcl 21 Jul 2004 22:37:18 -0000 1.5.4.1 @@ -64,7 +64,10 @@ ); end;"] + db_1row parent_folder { } + fs::do_notifications -folder_id $parent_folder -filename $filename -file_id $file_id -version_id $version_id -action "new_version" + if {$indb_p} { db_dml lob_content " Index: openacs-4/packages/file-storage/www/version-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/version-delete.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/file-storage/www/version-delete.tcl 19 Jan 2004 14:43:40 -0000 1.9 +++ openacs-4/packages/file-storage/www/version-delete.tcl 21 Jul 2004 22:37:18 -0000 1.9.2.1 @@ -57,9 +57,10 @@ file_storage.delete_file(:item_id); end;" + fs::do_notifications -folder_id $parent_id -filename $version_name -file_id $item_id -action "delete_file" + # Redirect to the folder, instead of the latest revision (which does not exist anymore) ad_returnredirect "index?folder_id=$parent_id" - ad_script_abort } else {