Index: openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql 17 Sep 2002 21:03:24 -0000 1.4 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql 17 May 2003 10:37:05 -0000 1.5 @@ -246,6 +246,8 @@ -- allow child items to be added content_folder.register_content_type(v_folder_id,'content_revision','t'); content_folder.register_content_type(v_folder_id,'content_folder','t'); + content_folder.register_content_type(v_folder_id,'content_extlink','t'); + content_folder.register_content_type(v_folder_id,'content_symlink','t'); -- set up default permissions acs_permission.grant_permission( @@ -612,6 +614,18 @@ 't' -- include_subtypes ); + content_folder.register_content_type( + v_folder_id, -- folder_id + 'content_extlink', -- content_type + 't' -- include_subtypes + ); + + content_folder.register_content_type( + v_folder_id, -- folder_id + 'content_symlink', -- content_type + 't' -- include_subtypes + ); + -- Give the creator admin privileges on the folder acs_permission.grant_permission( v_folder_id, -- object_id @@ -667,7 +681,18 @@ content_folder.delete(v_rec.item_id); end if; - -- We may have to delete other items here, e.g., symlinks(future feature) + -- Instead of doing an if-else, we make sure we are deleting a folder. + if v_rec.content_type = 'content_symlink' + then + content_symlink.delete(v_rec.item_id); + end if; + + -- Instead of doing an if-else, we make sure we are deleting a folder. + if v_rec.content_type = 'content_extlink' + then + content_extlink.delete(v_rec.item_id); + end if; + end loop; end; / Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/oracle/file-storage-simple-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/oracle/file-storage-simple-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/sql/oracle/file-storage-views-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/file-storage-views-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/file-storage/sql/oracle/file-storage-views-create.sql 11 Dec 2002 13:27:59 -0000 1.6 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-views-create.sql 17 May 2003 10:37:05 -0000 1.7 @@ -8,17 +8,17 @@ create or replace view fs_urls_full as - select fs_urls.url_id, - fs_urls.url, - fs_simple_objects.folder_id, - fs_simple_objects.name, - fs_simple_objects.description, + select cr_extlinks.extlink_id as url_id, + cr_extlinks.url, + cr_items.parent_id as folder_id, + cr_extlinks.label as name, + cr_extlinks.description, acs_objects.* - from fs_urls, - fs_simple_objects, + from cr_extlinks, + cr_items, acs_objects - where fs_urls.url_id = fs_simple_objects.object_id - and fs_simple_objects.object_id = acs_objects.object_id; + where cr_extlinks.extlink_id = cr_items.item_id + and cr_items.item_id = acs_objects.object_id; create or replace view fs_folders as @@ -59,41 +59,38 @@ create or replace view fs_objects as - select fs_folders.folder_id as object_id, - 0 as live_revision, - 'folder' as type, - fs_folders.content_size, - fs_folders.name, - '' as file_upload_name, - fs_folders.last_modified, - '' as url, - fs_folders.parent_id, - fs_folders.key, - 0 as sort_key - from fs_folders - union all - select fs_files.file_id as object_id, - fs_files.live_revision, - fs_files.type, - fs_files.content_size, - fs_files.name, - fs_files.file_upload_name, - fs_files.last_modified, - '' as url, - fs_files.parent_id, - fs_files.key, - 1 as sort_key - from fs_files - union all - select fs_urls_full.url_id as object_id, - 0 as live_revision, - 'url' as type, - 0 as content_size, - fs_urls_full.name, - fs_urls_full.name as file_upload_name, - fs_urls_full.last_modified, - fs_urls_full.url, - fs_urls_full.folder_id as parent_id, - fs_urls_full.url as key, - 1 as sort_key - from fs_urls_full; + select cr_items.item_id as object_id, + cr_items.live_revision, + case + when cr_items.content_type = 'content_folder' then 'folder' + when cr_items.content_type = 'content_extlink' then 'url' + else cr_revisions.mime_type + end as type, + case + when cr_items.content_type = 'content_folder' + then (select count(*) + from cr_items ci + where ci.content_type <> 'content_folder' + connect by prior ci.item_id = ci.parent_id + start with ci.item_id = cr_folders.folder_id) + else cr_revisions.content_length + end as content_size, + case + when cr_items.content_type = 'content_folder' then cr_folders.label + when cr_items.content_type = 'content_extlink' then cr_extlinks.label + else cr_items.name + end as name, + cr_revisions.title as file_upload_name, + acs_objects.last_modified, + cr_extlinks.url, + cr_items.parent_id, + cr_items.name as key, + case + when cr_items.content_type = 'content_folder' then 0 + else 1 + end as sort_key + from cr_items, cr_extlinks, cr_folders, cr_revisions, acs_objects + where cr_items.item_id = cr_extlinks.extlink_id(+) + and cr_items.item_id = cr_folders.folder_id(+) + and cr_items.item_id = acs_objects.object_id + and cr_items.live_revision = cr_revisions.revision_id(+); Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.6.1-4.6.2.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql 18 Sep 2002 06:03:29 -0000 1.8 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql 17 May 2003 10:38:11 -0000 1.9 @@ -131,6 +131,16 @@ ''content_folder'', -- content_types ''t'' -- include_subtypes ); + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_symlink'', -- content_types + ''t'' -- include_subtypes + ); + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_extlink'', -- content_types + ''t'' -- include_subtypes + ); -- set up default permissions PERFORM acs_permission__grant_permission ( @@ -637,6 +647,18 @@ ''t'' -- include_subtypes (default) ); + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_extlink'', -- content_types + ''t'' -- include_subtypes + ); + + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_symlink'', -- content_types + ''t'' -- include_subtypes + ); + -- Give the creator admin privileges on the folder PERFORM acs_permission__grant_permission ( v_folder_id, -- object_id @@ -685,7 +707,9 @@ order by c1.tree_sortkey desc loop + -- DRB: Why can''t we just use object delete here? + -- We delete the item. On delete cascade should take care -- of deletion of revisions. if v_rec.content_type = ''file_storage_object'' @@ -701,8 +725,20 @@ PERFORM content_folder__delete(v_rec.item_id); end if; - -- We may have to delete other items here, e.g., symlinks (future feature) + -- Instead of doing an if-else, we make sure we are deleting a folder. + if v_rec.content_type = ''content_symlink'' + then + raise notice ''Deleting symlink_id = %'',v_rec.item_id; + PERFORM content_symlink__delete(v_rec.item_id); + end if; + -- Instead of doing an if-else, we make sure we are deleting a folder. + if v_rec.content_type = ''content_extlink'' + then + raise notice ''Deleting folder_id = %'',v_rec.item_id; + PERFORM content_extlink__delete(v_rec.item_id); + end if; + end loop; -- We need to return something for the trigger to be activated Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/postgresql/file-storage-simple-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.10 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/postgresql/file-storage-simple-package-create.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql 18 Feb 2003 16:56:47 -0000 1.7 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql 17 May 2003 10:38:11 -0000 1.8 @@ -8,17 +8,17 @@ create view fs_urls_full as - select fs_urls.url_id, - fs_urls.url, - fs_simple_objects.folder_id, - fs_simple_objects.name, - fs_simple_objects.description, + select cr_extlinks.extlink_id as url_id, + cr_extlinks.url, + cr_items.parent_id as folder_id, + cr_extlinks.label as name, + cr_extlinks.description, acs_objects.* - from fs_urls, - fs_simple_objects, + from cr_extlinks, + cr_items, acs_objects - where fs_urls.url_id = fs_simple_objects.object_id - and fs_simple_objects.object_id = acs_objects.object_id; + where cr_extlinks.extlink_id = cr_items.item_id + and cr_items.item_id = acs_objects.object_id; create view fs_folders as @@ -37,7 +37,6 @@ where cr_folders.folder_id = ci.item_id and cr_folders.folder_id = acs_objects.object_id; - create view fs_files as select cr_revisions.item_id as file_id, @@ -59,41 +58,36 @@ create view fs_objects as - select fs_folders.folder_id as object_id, - 0 as live_revision, - 'folder' as type, - fs_folders.content_size, - fs_folders.name, - '' as file_upload_name, - fs_folders.last_modified, - '' as url, - fs_folders.parent_id, - fs_folders.key, - 0 as sort_key - from fs_folders - union all - select fs_files.file_id as object_id, - fs_files.live_revision, - fs_files.type, - fs_files.content_size, - fs_files.name, - fs_files.file_upload_name, - fs_files.last_modified, - '' as url, - fs_files.parent_id, - fs_files.key, - 1 as sort_key - from fs_files - union all - select fs_urls_full.url_id as object_id, - 0 as live_revision, - 'url' as type, - 0 as content_size, - fs_urls_full.name, - fs_urls_full.name as file_upload_name, - fs_urls_full.last_modified, - fs_urls_full.url, - fs_urls_full.folder_id as parent_id, - fs_urls_full.url as key, - 1 as sort_key - from fs_urls_full; + select cr_items.item_id as object_id, + cr_items.live_revision, + case + when cr_items.content_type = 'content_folder' then 'folder' + when cr_items.content_type = 'content_extlink' then 'url' + else cr_revisions.mime_type + end as type, + case + when cr_items.content_type = 'content_folder' + then (select count(*) + from cr_items ci2 + where ci2.content_type <> 'content_folder' + and ci2.tree_sortkey between cr_items.tree_sortkey and tree_right(cr_items.tree_sortkey)) + else cr_revisions.content_length + end as content_size, + case + when cr_items.content_type = 'content_folder' then cr_folders.label + when cr_items.content_type = 'content_extlink' then cr_extlinks.label + else cr_items.name + end as name, + cr_revisions.title as file_upload_name, + acs_objects.last_modified, + cr_extlinks.url, + cr_items.parent_id, + cr_items.name as key, + case + when cr_items.content_type = 'content_folder' then 0 + else 1 + end as sort_key + from cr_items left join cr_extlinks on (cr_items.item_id = cr_extlinks.extlink_id) + left join cr_folders on (cr_items.item_id = cr_folders.folder_id) + left join cr_revisions on (cr_items.live_revision = cr_revisions.revision_id) + join acs_objects on (cr_items.item_id = acs_objects.object_id); Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6-4.6.1.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.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.20 -r1.21 --- openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 18 Nov 2002 18:01:04 -0000 1.20 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 17 May 2003 10:39:21 -0000 1.21 @@ -52,26 +52,28 @@ - select fc.* - from (select fs_objects.object_id, - fs_objects.name, - fs_objects.live_revision, - fs_objects.type, - to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - fs_objects.content_size, - fs_objects.url, - fs_objects.key, - fs_objects.sort_key, - fs_objects.file_upload_name, - case when fs_objects.last_modified >= (sysdate - :n_past_days) then 1 else 0 end as new_p, - acs_permission.permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p, - acs_permission.permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p, - acs_permission.permission_p(fs_objects.object_id, :user_id, 'write') as write_p - from fs_objects - where fs_objects.parent_id = :folder_id) fc - where 't' = (select acs_permission.permission_p(fc.object_id, :user_id, 'read') from dual) - order by fc.sort_key, - fc.name + select fs_objects.object_id, + fs_objects.name, + fs_objects.live_revision, + fs_objects.type, + to_char(fs_objects.last_modified, 'Month DD YYYY HH24:MI') as last_modified, + fs_objects.content_size, + fs_objects.url, + fs_objects.key, + fs_objects.sort_key, + fs_objects.file_upload_name, + case when fs_objects.last_modified >= (sysdate - :n_past_days) then 1 else 0 end as new_p, + acs_permission.permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p, + acs_permission.permission_p(fs_objects.object_id, :user_id, 'write') as write_p + from fs_objects + where fs_objects.parent_id = :folder_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = fs_objects.object_id + and m.party_id = :user_id + and m.privilege = 'read') + order by fs_objects.sort_key, fs_objects.name @@ -139,4 +141,12 @@ + + + select content + from cr_revisions + where revision_id = $live_revision + + + 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.32 -r1.33 --- openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 21 Jan 2003 13:10:59 -0000 1.32 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 17 May 2003 10:39:21 -0000 1.33 @@ -44,30 +44,30 @@ --- we use $ n_past-days instead of :n_past_days because the pgdriver --- bind variable emulation puts single-quotes around the n_past_days --- integer. Postgresql tries to turn '-1' into a date datatype --- so now()-'-1' fails but now()- interval '-1' works fine. - select fc.* - from (select fs_objects.object_id, - fs_objects.name, - fs_objects.live_revision, - fs_objects.type, - to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - fs_objects.content_size, - fs_objects.url, - fs_objects.key, - fs_objects.sort_key, - fs_objects.file_upload_name, - case when fs_objects.last_modified >= (now() - interval '$n_past_days days') then 1 else 0 end as new_p, - acs_permission__permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p, - acs_permission__permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p, - acs_permission__permission_p(fs_objects.object_id, :user_id, 'write') as write_p - from fs_objects - where fs_objects.parent_id = :folder_id) fc - where 't' = (select acs_permission__permission_p(fc.object_id, :user_id, 'read') from dual) - order by fc.sort_key, - fc.name + + select fs_objects.object_id, + fs_objects.name, + fs_objects.live_revision, + fs_objects.type, + to_char(fs_objects.last_modified, 'Month DD YYYY HH24:MI') as last_modified, + fs_objects.content_size, + fs_objects.url, + fs_objects.key, + fs_objects.sort_key, + fs_objects.file_upload_name, + case when fs_objects.last_modified >= (now() - interval '$n_past_days days') then 1 else 0 end as new_p, + acs_permission__permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p, + acs_permission__permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p, + acs_permission__permission_p(fs_objects.object_id, :user_id, 'write') as write_p + from fs_objects + where fs_objects.parent_id = :folder_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = fs_objects.object_id + and m.party_id = :user_id + and m.privilege = 'read') + order by fs_objects.sort_key, fs_objects.name + @@ -81,7 +81,7 @@ select count(*) from cr_items c1, cr_items c2 - where c2.item_id = file_storage__get_parent_id(:item_id) + where c2.item_id = :item_id and c1.tree_sortkey between c2.tree_sortkey and tree_right(c2.tree_sortkey) and not acs_permission__permission_p(c1.item_id, :user_id, :privilege) @@ -128,4 +128,12 @@ + + + select lob + from cr_revisions + where revision_id = $live_revision + + + 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.30 -r1.31 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 18 Feb 2003 20:55:28 -0000 1.30 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 17 May 2003 10:39:21 -0000 1.31 @@ -181,41 +181,6 @@ return $context_bar } -# -# Make sure we don't have page crashes due to unknown MIME types -# - -ad_proc fs_maybe_create_new_mime_type { - file_name -} { - The content repository expects the MIME type to already be defined - when you upload content. We use this procedure to add a new type - when we encounter something we haven't seen before. -} { - - set file_extension [string trimleft [file extension $file_name] "."] - - # This case is now handled by the code below (Ben) - # if {[empty_string_p $file_extension]} { - # return "*/*" - #} - - if {![db_0or1row select_mime_type "select mime_type - from cr_mime_types - where file_extension = :file_extension"]} { - - # Ben: we've fixed this so that all AOLserver mime types - # are now part of the cr_mime_types. So we just return now - # or leave it at that. - - set mime_type "*/*" - } - - return $mime_type -} - - - namespace eval fs { ad_proc -public new_root_folder { @@ -357,10 +322,6 @@ } { Return a list the object_ids contained by a file storage folder. - This would be trivial if it weren't for the fact that we need to UNION ALL - with the gawddamned fs_simple_objects Open Force forced upon us and which - will be removed as soon as I (DRB) find the time to write upgrade scripts. - @param folder_id The folder for which to retrieve contents @param user_id The viewer of the contents (to make sure they have permission) @@ -376,6 +337,13 @@ } { WARNING: This proc is not scalable because it does too many permission checks. + DRB: Not so true now that permissions are fast. However it is now only used + to clone files in dotLRN and for the somewhat brain-damaged syllabus package. + At minimum the permission checks returned by the code can be removed. Most of + the other fields as well. Oh well ... + + REMOVE WHEN SYLLABUS IS REWRITTEN TO FIND ITS FILE INTELLIGENTLY + Retrieve the contents of the specified folder in the form of a list of ns_sets, one for each row returned. The keys for each row are as follows: @@ -449,7 +417,7 @@ if {[string equal folder $type]} { set result [publish_folder_to_file_system -folder_id $object_id -path $path -folder_name $name -user_id $user_id] } elseif {[string equal url $type]} { - set result [publish_simple_object_to_file_system -object_id $object_id -path $path -file_name $file_name] + set result [publish_url -object_id $object_id -path $path -file_name $file_name] } else { set result [publish_versioned_object_to_file_system -object_id $object_id -path $path] } @@ -488,29 +456,9 @@ return $dir } - ad_proc -public publish_simple_object_to_file_system { + ad_proc -public publish_url_to_file_system { {-object_id:required} {-path ""} - {-file_name:required} - } { - publish a simple object to the file system; you must implement a proc - named 'fs::publish_simple__to_file_system', where is the - fs_simple_object type that you create, for each new simple file storage - object you create. - } { - if {[empty_string_p $path]} { - set path [ns_tmpnam] - file mkdir $path - } - - set object [db_list_of_ns_sets select_object_info {}] - - return [publish_simple_[ns_set get $object type]_to_file_system -object $object -path $path -file_name $file_name] - } - - ad_proc -public publish_simple_url_to_file_system { - {-object:required} - {-path ""} {-file_name ""} } { publish a url object to the file system @@ -520,15 +468,15 @@ file mkdir $path } - set object [lindex $object 0] + db_1row select_object_metadata {} if {[empty_string_p $file_name]} { - set file_name [ns_set get $object name] + set file_name $label } set file_name [remove_special_file_system_characters -string $file_name] set fp [open [file join ${path} ${file_name}] w] - puts $fp [ns_set get $object url] + puts $fp url close $fp return [file join ${path} ${file_name}] @@ -555,7 +503,15 @@ switch $storage_type { lob { + # FIXME: db_blob_get_file is failing when i use bind variables + + # DRB: you're out of luck - the driver doesn't support them and while it should + # be fixed it will be a long time before we'll want to require an updated + # driver. I'm substituting the Tcl variable value directly in the query due to + # this. It's safe because we've pulled the value ourselves from the database, + # don't need to worry about SQL smuggling etc. + db_blob_get_file select_object_content {} -file [file join ${path} ${file_name}] } text { Index: openacs-4/packages/file-storage/tcl/file-storage-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.xql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/file-storage/tcl/file-storage-procs.xql 18 Feb 2003 20:55:28 -0000 1.11 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.xql 17 May 2003 10:39:21 -0000 1.12 @@ -17,23 +17,6 @@ - - - select mime_type - from cr_mime_types - where file_extension = :file_extension - - - - - - insert into cr_mime_types - (mime_type, file_extension) - values - (:mime_type, :extension) - - - select item_id @@ -74,21 +57,15 @@ - select * - from (select cr_items.item_id as object_id, - cr_items.name - from cr_items - where cr_items.parent_id = :folder_id - union all - select fs_simple_objects.object_id, - fs_simple_objects.name - from fs_simple_objects - where fs_simple_objects.folder_id = :folder_id) contents - where exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = contents.object_id - and m.party_id = :user_id - and m.privilege = 'read') + select cr_items.item_id as object_id, + cr_items.name + from cr_items + where cr_items.parent_id = :folder_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = cr_items.item_id + and m.party_id = :user_id + and m.privilege = 'read') @@ -109,11 +86,11 @@ - + - select fs_objects.* - from fs_objects - where fs_objects.object_id = :object_id + select fs_urls_full.* + from fs_urls_full + where fs_urls_full.object_id = :object_id @@ -132,14 +109,6 @@ - - - select content - from cr_revisions - where revision_id = $live_revision - - - select filename Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/tcl/fs-simple-procs-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/tcl/fs-simple-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/tcl/fs-simple-procs.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/tcl/fs-simple-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/file-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-add-2.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/file-storage/www/file-add-2.tcl 18 Nov 2002 18:01:05 -0000 1.9 +++ openacs-4/packages/file-storage/www/file-add-2.tcl 17 May 2003 10:39:54 -0000 1.10 @@ -41,10 +41,7 @@ # Get the ip set creation_ip [ad_conn peeraddr] -# The content repository is kinda stupid about mime types, -# so we have to check if we know about this one and possibly -# add it. -set mime_type [fs_maybe_create_new_mime_type $upload_file] +set mime_type [cr_filename_to_mime_type -create $upload_file] # Get the storage type set indb_p [ad_parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] @@ -82,7 +79,14 @@ } + # 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 file 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 $file_id -privilege admin + } + } on_error { # most likely a duplicate name or a double click Index: openacs-4/packages/file-storage/www/file-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-oracle.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/file-storage/www/file-oracle.xql 18 Nov 2002 18:01:05 -0000 1.7 +++ openacs-4/packages/file-storage/www/file-oracle.xql 17 May 2003 10:39:54 -0000 1.8 @@ -32,10 +32,14 @@ acs_permission.permission_p(r.revision_id,:user_id,'delete') as delete_p, r.content_length as content_size from acs_objects o, cr_revisions r, cr_items i - where o.object_id = r.revision_id - and acs_permission.permission_p(r.revision_id, :user_id, 'read') = 't' - and r.item_id = i.item_id - and r.item_id = :file_id + where o.object_id = r.revision_id + and r.item_id = i.item_id + and r.item_id = :file_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = r.revision_id + and m.party_id = :user_id + and m.privilege = 'read') $show_versions order by last_modified desc 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.7 -r1.8 --- openacs-4/packages/file-storage/www/file-postgresql.xql 18 Nov 2002 18:01:05 -0000 1.7 +++ openacs-4/packages/file-storage/www/file-postgresql.xql 17 May 2003 10:39:54 -0000 1.8 @@ -32,10 +32,14 @@ acs_permission__permission_p(r.revision_id,:user_id,'delete') as delete_p, r.content_length as content_size from acs_objects o, cr_revisions r, cr_items i - where o.object_id = r.revision_id - and acs_permission__permission_p(r.revision_id, :user_id, 'read') = 't' - and r.item_id = i.item_id - and r.item_id = :file_id + where o.object_id = r.revision_id + and r.item_id = i.item_id + and r.item_id = :file_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = r.revision_id + and m.party_id = :user_id + and m.privilege = 'read') $show_versions order by last_modified desc Index: openacs-4/packages/file-storage/www/folder-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/folder-chunk-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/file-storage/www/folder-chunk-oracle.xql 18 Feb 2003 20:56:09 -0000 1.3 +++ openacs-4/packages/file-storage/www/folder-chunk-oracle.xql 17 May 2003 10:39:54 -0000 1.4 @@ -9,7 +9,7 @@ fs_objects.name, fs_objects.live_revision, fs_objects.type, - to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified, + to_char(fs_objects.last_modified, 'Month DD YYYY HH24:MI') as last_modified, fs_objects.content_size, fs_objects.url, fs_objects.sort_key, 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.4 -r1.5 --- openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 18 Feb 2003 20:56:09 -0000 1.4 +++ openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 17 May 2003 10:39:54 -0000 1.5 @@ -9,74 +9,29 @@ fs_objects.name, fs_objects.live_revision, fs_objects.type, - to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified, + to_char(fs_objects.last_modified, 'Month DD YYYY HH24:MI') as last_modified, fs_objects.content_size, fs_objects.url, fs_objects.sort_key, fs_objects.file_upload_name, - case when fs_objects.last_modified >= (now() - interval '$n_past_days days') then 1 else 0 end as new_p, - delete_p, - write_p - from - (select fs_folders.folder_id as object_id, - 0 as live_revision, - 'folder' as type, - fs_folders.content_size, - fs_folders.name, - '' as file_upload_name, - fs_folders.last_modified, - '' as url, - fs_folders.parent_id, - cast('f' as bool) as write_p, - cast('f' as bool) as delete_p, - 0 as sort_key - from fs_folders - where fs_folders.parent_id = :folder_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = fs_folders.folder_id - and m.party_id = :viewing_user_id - and m.privilege = 'read') - union all - select fs_files.file_id as object_id, - fs_files.live_revision, - fs_files.type, - fs_files.content_size, - fs_files.name, - fs_files.file_upload_name, - fs_files.last_modified, - '' as url, - fs_files.parent_id, - cast('f' as bool) as write_p, - cast('f' as bool) as delete_p, - 1 as sort_key - from fs_files - where fs_files.parent_id = :folder_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = fs_files.file_id - and m.party_id = :viewing_user_id - and m.privilege = 'read') - union all - select fs_urls_full.url_id as object_id, - 0 as live_revision, - 'url' as type, - 0 as content_size, - fs_urls_full.name, - fs_urls_full.name as file_upload_name, - fs_urls_full.last_modified, - fs_urls_full.url, - fs_urls_full.folder_id as parent_id, - acs_permission__permission_p(fs_urls.url_id, :viewing_user_id, 'write') as write_p, - acs_permission__permission_p(fs_urls.url_id, :viewing_user_id, 'delete') as delete_p, - 1 as sort_key - from fs_urls_full - where fs_urls_full.folder_id = :folder_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = fs_urls_full.url_id - and m.party_id = :viewing_user_id - and m.privilege = 'read')) as fs_objects + case when fs_objects.last_modified >= (now() - cast('$n_past_days days' as interval)) then 1 else 0 end as new_p, + case + when type = 'url' + then acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'delete') + else 't' + end as delete_p, + case + when type = 'url' + then acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'write') + else 't' + end as write_p + from fs_objects + where fs_objects.parent_id = :folder_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = fs_objects.object_id + and m.party_id = :viewing_user_id + and m.privilege = 'read') order by fs_objects.sort_key, fs_objects.name 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.16 -r1.17 --- openacs-4/packages/file-storage/www/folder-chunk.adp 18 Feb 2003 20:56:09 -0000 1.16 +++ openacs-4/packages/file-storage/www/folder-chunk.adp 17 May 2003 10:39:54 -0000 1.17 @@ -1,5 +1,5 @@ - +
@@ -8,80 +8,82 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  #file-storage.Name##file-storage.Type# #file-storage.Last_Modified#
#file-storage.folder# - <%= [lang::util::localize @contents.name@] %> -#file-storage.new# -   - @contents.content_size@ #file-storage.items##file-storage.item# - #file-storage.folder#@contents.last_modified@#file-storage.file# - @contents.name@ -#file-storage.new# - - - - [ - #file-storage.edit# - - - - | - - #file-storage.delete# - - - - ] - - -  @contents.type@ @contents.last_modified@#file-storage.file# - - @contents.name@ - - - #file-storage.new# - - - [ - - #file-storage.view_details# - - ] - @contents.content_size@ bytes@contents.type@@contents.last_modified@
#file-storage.folder# + @contents.name@ + #file-storage.new# +   + @contents.content_size@ #file-storage.items##file-storage.item# + @contents.type@@contents.last_modified@#file-storage.file# + @contents.name@ + #file-storage.new# + + + + [ #file-storage.edit# + + + | + #file-storage.delete# + + + ] + + +  @contents.type@@contents.last_modified@#file-storage.file# + + @contents.name@ + + + #file-storage.new# + + + #file-storage.view_details# + @contents.content_size@ bytes@contents.type@@contents.last_modified@
+ + +

