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 -N -r1.21 -r1.22 --- openacs-4/packages/file-storage/file-storage.info 17 May 2003 10:36:33 -0000 1.21 +++ openacs-4/packages/file-storage/file-storage.info 7 Jul 2003 12:37:38 -0000 1.22 @@ -7,14 +7,14 @@ f f - + Jowell S. Sabino This application allows users to collaboratively maintain documents on the web server 2002-10-27 OpenACS Now allows storage of files on the filesystem or database. - + 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 -N -r1.14 -r1.15 --- openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql 12 May 2002 20:57:02 -0000 1.14 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql 7 Jul 2003 12:37:38 -0000 1.15 @@ -47,6 +47,11 @@ -- To enable site-wide search to distinguish CR items as File Storage items -- we create an item subtype of content_item in the ACS Object Model + +set escape on + +declare + template_id integer; begin content_type.create_type( content_type => 'file_storage_object', @@ -57,10 +62,31 @@ id_column => 'folder_id', name_method => 'file_storage.get_title' ); + + -- Create the (default) file_storage_object content type template + + template_id := content_template.new( + name => 'file-storage-default', + text => ' +@title;noquote@ +@context;noquote@ +\@text;noquote@' + ); + + -- Register the template for the file_storage_object content type + + content_type.register_template( + content_type => 'file_storage_object', + template_id => template_id, + use_context => 'public', + is_default => 't' + ); + end; / show errors; + @ file-storage-package-create.sql @ file-storage-simple-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 -N -r1.8 -r1.9 --- openacs-4/packages/file-storage/sql/oracle/file-storage-drop.sql 4 Apr 2002 03:01:06 -0000 1.8 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-drop.sql 7 Jul 2003 12:37:39 -0000 1.9 @@ -35,9 +35,21 @@ drop table fs_root_folders; drop package file_storage; +declare + template_id integer; begin +template_id := content_type.get_template( + content_type => 'file_storage_object', + use_context => 'public' +); + +content_type.unregister_template( + template_id => template_id +); + content_type.drop_type ( - content_type => 'file_storage_object'); + content_type => 'file_storage_object' +); end; / show errors Index: openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.6.2-4.7d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.6.2-4.7d3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.6.2-4.7d3.sql 7 Jul 2003 12:37:39 -0000 1.1 @@ -0,0 +1,33 @@ +-- Upgrade script that creates and registers a content template for the +-- file_storage_object content type. +-- +-- @author Ola Hansson + +set escape on + +declare + template_id integer; +begin + + -- Create the (default) file_storage_object content type template + + template_id := content_template.new( + name => 'file-storage-default', + text => ' +@title;noquote@ +@context;noquote@ +\@text;noquote@' + ); + + -- Register the template for the file_storage_object content type + + content_type.register_template( + content_type => 'file_storage_object', + template_id => template_id, + use_context => 'public', + is_default => 't' + ); + +end; +/ +show errors; 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 -N -r1.15 -r1.16 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql 4 Apr 2002 03:01:06 -0000 1.15 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql 7 Jul 2003 12:37:39 -0000 1.16 @@ -57,6 +57,39 @@ 'file_storage__get_title' -- name_method ); +create or replace function inline_0 () +returns integer as' +declare + template_id integer; +begin + + -- Create the (default) file_storage_object content type template + + template_id := content_template__new( + ''file-storage-default'', -- name + '' +@title@ +@context@ +@text;noquote@'', -- text + true -- is_live + ); + + -- Register the template for the file_storage_object content type + + perform content_type__register_template( + ''file_storage_object'', -- content_type + template_id, -- template_id + ''public'', -- use_context + ''t'' -- is_default + ); + + return null; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + + \i file-storage-package-create.sql \i file-storage-simple-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 -N -r1.8 -r1.9 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-drop.sql 4 Apr 2002 03:01:06 -0000 1.8 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-drop.sql 7 Jul 2003 12:37:39 -0000 1.9 @@ -48,6 +48,13 @@ drop table fs_root_folders; select drop_package('file_storage'); +-- Unregister the content template +select content_type__unregister_template ( + 'file-storage-object', + content_type__get_template('file-storage-object','public'), + 'public' +); + -- Remove subtype of content_revision so that site-wide-search -- can distinguish file-storage items in the search results select content_type__drop_type ( Index: openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.2-4.7d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/upgrade/Attic/upgrade-4.6.2-4.7d3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.2-4.7d3.sql 7 Jul 2003 12:37:39 -0000 1.1 @@ -0,0 +1,36 @@ +-- Upgrade script that creates and registers a content template for the +-- file_storage_object content type. +-- +-- @author Ola Hansson + +create or replace function inline_0 () +returns integer as' +declare + template_id integer; +begin + + -- Create the (default) file_storage_object content type template + + template_id := content_template__new( + ''file-storage-default'', -- name + '' +@title;noquote@ +@context;noquote@ +@text;noquote@'', -- text + true -- is_live + ); + + -- Register the template for the file_storage_object content type + + perform content_type__register_template( + ''file_storage_object'', -- content_type + template_id, -- template_id + ''public'', -- use_context + ''t'' -- is_default + ); + + return null; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); 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 -N -r1.10 -r1.11 --- openacs-4/packages/file-storage/www/file-add-2.tcl 17 May 2003 10:39:54 -0000 1.10 +++ openacs-4/packages/file-storage/www/file-add-2.tcl 7 Jul 2003 12:37:39 -0000 1.11 @@ -8,7 +8,7 @@ folder_id:integer,notnull upload_file:notnull,trim upload_file.tmpfile:tmpfile - title:notnull,trim + title:trim description } -validate { valid_folder -requires {folder_id:integer} { @@ -35,6 +35,11 @@ set filename $upload_file } +# Get the title +if { [empty_string_p $title] } { + set title $filename +} + # Get the user set user_id [ad_conn user_id] Index: openacs-4/packages/file-storage/www/folder-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk-oracle.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/file-storage/www/folder-chunk-oracle.xql 19 Jun 2003 14:19:48 -0000 1.5 +++ openacs-4/packages/file-storage/www/folder-chunk-oracle.xql 7 Jul 2003 12:37:39 -0000 1.6 @@ -12,6 +12,7 @@ to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified, fs_objects.content_size, fs_objects.url, + content_item.get_path(fs_objects.object_id, :root_folder_id) as file_url, 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, 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 -N -r1.6 -r1.7 --- openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 19 Jun 2003 14:19:48 -0000 1.6 +++ openacs-4/packages/file-storage/www/folder-chunk-postgresql.xql 7 Jul 2003 12:37:39 -0000 1.7 @@ -12,6 +12,7 @@ to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified, fs_objects.content_size, fs_objects.url, + content_item__get_path(fs_objects.object_id, :root_folder_id) as file_url, fs_objects.sort_key, fs_objects.file_upload_name, case when fs_objects.last_modified >= (now() - cast('$n_past_days days' as interval)) then 1 else 0 end as new_p, 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 -N -r1.17 -r1.18 --- openacs-4/packages/file-storage/www/folder-chunk.adp 17 May 2003 10:39:54 -0000 1.17 +++ openacs-4/packages/file-storage/www/folder-chunk.adp 7 Jul 2003 12:37:39 -0000 1.18 @@ -56,7 +56,7 @@ #file-storage.file# - + @contents.name@ 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 -N -r1.12 -r1.13 --- openacs-4/packages/file-storage/www/folder-chunk.tcl 17 May 2003 10:39:54 -0000 1.12 +++ openacs-4/packages/file-storage/www/folder-chunk.tcl 7 Jul 2003 12:37:39 -0000 1.13 @@ -26,16 +26,12 @@ set fs_url "" } -db_multirow contents select_folder_contents {} { - set file_upload_name [fs::remove_special_file_system_characters -string $file_upload_name] - set last_modified [lc_time_fmt $last_modified "%x %X"] - set content_size [lc_numeric $content_size] -} - set folder_name [fs::get_object_name -object_id $folder_id] set content_size_total 0 +set root_folder_id [fs::get_root_folder] + 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] } { Index: openacs-4/packages/file-storage/www/view/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/view/index-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/www/view/index-oracle.xql 7 Jul 2003 12:37:39 -0000 1.1 @@ -0,0 +1,15 @@ + + + + oracle8.1.6 + + + + + select content_template.get_root_folder from dual + + + + + + Index: openacs-4/packages/file-storage/www/view/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/view/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/www/view/index-postgresql.xql 7 Jul 2003 12:37:39 -0000 1.1 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + + select content_template__get_root_folder() + + + + + + Index: openacs-4/packages/file-storage/www/view/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/view/index.vuh,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/www/view/index.vuh 7 Jul 2003 12:37:39 -0000 1.1 @@ -0,0 +1,43 @@ +################## KLUDGE BY STAS ############### +# Try and look up the item in the content repository +################################################# +ad_page_contract { + + @author Unknown + @creation-date Unknown + @cvs-id $Id: index.vuh,v 1.1 2003/07/07 12:37:39 olah Exp $ +} { + { revision_id "" } +} + +# Get the paths +set the_root [ns_info pageroot] +set the_url [ad_conn path_info] +set content_type "content_revision" + + +# Get the IDs +set content_root [fs::get_root_folder] +set template_root [db_string template_root ""] + + +# Serve the page + +# DRB: Note that content::init modifies the local variable the_root, which is treated +# as though it's been passed by reference. This requires that the redirect treat the +# path as an absolute path within the filesystem. + +if { [content::init the_url the_root $content_root $template_root public $revision_id $content_type] } { + set file "$the_root/$the_url" + rp_internal_redirect -absolute_path $file +} else { + # ns_returnnotfound + set page "[ad_header {Content Item Not Found}]" + append page "

Content Item Not Found

" + append page "The requested item is not available for viewing. " + append page "The item is either not available on this server or it is not in a publishable state " + append page "Unpublished items can be viewed via the CMS interface if the CMS package is installed.
" + append page "[ad_footer]" + doc_return 200 text/html $page +} +