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.6.2.1 -r1.6.2.2 --- openacs-4/packages/general-comments/general-comments.info 9 Dec 2002 14:32:49 -0000 1.6.2.1 +++ openacs-4/packages/general-comments/general-comments.info 6 Feb 2003 13:03:20 -0000 1.6.2.2 @@ -20,6 +20,7 @@ + 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.3 -r1.3.4.1 --- openacs-4/packages/general-comments/www/file-add-2.tcl 31 Oct 2001 20:42:07 -0000 1.3 +++ openacs-4/packages/general-comments/www/file-add-2.tcl 6 Feb 2003 13:03:55 -0000 1.3.4.1 @@ -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.1.4.1 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/static-pages/tcl/static-pages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/tcl/static-pages-procs.tcl,v diff -u -r1.11.2.12 -r1.11.2.13 --- openacs-4/packages/static-pages/tcl/static-pages-procs.tcl 22 Jan 2003 21:22:19 -0000 1.11.2.12 +++ openacs-4/packages/static-pages/tcl/static-pages-procs.tcl 6 Feb 2003 13:05:51 -0000 1.11.2.13 @@ -473,7 +473,7 @@ # calling static_page.new - thus the addition of mutex # locking. --atp@piskorski.com, 2001/08/27 01:20 EDT - set mime_type [sp_maybe_create_new_mime_type $sp_filename] + set mime_type [cr_filename_to_mime_type -create $sp_filename] if { [catch { set static_page_id [db_exec_plsql do_sp_new {}] @@ -698,97 +698,6 @@ } -ad_proc sp_maybe_create_new_mime_type { - file_name -} { - - Contrary to the name, this proc does not ever insert a - new MIME type into the cr_mime_types table the way the - fs_maybe_create_new_mime_type proc does. That File Storage proc - and the design cr_mime_types table it mucks with are fundamentally - flawed, and (c. Jan. 2003) there have been several major threads - in BBoard about that already: - - one, - two, - three. - - And the old side-effecting implementation that inserted into - cr_mime_types led to some of the problems discussed in - Bug 145. - -

- The content repository insists that the MIME type already - be defined in cr_mime_types when you upload content. Therefore, - first we look for a MIME type for this file extension in - cr_mime_types. If we can't find a MIME type there, we might also - want to look in the AOLserver config file, but, that - would break things because the MIME type must be in - cr_mime_types. If you have MIME types defined in your AOLserve - config file but not in cr_mime_types, you should add them to - cr_mime_types. - -

- If no more specific MIME type for the file extension is found, we - return the "*/*" unknown MIME type. - -

- Known Bugs: -

    - -
  • If your file extension is not in cr_mime_types, your file - will get the default "*/*" MIME type. - -

    -

  • The default "*/*" MIME type is only created by - acs-content-repository/sql/oracle/content-create.sql - as of rev. 1.17, which should be part of the OpenACS 4.6.1 - release but was not in 4.6.0. If you don't have "*/*", - it is easy to add manually - for either Oracle or PostgreSQL, - just do: - -
    - insert into cr_mime_types(label, mime_type, file_extension) values ('Unknown', '*/*', ''); -
    - -

    -

  • All use of cr_mime_types table should be replaced with the - new cr_extension_mime_type_map table (or equivalent), once that - work is done. - -
- -

- --atp@piskorski.com, 2003/01/22 15:16 EST - - @author Andrew Piskorski (atp@piskorski.com) - @creation-date 2002-12-15 -} { - set proc_name {sp_maybe_create_new_mime_type} - set mime_type_unknown {*/*} - - set file_extension [string trimleft [file extension $file_name] "."] - if {[empty_string_p $file_extension]} { - set mime_type $mime_type_unknown - } - - if {![db_0or1row select_mime_type { - select mime_type - from cr_mime_types - where file_extension = :file_extension - }]} { - set mime_type $mime_type_unknown - - #set nsd_mime_type [ns_guesstype $file_name] - #if { ![string equal $mime_type $nsd_mime_type] } { - # ns_log Warning "$proc_name: For file extension '$file_extension', the only matching MIME type in cr_mime_types is '$mime_type', but AOLserver thinks the MIME type should be '$nsd_mime_type'." - #} - } - - return $mime_type -} - - ad_proc -public sp_package_key_is {} { Simply returns the package key string for this package. @author Andrew Piskorski (atp@piskorski.com) Index: openacs-4/packages/wp-slim/wp-slim.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/wp-slim.info,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/wp-slim/wp-slim.info 9 Dec 2002 14:35:39 -0000 1.9.2.1 +++ openacs-4/packages/wp-slim/wp-slim.info 6 Feb 2003 13:06:32 -0000 1.9.2.2 @@ -21,7 +21,7 @@ ArsDigita Corporation Ported (Jack). Fixed several bugs. Added new features (e.g. versioning and authorization). - + Index: openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql,v diff -u -r1.3 -r1.3.4.1 --- openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql 23 Feb 2002 21:21:07 -0000 1.3 +++ openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql 6 Feb 2003 13:07:20 -0000 1.3.4.1 @@ -34,8 +34,8 @@ -- Styles for presentations. We'll think more about this later if there's time - -- maybe allow ADPs for more flexibility. -insert into cr_mime_types (mime_type) -select 'application/octet-stream' +insert into cr_mime_types (label, mime_type) +select 'Binary data', 'application/octet-stream' from dual where not exists (select 1 from cr_mime_types where mime_type = 'application/octet-stream'); Index: openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql 21 Sep 2002 17:09:09 -0000 1.6 +++ openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql 6 Feb 2003 13:07:46 -0000 1.6.2.1 @@ -33,8 +33,8 @@ -- Style for presentation. We'll think more about this later if there's time -- maybe allow ADPs for more flexibility. -insert into cr_mime_types (mime_type) -select 'application/octet-stream' +insert into cr_mime_types (label, mime_type) +select 'Binary data', 'application/octet-stream' from dual where not exists (select 1 from cr_mime_types where mime_type ='application/octet-stream'); Fisheye: Tag 1.1.4.1 refers to a dead (removed) revision in file `openacs-4/packages/wp-slim/www/attach-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.4.1 refers to a dead (removed) revision in file `openacs-4/packages/wp-slim/www/attach-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/wp-slim/www/attach.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/attach.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/wp-slim/www/attach.tcl 18 Sep 2002 12:07:02 -0000 1.6 +++ openacs-4/packages/wp-slim/www/attach.tcl 6 Feb 2003 13:08:16 -0000 1.6.2.1 @@ -19,7 +19,7 @@ set creation_ip [ad_conn peeraddr] set tmp_filename [ns_queryget attachment.tmpfile] -set mime_type [ns_guesstype $attachment] +set mime_type [cr_filename_to_mime_type -create $attachment] set tmp_size [file size $tmp_filename] # strip off the C:\directories... crud and just get the file name