+ + Download an archive of the contents of this folder + +
+ Note: This may take a while, please be patient. +

+

#file-storage.lt_Folder_folder_name_is#

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.11 -r1.12 --- openacs-4/packages/file-storage/www/folder-chunk.tcl 18 Feb 2003 20:56:09 -0000 1.11 +++ openacs-4/packages/file-storage/www/folder-chunk.tcl 17 May 2003 10:39:54 -0000 1.12 @@ -8,17 +8,14 @@ } -properties { folder_name:onevalue contents:multirow + content_size_total:onevalue } if {![exists_and_not_null folder_id]} { ad_return_complaint 1 [_ file-storage.lt_bad_folder_id_folder_] ad_script_abort } -if {![exists_and_not_null viewing_user_id]} { - set viewing_user_id [acs_magic_object "the_public"] -} - permission::require_permission -party_id $viewing_user_id -object_id $folder_id -privilege "read" if {![exists_and_not_null n_past_days]} { @@ -37,4 +34,13 @@ set folder_name [fs::get_object_name -object_id $folder_id] +set content_size_total 0 + +db_multirow contents select_folder_contents {} { + set file_upload_name [fs::remove_special_file_system_characters -string $file_upload_name] + if { ![empty_string_p $content_size] } { + incr content_size_total $content_size + } +} + ad_return_template Index: openacs-4/packages/file-storage/www/folder-create.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-create.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/file-storage/www/folder-create.adp 5 Nov 2002 17:19:59 -0000 1.4 +++ openacs-4/packages/file-storage/www/folder-create.adp 17 May 2003 10:39:54 -0000 1.5 @@ -1,9 +1,10 @@ #file-storage.Create_New_Folder# @context@ +folder.folder_name -
+ 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.18 -r1.19 --- openacs-4/packages/file-storage/www/index.adp 5 Nov 2002 17:19:59 -0000 1.18 +++ openacs-4/packages/file-storage/www/index.adp 17 May 2003 10:39:54 -0000 1.19 @@ -3,45 +3,49 @@ @folder_name@@context@ -
- - - - +
- #file-storage.Upload_a_file# -   |   - #file-storage.Create_a_URL# -   |   - #file-storage.Create_a_new_folder# - -   |   - #file-storage.Rename_this_folder# - - -   |   - #file-storage.Delete_this_folder# - - - - #file-storage.lt_Show_files_modified_i# #file-storage.days_as_new# - -
+ + + + + + + + + - - - - - - - - -
+ #file-storage.Upload_a_file# +  |  + #file-storage.Create_a_URL# + + + #file-storage.lt_Show_files_modified_i# #file-storage.days_as_new# + +
+ #file-storage.Create_a_new_folder# + + +  |  + #file-storage.Rename_this_folder# + + + +  |  + #file-storage.Delete_this_folder# + + + +  |  + #file-storage.lt_Modify_permissions_on_1# + + + +  |  + Up to @up_name@ + + +

- - #file-storage.lt_Modify_permissions_on_1# - -

-
@@ -55,5 +59,3 @@ #file-storage.Note# #file-storage.lt_This_may_take_a_while# - - 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.19 -r1.20 --- openacs-4/packages/file-storage/www/index.tcl 5 Nov 2002 17:19:59 -0000 1.19 +++ openacs-4/packages/file-storage/www/index.tcl 17 May 2003 10:39:54 -0000 1.20 @@ -79,4 +79,10 @@ set context [fs_context_bar_list $folder_id] +set up_url {} +if { [llength $context] > 1 } { + set up_url [lindex [lindex $context end-1] 0] + set up_name [lindex [lindex $context end-1] 1] +} + ad_return_template 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.3 -r1.4 --- openacs-4/packages/file-storage/www/simple-add-2.tcl 5 Nov 2002 17:19:59 -0000 1.3 +++ openacs-4/packages/file-storage/www/simple-add-2.tcl 17 May 2003 10:39:54 -0000 1.4 @@ -18,11 +18,21 @@ } +set user_id [ad_conn user_id] + # Check for write permission on this folder ad_require_permission $folder_id write -# Create the URL (for now) -set url_id [fs::url_new -url $url -name $title -description $description -folder_id $folder_id] +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 +} + ad_returnredirect "?folder_id=$folder_id" Index: openacs-4/packages/file-storage/www/simple-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/simple-add.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/file-storage/www/simple-add.adp 5 Nov 2002 17:19:59 -0000 1.5 +++ openacs-4/packages/file-storage/www/simple-add.adp 17 May 2003 10:39:54 -0000 1.6 @@ -4,7 +4,7 @@ - + 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.6 -r1.7 --- openacs-4/packages/file-storage/www/simple-add.tcl 12 Nov 2002 08:36:44 -0000 1.6 +++ openacs-4/packages/file-storage/www/simple-add.tcl 17 May 2003 10:39:54 -0000 1.7 @@ -7,7 +7,6 @@ @cvs-id $Id$ } { folder_id:integer,notnull - {type "fs_url"} {title ""} {lock_title_p 0} } -validate { @@ -37,7 +36,6 @@ # Should probably generate the item_id and version_id now for # double-click protection - # if title isn't passed in ignore lock_title_p if {[empty_string_p $title]} { set lock_title_p 0 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.3 -r1.4 --- openacs-4/packages/file-storage/www/simple-delete.tcl 5 Nov 2002 17:19:59 -0000 1.3 +++ openacs-4/packages/file-storage/www/simple-delete.tcl 17 May 2003 10:39:54 -0000 1.4 @@ -13,7 +13,7 @@ ad_require_permission $object_id delete # Delete -fs::simple_delete -object_id $object_id +content_extlink::delete -extlink_id $object_id ad_returnredirect "./?folder_id=$folder_id" Index: openacs-4/packages/file-storage/www/simple-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/simple-edit-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/file-storage/www/simple-edit-2.tcl 5 Nov 2002 17:19:59 -0000 1.2 +++ openacs-4/packages/file-storage/www/simple-edit-2.tcl 17 May 2003 10:39:54 -0000 1.3 @@ -15,9 +15,9 @@ ad_require_permission $object_id write # edit the URL -fs::url_edit -url_id $object_id -name $name -description $description -url $url +content_extlink::edit -extlink_id $object_id -url $url -label $name -description $description -set folder_id [db_string select_folder_id "select folder_id from fs_simple_objects where object_id= :object_id"] +set folder_id [db_string select_folder_id {}] ad_returnredirect "?folder_id=$folder_id" Fisheye: Tag 1.1 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.3 -r1.4 --- openacs-4/packages/file-storage/www/simple-edit.tcl 5 Nov 2002 17:19:59 -0000 1.3 +++ openacs-4/packages/file-storage/www/simple-edit.tcl 17 May 2003 10:39:54 -0000 1.4 @@ -17,8 +17,5 @@ set pretty_name "$name" set context [fs_context_bar_list -final "[_ file-storage.Edit_URL]" $folder_id] -# Should probably generate the item_id and version_id now for -# double-click protection - ad_return_template Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/simple-edit.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/url-goto.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/url-goto.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/file-storage/www/url-goto.tcl 5 Nov 2002 17:19:59 -0000 1.3 +++ openacs-4/packages/file-storage/www/url-goto.tcl 17 May 2003 10:39:54 -0000 1.4 @@ -8,7 +8,7 @@ url_id:notnull } -# Check for write permission on this folder +# Check for read permission on this url ad_require_permission $url_id read # Check the URL @@ -19,4 +19,3 @@ } else { return -code error [_ file-storage.no_such_URL] } - Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/www/url-goto.xql'. Fisheye: No comparison available. Pass `N' to diff? 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.4 -r1.5 --- openacs-4/packages/file-storage/www/version-add-2.tcl 12 Nov 2002 08:36:44 -0000 1.4 +++ openacs-4/packages/file-storage/www/version-add-2.tcl 17 May 2003 10:39:54 -0000 1.5 @@ -43,10 +43,8 @@ # Get the ip set creation_ip [ad_conn peeraddr] -# The content repository is kinda stupid about mime types, -# so we have to check if we know about this one and possibly -# add it. -set mime_type [fs_maybe_create_new_mime_type $upload_file] +# get mime type (create if needed) +set mime_type [cr_filename_to_mime_type -create $upload_file] # Get the storage type set indb_p [ad_parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] Index: openacs-4/packages/file-storage/www/doc/design.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/doc/design.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/file-storage/www/doc/design.html 25 Sep 2001 19:24:01 -0000 1.2 +++ openacs-4/packages/file-storage/www/doc/design.html 17 May 2003 10:40:26 -0000 1.3 @@ -347,23 +347,6 @@

-

fs_maybe_create_new_mime_type

fs_maybe_create_new_mime_type file_name
-
-The content repository expects the MIME type to already be defined - when you upload content. We use this procedure to add a new type - when we encounter something we haven't seen before. - -

-

-

Parameters:
-file_name
-
-
-
- -

- -

fs_root_folder

fs_root_folder [ -package_id package_id ]
Returns the root folder for the file storage system. Index: openacs-4/packages/forums/forums.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/forums.info,v diff -u -r1.16 -r1.17 --- openacs-4/packages/forums/forums.info 16 Jan 2003 13:48:21 -0000 1.16 +++ openacs-4/packages/forums/forums.info 17 May 2003 10:40:57 -0000 1.17 @@ -20,127 +20,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: openacs-4/packages/forums/sql/oracle/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-messages-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 16 Jan 2003 13:48:49 -0000 1.5 +++ openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 17 May 2003 10:41:35 -0000 1.6 @@ -58,6 +58,9 @@ -- We do a some big queries on forum_id (thread count on index.tcl) so create a second index -- ordered so it's useful for them create unique index forums_mess_forum_sk_un on forums_messages(forum_id, tree_sortkey); +-- Need these for RI checks +create index forums_messages_user_id_idx ON forums_messages(user_id); +create index forums_messages_parent_id_idx ON forums_messages(parent_id); create view forums_messages_approved as select * Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/forums/sql/oracle/upgrade-0.3d-0.4d.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 30 Nov 2002 17:35:03 -0000 1.5 +++ openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 17 May 2003 10:42:08 -0000 1.6 @@ -70,7 +70,7 @@ package_id integer constraint forums_package_id_nn not null, - last_post timestamp + last_post timestamptz ); create view forums_forums_enabled Index: openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql 21 Dec 2002 22:28:17 -0000 1.8 +++ openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql 17 May 2003 10:42:08 -0000 1.9 @@ -13,7 +13,7 @@ select define_function_args('forums_forum__new','forum_id,object_type;forums_forum,name,charter,presentation_type,posting_policy,package_id,creation_date,creation_user,creation_ip,context_id'); -create function forums_forum__new (integer,varchar,varchar,varchar,varchar,varchar,integer,timestamp with time zone,integer,varchar,integer) +create function forums_forum__new (integer,varchar,varchar,varchar,varchar,varchar,integer,timestamptz,integer,varchar,integer) returns integer as ' declare p_forum_id alias for $1; Index: openacs-4/packages/forums/sql/postgresql/forums-forums-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-forums-package-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/sql/postgresql/forums-forums-package-drop.sql 12 Jun 2002 15:24:02 -0000 1.2 +++ openacs-4/packages/forums/sql/postgresql/forums-forums-package-drop.sql 17 May 2003 10:42:08 -0000 1.3 @@ -11,7 +11,7 @@ -- chunks lifted from Gilbert. Thanks Orchard Labs! -- -drop function forums_forum__new (integer,varchar,varchar,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer); +drop function forums_forum__new (integer,varchar,varchar,varchar,varchar,varchar,integer,timestamptz,integer,varchar,integer); drop function forums_forum__name(integer); Index: openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 16 Jan 2003 13:49:10 -0000 1.7 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 17 May 2003 10:42:08 -0000 1.8 @@ -31,8 +31,8 @@ references users(user_id) constraint forums_mess_user_id_nn not null, - posting_date timestamp - default now() + posting_date timestamptz + default current_timestamp constraint forum_mess_post_date_nn not null, state varchar(100) @@ -50,15 +50,19 @@ check (open_p in ('t','f')), tree_sortkey varbit, max_child_sortkey varbit, - last_child_post timestamp, + last_child_post timestamptz, constraint forums_mess_sk_forum_un unique (tree_sortkey, forum_id) ); -- We do a some big queries on forum_id (thread count on index.tcl) so create a second index -- ordered so it's useful for them create unique index forums_mess_forum_sk_un on forums_messages(forum_id, tree_sortkey); +-- Need these two for RI checks +create index forums_messages_user_id_idx ON forums_messages(user_id); +create index forums_messages_parent_id_idx ON forums_messages(parent_id); + create view forums_messages_approved as select * Index: openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 16 Jan 2003 13:49:10 -0000 1.11 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 17 May 2003 10:42:08 -0000 1.12 @@ -13,7 +13,7 @@ select define_function_args ('forums_message__new', 'message_id,object_type;forums_message,forum_id,subject,content,html_p,user_id,posting_date,state,parent_id,creation_date,creation_user,creation_ip,context_id'); -create function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamp with time zone,varchar,integer,timestamp with time zone,integer,varchar,integer) +create function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamptz,varchar,integer,timestamptz,integer,varchar,integer) returns integer as ' declare p_message_id alias for $1; Index: openacs-4/packages/forums/sql/postgresql/forums-messages-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-package-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/sql/postgresql/forums-messages-package-drop.sql 12 Jun 2002 15:24:02 -0000 1.2 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-package-drop.sql 17 May 2003 10:42:08 -0000 1.3 @@ -11,7 +11,7 @@ -- chunks lifted from Gilbert. Thanks Orchard Labs! -- -drop function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamp,varchar,integer,timestamp,integer,varchar,integer); +drop function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamptz,varchar,integer,timestamptz,integer,varchar,integer); drop function forums_message__root_message_id (integer); Index: openacs-4/packages/forums/sql/postgresql/upgrade-0.1d-0.2d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/Attic/upgrade-0.1d-0.2d.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/sql/postgresql/upgrade-0.1d-0.2d.sql 30 Nov 2002 17:35:03 -0000 1.2 +++ openacs-4/packages/forums/sql/postgresql/upgrade-0.1d-0.2d.sql 17 May 2003 10:42:08 -0000 1.3 @@ -1,10 +1,10 @@ -alter table forums_forums add column last_post timestamp; -alter table forums_messages add column last_child_post timestamp; +alter table forums_forums add column last_post timestamptz; +alter table forums_messages add column last_child_post timestamptz; create or replace function t () returns integer as ' declare v_record record; - v_timestamp timestamp; + v_timestamp timestamptz; begin for v_record in select forum_id @@ -68,7 +68,7 @@ from forums_forums where enabled_p = 't'; -create or replace function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamp,varchar,integer,timestamp,integer,varchar,integer) +create or replace function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamptz,varchar,integer,timestamptz,integer,varchar,integer) returns integer as ' declare p_message_id alias for $1; @@ -137,7 +137,7 @@ end; ' language 'plpgsql'; -create or replace function forums_forum__new (integer,varchar,varchar,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer) +create or replace function forums_forum__new (integer,varchar,varchar,varchar,varchar,varchar,integer,timestamptz,integer,varchar,integer) returns integer as ' declare p_forum_id alias for $1; Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/forums/sql/postgresql/upgrade-0.3d-0.4d.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/tcl/forums-security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-security-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/forums/tcl/forums-security-procs.tcl 30 Nov 2002 17:35:17 -0000 1.5 +++ openacs-4/packages/forums/tcl/forums-security-procs.tcl 17 May 2003 10:42:46 -0000 1.6 @@ -57,7 +57,7 @@ {-user_id ""} {-forum_id:required} } { - return [permission::permission_p -party_id $user_id -object_id $forum_id -privilege forum_write] + return [permission::permission_p -party_id $user_id -object_id $forum_id -privilege forum_create] } ad_proc -public require_post_forum { Index: openacs-4/packages/forums/www/forum-view-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/forum-view-postgresql.xql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/www/forum-view-postgresql.xql 10 Jan 2003 15:13:11 -0000 1.8 +++ openacs-4/packages/forums/www/forum-view-postgresql.xql 17 May 2003 10:43:31 -0000 1.9 @@ -14,7 +14,7 @@ from forums_messages_approved fm1 where fm1.forum_id = :forum_id and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages, - to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, + to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post, case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p from forums_messages_approved fm where fm.forum_id = :forum_id @@ -35,7 +35,7 @@ from forums_messages fm1 where fm1.forum_id = :forum_id and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages, - to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, + to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post, case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p from forums_messages_approved fm where fm.forum_id = :forum_id Index: openacs-4/packages/forums/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/index-postgresql.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/forums/www/index-postgresql.xql 16 Jan 2003 13:49:30 -0000 1.6 +++ openacs-4/packages/forums/www/index-postgresql.xql 17 May 2003 10:43:31 -0000 1.7 @@ -10,7 +10,7 @@ from forums_messages where forums_messages.forum_id = forums_forums_enabled.forum_id and parent_id is null) as n_threads, - to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, + to_char(last_post, 'Mon DD YYYY HH24:MI:SS') as last_post, case when last_post > (now() - interval '1 day') then 't' else 'f' end as new_p from forums_forums_enabled where forums_forums_enabled.package_id = :package_id Index: openacs-4/packages/forums/www/message-post.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/forums/www/message-post.tcl 20 Jan 2003 12:56:19 -0000 1.20 +++ openacs-4/packages/forums/www/message-post.tcl 17 May 2003 10:43:31 -0000 1.21 @@ -48,9 +48,11 @@ -html {rows 20 cols 60 wrap soft} \ -validate { empty {expr ![empty_string_p [string trim $value]]} { [_ forums.lt_Please_enter_a_messag] } - html { expr {( [string match [set l_html_p [ns_queryget html_p f]] "t"] && [empty_string_p [set v_message [ad_html_security_check $value]]] ) || [string match $l_html_p "f"] } } {} + html { expr {( [string match [set l_html_p [ns_queryget html_p f]] "t"] && [empty_string_p [set v_message [ad_quotehtml [ad_html_security_check $value]]]] ) || [string match $l_html_p "f"] } } + {} } + element create message html_p \ -label [_ forums.Format] \ -datatype text \ @@ -183,10 +185,15 @@ # trim multiple leading Re: regsub {^(\s*Re:\s*)*} $subject {Re: } subject + + # see if they're allowed to add to this thread + forum::security::require_post_message -message_id $parent_id +} else { + # no parent_id, therefore new thread + # require thread creation privs + forum::security::require_post_forum -forum_id $forum_id } -forum::security::require_post_forum -forum_id $forum_id - forum::get -forum_id $forum_id -array forum # Prepare the other data Index: openacs-4/packages/forums/www/message-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/forums/www/message-view.tcl 26 Jan 2003 19:52:35 -0000 1.17 +++ openacs-4/packages/forums/www/message-view.tcl 17 May 2003 10:43:31 -0000 1.18 @@ -17,18 +17,18 @@ set table_bgcolor [parameter::get -parameter table_bgcolor] set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] +# Load up the message information +forum::message::get -message_id $message_id -array message +set message(subject) [ad_quotehtml $message(subject)] + # Check if the user has admin on the message set moderate_p [forum::security::can_moderate_message_p -message_id $message_id] if {!${moderate_p}} { - set post_p [forum::security::can_post_message_p -message_id $message_id] + set post_p [forum::security::can_post_forum_p -forum_id $message(forum_id)] } else { set post_p 1 } -# Load up the message information -forum::message::get -message_id $message_id -array message -set message(subject) [ad_quotehtml $message(subject)] - form create search -action search element create search search_text \ @@ -125,6 +125,16 @@ set reply_url "message-post?[export_vars { { parent_id $last_message_id } }]" } +if { $post_p || [ad_conn user_id] == 0 } { + set rowcount ${responses:rowcount} + if { $rowcount > 0 } { + set last_message_id [set "responses:${rowcount}(message_id)"] + } else { + set last_message_id $message(message_id) + } + set reply_url "message-post?[export_vars { { parent_id $last_message_id } }]" +} + if {[string equal $forum(presentation_type) flat]} { ad_return_template "message-view-flat" } else { Index: openacs-4/packages/gatekeeper/gatekeeper.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/gatekeeper/gatekeeper.info,v diff -u -r1.1 -r1.2 --- openacs-4/packages/gatekeeper/gatekeeper.info 20 Apr 2001 20:51:11 -0000 1.1 +++ openacs-4/packages/gatekeeper/gatekeeper.info 17 May 2003 10:44:02 -0000 1.2 @@ -16,7 +16,7 @@ 2001-01-19 ArsDigita Corporation - + Index: openacs-4/packages/general-comments/general-comments.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/general-comments.info,v diff -u -r1.8 -r1.9 --- openacs-4/packages/general-comments/general-comments.info 30 Jan 2003 13:13:39 -0000 1.8 +++ openacs-4/packages/general-comments/general-comments.info 17 May 2003 10:44:33 -0000 1.9 @@ -19,108 +19,10 @@ OpenACS - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: openacs-4/packages/general-comments/www/file-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/file-add-2.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/general-comments/www/file-add-2.tcl 7 Nov 2002 08:32:49 -0000 1.4 +++ openacs-4/packages/general-comments/www/file-add-2.tcl 17 May 2003 10:45:05 -0000 1.5 @@ -51,17 +51,8 @@ # remove the first . from the file extension regsub {\.} $file_extension "" file_extension -set guessed_file_type [ns_guesstype $upload_file] +set guessed_file_type [cr_filename_to_mime_type -create $upload_file] -# if the guessed_file_type is not an entry in -# cr_mime_types, then set it as null -if { ![db_0or1row is_mime_type_valid { - select mime_type - from cr_mime_types - where mime_type = :guessed_file_type }] } { - set guessed_file_type [db_null] -} - # strip off the C:\directories... crud and just get the file name if ![regexp {([^/\\]+)$} $upload_file match client_filename] { # couldn't find a match Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/file-add-2.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/glossary/glossary.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossary/glossary.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/glossary/glossary.info 23 Sep 2002 23:32:21 -0000 1.5 +++ openacs-4/packages/glossary/glossary.info 17 May 2003 10:45:36 -0000 1.6 @@ -24,7 +24,7 @@ glossary's content will be stored in the content repository and its presentation will use the ArsDigita Templating System (ATS). - + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/logger/todo.txt'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/monitoring/monitoring.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/monitoring/monitoring.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/monitoring/monitoring.info 23 Aug 2002 03:39:12 -0000 1.5 +++ openacs-4/packages/monitoring/monitoring.info 17 May 2003 10:46:40 -0000 1.6 @@ -19,7 +19,7 @@ OpenACS The monitoring apps from ACS 3.4.x /admin/monitoring directory. Includes Cassandracle, Watchdog, etc. - +