Index: openacs-4/readme.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/readme.txt,v diff -u -N -r1.6 -r1.7 --- openacs-4/readme.txt 28 Apr 2003 17:18:20 -0000 1.6 +++ openacs-4/readme.txt 17 May 2003 09:35:17 -0000 1.7 @@ -1,31 +1,35 @@ This is the OpenACS - the Open Architecture Community System. -Version 4.6.2 +Version CVS-HEAD-DANGER-DANGER-DANGER -------------- +Full documentation is located in the tarball at +packages/acs-core-docs/www/index.html + For installation instructions, please see packages/acs-core-docs/www/acs-admin.html The release notes for this release are available at packages/acs-core-docs/www/release-notes.html +Once your service is up and running, this same documentation is +available at http://yourserver/doc/ + Documentation for this system is at viewable via your favorite browser at http://openacs.org/doc -Once your service is up and running, this same documenation is -available at http://yourserver/doc/ - Please report bugs via http://openacs.org/bugtracker/openacs/ -and any questions and feedback at http://openacs.org/forums/ +and any questions and feedback at http://openacs.org/forums/. Send +documentation questions and corrections to docs@openacs.org. -------------- OpenACS is an advanced toolkit for building scalable, community-oriented web applications. The original ACS - the Arsdigita Community System, which formed the -foundation of OpenACS is described in +foundation of OpenACS - is described in http://philip.greenspun.com/panda/community The original ACS was Copyright (C) 1995-2000 ArsDigita Corporation Index: openacs-4/contrib/obsolete-packages/acs-content/acs-content.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/acs-content/acs-content.info,v diff -u -N -r1.6 -r1.7 --- openacs-4/contrib/obsolete-packages/acs-content/acs-content.info 16 Jan 2003 13:29:08 -0000 1.6 +++ openacs-4/contrib/obsolete-packages/acs-content/acs-content.info 17 May 2003 09:40:41 -0000 1.7 @@ -19,19 +19,8 @@ ACS content is a service for implementing side wide search. - + - - - - - - - - - - - Index: openacs-4/packages/acs-admin/acs-admin.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/acs-admin.info,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/acs-admin/acs-admin.info 3 Apr 2003 14:55:02 -0000 1.20 +++ openacs-4/packages/acs-admin/acs-admin.info 17 May 2003 09:35:47 -0000 1.21 @@ -19,162 +19,8 @@ A UI for administering the OpenACS system. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 2 Jan 2003 17:16:58 -0000 1.6 +++ openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 17 May 2003 09:36:01 -0000 1.7 @@ -34,14 +34,24 @@ } ad_proc apm_header { { -form "" } args } { + Generates HTML for the header of a page (including context bar). + Must only be used for APM admin pages (under /acs-admin/apm). + We are adding the APM index page to the context bar + so it doesn't have to be added on each page + + @author Peter Marklund +} { + set apm_title "ACS Package Manager Administration" + set apm_url "/acs-admin/apm" + if { [llength $args] == 0 } { - set context_bar [ad_admin_context_bar "ACS Package Manager"] - set title "ACS Package Manager Administration" + set title $apm_title + set context_bar [ad_context_bar $title] } else { - - set context_bar [eval [concat [list ad_admin_context_bar [list "/acs-admin/apm/" "ACS Package Manager"]] $args]] set title [lindex $args end] + set context [concat [list [list $apm_url $apm_title]] $args] + set context_bar [eval ad_context_bar $context] } set header [ad_header $title ""] append body "$header\n" Index: openacs-4/packages/acs-admin/www/apm/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/index.tcl,v diff -u -N -r1.15 -r1.16 --- openacs-4/packages/acs-admin/www/apm/index.tcl 5 Apr 2003 08:22:33 -0000 1.15 +++ openacs-4/packages/acs-admin/www/apm/index.tcl 17 May 2003 09:36:29 -0000 1.16 @@ -95,6 +95,7 @@ set format_string [join $file_link_list " | "] format $format_string + }]  } } } Index: openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 25 Feb 2003 16:57:20 -0000 1.4 +++ openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 17 May 2003 09:36:29 -0000 1.5 @@ -63,7 +63,7 @@ } db_transaction { - apm_package_delete -remove_files=$remove_files -callback apm_doc_body_callback $package_key + apm_package_delete -remove_files=0 -callback apm_doc_body_callback $package_key } on_error { if {[apm_package_registered_p $package_key] } { doc_body_append "The database returned the following error Index: openacs-4/packages/acs-admin/www/apm/package-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-delete.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-admin/www/apm/package-delete.tcl 25 Feb 2003 16:57:20 -0000 1.5 +++ openacs-4/packages/acs-admin/www/apm/package-delete.tcl 17 May 2003 09:36:29 -0000 1.6 @@ -41,7 +41,6 @@ $file_list

- Also delete package files from the filesystem.

[ad_footer]" Index: openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 27 Mar 2003 10:46:17 -0000 1.8 +++ openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 17 May 2003 09:36:29 -0000 1.9 @@ -103,7 +103,7 @@ ns_write "

Done installing packages. -

You should restart the server now to make installed and upgraded packages available. Click here to restart the server.

+

You should restart the server now to make installed and upgraded packages available. Click here to restart the server now.

[ad_footer] " } Index: openacs-4/packages/acs-admin/www/apm/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install.tcl,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/acs-admin/www/apm/packages-install.tcl 10 Mar 2003 14:18:14 -0000 1.14 +++ openacs-4/packages/acs-admin/www/apm/packages-install.tcl 17 May 2003 09:36:29 -0000 1.15 @@ -42,8 +42,10 @@ if { [apm_package_registered_p $package_key] } { # This package is already on the system if { [apm_higher_version_installed_p $package_key $version_name] } { + ns_log Notice "higher version installed of $package_key $version_name" lappend spec_files $spec_file } else { + ns_log Notice "need upgrade of package $package_key $version_name" lappend already_installed_list "Package "$package_name" ($package_key) version $version_name or higher is already installed." } } else { Index: openacs-4/packages/acs-admin/www/apm/version-reload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-reload.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-admin/www/apm/version-reload.tcl 10 Mar 2003 12:23:12 -0000 1.4 +++ openacs-4/packages/acs-admin/www/apm/version-reload.tcl 17 May 2003 09:36:29 -0000 1.5 @@ -28,8 +28,12 @@ } else { # This file isn't being watched right now - provide a link setting a watch on it. set files_to_watch_p 1 - doc_body_append " (watch this file)" - lappend files_to_watch $file + + # Remove the two first elements of the path, namely packages/package-key/ + set local_path [eval [concat file join [lrange [file split $file] 2 end]]] + + doc_body_append " (watch this file)" + lappend files_to_watch $local_path } doc_body_append "\n" } @@ -49,4 +53,3 @@ Return to the Package Manager [ad_footer] " - Index: openacs-4/packages/acs-admin/www/apm/version-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-view.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/acs-admin/www/apm/version-view.tcl 31 Jan 2003 12:23:46 -0000 1.9 +++ openacs-4/packages/acs-admin/www/apm/version-view.tcl 17 May 2003 09:36:29 -0000 1.10 @@ -212,7 +212,6 @@
  • Dependencies and Provides
  • Parameters
  • Tcl Callbacks (install, instantiate, mount) -
  • Internationalization

    XML .info package specification file

      Index: openacs-4/packages/acs-admin/www/users/complex-search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/complex-search.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-admin/www/users/complex-search.adp 6 Sep 2002 21:49:53 -0000 1.3 +++ openacs-4/packages/acs-admin/www/users/complex-search.adp 17 May 2003 09:36:54 -0000 1.4 @@ -21,31 +21,35 @@
      - -
    • @user_search.first_names@ @user_search.last_name@ (@user_search.email@) - - @user_search.member_state@ @user_search.user_finite_state_links@ - - - -
    • No users found. - +
        +
      • No users found.
      • +
      + + - We're showing all users, authorized or not ( - show only authorized).

      + We're showing all users, authorized or not ( + show only authorized). +

      - We're only showing authorized users (show all).

      + We're only showing authorized users (show all). +

      -

    Index: openacs-4/packages/acs-admin/www/users/complex-search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/complex-search.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-admin/www/users/complex-search.tcl 16 Jan 2003 13:28:06 -0000 1.7 +++ openacs-4/packages/acs-admin/www/users/complex-search.tcl 17 May 2003 09:36:54 -0000 1.8 @@ -201,6 +201,7 @@ append query "\nwhere [join $where_clause "\n$where_conjunction "]" } } +append query "\norder by upper(first_names), upper(last_name)" set i 0 Index: openacs-4/packages/acs-admin/www/users/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/index.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-admin/www/users/index.adp 16 Jan 2003 13:28:06 -0000 1.5 +++ openacs-4/packages/acs-admin/www/users/index.adp 17 May 2003 09:36:54 -0000 1.6 @@ -16,6 +16,7 @@

  • Find all users needing approval
  • Add a user
  • +
  • Add a batch of users
  • Index: openacs-4/packages/acs-admin/www/users/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/one.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-admin/www/users/one.tcl 16 Jan 2003 13:28:06 -0000 1.7 +++ openacs-4/packages/acs-admin/www/users/one.tcl 17 May 2003 09:36:54 -0000 1.8 @@ -31,8 +31,8 @@ } set public_link [acs_community_member_url -user_id $user_id] - -if [db_0or1row user_is_admin "select privilege from acs_permissions where object_id = 0 and grantee_id = :user_id and privilege = 'admin'"] { +set sec_context_root [acs_magic_object "security_context_root"] +if [db_0or1row user_is_admin "select privilege from acs_permissions where object_id = :sec_context_root and grantee_id = :user_id and privilege = 'admin'"] { set admin_p 1 } else { set admin_p 0 Index: openacs-4/packages/acs-admin/www/users/one.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/one.xql,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/acs-admin/www/users/one.xql 16 Jan 2003 13:28:06 -0000 1.11 +++ openacs-4/packages/acs-admin/www/users/one.xql 17 May 2003 09:36:54 -0000 1.12 @@ -16,7 +16,7 @@ select privilege from acs_permissions - where object_id = 0 + where object_id = :sec_context_root and grantee_id = :user_id and privilege = 'admin' Index: openacs-4/packages/acs-admin/www/users/user-batch-add-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/user-batch-add-2.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/users/user-batch-add-2.adp 17 May 2003 09:36:54 -0000 1.2 @@ -0,0 +1,7 @@ + +Add a batch of users +@success_text@ +
    +@exception_text@ + + Index: openacs-4/packages/acs-admin/www/users/user-batch-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/user-batch-add-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/users/user-batch-add-2.tcl 17 May 2003 09:36:54 -0000 1.2 @@ -0,0 +1,93 @@ +ad_page_contract { + Interface for specifying a list of users to sign up as a batch + @cvs-id $Id: user-batch-add-2.tcl,v 1.2 2003/05/17 09:36:54 jeffd Exp $ +} -query { + userlist + from + subject + message +} -properties { + title:onevalue + success_text:onevalue + exception_text:onevalue +} + +# parse the notify_ids arguments +# ... + +set exception_text "" +set success_text "" +set title "Adding new users in bulk" + +# parse the userlist input a row at a time +# most errors stop the processing of the line but keep going on the +# bigger block +while {[regexp {(.[^\n]+)} $userlist match_fodder row] } { + # remove each row as it's handled + set remove_count [string length $row] + set userlist [string range $userlist [expr $remove_count + 1] end] + set row [split $row ,] + set email [string trim [lindex $row 0]] + set first_names [string trim [lindex $row 1]] + set last_name [string trim [lindex $row 2]] + + if {![info exists email] || ![util_email_valid_p $email]} { + append exception_text "
  • Couldn't find a valid email address in ($row).
  • \n" + continue + } else { + set email_count [db_string unused "select count(email) +from parties where email = lower(:email)"] + + if {$email_count > 0} { + append exception_text "
  • $email was already in the database.
  • \n" + continue + } + } + + if {![info exists first_names] || [empty_string_p $first_names]} { + append exception_text "
  • No first name in ($row)
  • \n" + continue + } + + if {![info exists last_name] || [empty_string_p $last_name]} { + append exception_text "
  • No last name in ($row)
  • \n" + continue + } + + # We've checked everything. + + set password [ad_generate_random_string] + + set user_id [ad_user_new $email $first_names $last_name $password "" "" "" "t" "approved"] + + append success_text "Created user $user_id for ($row)" + + # if anything goes wrong here, stop the whole process + if { !$user_id } { + ad_return_error "Insert Failed" "We were unable to create a user record for ($row)." + ad_script_abort + } + + # send email + + set key_list [list first_names last_name email password] + set value_list [list $first_names $last_name $email $password] + + set sub_message $message + foreach key $key_list value $value_list { + regsub -all "#$key#" $sub_message $value sub_message + } + + if {[catch {ns_sendmail "$email" "$from" "$subject" "$sub_message"} errmsg]} { + ad_return_error "Mail Failed" "The system was unable to send email. Please notify the user personally. This problem is probably caused by a misconfiguration of your email system. Here is the error: +
    +[ad_quotehtml $errmsg]
    +
    " + return + } + +} + +ad_return_template + + Index: openacs-4/packages/acs-admin/www/users/user-batch-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/user-batch-add.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/users/user-batch-add.adp 17 May 2003 09:36:54 -0000 1.2 @@ -0,0 +1,36 @@ + +Add a batch of users +@context@ + + +

    Add these users to @system_name@, one user per line.

    +
    +

    Each user will get this email: +
    From: +
    Subject: +

    Message: (The four variables delimited by # marks will be automatically set for each user.) +
    +

    +
    + +
    + + +

    + + Index: openacs-4/packages/acs-admin/www/users/user-batch-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/user-batch-add.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/users/user-batch-add.tcl 17 May 2003 09:36:54 -0000 1.2 @@ -0,0 +1,23 @@ +ad_page_contract { + Interface for specifying a list of users to sign up as a batch + @cvs-id $Id: user-batch-add.tcl,v 1.2 2003/05/17 09:36:54 jeffd Exp $ +} -properties { + context:onevalue + system_name:onevalue + system_url:onevalue + administration_name:onevalue + admin_email:onevalue +} + +set admin_user_id [ad_verify_and_get_user_id] +set admin_email [db_string unused "select email from +parties where party_id = :admin_user_id"] +set administration_name [db_string admin_name "select +first_names || ' ' || last_name from persons where person_id = :admin_user_id"] + +set context [list [list "./" "Users"] "Notify added user"] +set system_name [ad_system_name] +set export_vars [export_form_vars email first_names last_name user_id] +set system_url [ad_parameter -package_id [ad_acs_kernel_id] SystemURL ""]. + +ad_return_template Index: openacs-4/packages/acs-api-browser/acs-api-browser.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/acs-api-browser.info,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-api-browser/acs-api-browser.info 25 Apr 2003 11:44:58 -0000 1.7 +++ openacs-4/packages/acs-api-browser/acs-api-browser.info 17 May 2003 09:37:34 -0000 1.8 @@ -17,46 +17,8 @@ 2002-05-15 ArsDigita Corporation - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 25 Apr 2003 11:46:01 -0000 1.10 +++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 17 May 2003 09:38:08 -0000 1.11 @@ -177,7 +177,10 @@ # If it's not a Tcl file, we can't do a heck of a lot yet. Eventually # we'll be able to handle ADPs, at least. - if { ![string equal [file extension $path] ".tcl"] } { + if { [string equal [file extension $path] ".xql"] } { + append out "
    DB Query file
    \n" + return $out + } elseif { ![string equal [file extension $path] ".tcl"] } { append out "
    Delivered as [ns_guesstype $path]
    \n" return $out } @@ -393,10 +396,25 @@ return $public_p } +ad_proc -public api_quote_file { + filename +} { + returns a quoted version of the given filename +} { + if {![catch {set fp [open $filename r]} err]} { + set content [ad_quotehtml [read $fp]] + close $fp + return $content + } + return {} +} + + ad_proc -public api_proc_documentation { { -format text/html } -script:boolean -source:boolean + -xql:boolean proc_name } { @@ -405,6 +423,7 @@ @param format the type of documentation to generate. Currently, only text/html and text/plain are supported. @param script include information about what script this proc lives in? + @param xql include the source code for the related xql files? @param source include the source code for the script? @param proc_name the name of the procedure for which to generate documentation. @return the formatted documentation string. @@ -558,8 +577,33 @@
    [ns_quotehtml [info body $proc_name]]
     

    \n" } + + set xql_base_name [get_server_root]/ + append xql_base_name [file rootname $doc_elements(script)] + if { $xql_p } { + if { [file exists ${xql_base_name}.xql] } { + append out "

    Generic XQL file:
    +
    [api_quote_file ${xql_base_name}.xql]
    +

    \n" + } else { + append out "

    Generic XQL file: ${xql_base_name}.xql does not exist

    \n" + } + if { [file exists ${xql_base_name}-postgresql.xql] } { + append out "

    Postgresql XQL file:
    +
    [api_quote_file ${xql_base_name}-postgresql.xql]
    +

    \n" + } else { + append out "

    Postgresql XQL file: ${xql_base_name}-postgresql.xql does not exist

    \n" + } + if { [file exists ${xql_base_name}-oracle.xql] } { + append out "

    Oracle XQL file:
    +
    [api_quote_file ${xql_base_name}-oracle.xql]
    +

    \n" + } else { + append out "

    Oracle XQL file: ${xql_base_name}-oracle.xql does not exist

    \n" + } } - + # No "see also" yet. append out "" @@ -1000,3 +1044,35 @@ } { return "$proc" } + +ad_proc -private api_xql_links_list { path } { + + Returns list of xql files related to tcl script file + @param path path and filename from [acs_root_dir] + + +} { + + set linkList [list] + set filename "[acs_root_dir]/$path" + set path_dirname [file dirname $path] + set file_dirname [file dirname $filename] + set file_rootname [file rootname [file tail $filename]] + regsub {(-oracle|-postgresql)$} $file_rootname {} file_rootname + set files \ + [lsort -decreasing \ + [glob -nocomplain \ + -directory $file_dirname \ + "${file_rootname}{,-}{,oracle,postgresql}.{adp,tcl,xql}" ]] + + foreach file $files { + lappend linkList [list \ + filename $file \ + link "content-page-view?source_p=1&path=[ns_urlencode "$path_dirname/[file tail $file]"]" \ + ] + + } + + return $linkList + +} Index: openacs-4/packages/acs-api-browser/www/content-page-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/content-page-view.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-api-browser/www/content-page-view.adp 6 Sep 2002 21:49:54 -0000 1.4 +++ openacs-4/packages/acs-api-browser/www/content-page-view.adp 17 May 2003 09:38:28 -0000 1.5 @@ -2,4 +2,34 @@ @title@ @context@ -@script_documentation@ \ No newline at end of file +@script_documentation@ + + + +

    Related Files

    + +
  • @xql_links.filename@
  • +
    + + +

    + +[ show source ] + + +[ hide source ] + + + + + | [ make this +the default ] + + + +

    Content File Source

    +
    +@file_contents@
    +
    + + Index: openacs-4/packages/acs-api-browser/www/content-page-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/content-page-view.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/acs-api-browser/www/content-page-view.tcl 6 Sep 2002 21:49:54 -0000 1.2 +++ openacs-4/packages/acs-api-browser/www/content-page-view.tcl 17 May 2003 09:38:28 -0000 1.3 @@ -11,6 +11,7 @@ @cvs-id $Id$ } { version_id:integer,optional + source_p:integer,optional,trim path } -properties { title:onevalue @@ -19,6 +20,14 @@ } set context [list] +set url_vars [export_url_vars path version_id] +set return_url [ns_urlencode [ad_conn url]?][ns_urlencode $url_vars] +set default_source_p [ad_get_client_property -default 0 acs-api-browser api_doc_source_p] + +if { ![info exists source_p] } { + set source_p $default_source_p +} + if { ![info exists version_id] && \ [regexp {^packages/([^ /]+)/} $path "" package_key] } { db_0or1row version_id_from_package_key { @@ -39,6 +48,29 @@ lappend context [file tail $path] +set filename "[acs_root_dir]/$path" + +if {![file exists $filename] || [file isdirectory $filename]} { + set file_contents "file '$filename' not found" +} else { + if { $source_p } { + if {[catch { + + set fd [open $filename r] + set file_contents [read $fd] + close $fd + + } err ]} { + set file_contents "error opening '$filename'\n$err" + } else { + set file_contents [ad_quotehtml $file_contents] + } + } + + template::util::list_to_multirow xql_links [api_xql_links_list $path] +} + + set title [file tail $path] set script_documentation [api_script_documentation $path] Index: openacs-4/packages/acs-api-browser/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/index.adp,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/acs-api-browser/www/index.adp 25 Apr 2003 11:46:44 -0000 1.12 +++ openacs-4/packages/acs-api-browser/www/index.adp 17 May 2003 09:38:28 -0000 1.13 @@ -47,7 +47,7 @@
    -

    AOLserver API Search

    +

    AOLserver Tcl API Search


    (enter exact procedure name)
    Index: openacs-4/packages/acs-api-browser/www/proc-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/proc-view.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-api-browser/www/proc-view.tcl 30 Nov 2002 17:13:37 -0000 1.3 +++ openacs-4/packages/acs-api-browser/www/proc-view.tcl 17 May 2003 09:38:28 -0000 1.4 @@ -41,7 +41,7 @@ } else { if { $source_p } { - set documentation [api_proc_documentation -script -source $proc] + set documentation [api_proc_documentation -script -xql -source $proc] } else { set documentation [api_proc_documentation -script $proc] } Index: openacs-4/packages/acs-api-browser/www/tcl-proc-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-proc-view.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-api-browser/www/tcl-proc-view.adp 6 Sep 2002 21:49:54 -0000 1.5 +++ openacs-4/packages/acs-api-browser/www/tcl-proc-view.adp 17 May 2003 09:38:28 -0000 1.6 @@ -2,7 +2,7 @@ @title@ @context@ -Sorry, no Tcl API procedures were found with that name. +Sorry, no AOLserver Tcl API procedures were found with that name.

    Index: openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 18 Sep 2002 11:55:43 -0000 1.4 +++ openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 17 May 2003 09:38:28 -0000 1.5 @@ -25,5 +25,5 @@ } } -set title "Tcl API Procedure Search for: \"$tcl_proc\"" +set title "AOLserver Tcl API Search for: \"$tcl_proc\"" set context [list "TCL API Search: $tcl_proc"] Index: openacs-4/packages/acs-automated-testing/sql/postgresql/acs-automated-testing-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/sql/postgresql/acs-automated-testing-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-automated-testing/sql/postgresql/acs-automated-testing-create.sql 11 Nov 2001 18:03:52 -0000 1.1 +++ openacs-4/packages/acs-automated-testing/sql/postgresql/acs-automated-testing-create.sql 17 May 2003 09:38:51 -0000 1.2 @@ -27,7 +27,7 @@ testcase_id varchar(512), package_key varchar(100), test_id integer, - timestamp timestamp, + timestamp timestamptz, result varchar(4), notes varchar(2000) ); @@ -36,7 +36,7 @@ create table aa_test_final_results ( testcase_id varchar(512), package_key varchar(100), - timestamp timestamp, + timestamp timestamptz, passes integer, fails integer ); Index: openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl 4 Apr 2003 08:04:32 -0000 1.5 +++ openacs-4/packages/acs-automated-testing/tcl/aa-test-procs.tcl 17 May 2003 09:39:25 -0000 1.6 @@ -767,3 +767,11 @@ error $error_text } } + +# +# Set the valid testcase categories list, and testcase/component lists. +# +nsv_set aa_test cases {} +nsv_set aa_test components {} +nsv_set aa_test init_classes {} +nsv_set aa_test categories {config db script web} Index: openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info 16 Jan 2003 13:28:23 -0000 1.8 +++ openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info 17 May 2003 09:39:49 -0000 1.9 @@ -7,7 +7,7 @@ t t - + oracle postgresql @@ -19,33 +19,9 @@ This package bootstraps OpenACS. If the core packages have not yet been installed, it calls the installer which leads the user through the steps necessary to do so. - + + - - - - - - - - - - - - - - - - - - - - - - - - - Index: openacs-4/packages/acs-bootstrap-installer/db-init-checks-postgresql.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/db-init-checks-postgresql.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/acs-bootstrap-installer/db-init-checks-postgresql.tcl 11 Apr 2003 03:58:09 -0000 1.9 +++ openacs-4/packages/acs-bootstrap-installer/db-init-checks-postgresql.tcl 17 May 2003 09:39:49 -0000 1.10 @@ -41,7 +41,7 @@ } if { [catch { ns_pg_bind 1row $db "select count(*) from pg_class" }] } { - append my_errors "

  • Your Postgres driver is too old. You need to update.\n" + append my_errors "
  • Your Postgres driver is either too old or was not compiled with ACS=1. Please update to a version 2.3 or higher and compile it with ACS=1.\n" set my_error_p 1 } Index: openacs-4/packages/acs-bootstrap-installer/installer/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/index.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 30 Jan 2003 14:10:55 -0000 1.9 +++ openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 17 May 2003 09:40:03 -0000 1.10 @@ -59,6 +59,30 @@ " +if { [file exists [acs_root_dir]/install.xml] } { + + set file [open "[acs_root_dir]/install.xml"] + nsv_set acs_application node [xml_doc_get_first_node_by_name [xml_parse -persist [xml_prepare_data [read $file]]] application] + close $file + + nsv_set acs_application name [apm_required_attribute_value [nsv_get acs_application node] name] + nsv_set acs_application pretty_name \ + [apm_attribute_value -default [nsv_get acs_application name] [nsv_get acs_application node] pretty-name] + nsv_set acs_application home [apm_attribute_value -default "" [nsv_get acs_application node] home] + + append body "

    +The installer will automatically install the [nsv_get acs_application pretty_name] +application after the basic OpenACS tookit has been installed. +" + + if { ![string equal [nsv_get acs_application home] ""] } { + append body "

    +For more information about the [nsv_get acs_application pretty_name] application visit the +[nsv_get acs_application pretty_name] home page +" + } +} + set error_p 0 # do some error checking. @@ -183,7 +207,6 @@ # APM needs to check its permissions. if { [catch {apm_workspace_dir} ] } { append errors "

  • The [acs_root_dir] directory has incorrect permissions. It must be owned by -[apm_workspace_dir] the user executing the web server, normally nsadmin, and the owner must have read and write priveliges on this directory. You can correct this by running the following script as root. To give another user access to the files, add them to web group. Index: openacs-4/packages/acs-bootstrap-installer/installer/install-data-model.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/Attic/install-data-model.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-bootstrap-installer/installer/install-data-model.tcl 15 Feb 2003 23:58:33 -0000 1.7 +++ openacs-4/packages/acs-bootstrap-installer/installer/install-data-model.tcl 17 May 2003 09:40:03 -0000 1.8 @@ -64,22 +64,10 @@ # before starting APM install apm_source "[acs_package_root_dir acs-tcl]/tcl/20-memoize-init.tcl" -apm_version_enable -callback apm_dummy_callback [apm_package_install -callback apm_dummy_callback "[file join [acs_root_dir] packages acs-kernel acs-kernel.info]"] +apm_version_enable -callback apm_ns_write_callback [apm_package_install -callback apm_ns_write_callback "[file join [acs_root_dir] packages acs-kernel acs-kernel.info]"] -ns_write "

    +ns_write "

    Loading package .info files.

    " -Loading package .info files - this will take a few minutes. - -

    - -This might really take a few minutes, depending on your machine. Have a cup of coffee or beer or whatever and be patient. Thanks. - -

    - -... - -" - # Preload all the .info files so the next page is snappy. apm_dependency_check -initial_install [apm_scan_packages -new [file join [acs_root_dir] packages]] Index: openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/Attic/packages-install.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl 25 Feb 2003 16:47:33 -0000 1.7 +++ openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl 17 May 2003 09:40:03 -0000 1.8 @@ -59,8 +59,148 @@ apm_mount_core_packages ns_write "

  • " + + # Now process the application bundle if an install.xml file was found. + + if { [nsv_exists acs_application node] } { + + ns_write "

    Loading packages for the [nsv_get acs_application pretty_name] application.

    " + + set actions [xml_node_get_children_by_name [nsv_get acs_application node] actions] + if { [llength $actions] > 1 } { + ns_log Error "Error in \"install.xml\": only one action node is allowed" + ns_write "

    Error in \"install.xml\": only one action node is allowed

    " + return + } + set actions [xml_node_get_children [lindex $actions 0]] + + foreach action $actions { + + switch -exact [xml_node_get_name $action] { + + text {} + + install { + + set install_spec_files [list] + foreach install_spec_file \ + [glob -nocomplain "[acs_root_dir]/packages/[apm_required_attribute_value $action package]/*.info"] { + if { [catch { array set package [apm_read_package_info_file $install_spec_file] } errmsg] } { + # Unable to parse specification file. + ns_log Error "$install_spec_file could not be parsed correctly. The error: $errmsg" + ns_write "
    install: $install_spec_file could not be parsed correctly. The error: $errmsg" + return + } + if { [apm_package_supports_rdbms_p -package_key $package(package.key)] && + ![apm_package_installed_p $package(package.key)] } { + lappend install_spec_files $install_spec_file + } + } + + set pkg_info_list [list] + foreach spec_file [glob -nocomplain "[acs_root_dir]/packages/*/*.info"] { + # Get package info, and find out if this is a package we should install + if { [catch { array set package [apm_read_package_info_file $spec_file] } errmsg] } { + # Unable to parse specification file. + ns_log Error "$spec_file could not be parsed correctly. The error: $errmsg" + ns_write "
    install: $spec_file could not be parsed correctly. The error: $errmsg" + return + } + + if { [apm_package_supports_rdbms_p -package_key $package(package.key)] && + ![apm_package_installed_p $package(package.key)] } { + # Save the package info, we may need it for dependency satisfaction later + lappend pkg_info_list [pkg_info_new $package(package.key) $spec_file \ + $package(provides) $package(requires) ""] + } + } + + if { [llength $install_spec_files] > 0 } { + set dependency_results [apm_dependency_check -pkg_info_all $pkg_info_list $install_spec_files] + if { [lindex $dependency_results 0] == 1 } { + apm_packages_full_install -callback apm_ns_write_callback [lindex $dependency_results 1] + } else { + foreach package_spec [lindex $dependency_results 1] { + if { [string is false [pkg_info_dependency_p $package_spec]] } { + ns_log Error "install: package \"[pkg_info_key $package_spec]\"[join [pkg_info_comment $package_spec] ","]" + append html "

    Package \"[pkg_info_key $package_spec]\"\n

    • [join [pkg_info_comment $package_spec] "
    • "]\n
    \n" + } + } + ns_write "$html\n" + return + } + } + } + + mount { + + set package_key [apm_required_attribute_value $action package] + set instance_name [apm_required_attribute_value $action instance-name] + set mount_point [apm_required_attribute_value $action mount-point] + + set parent_id [site_node::get_node_id -url "/"] + + if { [catch { + db_transaction { + set node_id [site_node::new -name $mount_point -parent_id $parent_id] + } + } error] } { + # There is already a node with that path, check if there is a package mounted there + array set node [site_node::get -url "/$mount_point"] + if { [empty_string_p $node(object_id)] } { + # There is no package mounted there so go ahead and mount the new package + set node_id $node(node_id) + } else { + ns_log Error "A package is already mounted at \"$mount_point\"" + ns_write "
    mount: A package is already mounted at \"$mount_point\", ignoring mount command." + set node_id "" + } + } + + if { ![empty_string_p $node_id] } { + + ns_write "

    Mounting new instance of package $package_key at /$mount_point

    " + site_node::instantiate_and_mount \ + -node_id $node_id \ + -node_name $mount_point \ + -package_name $instance_name \ + -package_key $package_key + + } + + } + + set-parameter { + set name [apm_required_attribute_value $action name] + set value [apm_required_attribute_value $action value] + set package_key [apm_attribute_value -default "" $action package] + set url [apm_attribute_value -default "" $action url] + + if { ![string equal $package_key ""] && ![string equal $url ""] } { + ns_log Error "set-parameter: Can't specify both package and url" + ns_write "
    set-parameter: Can't specify both package and url" + return + } elseif { ![string equal $package_key ""] } { + parameter::set_from_package_key -package_key $package_key -parameter $name -value $value + } else { + parameter::set_value \ + -package_id [site_node::get_object_id -node_id [site_node::get_node_id -url $url]] \ + -parameter $name \ + -value $value + } + } + + default { + ns_log Error "Error in \"install.xml\": got bad node \"[xml_node_get_name $action]\"" + } + + } + + } + } } + ns_write "All Packages Installed." ns_write "

    Generating secret tokens..." Index: openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl 5 Apr 2003 08:21:11 -0000 1.14 +++ openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl 17 May 2003 09:40:20 -0000 1.15 @@ -463,7 +463,7 @@

    Here's an example with named parameters, and namespaces (notice the preferred way of - declaring namespaces and namespaced procedures). Ignore the '\' in '\@param', + declaring namespaces and namespaced procedures). Ignore the "\" in "\@param", I had to use it so the api-browser wouldn't think the parameter docs were for ad_proc itself:

    Index: openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl,v diff -u -N -r1.16 -r1.17 --- openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 10 Mar 2003 21:12:44 -0000 1.16 +++ openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 17 May 2003 09:40:20 -0000 1.17 @@ -1,6 +1,6 @@ ad_library { - Routines needed by the boostrapper to load package code. + Routines needed by the bootstrapper to load package code. @creation-date 26 May 2000 @author Jon Salz [jsalz@arsdigita.com] @@ -97,10 +97,14 @@ # acs-mail-create.sql only). I've tightened up the regexp below to # avoid this problem, along with renaming the file... + # DRB: I've tightened it up again because forums-forums-create.sql + # was being recognized as a datamodel create script for the forums + # package. + if { [string equal $extension ".sql"] } { if { [lsearch -glob $components "*upgrade-*-*"] >= 0 } { set type "data_model_upgrade" - } elseif { [regexp -- "^$package_key-(create|drop)\.sql\$" [file tail $path] "" kind] } { + } elseif { [regexp -- "^$package_key-(create|drop)\.sql\$" [file tail $path] "" kind] } { set type "data_model_$kind" } else { set type "data_model" Index: openacs-4/packages/acs-bootstrap-installer/tcl/40-db-query-dispatcher-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/40-db-query-dispatcher-procs.tcl,v diff -u -N -r1.33 -r1.34 --- openacs-4/packages/acs-bootstrap-installer/tcl/40-db-query-dispatcher-procs.tcl 31 Mar 2003 17:21:45 -0000 1.33 +++ openacs-4/packages/acs-bootstrap-installer/tcl/40-db-query-dispatcher-procs.tcl 17 May 2003 09:40:20 -0000 1.34 @@ -307,6 +307,7 @@ regsub -all {/} $url {.} url # We insert the "www" after the package key + set rest {} regexp {^([^\.]*)(.*)} $url all package_key rest db_qd_log QDDebug "package key is $package_key and rest is $rest" @@ -362,6 +363,7 @@ # We get something like packages.acs-tcl.tcl.acs-kernel-procs # We need to remove packages. + set rest {} regexp {^packages\.(.*)} $url all rest db_qd_log QDDebug "TEMP - QD: proc_name is $proc_name" @@ -566,9 +568,11 @@ } { # Check if it's compatible at all! - if {![db_rdbms_compatible_p [db_fullquery_get_rdbms $fullquery] [db_current_rdbms]]} { - ns_log Error "Query [db_fullquery_get_name $fullquery] has an rdbms of [db_fullquery_get_rdbms $fullquery] which is *NOT* compatible with system rdbms [db_current_rdbms]" - return + set rdbms [db_fullquery_get_rdbms $fullquery] + if {![db_rdbms_compatible_p $rdbms [db_current_rdbms]]} { + # The query isn't compatible, probably because of a too high version + ns_log Warning "Query [db_fullquery_get_name $fullquery] has rdbms info $rdbms which is not compatible with system rdbms [db_current_rdbms]" + return } set name [db_fullquery_get_name $fullquery] Index: openacs-4/packages/acs-content-repository/acs-content-repository.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v diff -u -N -r1.21 -r1.22 --- openacs-4/packages/acs-content-repository/acs-content-repository.info 5 Mar 2003 17:01:34 -0000 1.21 +++ openacs-4/packages/acs-content-repository/acs-content-repository.info 17 May 2003 09:41:08 -0000 1.22 @@ -19,155 +19,12 @@ OpenACS - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Index: openacs-4/packages/acs-content-repository/sql/common/mime-type-data.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/common/mime-type-data.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/common/mime-type-data.sql 17 May 2003 09:41:38 -0000 1.2 @@ -0,0 +1,450 @@ +-- Common mime types (administered from admin pages) +-- +-- see http://www.isi.edu/in-notes/iana/assignments/media-types/ +-- also http://www.utoronto.ca/webdocs/HTMLdocs/Book/Book-3ed/appb/mimetype.html +-- +-- data assembly Jeff Davis davis@xarg.net + +-- Here are Mime types + text description + cannonical extension +-- +-- mapping of extension to mime type done later. + +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Unkown' , '*/*' , '' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'AutoCAD drawing files' , 'application/acad' , 'dwg' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Andrew data stream' , 'application/andrew-inset' , 'ez' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'ClarisCAD files' , 'application/clariscad' , 'ccad' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - Comma separated value' , 'application/csv' , 'csv' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'MATRA Prelude drafting' , 'application/drafting' , 'drw' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'DXF (AutoCAD)' , 'application/dxf' , 'dxf' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Filemaker Pro' , 'application/filemaker' , 'fm' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Futuresplash' , 'application/futuresplash' , 'spl' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'NCSA HDF data format' , 'application/hdf' , 'hdf' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - IGES graphics format' , 'application/iges' , 'iges' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Mac binhex 4.0' , 'application/mac-binhex40' , 'hqx' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Mac Compactpro' , 'application/mac-compactpro' , 'cpt' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Word' , 'application/msword' , 'doc' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Uninterpreted binary' , 'application/octet-stream' , 'bin' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'ODA ODIF' , 'application/oda' , 'oda' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'PDF' , 'application/pdf' , 'pdf' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'PostScript' , 'application/postscript' , 'ps' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'RTF - Rich Text Format' , 'application/rtf' , 'rtf' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Stereolithography' , 'application/sla' , 'stl'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'VCard' , 'application/vcard' , 'vcf'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'VDA-FS Surface data' , 'application/vda' , 'vda'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'SSOYE Koan Files' , 'application/vnd.koan' , 'skp'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'FrameMaker MIF format' , 'application/vnd.mif' , 'mif' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Access file' , 'application/vnd.ms-access' , 'mdb' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Excel' , 'application/vnd.ms-excel' , 'xls' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft PowerPoint' , 'application/vnd.ms-powerpoint' , 'ppt' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Project' , 'application/vnd.ms-project' , 'mpp' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'WML XML in binary format', 'application/vnd.wap.wmlc' , 'wmlc'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'WMLScript bytecode' , 'application/vnd.wap.wmlscriptc', 'wmlsc'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'CorelXARA' , 'application/vnd.xara' , 'xar'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'WordPerfect' , 'application/wordperfect' , 'wpd'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'WordPerfect 6.0' , 'application/wordperfect6.0' , 'w60'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive ARJ ' , 'application/x-arj-compressed' , 'arj'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-bin' , 'aab' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-map' , 'aam' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-seg' , 'aas' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Channel Definition' , 'application/x-cdf' , 'cdf' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'VCD' , 'application/x-cdlink' , 'vcd' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Chess PGN file' , 'application/x-chess-pgn' , 'pgn'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive compres' , 'application/x-compress' , 'z'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive CPIO' , 'application/x-cpio' , 'cpio'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'C-shell script' , 'application/x-csh' , 'csh' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive Debian Package' , 'application/x-debian-package' , 'deb'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Director' , 'application/x-director' , 'dxr' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'TeX DVI file' , 'application/x-dvi' , 'dvi' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive GNU Tar' , 'application/x-gtar' , 'gtar'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive gzip compressed' , 'application/x-gzip' , 'gz' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'CGI Script' , 'application/x-httpd-cgi' , 'cgi'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Adobe Illustrator' , 'application/x-illustrator' , 'ai' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Installshield data' , 'application/x-installshield' , 'wis'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Java Network Launching Protocol', 'application/x-java-jnlp-file', 'jnlp'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Javascript' , 'application/x-javascript' , 'js' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'LaTeX source' , 'application/x-latex' , 'latex' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmd)', 'application/x-ms-wmd' , 'wmd'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmz)', 'application/x-ms-wmz' , 'wmz'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Unidata netCDF' , 'application/x-netcdf' , 'cdf'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Ogg Vorbis' , 'application/x-ogg' , 'ogg' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Adobe PageMaker' , 'application/x-pagemaker' , 'p65' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Photoshop' , 'application/x-photoshop' , 'psd' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Palm Pilot Data' , 'application/x-pilot' , 'prc' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Real' , 'application/x-pn-realmedia' , 'rp'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Quattro Pro' , 'application/x-quattro-pro' , 'wq1'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive RAR' , 'application/x-rar-compressed' , 'rar'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Session Description Protocol', 'application/sdp' , 'sdp' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Shockwave' , 'application/x-shockwave-flash' , 'swf' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'SQL' , 'application/x-sql' , 'sql' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive Mac Stuffit compressed' , 'application/x-stuffit' , 'sit' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive SVR4 cpio' , 'application/x-sv4cpio' , 'sv4cpio'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive SVR4 crc' , 'application/x-sv4crc' , 'sv4crc'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive Tar' , 'application/x-tar' , 'tar' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - TeX source' , 'application/x-tex' , 'tex' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - Texinfo (emacs)' , 'application/x-texinfo' , 'texinfo' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - troff' , 'application/x-troff' , 'tr' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - troff with MAN macros' , 'application/x-troff-man' , 'man' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - troff with ME macros' , 'application/x-troff-me' , 'me' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - troff with MS macros' , 'application/x-troff-ms' , 'ms' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive POSIX Tar' , 'application/x-ustar' , 'ustar'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'X509 CA Cert' , 'application/x-x509-ca-cert' , 'cacert'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Archive Zip' , 'application/zip' , 'zip' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Basic audio (m-law PCM)' , 'audio/basic' , 'au' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Midi' , 'audio/midi' , 'midi'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio MPEG' , 'audio/x-mpeg' , 'mp3'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio MPEG-2' , 'audio/x-mpeg2' , 'mp2a'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Java Media Framework', 'audio/rmf' , 'rmf'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Voice' , 'audio/voice' , 'voc' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio AIFF' , 'audio/x-aiff' , 'aif' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Mod' , 'audio/x-mod' , 'xm'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio mpeg url (m3u)' , 'audio/x-mpegurl' , 'm3u'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Windows Media Services (wma)', 'audio/x-ms-wma' , 'wma'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Windows Media Services (wmv)', 'audio/x-ms-wmv' , 'wmv'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Realaudio' , 'audio/x-pn-realaudio' , 'ra' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Realaudio Plugin' , 'audio/x-pn-realaudio-plugin' , 'rm' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Audio Microsoft WAVE' , 'audio/x-wav' , 'wav' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Chemical Brookhaven PDB' , 'chemical/x-pdb' , 'pdb'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Chemical XMol XYZ' , 'chemical/x-xyz' , 'xyz'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'WHIP Web Drawing file' , 'drawing/x-dwf' , 'dwf'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - BMP' , 'image/bmp' , 'bmp' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Fractal Image Format', 'image/fif' , 'fif'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Gif' , 'image/gif' , 'gif' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Image Exchange Format' , 'image/ief' , 'ief' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Jpeg' , 'image/jpeg' , 'jpg' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - PNG' , 'image/png' , 'png' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - TIFF' , 'image/tiff' , 'tif' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - WAP wireless bitmap' , 'image/vnd.wap.wbmp' , 'wbmp'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - CMU Raster' , 'image/x-cmu-raster' , 'ras' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Flexible Image Transport', 'image/x-fits' , 'fit' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Macromedia Freehand' , 'image/x-freehand' , 'fh' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - SVG' , 'image/xml+svg' , 'svg' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - PhotoCD' , 'image/x-photo-cd' , 'pcd' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Mac pict' , 'image/x-pict' , 'pict' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - PNM' , 'image/x-portable-anymap' , 'pnm' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - PBM' , 'image/x-portable-bitmap' , 'pbm' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - PGM' , 'image/x-portable-graymap' , 'pgm' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - Portable Pixmap' , 'image/x-portable-pixmap' , 'ppm'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - RGB' , 'image/x-rgb' , 'rgb'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - X bitmap' , 'image/x-xbitmap' , 'xbm' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - X pixmap' , 'image/x-xpixmap' , 'xpm' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Image - X window dump (xwd)' , 'image/x-xwindowdump' , 'xwd' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'RFC822 Message' , 'message/rfc822' , 'mime'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Computational mesh' , 'model/mesh' , 'mesh'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - SGML Text' , 'text/sgml' , 'sgml'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - CSS' , 'text/css' , 'css' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - HTML' , 'text/html' , 'html' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - Plain text' , 'text/plain' , 'txt' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - Plain text (flowed)' , 'text/plain; format=flowed' , 'text' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - Enriched Text' , 'text/enriched' , 'rtx' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - Tab separated values' , 'text/tab-separated-values' , 'tsv' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - WMLScript' , 'text/vnd.wap.wmlscript' , 'wmls'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - WML' , 'text/vnd.wap.wml' , 'wml'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - XML Document' , 'text/xml' , 'xml' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - Structured enhanced text', 'text/x-setext' , 'etx'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Text - XSL' , 'text/xsl' , 'xsl' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video FLI' , 'video/fli' , 'fli'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video MPEG' , 'video/mpeg' , 'mpg' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video MPEG-2' , 'video/mpeg2' , 'mpv2' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video Quicktime' , 'video/quicktime' , 'mov' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video VDOlive streaming' , 'video/vdo' , 'vdo'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video Vivo' , 'video/vnd.vivo' , 'vivo'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video Microsoft ASF' , 'video/x-ms-asf' , 'asf' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video Windows Media Services (wm)', 'video/x-ms-wm' , 'wm'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video Windows Media Services (wvx)', 'video/x-ms-wvx' , 'wvx'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video Windows Media Services (wmx)', 'video/x-mx-wmx' , 'wmx'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video Microsoft AVI' , 'video/x-msvideo' , 'avi' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Video SGI movie player' , 'video/x-sgi-movie' , 'movie' ); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Conference Cooltalk' , 'x-conference/x-cooltalk' , 'ice'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'VRML' , 'x-world/x-vrml' , 'vrml'); +insert into cr_mime_types (label,mime_type,file_extension) values ( 'Xuda' , 'xuda/gen-cert' , 'xuda'); +insert into cr_mime_types (label,mime_type,file_extension) values ('Enhanced text' , 'text/enhanced' , 'etxt'); +insert into cr_mime_types (label,mime_type,file_extension) values ('Fixed-width text' , 'text/fixed-width' , 'ftxt'); + + +-- Extension to mime type maps. + +-- text/plain for prog langs (maybe we should do application/x-LANG but then you can't look +-- at the code in the browser. +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'c', 'text/plain'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'c++', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cpp', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cxx', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cc', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'h', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'hh', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'h++', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'hxx', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'tcl', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sql', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sh', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'csh', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ksh', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'py', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'java', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xql', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'php', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'm4', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pl', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pm', 'text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pod', 'text/plain' ); + +-- map a few to binary +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'o','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'so','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'a','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dll','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'exe','application/octet-stream' ); + +-- all the rest +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'aab','application/x-authorware-bin' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'aam','application/x-authorware-map' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'aas','application/x-authorware-seg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ai','application/x-illustrator'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'aif','audio/x-aiff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'aifc','audio/x-aiff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'aiff','audio/x-aiff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ani','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'arj','application/x-arj-compressed' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'asc','text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'asf','video/x-ms-asf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'asx','video/x-ms-asf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'au','audio/basic' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'avi','video/x-msvideo' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'bin','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'bmp','image/bmp' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'bqy','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cacert','application/x-x509-ca-cert' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ccad','application/clariscad' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cdf','application/x-netcdf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cgi','application/x-httpd-cgi' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'class','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cpio','application/x-cpio' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cpt','application/mac-compactpro' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'css','text/css' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'csv','application/csv'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'cur','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dcr','application/x-director' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'deb','application/x-debian-package' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dhtml','text/html' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dir','application/x-director' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dms','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'doc','application/msword' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dot','application/msword' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'drw','application/drafting' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dump','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dvi','application/x-dvi' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dwf','drawing/x-dwf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dwg','application/acad' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dxf','application/dxf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'dxr','application/x-director' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'eps','application/postscript' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'etx','text/x-setext' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ez','application/andrew-inset' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fh4','image/x-freehand' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fh5','image/x-freehand' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fh7','image/x-freehand' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fhc','image/x-freehand' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fh','image/x-freehand' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fif','image/fif' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fit','image/x-fits'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fli','video/fli' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'fm','application/filemaker'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'gif','image/gif' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'gtar','application/x-gtar' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'gz','application/x-gzip' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'gzip','application/x-gzip' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'hdf','application/hdf'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'hqx','application/mac-binhex40' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'html','text/html' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'htm','text/html' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ice','x-conference/x-cooltalk' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ico','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ief','image/ief' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'iges','application/iges' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'igs','application/iges' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'jnlp','application/x-java-jnlp-file' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'jpeg','image/jpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'jpe','image/jpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'jpg','image/jpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'js','application/x-javascript' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'kar','audio/midi' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'latex','application/x-latex' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'lha','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'lzh','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'm15','audio/x-mod' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'm3u','audio/x-mpegurl' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'm3url','audio/x-mpegurl' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'man','application/x-troff-man' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mdb','application/vnd.ms-access'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'me','application/x-troff-me' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mesh','model/mesh' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mid','audio/midi' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'midi','audio/midi' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mif','application/vnd.mif' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mime','message/rfc822' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'movie','video/x-sgi-movie' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mov','video/quicktime' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mp2','audio/x-mpeg2' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mp2a','audio/x-mpeg2' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mp3','audio/x-mpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mp3a','audio/x-mpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpeg','video/mpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpe','video/mpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpga','audio/x-mpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpg','video/mpeg' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpv2','video/mpeg2' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mp2v','video/mpeg2' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpp','application/vnd.ms-project'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpc','application/vnd.ms-project'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpt','application/vnd.ms-project'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpx','application/vnd.ms-project'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mpw','application/vnd.ms-project'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ms','application/x-troff-ms' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'msh','model/mesh' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'msw','application/msword' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'mtm','audio/x-mod' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'nc','application/x-netcdf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'oda','application/oda' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ogg','application/x-ogg'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'p65','application/x-pagemaker'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pbm','image/x-portable-bitmap' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pcd','image/x-photo-cd'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pdb','chemical/x-pdb' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pdf','application/pdf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pgm','image/x-portable-graymap' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pgn','application/x-chess-pgn' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pict','image/x-pict' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'png','image/png' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pnm','image/x-portable-anymap' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ppm','image/x-portable-pixmap' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ppt','application/vnd.ms-powerpoint' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ppz','application/vnd.ms-powerpoint' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pps','application/vnd.ms-powerpoint' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'pot','application/vnd.ms-powerpoint' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'prc','application/x-pilot'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ps','application/postscript' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'psd','application/x-photoshop'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'qt','video/quicktime' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ra','audio/x-pn-realaudio' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ram','audio/x-pn-realaudio' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rar','application/x-rar-compressed' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ras','image/x-cmu-raster' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rgb','image/x-rgb' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rmf', 'audio/rmf'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rm','audio/x-pn-realaudio-plugin' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rmm','audio/x-pn-realaudio-plugin' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'roff','application/x-troff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rp','application/x-pn-realmedia' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rpm','audio/x-pn-realaudio-plugin' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rr','application/x-troff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rtf','application/rtf' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'rtx','text/enriched' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 's3m','audio/x-mod' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sd2','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sdp','application/sdp' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sea','application/x-stuffit' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sgml','text/sgml' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sgm','text/sgml' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'shtml','text/html' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'silo','model/mesh' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sit','application/x-stuffit' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'skd','application/vnd.koan' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'skm','application/vnd.koan' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'skp','application/vnd.koan' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'skt','application/vnd.koan' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'snd','audio/basic' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'spl','application/futuresplash' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'stl','application/sla' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'stm','audio/x-mod' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sv4cpio','application/x-sv4cpio' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'sv4crc','application/x-sv4crc' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'svg','image/xml+svg'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'swf','application/x-shockwave-flash' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 't','application/x-troff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'tar','application/x-tar' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'tex','application/x-tex' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'texi','application/x-texinfo' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'texinfo','application/x-texinfo' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'text','text/plain; format=flowed'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'tiff','image/tiff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'tif','image/tiff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'tr','application/x-troff' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'tsv','text/tab-separated-values' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'txt','text/plain' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ult','audio/x-mod' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'ustar','application/x-ustar' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'uu','application/octet-stream' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'vcd','application/x-cdlink' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'vcf','application/vcard' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'vdo','video/vdo' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'vda','application/vda' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'vivo','video/vnd.vivo' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'viv','video/vnd.vivo' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'voc','audio/voice'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'vrml','x-world/x-vrml' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'vrm','x-world/x-vrml' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wav','audio/x-wav' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wb1','application/x-quattro-pro' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wb2','application/x-quattro-pro' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wb3','application/x-quattro-pro' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wbmp','image/vnd.wap.wbmp' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'web','application/vnd.xara' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wis','application/x-installshield' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wma','audio/x-ms-wma' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wmd','application/x-ms-wmd' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wmlc','application/vnd.wap.wmlc' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wmlsc','application/vnd.wap.wmlscriptc' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wmls','text/vnd.wap.wmlscript' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wml','text/vnd.wap.wml' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wmv','audio/x-ms-wmv' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wm','video/x-ms-wm' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wmx','video/x-mx-wmx' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wmz','application/x-ms-wmz' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wpd','application/wordperfect' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wq1','application/x-quattro-pro' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wrl','x-world/x-vrml' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'wvx','video/x-ms-wvx' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xar','application/vnd.xara' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'w60','application/wordperfect6.0'); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xbm','image/x-xbitmap' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xlc','application/vnd.ms-excel' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xls','application/vnd.ms-excel' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xlm','application/vnd.ms-excel' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xlw','application/vnd.ms-excel' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xm','audio/x-mod' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xml','text/xml' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xpm','image/x-xpixmap' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xsl','text/xsl' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xuda','xuda/gen-cert' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xwd','image/x-xwindowdump' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'xyz','chemical/x-xyz' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'z','application/x-compress' ); +insert into cr_extension_mime_type_map (extension, mime_type) values ( 'zip','application/zip' ); + + +-- Here are some less common mime types and extensions not defined here. +-- +-- tsp | application/dsptype +-- pfr | application/font-tdpfr +-- imd | application/immedia +-- mbd | application/mbedlet +-- pps | application/pps +-- prt | application/pro_eng +-- smi | application/smil +-- smil | application/smil +-- sol | application/solids +-- step | application/step +-- stp | application/step +-- vmd | application/vocaltec-media-desc +-- vmf | application/vocaltec-media-file +-- bcpio | application/x-bcpio +-- chat | application/x-chat +-- ipx | application/x-ipix +-- ips | application/x-ipscript +-- src | application/x-wais-source +-- wsrc | application/x-wais-source +-- vox | audio/voxware +-- rmf | audio/x-rmf +-- svh | image/svh +-- ivr | i-world/i-vrml +-- hdml | text/x-hdml Index: openacs-4/packages/acs-content-repository/sql/oracle/content-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-create.sql,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/acs-content-repository/sql/oracle/content-create.sql 23 Feb 2003 16:22:33 -0000 1.19 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-create.sql 17 May 2003 09:42:01 -0000 1.20 @@ -52,36 +52,27 @@ a file extension to the file after its MIME type is specified. '; --- Common mime types (administered from admin pages) +-- Currently file_extension is the pk although it seems likely someone +-- will want to support multiple mime types with the same extension. +-- Would need UI work however -insert into cr_mime_types(label, mime_type, file_extension) values ('Enhanced text', 'text/enhanced', 'etxt'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Plain text', 'text/plain', 'txt'); -insert into cr_mime_types(label, mime_type, file_extension) values ('HTML text', 'text/html', 'html'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Fixed-width text', 'text/fixed-width', 'ftxt'); +create table cr_extension_mime_type_map ( + extension varchar(200) + constraint cr_mime_type_extension_map_pk + primary key, + mime_type varchar(200) + constraint cr_mime_ext_map_mime_type_ref + references cr_mime_types +); +create index cr_extension_mime_type_map_idx on cr_extension_mime_type_map(mime_type); -insert into cr_mime_types(label, mime_type, file_extension) values ('Rich Text Format (RTF)', 'text/richtext', 'rtf'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Binary', 'application/octet-stream', 'bin'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft Word', 'application/msword', 'doc'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft Excel', 'application/msexcel', 'xls'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft PowerPoint', 'application/powerpoint', 'ppt'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft Project', 'application/msproject', 'mpp'); -insert into cr_mime_types(label, mime_type, file_extension) values ('PostScript', 'application/postscript', 'ps'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Adobe Illustrator', 'application/x-illustrator', 'ai'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Adobe PageMaker', 'application/x-pagemaker', 'p65'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Filemaker Pro', 'application/filemaker', 'fm'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Image Pict', 'image/x-pict', 'pic'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Photoshop', 'application/x-photoshop', 'psd'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Acrobat', 'application/pdf', 'pdf'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Video Quicktime', 'video/quicktime', 'mov'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Video MPEG', 'video/mpeg', 'mpg'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio AIFF', 'audio/aiff', 'aif'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio Basic', 'audio/basic', 'au'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio Voice', 'audio/voice', 'voc'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio Wave', 'audio/wave', 'wav'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Archive Zip', 'application/zip', 'zip'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Archive Tar', 'application/z-tar', 'tar'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Unknown', '*/*', ''); +comment on table cr_extension_mime_type_map is ' + a mapping table for extension to mime_type in db version of ns_guesstype data +'; +prompt *** Loading mime type data ... +@ '../common/mime-type-data.sql' + create table cr_content_mime_type_map ( content_type varchar2(100) constraint cr_content_mime_map_ctyp_fk @@ -98,6 +89,8 @@ content type. '; +--RI Indexes +create index cr_cont_mimetypmap_mimetyp_idx ON cr_content_mime_type_map(mime_type); -------------------------------------------------------------- @@ -151,6 +144,9 @@ primary key (parent_type, child_type, relation_tag) ); +--RI Indexes +create index cr_type_children_chld_type_idx ON cr_type_children(child_type); + comment on table cr_type_children is ' Constrains the allowable content types which a content type may contain. @@ -170,6 +166,9 @@ primary key (content_type, target_type, relation_tag) ); +-- RI Indexes +create index cr_type_relations_tgt_typ_idx ON cr_type_relations(target_type); + comment on table cr_type_relations is ' Constrains the allowable object types to which a content type may relate (see above). @@ -300,6 +299,9 @@ item_id, related_object_id, relation_tag ); +-- RI Indexes +create index cr_item_rels_rel_obj_id_idx ON cr_item_rels(related_object_id); + comment on table cr_item_rels is ' Describes all relations from one item to any number of other objects. @@ -346,6 +348,8 @@ create index cr_revisions_by_mime_type on cr_revisions(mime_type); create index cr_revisions_title_idx on cr_revisions(title); +create index cr_revisions_item_id_idx ON cr_revisions(item_id); + -- create index cr_revisions_lower_title_idx on cr_revisions(lower(title)); -- create index cr_revisions_title_ltr_idx on cr_revisions(substr(lower(title), 1, 1)); @@ -374,8 +378,8 @@ attributes clob ); -comment on column cr_revision_attributes.attributes is ' - An XML document representing the compiled attributes for a revision +comment on table cr_revision_attributes is ' + Table contains an XML document representing the compiled attributes for a revision. '; create global temporary table cr_content_text ( @@ -480,6 +484,8 @@ repository. '; +--RI Indexes +create index cr_folders_package_id_idx ON cr_folders(package_id); create table cr_folder_type_map ( folder_id integer @@ -499,9 +505,10 @@ thos available for content types. '; +-- RI Indexes +create index cr_folder_typ_map_cont_typ_idx ON cr_folder_type_map(content_type); - -------------------------------------------------------------- -- CONTENT TEMPLATES -------------------------------------------------------------- @@ -668,6 +675,9 @@ check (has_children in ('t', 'f')) ); +-- RI Indexes +create index cr_keywords_parent_id_idx ON cr_keywords(parent_id); + comment on table cr_keywords is ' Stores a subject taxonomy for classifying content items, analogous to the system used by a library. @@ -700,6 +710,8 @@ primary key (item_id, keyword_id) ); +-- RI Indexes +create index cr_item_keyword_map_kw_id_idx ON cr_item_keyword_map(keyword_id); -------------------------------------------------------------- -- TEXT SUBMISSION @@ -795,15 +807,15 @@ prompt *** Creating image content type... @@ content-image --- by default, map all MIME types to 'content_revision' +-- map some MIME types to 'content_revision' begin content_type.register_mime_type( content_type => 'content_revision', mime_type => 'text/html'); content_type.register_mime_type( content_type => 'content_revision', mime_type => 'text/plain'); content_type.register_mime_type( - content_type => 'content_revision', mime_type => 'text/richtext'); + content_type => 'content_revision', mime_type => 'application/rtf'); end; / show errors Index: openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql 24 Mar 2001 22:00:48 -0000 1.1 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql 17 May 2003 09:42:02 -0000 1.2 @@ -100,8 +100,62 @@ end is_extlink; +procedure copy ( + extlink_id in cr_extlinks.extlink_id%TYPE, + target_folder_id in cr_folders.folder_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE default null +) is + v_current_folder_id cr_folders.folder_id%TYPE; + v_name cr_items.name%TYPE; + v_url cr_extlinks.url%TYPE; + v_label cr_extlinks.label%TYPE; + v_description cr_extlinks.description%TYPE; + v_extlink_id cr_extlinks.extlink_id%TYPE; +begin + + if content_folder.is_folder(copy.target_folder_id) = 't' then + select + parent_id + into + v_current_folder_id + from + cr_items + where + item_id = copy.extlink_id; + + -- can't copy to the same folder + if copy.target_folder_id ^= v_current_folder_id then + + select + i.name, e.url, e.label, e.description + into + v_name, v_url, v_label, v_description + from + cr_extlinks e, cr_items i + where + e.extlink_id = i.item_id + and + e.extlink_id = copy.extlink_id; + + if content_folder.is_registered(copy.target_folder_id, 'content_extlink') = 't' then + + v_extlink_id := content_extlink.new( + parent_id => copy.target_folder_id, + name => v_name, + label => v_label, + description => v_description, + url => v_url, + creation_user => copy.creation_user, + creation_ip => copy.creation_ip + ); + + end if; + end if; + end if; +end copy; + end content_extlink; / show errors - Index: openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql 30 Nov 2002 17:14:52 -0000 1.5 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-image.sql 17 May 2003 09:42:02 -0000 1.6 @@ -57,21 +57,6 @@ show errors --- insert new MIME types -insert into cr_mime_types ( - label, mime_type, file_extension -) values ( - 'Image - Jpeg', 'image/jpeg','jpg' -); - -insert into cr_mime_types ( - label, mime_type, file_extension -) values ( - 'Image - Gif', 'image/gif','gif' -); - - - -- register MIME types to this content type begin Index: openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql 25 May 2002 14:30:02 -0000 1.10 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql 17 May 2003 09:42:02 -0000 1.11 @@ -132,11 +132,19 @@ begin + -- Figure out the relation_tag to use + if content_item.new.relation_tag is null then + v_rel_tag := content_item.get_content_type(v_parent_id) + || '-' || content_item.new.content_type; + else + v_rel_tag := content_item.new.relation_tag; + end if; + select object_type into v_parent_type from acs_objects where object_id = v_parent_id; if is_subclass(v_parent_type, 'content_item') = 't' and - is_valid_child(v_parent_id, content_item.new.content_type) = 'f' then + is_valid_child(v_parent_id, content_item.new.content_type, v_rel_tag) = 'f' then raise_application_error(-20000, 'This item''s content type ' || content_item.new.content_type || @@ -179,23 +187,15 @@ ); -- if the parent is not a folder, insert into cr_child_rels + -- We checked above before creating the object that it is a valid rel if v_parent_id ^= 0 and - content_folder.is_folder(v_parent_id) = 'f' and - content_item.is_valid_child(v_parent_id, - content_item.new.content_type) = 't' then + content_folder.is_folder(v_parent_id) = 'f' then v_rel_id := acs_object.new( object_type => 'cr_item_child_rel', context_id => v_parent_id ); - if content_item.new.relation_tag is null then - v_rel_tag := content_item.get_content_type(v_parent_id) - || '-' || content_item.new.content_type; - else - v_rel_tag := content_item.new.relation_tag; - end if; - insert into cr_child_rels ( rel_id, parent_id, child_id, relation_tag, order_n ) values ( @@ -396,10 +396,10 @@ return 'f'; end is_publishable; - function is_valid_child ( item_id in cr_items.item_id%TYPE, - content_type in acs_object_types.object_type%TYPE + content_type in acs_object_types.object_type%TYPE, + relation_tag in cr_child_rels.relation_tag%TYPE default null ) return char is v_is_valid_child char(1); @@ -412,13 +412,16 @@ -- first check if content_type is a registered child_type begin select - max_n into v_max_children + sum(max_n) into v_max_children from cr_type_children where parent_type = content_item.get_content_type( is_valid_child.item_id ) and - child_type = is_valid_child.content_type; + child_type = is_valid_child.content_type + and + (is_valid_child.relation_tag is null + or is_valid_child.relation_tag = relation_tag); exception when NO_DATA_FOUND then @@ -438,7 +441,10 @@ where parent_id = is_valid_child.item_id and - content_item.get_content_type( child_id ) = is_valid_child.content_type; + content_item.get_content_type( child_id ) = is_valid_child.content_type + and + (is_valid_child.relation_tag is null + or is_valid_child.relation_tag = relation_tag); if v_n_children < v_max_children then v_is_valid_child := 't'; @@ -1287,6 +1293,14 @@ creation_user => copy2.creation_user, creation_ip => copy2.creation_ip ); + -- call content_extlink.copy if the item is a extlink + elsif content_extlink.is_extlink(copy2.item_id) = 't' then + content_extlink.copy( + extlink_id => copy2.item_id, + target_folder_id => copy2.target_folder_id, + creation_user => copy2.creation_user, + creation_ip => copy2.creation_ip + ); -- make sure the target folder is really a folder elsif content_folder.is_folder(copy2.target_folder_id) = 't' then Index: openacs-4/packages/acs-content-repository/sql/oracle/content-type.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-type.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-content-repository/sql/oracle/content-type.sql 5 Mar 2003 17:01:46 -0000 1.3 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-type.sql 17 May 2003 09:42:02 -0000 1.4 @@ -658,7 +658,8 @@ select decode(count(*),0,0,1) into v_exists from cr_type_children where parent_type = register_child_type.parent_type - and child_type = register_child_type.child_type; + and child_type = register_child_type.child_type + and relation_tag = register_child_type.relation_tag; if v_exists = 0 then @@ -927,5 +928,3 @@ end; / - - Index: openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql 25 May 2002 14:30:02 -0000 1.7 +++ openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql 17 May 2003 09:42:02 -0000 1.8 @@ -416,7 +416,8 @@ --*/ item_id in cr_items.item_id%TYPE, - content_type in acs_object_types.object_type%TYPE + content_type in acs_object_types.object_type%TYPE, + relation_tag in cr_child_rels.relation_tag%TYPE default null ) return char; procedure delete ( @@ -1142,6 +1143,12 @@ item_id in cr_items.item_id%TYPE ) return char; +procedure copy ( + extlink_id in cr_extlinks.extlink_id%TYPE, + target_folder_id in cr_folders.folder_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE default null +); end content_extlink; / Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6-4.6.1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6-4.6.1.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6-4.6.1.sql 17 May 2003 09:42:34 -0000 1.2 @@ -0,0 +1,5 @@ +-- +-- Adds the */* mime type as "Unknown" (added to content-create.sql by lars +-- + +insert into cr_mime_types(label, mime_type, file_extension) select 'Unkown', '*/*', '' from dual where not exists (select 1 from cr_mime_types where mime_type = '*/*'); Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.1-4.6.2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.1-4.6.2.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.1-4.6.2.sql 17 May 2003 09:42:34 -0000 1.2 @@ -0,0 +1,11 @@ +-- Adds indexes for RI checking +-- +create index cr_cont_mimetypmap_mimetyp_idx ON cr_content_mime_type_map(mime_type); -- cr_mime_types.mime_type +create index cr_folder_typ_map_cont_typ_idx ON cr_folder_type_map(content_type); -- acs_object_types.object_type +create index cr_folders_package_id_idx ON cr_folders(package_id); -- apm_packages.package_id +create index cr_item_keyword_map_kw_id_idx ON cr_item_keyword_map(keyword_id); -- cr_keywords.keyword_id +create index cr_item_rels_rel_obj_id_idx ON cr_item_rels(related_object_id); -- acs_objects.object_id +create index cr_keywords_parent_id_idx ON cr_keywords(parent_id); -- cr_keywords.keyword_id +create index cr_revisions_item_id_idx ON cr_revisions(item_id); -- cr_items.item_id +create index cr_type_children_chld_type_idx ON cr_type_children(child_type); -- acs_object_types.object_type +create index cr_type_relations_tgt_typ_idx ON cr_type_relations(target_type); -- acs_object_types.object_type Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.2-4.6.3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.2-4.6.3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.2-4.6.3.sql 17 May 2003 09:42:34 -0000 1.2 @@ -0,0 +1,483 @@ +-- This upgrade adds more mime types and +-- creates the cr_extension_mime_type_map +-- +-- Jeff Davis davis@xarg.net 2003-02-06 + +create table cr_extension_mime_type_map ( + extension varchar(200) + constraint cr_mime_type_extension_map_pk + primary key, + mime_type varchar(200) + constraint cr_mime_ext_map_mime_type_ref + references cr_mime_types +); +create index cr_extension_mime_type_map_idx on cr_extension_mime_type_map(mime_type); + +comment on table cr_extension_mime_type_map is ' + a mapping table for extension to mime_type in db version of ns_guesstype data +'; + +-- Quicky create some tmp tables. +create table tmp_cr_mime_types as select * from cr_mime_types where 0 = 1; +create table tmp_cr_extension_mime_type_map as select * from cr_extension_mime_type_map where 0 = 1; + +-- data from sql/common/mime-type-data.sql + +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Unkown' , '*/*' , '' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'AutoCAD drawing files' , 'application/acad' , 'dwg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Andrew data stream' , 'application/andrew-inset' , 'ez' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'ClarisCAD files' , 'application/clariscad' , 'ccad' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Comma separated value' , 'application/csv' , 'csv' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'MATRA Prelude drafting' , 'application/drafting' , 'drw' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'DXF (AutoCAD)' , 'application/dxf' , 'dxf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Filemaker Pro' , 'application/filemaker' , 'fm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Futuresplash' , 'application/futuresplash' , 'spl' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'NCSA HDF data format' , 'application/hdf' , 'hdf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'IGES graphics format' , 'application/iges' , 'iges' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Mac binhex 4.0' , 'application/mac-binhex40' , 'hqx' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Mac Compactpro' , 'application/mac-compactpro' , 'cpt' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Word' , 'application/msword' , 'doc' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Uninterpreted binary' , 'application/octet-stream' , 'bin' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'ODA ODIF' , 'application/oda' , 'oda' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'PDF' , 'application/pdf' , 'pdf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'PostScript' , 'application/postscript' , 'ps' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Rich Text Format' , 'application/rtf' , 'rtf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Stereolithography' , 'application/sla' , 'stl'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VCard' , 'application/vcard' , 'vcf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VDA-FS Surface data' , 'application/vda' , 'vda'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SSOYE Koan Files' , 'application/vnd.koan' , 'skp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'FrameMaker MIF format' , 'application/vnd.mif' , 'mif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Access file' , 'application/vnd.ms-access' , 'mdb' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Excel' , 'application/vnd.ms-excel' , 'xls' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft PowerPoint' , 'application/vnd.ms-powerpoint' , 'ppt' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Project' , 'application/vnd.ms-project' , 'mpp' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WML XML in binary format', 'application/vnd.wap.wmlc' , 'wmlc'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WMLScript bytecode' , 'application/vnd.wap.wmlscriptc', 'wmlsc'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'CorelXARA' , 'application/vnd.xara' , 'xar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WordPerfect' , 'application/wordperfect' , 'wpd'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WordPerfect 6.0' , 'application/wordperfect6.0' , 'w60'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive ARJ ' , 'application/x-arj-compressed' , 'arj'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-bin' , 'aab' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-map' , 'aam' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-seg' , 'aas' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Channel Definition' , 'application/x-cdf' , 'cdf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VCD' , 'application/x-cdlink' , 'vcd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Chess PGN file' , 'application/x-chess-pgn' , 'pgn'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive compres' , 'application/x-compress' , 'z'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive CPIO' , 'application/x-cpio' , 'cpio'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'C-shell script' , 'application/x-csh' , 'csh' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive Debian Package' , 'application/x-debian-package' , 'deb'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Director' , 'application/x-director' , 'dxr' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'TeX DVI file' , 'application/x-dvi' , 'dvi' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'GNU Tar' , 'application/x-gtar' , 'gtar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Compressed - gzip' , 'application/x-gzip' , 'gz' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'CGI Script' , 'application/x-httpd-cgi' , 'cgi'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Adobe Illustrator' , 'application/x-illustrator' , 'ai' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Installshield data' , 'application/x-installshield' , 'wis'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Java Network Launching Protocol', 'application/x-java-jnlp-file', 'jnlp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Javascript' , 'application/x-javascript' , 'js' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'LaTeX source' , 'application/x-latex' , 'latex' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmd)', 'application/x-ms-wmd' , 'wmd'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmz)', 'application/x-ms-wmz' , 'wmz'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Unidata netCDF' , 'application/x-netcdf' , 'cdf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Ogg Vorbis' , 'application/x-ogg' , 'ogg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Adobe PageMaker' , 'application/x-pagemaker' , 'p65' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Photoshop' , 'application/x-photoshop' , 'psd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Palm Pilot Data' , 'application/x-pilot' , 'prc' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Real' , 'application/x-pn-realmedia' , 'rp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Quattro Pro' , 'application/x-quattro-pro' , 'wq1'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive RAR' , 'application/x-rar-compressed' , 'rar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Session Description Protocol', 'application/sdp' , 'sdp' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Shockwave' , 'application/x-shockwave-flash' , 'swf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SQL' , 'application/x-sql' , 'sql' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Mac Stuffit compressed' , 'application/x-stuffit' , 'sit' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive SVR4 cpio' , 'application/x-sv4cpio' , 'sv4cpio'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive SVR4 crc' , 'application/x-sv4crc' , 'sv4crc'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Tar Archive' , 'application/x-tar' , 'tar' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'TeX source' , 'application/x-tex' , 'tex' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Texinfo (emacs)' , 'application/x-texinfo' , 'texinfo' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff' , 'application/x-troff' , 'tr' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff with MAN macros' , 'application/x-troff-man' , 'man' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff with ME macros' , 'application/x-troff-me' , 'me' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff with MS macros' , 'application/x-troff-ms' , 'ms' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive POSIX Tar' , 'application/x-ustar' , 'ustar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X509 CA Cert' , 'application/x-x509-ca-cert' , 'cacert'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive Zip' , 'application/zip' , 'zip' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Basic audio (m-law PCM)' , 'audio/basic' , 'au' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Midi' , 'audio/midi' , 'midi'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio MPEG' , 'audio/x-mpeg' , 'mpga'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio MPEG-2' , 'audio/x-mpeg2' , 'mp2a'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Java Media Framework', 'audio/rmf' , 'rmf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Voice' , 'audio/voice' , 'voc' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio AIFF' , 'audio/x-aiff' , 'aif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Mod' , 'audio/x-mod' , 'xm'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'mpeg url (m3u)' , 'audio/x-mpegurl' , 'm3u'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wma)', 'audio/x-ms-wma' , 'wma'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmv)', 'audio/x-ms-wmv' , 'wmv'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Realaudio' , 'audio/x-pn-realaudio' , 'ra' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Realaudio Plugin' , 'audio/x-pn-realaudio-plugin' , 'rm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft WAVE audio' , 'audio/x-wav' , 'wav' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Brookhaven PDB' , 'chemical/x-pdb' , 'pdb'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'XMol XYZ' , 'chemical/x-xyz' , 'xyz'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WHIP Web Drawing file' , 'drawing/x-dwf' , 'dwf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - BMP' , 'image/bmp' , 'bmp' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Fractal Image Format' , 'image/fif' , 'fif'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Gif' , 'image/gif' , 'gif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image Exchange Format' , 'image/ief' , 'ief' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Jpeg' , 'image/jpeg' , 'jpg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PNG' , 'image/png' , 'png' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - TIFF' , 'image/tiff' , 'tif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WAP wireless bitmap' , 'image/vnd.wap.wbmp' , 'wbmp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - CMU Raster' , 'image/x-cmu-raster' , 'ras' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Flexible Image Transport', 'image/x-fits' , 'fit' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Freehand' , 'image/x-freehand' , 'fh' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SVG' , 'image/xml+svg' , 'svg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PhotoCD' , 'image/x-photo-cd' , 'pcd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Mac pict' , 'image/x-pict' , 'pict' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PNM' , 'image/x-portable-anymap' , 'pnm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PBM' , 'image/x-portable-bitmap' , 'pbm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PGM' , 'image/x-portable-graymap' , 'pgm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Portable Pixmap' , 'image/x-portable-pixmap' , 'ppm'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - RGB' , 'image/x-rgb' , 'rgb'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X bitmap' , 'image/x-xbitmap' , 'xbm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X pixmap' , 'image/x-xpixmap' , 'xpm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X window dump (xwd)' , 'image/x-xwindowdump' , 'xwd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'RFC822 Message' , 'message/rfc822' , 'mime'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Computational mesh' , 'model/mesh' , 'mesh'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SGML Text' , 'text/sgml' , 'sgml'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Cascading style sheet' , 'text/css' , 'css' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'HTML text' , 'text/html' , 'html' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Plain text' , 'text/plain' , 'txt' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Text (flowed)' , 'text/plain; format=flowed' , 'text' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Enriched Text' , 'text/enriched' , 'rtx' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Tab separated values' , 'text/tab-separated-values' , 'tsv' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WMLScript' , 'text/vnd.wap.wmlscript' , 'wmls'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WML' , 'text/vnd.wap.wml' , 'wml'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'XML Document' , 'text/xml' , 'xml' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Structured enhanced text', 'text/x-setext' , 'etx'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'XSL style sheet' , 'text/xsl' , 'xsl' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video FLI' , 'video/fli' , 'fli'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video MPEG' , 'video/mpeg' , 'mpg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video MPEG-2' , 'video/mpeg2' , 'mpv2' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Quicktime' , 'video/quicktime' , 'mov' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video VDOlive streaming' , 'video/vdo' , 'vdo'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Vivo' , 'video/vnd.vivo' , 'vivo'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Microsoft ASF' , 'video/x-ms-asf' , 'asf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wm)', 'video/x-ms-wm' , 'wm'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wvx)', 'video/x-ms-wvx' , 'wvx'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmx)', 'video/x-mx-wmx' , 'wmx'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Microsoft AVI' , 'video/x-msvideo' , 'avi' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video SGI movie player' , 'video/x-sgi-movie' , 'movie' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Conference Cooltalk' , 'x-conference/x-cooltalk' , 'ice'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VRML' , 'x-world/x-vrml' , 'vrml'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Xuda' , 'xuda/gen-cert' , 'xuda'); + +-- Extension to mime type maps. + +-- text/plain for prog langs (maybe we should do application/x-LANG but then you can't look +-- at the code in the browser. +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'c', 'text/plain'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'c++', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cpp', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cxx', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cc', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'h', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'h++', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hxx', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tcl', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sql', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'csh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ksh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'py', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'java', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xql', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'php', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm4', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pl', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pm', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pod', 'text/plain' ); + +-- map a few to binary +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'o','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'so','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'a','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dll','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'exe','application/octet-stream' ); + +-- all the rest +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aab','application/x-authorware-bin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aam','application/x-authorware-map' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aas','application/x-authorware-seg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ai','application/x-illustrator'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aif','audio/x-aiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aifc','audio/x-aiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aiff','audio/x-aiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ani','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'arj','application/x-arj-compressed' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'asc','text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'asf','video/x-ms-asf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'asx','video/x-ms-asf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'au','audio/basic' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'avi','video/x-msvideo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'bin','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'bmp','image/bmp' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'bqy','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cacert','application/x-x509-ca-cert' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ccad','application/clariscad' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cdf','application/x-netcdf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cgi','application/x-httpd-cgi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'class','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cpio','application/x-cpio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cpt','application/mac-compactpro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'css','text/css' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'csv','application/csv'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cur','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dcr','application/x-director' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'deb','application/x-debian-package' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dhtml','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dir','application/x-director' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dms','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'doc','application/msword' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dot','application/msword' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'drw','application/drafting' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dump','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dvi','application/x-dvi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dwf','drawing/x-dwf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dwg','application/acad' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dxf','application/dxf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dxr','application/x-director' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'eps','application/postscript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'etx','text/x-setext' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ez','application/andrew-inset' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh4','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh5','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh7','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fhc','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fif','image/fif' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fit','image/x-fits'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fli','video/fli' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fm','application/filemaker'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gif','image/gif' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gtar','application/x-gtar' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gz','application/x-gzip' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gzip','application/x-gzip' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hdf','application/hdf'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hqx','application/mac-binhex40' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'html','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'htm','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ice','x-conference/x-cooltalk' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ico','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ief','image/ief' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'iges','application/iges' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'igs','application/iges' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jnlp','application/x-java-jnlp-file' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jpeg','image/jpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jpe','image/jpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jpg','image/jpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'js','application/x-javascript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'kar','audio/midi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'latex','application/x-latex' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'lha','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'lzh','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm15','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm3u','audio/x-mpegurl' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm3url','audio/x-mpegurl' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'man','application/x-troff-man' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mdb','application/vnd.ms-access'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'me','application/x-troff-me' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mesh','model/mesh' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mid','audio/midi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'midi','audio/midi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mif','application/vnd.mif' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mime','message/rfc822' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'movie','video/x-sgi-movie' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mov','video/quicktime' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp2','audio/x-mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp2a','audio/x-mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp3','audio/x-mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp3a','audio/x-mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpeg','video/mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpe','video/mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpga','audio/x-mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpg','video/mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpv2','video/mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp2v','video/mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpp','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpc','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpt','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpx','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpw','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ms','application/x-troff-ms' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'msh','model/mesh' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'msw','application/msword' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mtm','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'nc','application/x-netcdf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'oda','application/oda' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ogg','application/x-ogg'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'p65','application/x-pagemaker'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pbm','image/x-portable-bitmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pcd','image/x-photo-cd'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pdb','chemical/x-pdb' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pdf','application/pdf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pgm','image/x-portable-graymap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pgn','application/x-chess-pgn' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pict','image/x-pict' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'png','image/png' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pnm','image/x-portable-anymap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ppm','image/x-portable-pixmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ppt','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ppz','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pps','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pot','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'prc','application/x-pilot'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ps','application/postscript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'psd','application/x-photoshop'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'qt','video/quicktime' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ra','audio/x-pn-realaudio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ram','audio/x-pn-realaudio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rar','application/x-rar-compressed' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ras','image/x-cmu-raster' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rgb','image/x-rgb' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rmf', 'audio/rmf'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rm','audio/x-pn-realaudio-plugin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rmm','audio/x-pn-realaudio-plugin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'roff','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rp','application/x-pn-realmedia' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rpm','audio/x-pn-realaudio-plugin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rr','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rtf','application/rtf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rtx','text/enriched' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 's3m','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sd2','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sdp','application/sdp' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sea','application/x-stuffit' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sgml','text/sgml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sgm','text/sgml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'shtml','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'silo','model/mesh' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sit','application/x-stuffit' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skd','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skm','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skp','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skt','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'snd','audio/basic' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'spl','application/futuresplash' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'stl','application/sla' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'stm','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sv4cpio','application/x-sv4cpio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sv4crc','application/x-sv4crc' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'svg','image/xml+svg'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'swf','application/x-shockwave-flash' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 't','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tar','application/x-tar' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tex','application/x-tex' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'texi','application/x-texinfo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'texinfo','application/x-texinfo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'text','text/plain; format=flowed'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tiff','image/tiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tif','image/tiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tr','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tsv','text/tab-separated-values' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'txt','text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ult','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ustar','application/x-ustar' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'uu','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vcd','application/x-cdlink' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vcf','application/vcard' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vdo','video/vdo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vda','application/vda' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vivo','video/vnd.vivo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'viv','video/vnd.vivo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'voc','audio/voice'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vrml','x-world/x-vrml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vrm','x-world/x-vrml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wav','audio/x-wav' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wb1','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wb2','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wb3','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wbmp','image/vnd.wap.wbmp' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'web','application/vnd.xara' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wis','application/x-installshield' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wma','audio/x-ms-wma' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmd','application/x-ms-wmd' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmlc','application/vnd.wap.wmlc' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmlsc','application/vnd.wap.wmlscriptc' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmls','text/vnd.wap.wmlscript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wml','text/vnd.wap.wml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmv','audio/x-ms-wmv' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wm','video/x-ms-wm' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmx','video/x-mx-wmx' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmz','application/x-ms-wmz' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wpd','application/wordperfect' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wq1','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wrl','x-world/x-vrml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wvx','video/x-ms-wvx' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xar','application/vnd.xara' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'w60','application/wordperfect6.0'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xbm','image/x-xbitmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xlc','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xls','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xlm','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xlw','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xm','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xml','text/xml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xpm','image/x-xpixmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xsl','text/xsl' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xuda','xuda/gen-cert' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xwd','image/x-xwindowdump' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xyz','chemical/x-xyz' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'z','application/x-compress' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'zip','application/zip' ); + +-- Now update the existing data taking care not to mess anything up. + +-- Add the mime types that don't already exist. +-- don't add extensions yet since we do that later to prevent +-- duplicates in the +insert into cr_mime_types + select label, mime_type, null + from tmp_cr_mime_types n + where not exists ( + select 1 + from cr_mime_types o + where o.mime_type = n.mime_type); + +-- Provide extension for mime types with missing ones and which are +-- not in use for another mime type. +update cr_mime_types set label = ( + select label + from tmp_cr_mime_types n + where n.mime_type = cr_mime_types.mime_type) +where label is null; + +-- Add extensions, verify extension not already used by another mime type. +-- have to do this since we don't want to introduce duplicate +-- extensions since there is still code using the cr_mime_types table to +-- look up mime_type. + +update cr_mime_types set file_extension = ( + select file_extension from tmp_cr_mime_types m + where m.mime_type = cr_mime_types.mime_type + and not exists (select * from cr_mime_types c where m.file_extension = c.file_extension)) +where file_extension is null; + + +-- Create a mapping entry for existing mime types. +-- we make sure we only get one mapping per extension just in case +insert into cr_extension_mime_type_map (extension, mime_type) +select file_extension, min(mime_type) from cr_mime_types +where file_extension is not null group by file_extension; + +-- insert all the rest that are not being used +insert into cr_extension_mime_type_map + select extension, mime_type + from tmp_cr_extension_mime_type_map n + where not exists ( + select 1 from cr_extension_mime_type_map o + where o.extension = n.extension ); + +drop table tmp_cr_mime_types; +drop table tmp_cr_extension_mime_type_map; Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.4-4.6.5.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.4-4.6.5.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-4.6.4-4.6.5.sql 17 May 2003 09:42:34 -0000 1.2 @@ -0,0 +1,1908 @@ + +create or replace package content_extlink +as + +function new ( + --/** Create a new extlink, an item pointing to an off-site resource + -- @author Karl Goldstein + -- @param name The name for the new extlink, defaults to the name of the + -- target item + -- @param url The URL of the item + -- @param label The text label or title of the item + -- @param description A brief description of the item + -- @param parent_id The parent folder for the extlink. This must actually be a folder + -- and not a generic content item. + -- @param extlink_id The id of the new extlink. A new id will be allocated by default + -- @param creation_date As in acs_object.new + -- @param creation_ip As in acs_object.new + -- @param creation_user As in acs_object.new + -- @return The id of the newly created extlink + -- @see {acs_object.new}, {content_item.new}, {content_extlink.resolve} + --*/ + name in cr_items.name%TYPE default null, + url in cr_extlinks.url%TYPE, + label in cr_extlinks.label%TYPE default null, + description in cr_extlinks.description%TYPE default null, + parent_id in cr_items.parent_id%TYPE, + extlink_id in cr_extlinks.extlink_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE + default sysdate, + creation_user in acs_objects.creation_user%TYPE + default null, + creation_ip in acs_objects.creation_ip%TYPE default null +) return cr_extlinks.extlink_id%TYPE; + + +procedure delete ( + --/** Deletes the extlink + -- @author Karl Goldstein + -- @param extlink_id The id of the extlink to delete + -- @see {content_extlink.new}, {acs_object.delete} + --*/ + extlink_id in cr_extlinks.extlink_id%TYPE +); + + +function is_extlink ( + --/** Determines if the item is a extlink + -- @author Karl Goldstein + -- @param item_id The item id + -- @return 't' if the item is a extlink, 'f' otherwise + -- @see {content_extlink.new}, {content_extlink.resolve} + --*/ + item_id in cr_items.item_id%TYPE +) return char; + +procedure copy ( + extlink_id in cr_extlinks.extlink_id%TYPE, + target_folder_id in cr_folders.folder_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE default null +); + +end content_extlink; +/ +show errors + +-- Data model to support content repository of the ArsDigita +-- Community System + +-- Copyright (C) 1999-2000 ArsDigita Corporation +-- Author: Karl Goldstein (karlg@arsdigita.com) + +-- $Id: upgrade-4.6.4-4.6.5.sql,v 1.2 2003/05/17 09:42:34 jeffd Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +create or replace package body content_extlink +as + +function new ( + name in cr_items.name%TYPE default null, + url in cr_extlinks.url%TYPE, + label in cr_extlinks.label%TYPE default null, + description in cr_extlinks.description%TYPE default null, + parent_id in cr_items.parent_id%TYPE, + extlink_id in cr_extlinks.extlink_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE + default sysdate, + creation_user in acs_objects.creation_user%TYPE + default null, + creation_ip in acs_objects.creation_ip%TYPE default null +) return cr_extlinks.extlink_id%TYPE is + + v_extlink_id cr_extlinks.extlink_id%TYPE; + v_label cr_extlinks.label%TYPE; + v_name cr_items.name%TYPE; + +begin + + if label is null then + v_label := url; + else + v_label := label; + end if; + + if name is null then + select acs_object_id_seq.nextval into v_extlink_id from dual; + v_name := 'link' || v_extlink_id; + else + v_name := name; + end if; + + v_extlink_id := content_item.new( + item_id => content_extlink.new.extlink_id, + name => v_name, + content_type => 'content_extlink', + creation_date => content_extlink.new.creation_date, + creation_user => content_extlink.new.creation_user, + creation_ip => content_extlink.new.creation_ip, + parent_id => content_extlink.new.parent_id + ); + + insert into cr_extlinks + (extlink_id, url, label, description) + values + (v_extlink_id, content_extlink.new.url, v_label, + content_extlink.new.description); + + return v_extlink_id; + +end new; + +procedure delete ( + extlink_id in cr_extlinks.extlink_id%TYPE +) is +begin + + delete from cr_extlinks + where extlink_id = content_extlink.delete.extlink_id; + + content_item.delete(content_extlink.delete.extlink_id); + +end delete; + +function is_extlink ( + item_id in cr_items.item_id%TYPE +) return char +is + v_extlink_p integer := 0; +begin + + select + count(1) into v_extlink_p + from + cr_extlinks + where + extlink_id = is_extlink.item_id; + + if v_extlink_p = 1 then + return 't'; + else + return 'f'; + end if; + +end is_extlink; + +procedure copy ( + extlink_id in cr_extlinks.extlink_id%TYPE, + target_folder_id in cr_folders.folder_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE default null +) is + v_current_folder_id cr_folders.folder_id%TYPE; + v_name cr_items.name%TYPE; + v_url cr_extlinks.url%TYPE; + v_label cr_extlinks.label%TYPE; + v_description cr_extlinks.description%TYPE; + v_extlink_id cr_extlinks.extlink_id%TYPE; +begin + + if content_folder.is_folder(copy.target_folder_id) = 't' then + select + parent_id + into + v_current_folder_id + from + cr_items + where + item_id = copy.extlink_id; + + -- can't copy to the same folder + if copy.target_folder_id ^= v_current_folder_id then + + select + i.name, e.url, e.label, e.description + into + v_name, v_url, v_label, v_description + from + cr_extlinks e, cr_items i + where + e.extlink_id = i.item_id + and + e.extlink_id = copy.extlink_id; + + if content_folder.is_registered(copy.target_folder_id, 'content_extlink') = 't' then + + v_extlink_id := content_extlink.new( + parent_id => copy.target_folder_id, + name => v_name, + label => v_label, + description => v_description, + url => v_url, + creation_user => copy.creation_user, + creation_ip => copy.creation_ip + ); + + end if; + end if; + end if; +end copy; + +end content_extlink; +/ +show errors + +set serveroutput on size 1000000 format wrapped + +create or replace package body content_item +as + +function get_root_folder ( + item_id in cr_items.item_id%TYPE default null +) return cr_folders.folder_id%TYPE is + + v_folder_id cr_folders.folder_id%TYPE; + +begin + + if item_id is NULL then + + v_folder_id := c_root_folder_id; + + else + + select + item_id into v_folder_id + from + cr_items + where + parent_id = 0 + connect by + prior parent_id = item_id + start with + item_id = get_root_folder.item_id; + + end if; + + return v_folder_id; + +exception + when NO_DATA_FOUND then + raise_application_error(-20000, + 'Could not find a root folder for item ID ' || item_id || '. ' || + 'Either the item does not exist or its parent value is corrupted.'); +end get_root_folder; + +function new ( + name in cr_items.name%TYPE, + parent_id in cr_items.parent_id%TYPE default null, + item_id in acs_objects.object_id%TYPE default null, + locale in cr_items.locale%TYPE default null, + creation_date in acs_objects.creation_date%TYPE + default sysdate, + creation_user in acs_objects.creation_user%TYPE + default null, + context_id in acs_objects.context_id%TYPE + default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + item_subtype in acs_object_types.object_type%TYPE + default 'content_item', + content_type in acs_object_types.object_type%TYPE + default 'content_revision', + title in cr_revisions.title%TYPE default null, + description in cr_revisions.description%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default 'text/plain', + nls_language in cr_revisions.nls_language%TYPE default null, + text in varchar2 default null, + data in cr_revisions.content%TYPE default null, + relation_tag in cr_child_rels.relation_tag%TYPE default null, + is_live in char default 'f', + storage_type in cr_items.storage_type%TYPE default 'lob' +) return cr_items.item_id%TYPE +is + v_parent_id cr_items.parent_id%TYPE; + v_parent_type acs_objects.object_type%TYPE; + v_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_title cr_revisions.title%TYPE; + v_rel_id acs_objects.object_id%TYPE; + v_rel_tag cr_child_rels.relation_tag%TYPE; + v_context_id acs_objects.context_id%TYPE; + v_storage_type cr_items.storage_type%TYPE; +begin + + -- if content_item.is_subclass(item_subtype,'content_item') = 'f' then + -- raise_application_error(-20000, 'The object_type ' || item_subtype || + -- ' does not inherit from content_item.'); + -- end if; + + -- place the item in the context of the pages folder if no + -- context specified + + if storage_type = 'text' then + v_storage_type := 'lob'; + else + v_storage_type := storage_type; + end if; + + if parent_id is null then + v_parent_id := c_root_folder_id; + else + v_parent_id := parent_id; + end if; + + -- Determine context_id + if context_id is null then + v_context_id := v_parent_id; + else + v_context_id := context_id; + end if; + + if v_parent_id = 0 or + content_folder.is_folder(v_parent_id) = 't' then + + if v_parent_id ^= 0 and + content_folder.is_registered( + v_parent_id, content_item.new.content_type, 'f') = 'f' then + + raise_application_error(-20000, + 'This item''s content type ' || content_item.new.content_type || + ' is not registered to this folder ' || v_parent_id); + + end if; + + elsif v_parent_id ^= 0 then + + begin + + select object_type into v_parent_type from acs_objects + where object_id = v_parent_id; + + if is_subclass(v_parent_type, 'content_item') = 't' and + is_valid_child(v_parent_id, content_item.new.content_type) = 'f' then + + raise_application_error(-20000, + 'This item''s content type ' || content_item.new.content_type || + ' is not allowed in this container ' || v_parent_id); + + end if; + + exception when NO_DATA_FOUND then + + raise_application_error(-20000, + 'Invalid parent ID ' || v_parent_id || + ' specified in content_item.new'); + + end; + + end if; + + -- Create the object + + v_item_id := acs_object.new( + object_id => content_item.new.item_id, + object_type => content_item.new.item_subtype, + context_id => v_context_id, + creation_date => content_item.new.creation_date, + creation_user => content_item.new.creation_user, + creation_ip => content_item.new.creation_ip + ); + + -- Turn off security inheritance if there is no security context + --if context_id is null then + -- update acs_objects set security_inherit_p = 'f' + -- where object_id = v_item_id; + --end if; + + insert into cr_items ( + item_id, name, content_type, parent_id, storage_type + ) values ( + v_item_id, content_item.new.name, + content_item.new.content_type, v_parent_id, v_storage_type + ); + + -- if the parent is not a folder, insert into cr_child_rels + if v_parent_id ^= 0 and + content_folder.is_folder(v_parent_id) = 'f' and + content_item.is_valid_child(v_parent_id, + content_item.new.content_type) = 't' then + + v_rel_id := acs_object.new( + object_type => 'cr_item_child_rel', + context_id => v_parent_id + ); + + if content_item.new.relation_tag is null then + v_rel_tag := content_item.get_content_type(v_parent_id) + || '-' || content_item.new.content_type; + else + v_rel_tag := content_item.new.relation_tag; + end if; + + insert into cr_child_rels ( + rel_id, parent_id, child_id, relation_tag, order_n + ) values ( + v_rel_id, v_parent_id, v_item_id, v_rel_tag, v_item_id + ); + + end if; + + -- use the name of the item if no title is supplied + if content_item.new.title is null then + v_title := content_item.new.name; + else + v_title := content_item.new.title; + end if; + + -- create the revision if data or title or text is not null + -- note that the caller could theoretically specify both text + -- and data, in which case the text is ignored. + + if content_item.new.data is not null then + + v_revision_id := content_revision.new( + item_id => v_item_id, + title => v_title, + description => content_item.new.description, + data => content_item.new.data, + mime_type => content_item.new.mime_type, + creation_date => content_item.new.creation_date, + creation_user => content_item.new.creation_user, + creation_ip => content_item.new.creation_ip, + nls_language => content_item.new.nls_language + ); + + elsif content_item.new.title is not null or + content_item.new.text is not null then + + v_revision_id := content_revision.new( + item_id => v_item_id, + title => v_title, + description => content_item.new.description, + text => content_item.new.text, + mime_type => content_item.new.mime_type, + creation_date => content_item.new.creation_date, + creation_user => content_item.new.creation_user, + creation_ip => content_item.new.creation_ip + ); + + end if; + + -- make the revision live if is_live is 't' + if content_item.new.is_live = 't' then + content_item.set_live_revision(v_revision_id); + end if; + + -- Have the new item inherit the permission of the parent item + -- if no security context was specified + --if parent_id is not null and context_id is null then + -- content_permission.inherit_permissions ( + -- parent_id, v_item_id, creation_user + -- ); + --end if; + + return v_item_id; +end new; + +function is_published ( + item_id in cr_items.item_id%TYPE +) return char +is + v_is_published char(1); +begin + + select + 't' into v_is_published + from + cr_items + where + live_revision is not null + and + publish_status = 'live' + and + item_id = is_published.item_id; + + return v_is_published; + exception + when NO_DATA_FOUND then + return 'f'; +end is_published; + +function is_publishable ( + item_id in cr_items.item_id%TYPE +) return char +is + v_child_count integer; + v_rel_count integer; + v_template_id cr_templates.template_id%TYPE; + + -- get the child types registered to this content type + cursor c_child_types is + select + child_type, min_n, max_n + from + cr_type_children + where + parent_type = content_item.get_content_type( is_publishable.item_id ); + + -- get the relation types registered to this content type + cursor c_rel_types is + select + target_type, min_n, max_n + from + cr_type_relations + where + content_type = content_item.get_content_type( is_publishable.item_id ); + + -- get the publishing workflows associated with this content item + -- there should only be 1 if CMS exists, otherwise 0 + -- cursor c_pub_wf is + -- select + -- case_id, state + -- from + -- wf_cases + -- where + -- workflow_key = 'publishing_wf' + -- and + -- object_id = is_publishable.item_id; + +begin + + -- validate children + -- make sure the # of children of each type fall between min_n and max_n + for v_child_type in c_child_types loop + select + count(rel_id) into v_child_count + from + cr_child_rels + where + parent_id = is_publishable.item_id + and + content_item.get_content_type( child_id ) = v_child_type.child_type; + + -- make sure # of children is in range + if v_child_type.min_n is not null + and v_child_count < v_child_type.min_n then + return 'f'; + end if; + if v_child_type.max_n is not null + and v_child_count > v_child_type.max_n then + return 'f'; + end if; + + end loop; + + + -- validate relations + -- make sure the # of ext links of each type fall between min_n and max_n + for v_rel_type in c_rel_types loop + select + count(rel_id) into v_rel_count + from + cr_item_rels i, acs_objects o + where + i.related_object_id = o.object_id + and + i.item_id = is_publishable.item_id + and + nvl(content_item.get_content_type(o.object_id),o.object_type) = v_rel_type.target_type; + + -- make sure # of object relations is in range + if v_rel_type.min_n is not null + and v_rel_count < v_rel_type.min_n then + return 'f'; + end if; + if v_rel_type.max_n is not null + and v_rel_count > v_rel_type.max_n then + return 'f'; + end if; + end loop; + + -- validate publishing workflows + -- make sure any 'publishing_wf' associated with this item are finished + -- KG: logic is wrong here. Only the latest workflow matters, and even + -- that is a little problematic because more than one workflow may be + -- open on an item. In addition, this should be moved to CMS. + + -- Removed this as having workflow stuff in the CR is just plain wrong. + -- DanW, Aug 25th, 2001. + + -- for v_pub_wf in c_pub_wf loop + -- if v_pub_wf.state ^= 'finished' then + -- return 'f'; + -- end if; + -- end loop; + + return 't'; + exception + when NO_DATA_FOUND then + return 'f'; +end is_publishable; + +function is_valid_child ( + item_id in cr_items.item_id%TYPE, + content_type in acs_object_types.object_type%TYPE +) return char +is + v_is_valid_child char(1); + v_max_children cr_type_children.max_n%TYPE; + v_n_children integer; +begin + + v_is_valid_child := 'f'; + + -- first check if content_type is a registered child_type + begin + select + sum(max_n) into v_max_children + from + cr_type_children + where + parent_type = content_item.get_content_type( is_valid_child.item_id ) + and + child_type = is_valid_child.content_type; + + exception + when NO_DATA_FOUND then + return 'f'; + end; + + -- if the max is null then infinite number is allowed + if v_max_children is null then + return 't'; + end if; + + -- next check if there are already max_n children of that content type + select + count(rel_id) into v_n_children + from + cr_child_rels + where + parent_id = is_valid_child.item_id + and + content_item.get_content_type( child_id ) = is_valid_child.content_type; + + if v_n_children < v_max_children then + v_is_valid_child := 't'; + end if; + + return v_is_valid_child; + exception + when NO_DATA_FOUND then + return 'f'; +end is_valid_child; + +/* delete a content item + 1) delete all associated workflows + 2) delete all symlinks associated with this object + 3) delete any revisions for this item + 4) unregister template relations + 5) delete all permissions associated with this item + 6) delete keyword associations + 7) delete all associated comments */ +procedure delete ( + item_id in cr_items.item_id%TYPE +) is + +-- cursor c_wf_cases_cur is +-- select +-- case_id +-- from +-- wf_cases +-- where +-- object_id = item_id; + + cursor c_symlink_cur is + select + symlink_id + from + cr_symlinks + where + target_id = content_item.delete.item_id; + + cursor c_revision_cur is + select + revision_id + from + cr_revisions + where + item_id = content_item.delete.item_id; + + cursor c_rel_cur is + select + rel_id + from + cr_item_rels + where + item_id = content_item.delete.item_id + or + related_object_id = content_item.delete.item_id; + + cursor c_child_cur is + select + rel_id + from + cr_child_rels + where + child_id = content_item.delete.item_id; + + cursor c_parent_cur is + select + rel_id, child_id + from + cr_child_rels + where + parent_id = content_item.delete.item_id; + + -- this is strictly for debugging + -- cursor c_error_cur is + -- select + -- object_id, object_type + -- from + -- acs_objects + -- where + -- context_id = content_item.delete.item_id; + +begin + + -- Removed this as having workflow stuff in the CR is just plain wrong. + -- DanW, Aug 25th, 2001. + + -- dbms_output.put_line('Deleting associated workflows...'); + -- 1) delete all workflow cases associated with this item + -- for v_wf_cases_val in c_wf_cases_cur loop + -- workflow_case.delete(v_wf_cases_val.case_id); + -- end loop; + + dbms_output.put_line('Deleting symlinks...'); + -- 2) delete all symlinks to this item + for v_symlink_val in c_symlink_cur loop + content_symlink.delete(v_symlink_val.symlink_id); + end loop; + + dbms_output.put_line('Unscheduling item...'); + delete from cr_release_periods + where item_id = content_item.delete.item_id; + + dbms_output.put_line('Deleting associated revisions...'); + -- 3) delete all revisions of this item + delete from cr_item_publish_audit + where item_id = content_item.delete.item_id; + for v_revision_val in c_revision_cur loop + content_revision.delete(v_revision_val.revision_id); + end loop; + + dbms_output.put_line('Deleting associated item templates...'); + -- 4) unregister all templates to this item + delete from cr_item_template_map + where item_id = content_item.delete.item_id; + + dbms_output.put_line('Deleting item relationships...'); + -- Delete all relations on this item + for v_rel_val in c_rel_cur loop + acs_rel.delete(v_rel_val.rel_id); + end loop; + + dbms_output.put_line('Deleting child relationships...'); + for v_rel_val in c_child_cur loop + acs_rel.delete(v_rel_val.rel_id); + end loop; + + dbms_output.put_line('Deleting parent relationships...'); + for v_rel_val in c_parent_cur loop + acs_rel.delete(v_rel_val.rel_id); + content_item.delete(v_rel_val.child_id); + end loop; + + dbms_output.put_line('Deleting associated permissions...'); + -- 5) delete associated permissions + delete from acs_permissions + where object_id = content_item.delete.item_id; + + dbms_output.put_line('Deleting keyword associations...'); + -- 6) delete keyword associations + delete from cr_item_keyword_map + where item_id = content_item.delete.item_id; + + dbms_output.put_line('Deleting associated comments...'); + -- 7) delete associated comments + journal_entry.delete_for_object( content_item.delete.item_id ); + + -- context_id debugging loop + --for v_error_val in c_error_cur loop + -- dbms_output.put_line('ID=' || v_error_val.object_id || ' TYPE=' + -- || v_error_val.object_type); + --end loop; + + dbms_output.put_line('Deleting content item...'); + acs_object.delete(content_item.delete.item_id); + +end delete; + + +procedure rename ( + item_id in cr_items.item_id%TYPE, + name in cr_items.name%TYPE +) is + cursor exists_cur is + select + item_id + from + cr_items + where + name = rename.name + and + parent_id = (select + parent_id + from + cr_items + where + item_id = rename.item_id); + + exists_id integer; +begin + + open exists_cur; + fetch exists_cur into exists_id; + + if exists_cur%NOTFOUND then + close exists_cur; + update cr_items + set name = rename.name + where item_id = rename.item_id; + else + close exists_cur; + if exists_id <> rename.item_id then + raise_application_error(-20000, + 'An item with the name ' || rename.name || + ' already exists in this directory.'); + end if; + end if; + +end rename; + +function get_id ( + item_path in varchar2, + root_folder_id in cr_items.item_id%TYPE default c_root_folder_id, + resolve_index in char default 'f' +) return cr_items.item_id%TYPE is + + v_item_path varchar2(4000); + v_root_folder_id cr_items.item_id%TYPE; + parent_id integer; + child_id integer; + start_pos integer := 1; + end_pos integer; + counter integer := 0; + item_name varchar2(200); + +begin + + v_root_folder_id := nvl(root_folder_id, c_root_folder_id); + + -- If the request path is the root, then just return the root folder + if item_path = '/' then + return v_root_folder_id; + end if; + + -- Remove leading, trailing spaces, leading slashes + v_item_path := rtrim(ltrim(trim(item_path), '/'), '/'); + + parent_id := v_root_folder_id; + + -- if parent_id is a symlink, resolve it + parent_id := content_symlink.resolve(parent_id); + + loop + + end_pos := instr(v_item_path, '/', start_pos); + + if end_pos = 0 then + item_name := substr(v_item_path, start_pos); + else + item_name := substr(v_item_path, start_pos, end_pos - start_pos); + end if; + + select + item_id into child_id + from + cr_items + where + parent_id = get_id.parent_id + and + name = item_name; + + exit when end_pos = 0; + + parent_id := child_id; + + -- if parent_id is a symlink, resolve it + parent_id := content_symlink.resolve(parent_id); + + start_pos := end_pos + 1; + + end loop; + + if get_id.resolve_index = 't' then + + -- if the item is a folder and has an index page, then return + + if content_folder.is_folder( child_id ) = 't' and + content_folder.get_index_page( child_id ) is not null then + + child_id := content_folder.get_index_page( child_id ); + + end if; + + end if; + + return child_id; + +exception + when NO_DATA_FOUND then + return null; +end get_id; + +function get_path ( + item_id in cr_items.item_id%TYPE, + root_folder_id in cr_items.item_id%TYPE default null +) return varchar2 +is + + cursor c_abs_cur is + select + name, parent_id, level as tree_level + from + cr_items + where + parent_id <> 0 + connect by + prior parent_id = item_id + start with + item_id = get_path.item_id + order by + tree_level desc; + + v_count integer; + v_name varchar2(400); + v_parent_id integer := 0; + v_tree_level integer; + + v_resolved_root_id integer; + + cursor c_rel_cur is + select + parent_id, level as tree_level + from + cr_items + where + parent_id <> 0 + connect by + prior parent_id = item_id + start with + item_id = v_resolved_root_id + order by + tree_level desc; + + v_rel_parent_id integer := 0; + v_rel_tree_level integer := 0; + + v_path varchar2(4000) := ''; + +begin + + -- check that the item exists + select count(*) into v_count from cr_items where item_id = get_path.item_id; + + if v_count = 0 then + raise_application_error(-20000, 'Invalid item ID: ' || item_id); + end if; + + -- begin walking down the path to the item (from the repository root) + open c_abs_cur; + + -- if the root folder is not null then prepare for a relative path + + if root_folder_id is not null then + + -- if root_folder_id is a symlink, resolve it (child items will point + -- to the actual folder, not the symlink) + + v_resolved_root_id := content_symlink.resolve(root_folder_id); + + -- begin walking down the path to the root folder. Discard + -- elements of the item path as long as they are the same as the root + -- folder + + open c_rel_cur; + + while v_parent_id = v_rel_parent_id loop + fetch c_abs_cur into v_name, v_parent_id, v_tree_level; + fetch c_rel_cur into v_rel_parent_id, v_rel_tree_level; + exit when c_abs_cur%NOTFOUND or c_rel_cur%NOTFOUND; + end loop; + + -- walk the remainder of the relative path, add a '..' for each + -- additional step + + loop + exit when c_rel_cur%NOTFOUND; + v_path := v_path || '../'; + fetch c_rel_cur into v_rel_parent_id, v_rel_tree_level; + end loop; + close c_rel_cur; + + -- an item relative to itself is '../item' + if v_resolved_root_id = item_id then + v_path := '../'; + end if; + + else + + -- this is an absolute path so prepend a '/' + v_path := '/'; + + -- prime the pump to be consistent with relative path execution plan + fetch c_abs_cur into v_name, v_parent_id, v_tree_level; + + end if; + + -- loop over the remainder of the absolute path + + loop + + v_path := v_path || v_name; + + fetch c_abs_cur into v_name, v_parent_id, v_tree_level; + + exit when c_abs_cur%NOTFOUND; + + v_path := v_path || '/'; + + end loop; + close c_abs_cur; + + return v_path; + +end get_path; + + +function get_virtual_path ( + item_id in cr_items.item_id%TYPE, + root_folder_id in cr_items.item_id%TYPE default c_root_folder_id +) return varchar2 +is + v_path varchar2(4000); + v_item_id cr_items.item_id%TYPE; + v_is_folder char(1); + v_index cr_items.item_id%TYPE; +begin + + -- first resolve the item + v_item_id := content_symlink.resolve( get_virtual_path.item_id ); + + v_is_folder := content_folder.is_folder( v_item_id ); + v_index := content_folder.get_index_page( v_item_id ); + + -- if the folder has an index page + if v_is_folder = 't' and v_index is not null then + v_path := content_item.get_path( content_symlink.resolve( v_index )); + else + v_path := content_item.get_path( v_item_id ); + end if; + + return v_path; + exception + when NO_DATA_FOUND then + return null; +end get_virtual_path; + + + +procedure write_to_file ( + item_id in cr_items.item_id%TYPE, + root_path in varchar2 +)is + + blob_loc cr_revisions.content%TYPE; + v_revision cr_items.live_revision%TYPE; + +begin + + v_revision := get_live_revision(item_id); + select content into blob_loc from cr_revisions + where revision_id = v_revision; + + blob_to_file(root_path || get_path(item_id), blob_loc); + +exception when no_data_found then + + raise_application_error(-20000, 'No live revision for content item' || + item_id || ' in content_item.write_to_file.'); + +end write_to_file; + +procedure register_template ( + item_id in cr_items.item_id%TYPE, + template_id in cr_templates.template_id%TYPE, + use_context in cr_item_template_map.use_context%TYPE +) is + +begin + + -- register template if it is not already registered + insert into cr_item_template_map ( + template_id, item_id, use_context + ) select + register_template.template_id, + register_template.item_id, + register_template.use_context + from + dual + where + not exists ( select 1 + from + cr_item_template_map + where + item_id = register_template.item_id + and + template_id = register_template.template_id + and + use_context = register_template.use_context ); + +end register_template; + +procedure unregister_template ( + item_id in cr_items.item_id%TYPE, + template_id in cr_templates.template_id%TYPE default null, + use_context in cr_item_template_map.use_context%TYPE default null +) is + +begin + + if use_context is null and template_id is null then + + delete from cr_item_template_map + where item_id = unregister_template.item_id; + + elsif use_context is null then + + delete from cr_item_template_map + where template_id = unregister_template.template_id + and item_id = unregister_template.item_id; + + elsif template_id is null then + + delete from cr_item_template_map + where item_id = unregister_template.item_id + and use_context = unregister_template.use_context; + + else + + delete from cr_item_template_map + where template_id = unregister_template.template_id + and item_id = unregister_template.item_id + and use_context = unregister_template.use_context; + + end if; + +end unregister_template; + +function get_template ( + item_id in cr_items.item_id%TYPE, + use_context in cr_item_template_map.use_context%TYPE +) return cr_templates.template_id%TYPE is + + v_template_id cr_templates.template_id%TYPE; + v_content_type cr_items.content_type%TYPE; + + cursor item_cur is + select + template_id + from + cr_item_template_map + where + item_id = get_template.item_id + and + use_context = get_template.use_context; + +begin + + -- look for a template assigned specifically to this item + open item_cur; + fetch item_cur into v_template_id; + + -- otherwise get the default for the content type + if item_cur%NOTFOUND then + select + m.template_id + into + v_template_id + from + cr_items i, cr_type_template_map m + where + i.item_id = get_template.item_id + and + i.content_type = m.content_type + and + m.use_context = get_template.use_context + and + m.is_default = 't'; + end if; + close item_cur; + + return v_template_id; + +exception + when NO_DATA_FOUND then + if item_cur%ISOPEN then + close item_cur; + end if; + return null; +end get_template; + +-- Return the object type of this item + +function get_content_type ( + item_id in cr_items.item_id%TYPE +) return cr_items.content_type%TYPE is + v_content_type cr_items.content_type%TYPE; +begin + + select + content_type into v_content_type + from + cr_items + where + item_id = get_content_type.item_id; + + return v_content_type; +exception + when NO_DATA_FOUND then + return null; +end get_content_type; + +function get_live_revision ( + item_id in cr_items.item_id%TYPE +) return cr_revisions.revision_id%TYPE is + + v_revision_id acs_objects.object_id%TYPE; + +begin + + select + live_revision into v_revision_id + from + cr_items + where + item_id = get_live_revision.item_id; + + return v_revision_id; + +exception + when NO_DATA_FOUND then + return null; +end get_live_revision; + +procedure set_live_revision ( + revision_id in cr_revisions.revision_id%TYPE, + publish_status in cr_items.publish_status%TYPE default 'ready' +) is +begin + + update + cr_items + set + live_revision = set_live_revision.revision_id, + publish_status = set_live_revision.publish_status + where + item_id = (select + item_id + from + cr_revisions + where + revision_id = set_live_revision.revision_id); + + update + cr_revisions + set + publish_date = sysdate + where + revision_id = set_live_revision.revision_id; + +end set_live_revision; + + +procedure unset_live_revision ( + item_id in cr_items.item_id%TYPE +) is +begin + + update + cr_items + set + live_revision = NULL + where + item_id = unset_live_revision.item_id; + + -- if an items publish status is "live", change it to "ready" + update + cr_items + set + publish_status = 'production' + where + publish_status = 'live' + and + item_id = unset_live_revision.item_id; + + +end unset_live_revision; + + +procedure set_release_period ( + item_id in cr_items.item_id%TYPE, + start_when date default null, + end_when date default null +) is + + v_count integer; + +begin + + select decode(count(*),0,0,1) into v_count from cr_release_periods + where item_id = set_release_period.item_id; + + if v_count = 0 then + + insert into cr_release_periods ( + item_id, start_when, end_when + ) values ( + item_id, start_when, end_when + ); + + else + + update cr_release_periods + set start_when = set_release_period.start_when, + end_when = set_release_period.end_when + where + item_id = set_release_period.item_id; + + end if; + +end set_release_period; + + +function get_revision_count ( + item_id in cr_items.item_id%TYPE +) return number is + + v_count integer; + +begin + + select + count(*) into v_count + from + cr_revisions + where + item_id = get_revision_count.item_id; + + return v_count; + +end get_revision_count; + +function get_context ( + item_id in cr_items.item_id%TYPE +) return acs_objects.context_id%TYPE is + + v_context_id acs_objects.context_id%TYPE; + +begin + + select + context_id + into + v_context_id + from + acs_objects + where + object_id = get_context.item_id; + + return v_context_id; + +exception when no_data_found then + + raise_application_error(-20000, 'Content item ' || item_id || + ' does not exist in content_item.get_context'); + + +end get_context; + +-- 1) make sure we are not moving the item to an invalid location: +-- that is, the destination folder exists and is a valid folder +-- 2) make sure the content type of the content item is registered +-- to the target folder +-- 3) update the parent_id for the item +procedure move ( + item_id in cr_items.item_id%TYPE, + target_folder_id in cr_folders.folder_id%TYPE +) is +begin + + if content_folder.is_folder(item_id) = 't' then + content_folder.move(item_id, target_folder_id); + elsif content_folder.is_folder(target_folder_id) = 't' then + + + if content_folder.is_registered( move.target_folder_id, + get_content_type( move.item_id )) = 't' and + content_folder.is_registered( move.target_folder_id, + get_content_type( content_symlink.resolve( move.item_id)),'f') = 't' + then + + -- update the parent_id for the item + update cr_items + set parent_id = move.target_folder_id + where item_id = move.item_id; + end if; + + end if; +end move; + +procedure copy ( + item_id in cr_items.item_id%TYPE, + target_folder_id in cr_folders.folder_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE default null +) is + + copy_id cr_items.item_id%TYPE; + +begin + + copy_id := copy2(item_id, target_folder_id, creation_user, creation_ip); + +end copy; + +-- copy a content item to a target folder +-- 1) make sure we are not copying the item to an invalid location: +-- that is, the destination folder exists, is a valid folder, +-- and is not the current folder +-- 2) make sure the content type of the content item is registered +-- with the current folder +-- 3) create a new item with no revisions in the target folder +-- 4) copy the latest revision from the original item to the new item (if any) + +function copy2 ( + item_id in cr_items.item_id%TYPE, + target_folder_id in cr_folders.folder_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE default null +) return cr_items.item_id%TYPE is + v_current_folder_id cr_folders.folder_id%TYPE; + v_num_revisions integer; + v_name cr_items.name%TYPE; + v_content_type cr_items.content_type%TYPE; + v_locale cr_items.locale%TYPE; + v_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_is_registered char(1); + v_old_revision_id cr_revisions.revision_id%TYPE; + v_new_revision_id cr_revisions.revision_id%TYPE; + v_storage_type cr_items.storage_type%TYPE; +begin + + -- call content_folder.copy if the item is a folder + if content_folder.is_folder(copy2.item_id) = 't' then + content_folder.copy( + folder_id => copy2.item_id, + target_folder_id => copy2.target_folder_id, + creation_user => copy2.creation_user, + creation_ip => copy2.creation_ip + ); + -- call content_symlink.copy if the item is a symlink + elsif content_symlink.is_symlink(copy2.item_id) = 't' then + content_symlink.copy( + symlink_id => copy2.item_id, + target_folder_id => copy2.target_folder_id, + creation_user => copy2.creation_user, + creation_ip => copy2.creation_ip + ); + -- call content_extlink.copy if the item is a extlink + elsif content_extlink.is_extlink(copy2.item_id) = 't' then + content_extlink.copy( + extlink_id => copy2.item_id, + target_folder_id => copy2.target_folder_id, + creation_user => copy2.creation_user, + creation_ip => copy2.creation_ip + ); + -- make sure the target folder is really a folder + elsif content_folder.is_folder(copy2.target_folder_id) = 't' then + + select + parent_id + into + v_current_folder_id + from + cr_items + where + item_id = copy2.item_id; + + -- can't copy to the same folder + if copy2.target_folder_id ^= v_current_folder_id then + + select + content_type, name, locale, + nvl(live_revision, latest_revision), storage_type + into + v_content_type, v_name, v_locale, v_revision_id, v_storage_type + from + cr_items + where + item_id = copy2.item_id; + + -- make sure the content type of the item is registered to the folder + v_is_registered := content_folder.is_registered( + folder_id => copy2.target_folder_id, + content_type => v_content_type, + include_subtypes => 'f' + ); + + if v_is_registered = 't' then + -- create the new content item + v_item_id := content_item.new( + parent_id => copy2.target_folder_id, + name => v_name, + locale => v_locale, + content_type => v_content_type, + creation_user => copy2.creation_user, + creation_ip => copy2.creation_ip, + storage_type => v_storage_type + ); + + -- get the latest revision of the old item + select + latest_revision into v_old_revision_id + from + cr_items + where + item_id = copy2.item_id; + + -- copy the latest revision (if any) to the new item + if v_old_revision_id is not null then + v_new_revision_id := content_revision.copy ( + revision_id => v_old_revision_id, + target_item_id => v_item_id, + creation_user => copy2.creation_user, + creation_ip => copy2.creation_ip + ); + end if; + end if; + + + end if; + end if; + + return v_item_id; + +end copy2; + +-- get the latest revision for an item +function get_latest_revision ( + item_id in cr_items.item_id%TYPE +) return cr_revisions.revision_id%TYPE is + v_revision_id integer; + + cursor c_revision_cur is + select + r.revision_id + from + cr_revisions r, acs_objects o + where + r.revision_id = o.object_id + and + r.item_id = get_latest_revision.item_id + order by + o.creation_date desc; +begin + + if item_id is null then + return null; + end if; + + open c_revision_cur; + fetch c_revision_cur into v_revision_id; + if c_revision_cur%NOTFOUND then + close c_revision_cur; + return null; + end if; + close c_revision_cur; + return v_revision_id; + +exception + when NO_DATA_FOUND then + if c_revision_cur%ISOPEN then + close c_revision_cur; + end if; + return null; +end get_latest_revision; + + + +function get_best_revision ( + item_id in cr_items.item_id%TYPE +) return cr_revisions.revision_id%TYPE +is + v_revision_id cr_revisions.revision_id%TYPE; +begin + + select + NVL (live_revision, latest_revision ) + into + v_revision_id + from + cr_items + where + item_id = get_best_revision.item_id; + + return v_revision_id; +exception + when NO_DATA_FOUND then + return null; +end get_best_revision; + + + +function get_title ( + item_id in cr_items.item_id%TYPE, + is_live in char default 'f' +) return cr_revisions.title%TYPE is + + v_title cr_revisions.title%TYPE; + v_content_type cr_items.content_type%TYPE; + +begin + + select content_type into v_content_type from cr_items + where item_id = get_title.item_id; + + if v_content_type = 'content_folder' then + select label into v_title from cr_folders + where folder_id = get_title.item_id; + elsif v_content_type = 'content_symlink' then + select label into v_title from cr_symlinks + where symlink_id = get_title.item_id; + else + if is_live ^= 'f' then + select + title into v_title + from + cr_revisions r, cr_items i + where + i.item_id = get_title.item_id + and + r.revision_id = i.live_revision; + else + select + title into v_title + from + cr_revisions r, cr_items i + where + i.item_id = get_title.item_id + and + r.revision_id = i.latest_revision; + end if; + end if; + + return v_title; + +end get_title; + +function get_publish_date ( + item_id in cr_items.item_id%TYPE, + is_live in char default 'f' +) return cr_revisions.publish_date%TYPE +is + v_revision_id cr_revisions.revision_id%TYPE; + v_publish_date cr_revisions.publish_date%TYPE; +begin + + if is_live ^= 'f' then + select + publish_date into v_publish_date + from + cr_revisions r, cr_items i + where + i.item_id = get_publish_date.item_id + and + r.revision_id = i.live_revision; + else + select + publish_date into v_publish_date + from + cr_revisions r, cr_items i + where + i.item_id = get_publish_date.item_id + and + r.revision_id = i.latest_revision; + end if; + + return v_publish_date; + +exception when no_data_found then + return null; +end get_publish_date; + +function is_subclass ( + object_type in acs_object_types.object_type%TYPE, + supertype in acs_object_types.supertype%TYPE +) return char is + + v_subclass_p char; + + cursor c_inherit_cur is + select + object_type + from + acs_object_types + connect by + prior object_type = supertype + start with + object_type = is_subclass.supertype; + +begin + + v_subclass_p := 'f'; + + for v_inherit_val in c_inherit_cur loop + if v_inherit_val.object_type = is_subclass.object_type then + v_subclass_p := 't'; + end if; + end loop; + + return v_subclass_p; + +end is_subclass; + +function relate ( + item_id in cr_items.item_id%TYPE, + object_id in acs_objects.object_id%TYPE, + relation_tag in cr_type_relations.relation_tag%TYPE default 'generic', + order_n in cr_item_rels.order_n%TYPE default null, + relation_type in acs_object_types.object_type%TYPE default 'cr_item_rel' +) return cr_item_rels.rel_id%TYPE +is + v_content_type cr_items.content_type%TYPE; + v_object_type acs_objects.object_type%TYPE; + v_is_valid integer; + v_rel_id integer; + v_exists integer; + v_order_n cr_item_rels.order_n%TYPE; +begin + + -- check the relationship is valid + v_content_type := content_item.get_content_type ( relate.item_id ); + v_object_type := content_item.get_content_type ( relate.object_id ); + + select + decode( count(1),0,0,1) into v_is_valid + from + cr_type_relations + where + content_item.is_subclass( v_object_type, target_type ) = 't' + and + content_item.is_subclass( v_content_type, content_type ) = 't'; + + if v_is_valid = 0 then + raise_application_error(-20000, + 'There is no registered relation type matching this item relation.'); + end if; + + if relate.item_id ^= relate.object_id then + -- check that these two items are not related already + --dbms_output.put_line( 'checking if the items are already related...'); + begin + select + rel_id, 1 as v_exists into v_rel_id, v_exists + from + cr_item_rels + where + item_id = relate.item_id + and + related_object_id = relate.object_id + and + relation_tag = relate.relation_tag; + exception when no_data_found then + v_exists := 0; + end; + + + -- if order_n is null, use rel_id (the order the item was related) + if relate.order_n is null then + v_order_n := v_rel_id; + else + v_order_n := relate.order_n; + end if; + + + -- if relationship does not exist, create it + if v_exists <> 1 then + --dbms_output.put_line( 'creating new relationship...'); + v_rel_id := acs_object.new( + object_type => relation_type, + context_id => item_id + ); + insert into cr_item_rels ( + rel_id, item_id, related_object_id, order_n, relation_tag + ) values ( + v_rel_id, item_id, object_id, v_order_n, relation_tag + ); + + -- if relationship already exists, update it + else + --dbms_output.put_line( 'updating existing relationship...'); + update cr_item_rels set + relation_tag = relate.relation_tag, + order_n = v_order_n + where + rel_id = v_rel_id; + end if; + + end if; + return v_rel_id; +end relate; + + +procedure unrelate ( + rel_id in cr_item_rels.rel_id%TYPE +) is +begin + + -- delete the relation object + acs_rel.delete( unrelate.rel_id ); + + -- delete the row from the cr_item_rels table + delete from cr_item_rels where rel_id = unrelate.rel_id; + +end unrelate; + +function is_index_page ( + item_id in cr_items.item_id%TYPE, + folder_id in cr_folders.folder_id%TYPE +) return varchar2 +is +begin + if content_folder.get_index_page(folder_id) = item_id then + return 't'; + else + return 'f'; + end if; +end is_index_page; + + + +function get_parent_folder ( + item_id in cr_items.item_id%TYPE +) return cr_folders.folder_id%TYPE +is + v_folder_id cr_folders.folder_id%TYPE; + v_parent_folder_p char(1); +begin + v_parent_folder_p := 'f'; + + while v_parent_folder_p = 'f' loop + + select + parent_id, content_folder.is_folder( parent_id ) + into + v_folder_id, v_parent_folder_p + from + cr_items + where + item_id = get_parent_folder.item_id; + + end loop; + + return v_folder_id; + exception + when NO_DATA_FOUND then + return null; +end get_parent_folder; + +end content_item; +/ +show errors Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql,v diff -u -N -r1.39 -r1.40 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 10 Feb 2003 17:38:38 -0000 1.39 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 17 May 2003 09:43:09 -0000 1.40 @@ -37,10 +37,10 @@ - -------------------------------------------------------------- -- MIME TYPES -------------------------------------------------------------- +-- Mime data for the following table is in mime-type-data.sql create table cr_mime_types ( label varchar(200), @@ -60,36 +60,27 @@ a file extension to the file after its MIME type is specified. '; --- Common mime types (administered from admin pages) +-- Currently file_extension is the pk although it seems likely someone +-- will want to support multiple mime types with the same extension. +-- Would need UI work however -insert into cr_mime_types(label, mime_type, file_extension) values ('Enhanced text', 'text/enhanced', 'etxt'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Plain text', 'text/plain', 'txt'); -insert into cr_mime_types(label, mime_type, file_extension) values ('HTML text', 'text/html', 'html'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Fixed-width text', 'text/fixed-width', 'ftxt'); +create table cr_extension_mime_type_map ( + extension varchar(200) + constraint cr_mime_type_extension_map_pk + primary key, + mime_type varchar(200) + constraint cr_mime_ext_map_mime_type_ref + references cr_mime_types +); +create index cr_extension_mime_type_map_idx on cr_extension_mime_type_map(mime_type); -insert into cr_mime_types(label, mime_type, file_extension) values ('Rich Text Format (RTF)', 'text/richtext', 'rtf'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Binary', 'application/octet-stream', 'bin'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft Word', 'application/msword', 'doc'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft Excel', 'application/msexcel', 'xls'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft PowerPoint', 'application/powerpoint', 'ppt'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Microsoft Project', 'application/msproject', 'mpp'); -insert into cr_mime_types(label, mime_type, file_extension) values ('PostScript', 'application/postscript', 'ps'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Adobe Illustrator', 'application/x-illustrator', 'ai'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Adobe PageMaker', 'application/x-pagemaker', 'p65'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Filemaker Pro', 'application/filemaker', 'fm'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Image Pict', 'image/x-pict', 'pic'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Photoshop', 'application/x-photoshop', 'psd'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Acrobat', 'application/pdf', 'pdf'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Video Quicktime', 'video/quicktime', 'mov'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Video MPEG', 'video/mpeg', 'mpg'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio AIFF', 'audio/aiff', 'aif'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio Basic', 'audio/basic', 'au'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio Voice', 'audio/voice', 'voc'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Audio Wave', 'audio/wave', 'wav'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Archive Zip', 'application/zip', 'zip'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Archive Tar', 'application/z-tar', 'tar'); -insert into cr_mime_types(label, mime_type, file_extension) values ('Unknown', '*/*', ''); +comment on table cr_extension_mime_type_map is ' + a mapping table for extension to mime_type in db version of ns_guesstype data +'; +-- Load the mime type data. +\i ../common/mime-type-data.sql + create table cr_content_mime_type_map ( content_type varchar(100) constraint cr_content_mime_map_ctyp_fk @@ -106,8 +97,10 @@ content type. '; +-- RI Index +-- fairly static, could probably omit this one. +create index cr_cont_mimetypmap_mimetyp_idx ON cr_content_mime_type_map(mime_type); - -------------------------------------------------------------- -- LOCALES -------------------------------------------------------------- @@ -164,6 +157,10 @@ contain. '; +-- RI Indexes +create index cr_type_children_chld_type_idx ON cr_type_children(child_type); + + create table cr_type_relations ( content_type varchar(100) constraint cr_type_relations_parent_fk @@ -183,6 +180,10 @@ relate (see above). '; +-- RI Indexes +create index cr_type_relations_tgt_typ_idx ON cr_type_relations(target_type); + + -------------------------------------------------------------- -- CONTENT ITEMS -------------------------------------------------------------- @@ -415,6 +416,9 @@ item_id, related_object_id, relation_tag ); +-- RI Indexes +create index cr_item_rels_rel_obj_id_idx ON cr_item_rels(related_object_id); + comment on table cr_item_rels is ' Describes all relations from one item to any number of other objects. @@ -448,7 +452,7 @@ cr_items on delete cascade, title varchar(1000), description text, - publish_date timestamp, + publish_date timestamptz, mime_type varchar(200) default 'text/plain' constraint cr_revisions_mime_type_ref references cr_mime_types, @@ -461,6 +465,10 @@ content_length integer ); +-- RI Indexes +create index cr_revisions_lob_idx ON cr_revisions(lob); +create index cr_revisions_item_id_idx ON cr_revisions(item_id); + create trigger cr_revisions_lob_trig before delete or update or insert on cr_revisions for each row execute procedure on_lob_ref(); @@ -688,7 +696,7 @@ new_revision integer, old_status varchar(40), new_status varchar(40), - publish_date timestamp + publish_date timestamptz constraint cr_item_publish_audit_date_nil not null ); @@ -706,12 +714,12 @@ references cr_items constraint cr_release_periods_pk primary key, - start_when timestamp default now(), - end_when timestamp default now() + interval '20 years' + start_when timestamptz default current_timestamp, + end_when timestamptz default current_timestamp + interval '20 years' ); create table cr_scheduled_release_log ( - exec_date timestamp default now() not null, + exec_date timestamptz default current_timestamp not null, items_released integer not null, items_expired integer not null, err_num integer, @@ -725,7 +733,7 @@ create table cr_scheduled_release_job ( job_id integer, - last_exec timestamp + last_exec timestamptz ); comment on table cr_scheduled_release_job is ' @@ -762,6 +770,8 @@ repository. '; +--RI Indexes +create index cr_folders_package_id_idx ON cr_folders(package_id); create function cr_folder_ins_up_ri_trg() returns opaque as ' declare @@ -821,9 +831,9 @@ thos available for content types. '; +-- RI Indexes +create index cr_folder_typ_map_cont_typ_idx ON cr_folder_type_map(content_type); - - -------------------------------------------------------------- -- CONTENT TEMPLATES -------------------------------------------------------------- @@ -986,6 +996,8 @@ tree_sortkey varbit ); +-- RI Indexes +create index cr_keywords_parent_id_idx ON cr_keywords(parent_id); create function cr_keywords_get_tree_sortkey(integer) returns varbit as ' declare @@ -1116,6 +1128,8 @@ primary key (item_id, keyword_id) ); +-- RI Indexes +create index cr_item_keyword_map_kw_id_idx ON cr_item_keyword_map(keyword_id); -------------------------------------------------------------- -- TEXT SUBMISSION @@ -1209,7 +1223,7 @@ PERFORM content_type__register_mime_type(''content_revision'', ''text/plain''); PERFORM content_type__register_mime_type(''content_revision'', - ''text/richtext''); + ''application/rtf''); v_id := content_folder__new ( ''pages'', @@ -1359,7 +1373,6 @@ add constraint cr_flder_pkg_id_fk foreign key (package_id) references apm_packages (package_id); --constraint cr_fldr_pkg_id_fk --- show errors -- prompt *** Preparing search indices... \i content-search.sql Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql 21 Dec 2002 22:32:31 -0000 1.8 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql 17 May 2003 09:43:09 -0000 1.9 @@ -10,9 +10,7 @@ -- License. Full text of the license is available from the GNU Project: -- http://www.fsf.org/copyleft/gpl.html --- create or replace package body content_extlink --- function new -create function content_extlink__new (varchar,varchar,varchar,varchar,integer,integer,timestamp with time zone,integer,varchar) +create function content_extlink__new (varchar,varchar,varchar,varchar,integer,integer,timestamptz,integer,varchar) returns integer as ' declare new__name alias for $1; -- default null @@ -70,8 +68,6 @@ end;' language 'plpgsql'; - --- procedure delete create function content_extlink__delete (integer) returns integer as ' declare @@ -87,7 +83,6 @@ end;' language 'plpgsql'; --- function is_extlink create function content_extlink__is_extlink (integer) returns boolean as ' declare @@ -106,8 +101,66 @@ end;' language 'plpgsql'; +create function content_extlink__copy (integer,integer,integer,varchar) +returns integer as ' +declare + copy__extlink_id alias for $1; + copy__target_folder_id alias for $2; + copy__creation_user alias for $3; + copy__creation_ip alias for $4; -- default null + v_current_folder_id cr_folders.folder_id%TYPE; + v_name cr_items.name%TYPE; + v_url cr_extlinks.url%TYPE; + v_description cr_extlinks.description%TYPE; + v_label cr_extlinks.label%TYPE; + v_extlink_id cr_extlinks.extlink_id%TYPE; +begin + if content_folder__is_folder(copy__target_folder_id) = ''t'' then + select + parent_id + into + v_current_folder_id + from + cr_items + where + item_id = copy__extlink_id; --- show errors + -- can''t copy to the same folder + if copy__target_folder_id != v_current_folder_id then + select + i.name, e.url, e.description, e.label + into + v_name, v_url, v_description, v_label + from + cr_extlinks e, cr_items i + where + e.extlink_id = i.item_id + and + e.extlink_id = copy__extlink_id; + if content_folder__is_registered(copy__target_folder_id, + ''content_extlink'',''f'') = ''t'' then + + v_extlink_id := content_extlink__new( + v_name, + v_url, + v_label, + v_description, + copy__target_folder_id, + null, + current_timestamp, + copy__creation_user, + copy__creation_ip + ); + + end if; + end if; + end if; + + return 0; +end;' language 'plpgsql'; + + + Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql,v diff -u -N -r1.21 -r1.22 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 21 Dec 2002 22:32:31 -0000 1.21 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 17 May 2003 09:43:09 -0000 1.22 @@ -33,7 +33,7 @@ end;' language 'plpgsql'; -- function new -create function content_folder__new (varchar,varchar,varchar,integer,integer,integer,timestamp with time zone,integer,varchar) +create function content_folder__new (varchar,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar) returns integer as ' declare new__name alias for $1; @@ -115,7 +115,7 @@ -- function new -- accepts security_inherit_p DaveB -create function content_folder__new (varchar,varchar,varchar,integer,integer,integer,timestamp with time zone,integer,varchar, boolean) +create function content_folder__new (varchar,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar, boolean) returns integer as ' declare new__name alias for $1; Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-image-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-image-drop.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-image-drop.sql 15 Nov 2001 01:47:13 -0000 1.3 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-image-drop.sql 17 May 2003 09:43:09 -0000 1.4 @@ -12,13 +12,13 @@ drop function image__delete (integer); -drop function image__new (varchar,integer,integer,integer,varchar,integer,varchar,integer,varchar,varchar,boolean,timestamp,varchar,integer,integer,integer); +drop function image__new (varchar,integer,integer,integer,varchar,integer,varchar,integer,varchar,varchar,boolean,timestamptz,varchar,integer,integer,integer); -drop function image__new_revision(integer, integer, varchar, varchar, timestamp, varchar, varchar, +drop function image__new_revision(integer, integer, varchar, varchar, timestamptz, varchar, varchar, integer, varchar, integer, integer); drop function image__new (varchar,integer,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,varchar, - varchar,timestamp,integer, integer); + varchar,timestamptz,integer, integer); begin; select content_type__unregister_mime_type( Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-image.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-image.sql,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-image.sql 21 Dec 2002 22:32:31 -0000 1.9 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-image.sql 17 May 2003 09:43:09 -0000 1.10 @@ -59,22 +59,6 @@ end; - --- insert new MIME types -insert into cr_mime_types ( - label, mime_type, file_extension -) values ( - 'Image - Jpeg', 'image/jpeg','jpg' -); - -insert into cr_mime_types ( - label, mime_type, file_extension -) values ( - 'Image - Gif', 'image/gif','gif' -); - - - -- register MIME types to this content type begin; @@ -120,7 +104,7 @@ -- The Oracle version does allow a non-image type to be specified, as does my -- alternative down below. This needs a little more straightening out. -create function image__new (varchar,integer,integer,integer,varchar,integer,varchar,varchar,varchar,varchar,boolean,timestamp with time zone,varchar,integer,integer,integer +create function image__new (varchar,integer,integer,integer,varchar,integer,varchar,varchar,varchar,varchar,boolean,timestamptz,varchar,integer,integer,integer ) returns integer as ' declare new__name alias for $1; @@ -142,7 +126,7 @@ new__locale varchar default null; new__nls_language varchar default null; - new__creation_date timestamp default now(); + new__creation_date timestamptz default current_timestamp; new__context_id integer; v_item_id cr_items.item_id%TYPE; @@ -215,7 +199,7 @@ -- DRB's version create function image__new (varchar,integer,integer,integer,varchar,integer,varchar,varchar,varchar,varchar,varchar, - varchar,timestamp,integer, integer) returns integer as ' + varchar,timestamptz,integer, integer) returns integer as ' declare p_name alias for $1; p_parent_id alias for $2; -- default null @@ -284,7 +268,8 @@ return v_item_id; end; ' language 'plpgsql'; -create function image__new_revision(integer, integer, varchar, varchar, timestamp with time zone, varchar, varchar, + +create function image__new_revision(integer, integer, varchar, varchar, timestamptz, varchar, varchar, integer, varchar, integer, integer) returns integer as ' declare p_item_id alias for $1; Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql,v diff -u -N -r1.40 -r1.41 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 21 Dec 2002 22:32:31 -0000 1.40 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 17 May 2003 09:43:09 -0000 1.41 @@ -26,17 +26,6 @@ else --- select --- item_id into v_folder_id --- from --- cr_items --- where --- parent_id = 0 --- connect by --- prior parent_id = item_id --- start with --- item_id = get_root_folder__item_id; - select i2.item_id into v_folder_id from cr_items i1, cr_items i2 where i2.parent_id = 0 @@ -52,9 +41,7 @@ end;' language 'plpgsql'; - --- function new -create function content_item__new (varchar,integer,integer,varchar,timestamp with time zone,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar) +create function content_item__new (varchar,integer,integer,varchar,timestamptz,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar) returns integer as ' declare new__name alias for $1; @@ -73,8 +60,6 @@ new__nls_language alias for $14; -- default null new__text alias for $15; -- default null new__storage_type alias for $16; -- check in (''text'',''file'') --- relation_tag alias for $17; --- is_live alias for $18; new__relation_tag varchar default null; new__is_live boolean default ''f''; @@ -212,7 +197,7 @@ end;' language 'plpgsql'; -create function content_item__new (varchar,integer,integer,varchar,timestamp with time zone,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,varchar,integer) +create function content_item__new (varchar,integer,integer,varchar,timestamptz,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,varchar,integer) returns integer as ' declare new__name alias for $1; @@ -231,8 +216,6 @@ new__nls_language alias for $14; -- default null -- changed to integer for blob_id new__data alias for $15; -- default null --- relation_tag alias for $17; --- is_live alias for $18; new__relation_tag varchar default null; new__is_live boolean default ''f''; @@ -416,7 +399,7 @@ -- function new -- sets security_inherit_p to FALSE -DaveB -create function content_item__new ( integer, varchar, integer, varchar, timestamp with time zone, integer, integer, varchar, boolean, varchar, text, varchar, boolean, varchar,varchar,varchar) +create function content_item__new ( integer, varchar, integer, varchar, timestamptz, integer, integer, varchar, boolean, varchar, text, varchar, boolean, varchar,varchar,varchar) returns integer as ' declare @@ -577,7 +560,6 @@ end;' language 'plpgsql'; --- function is_published create function content_item__is_published (integer) returns boolean as ' declare @@ -598,7 +580,6 @@ end;' language 'plpgsql'; --- function is_publishable create function content_item__is_publishable (integer) returns boolean as ' declare @@ -706,7 +687,6 @@ end;' language 'plpgsql'; --- function is_valid_child create function content_item__is_valid_child (integer,varchar) returns boolean as ' declare @@ -721,7 +701,7 @@ -- first check if content_type is a registered child_type select - max_n into v_max_children + sum(max_n) into v_max_children from cr_type_children where @@ -769,7 +749,7 @@ 5) delete all permissions associated with this item 6) delete keyword associations 7) delete all associated comments */ --- procedure delete + create function content_item__delete (integer) returns integer as ' declare @@ -895,7 +875,6 @@ end;' language 'plpgsql'; --- procedure rename create function content_item__rename (integer,varchar) returns integer as ' declare @@ -931,7 +910,6 @@ return 0; end;' language 'plpgsql'; --- function get_id create function content_item__get_id (varchar,integer,boolean) returns integer as ' declare @@ -1013,10 +991,6 @@ return child_id; --- exception --- when NO_DATA_FOUND then --- return null; - end;' language 'plpgsql'; create sequence content_item_gp_session_id; @@ -1284,7 +1258,6 @@ end;' language 'plpgsql'; --- function get_virtual_path create function content_item__get_virtual_path (integer,integer) returns varchar as ' declare @@ -1310,14 +1283,10 @@ end if; return v_path; --- exception --- when NO_DATA_FOUND then --- return null; end;' language 'plpgsql'; --- procedure write_to_file create function content_item__write_to_file (integer,varchar) returns integer as ' declare @@ -1345,7 +1314,6 @@ end;' language 'plpgsql'; --- procedure register_template create function content_item__register_template (integer,integer,varchar) returns integer as ' declare @@ -1378,7 +1346,6 @@ end;' language 'plpgsql'; --- procedure unregister_template create function content_item__unregister_template (integer,integer,varchar) returns integer as ' declare @@ -1419,7 +1386,6 @@ end;' language 'plpgsql'; --- function get_template create function content_item__get_template (integer,varchar) returns integer as ' declare @@ -1467,7 +1433,6 @@ end;' language 'plpgsql'; --- function get_content_type create function content_item__get_content_type (integer) returns varchar as ' declare @@ -1491,7 +1456,6 @@ end;' language 'plpgsql'; --- function get_live_revision create function content_item__get_live_revision (integer) returns integer as ' declare @@ -1544,7 +1508,6 @@ return 0; end;' language 'plpgsql'; --- procedure set_live_revision create function content_item__set_live_revision (integer,varchar) returns integer as ' declare @@ -1576,7 +1539,6 @@ end;' language 'plpgsql'; --- procedure unset_live_revision create function content_item__unset_live_revision (integer) returns integer as ' declare @@ -1603,9 +1565,7 @@ return 0; end;' language 'plpgsql'; - --- procedure set_release_period -create function content_item__set_release_period (integer, timestamp with time zone, timestamp with time zone) +create function content_item__set_release_period (integer, timestamptz, timestamptz) returns integer as ' declare set_release_period__item_id alias for $1; @@ -1637,7 +1597,6 @@ end;' language 'plpgsql'; --- function get_revision_count create function content_item__get_revision_count (integer) returns integer as ' declare @@ -1657,7 +1616,6 @@ end;' language 'plpgsql'; --- function get_context create function content_item__get_context (integer) returns integer as ' declare @@ -1689,7 +1647,6 @@ -- to the target folder -- 3) update the parent_id for the item --- procedure move create function content_item__move (integer,integer) returns integer as ' declare @@ -1722,7 +1679,6 @@ end;' language 'plpgsql'; --- procedure copy create function content_item__copy (integer,integer,integer,varchar) returns integer as ' declare @@ -1747,7 +1703,6 @@ -- 3) create a new item with no revisions in the target folder -- 4) copy the latest revision from the original item to the new item (if any) --- function copy2 create function content_item__copy2 (integer,integer,integer,varchar) returns integer as ' declare @@ -1784,6 +1739,14 @@ copy2__creation_user, copy2__creation_ip ); + -- call content_extlink.copy if the item is an url + else if content_extlink__is_extlink(copy2__item_id) = ''t'' then + PERFORM content_extlink__copy( + copy2__item_id, + copy2__target_folder_id, + copy2__creation_user, + copy2__creation_ip + ); -- make sure the target folder is really a folder else if content_folder__is_folder(copy2__target_folder_id) = ''t'' then @@ -1859,14 +1822,13 @@ end if; - end if; end if; end if; + end if; end if; end if; end if; return v_item_id; end;' language 'plpgsql'; --- function get_latest_revision create function content_item__get_latest_revision (integer) returns integer as ' declare @@ -1899,7 +1861,6 @@ end;' language 'plpgsql' with (isstrict); --- function get_best_revision create function content_item__get_best_revision (integer) returns integer as ' declare @@ -1925,7 +1886,6 @@ end;' language 'plpgsql'; --- function get_title create function content_item__get_title (integer,boolean) returns varchar as ' declare @@ -1982,9 +1942,8 @@ end;' language 'plpgsql'; --- function get_publish_date create function content_item__get_publish_date (integer,boolean) -returns timestamp as ' +returns timestamptz as ' declare get_publish_date__item_id alias for $1; get_publish_date__is_live alias for $2; -- default ''f'' @@ -2021,7 +1980,6 @@ end;' language 'plpgsql'; --- function is_subclass create function content_item__is_subclass (varchar,varchar) returns boolean as ' declare @@ -2033,15 +1991,6 @@ v_subclass_p := ''f''; --- select --- object_type --- from --- acs_object_types --- connect by --- prior object_type = supertype --- start with --- object_type = is_subclass__supertype - for v_inherit_val in select o.object_type from acs_object_types o, acs_object_types o2 where o2.object_type = is_subclass__supertype @@ -2058,7 +2007,6 @@ end;' language 'plpgsql'; --- function relate create function content_item__relate (integer,integer,varchar,integer,varchar) returns integer as ' declare @@ -2154,7 +2102,6 @@ end;' language 'plpgsql'; --- procedure unrelate create function content_item__unrelate (integer) returns integer as ' declare @@ -2171,7 +2118,6 @@ end;' language 'plpgsql'; --- function is_index_page create function content_item__is_index_page (integer,integer) returns boolean as ' declare @@ -2187,7 +2133,6 @@ end;' language 'plpgsql'; --- function get_parent_folder create function content_item__get_parent_folder (integer) returns integer as ' declare @@ -2217,7 +2162,6 @@ end;' language 'plpgsql'; --- show errors -- Trigger to maintain context_id in acs_objects @@ -2235,7 +2179,6 @@ create trigger cr_items_update_tr after update on cr_items for each row execute procedure cr_items_update_tr (); --- show errors -- Trigger to maintain publication audit trail create function cr_items_publish_update_tr () returns opaque as ' @@ -2261,6 +2204,3 @@ create trigger cr_items_publish_update_tr before update on cr_items for each row execute procedure cr_items_publish_update_tr (); --- show errors - - Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql 27 Feb 2003 13:55:33 -0000 1.13 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql 17 May 2003 09:43:09 -0000 1.14 @@ -91,7 +91,7 @@ -- function new -create function content_keyword__new (varchar,varchar,integer,integer,timestamp with time zone,integer,varchar,varchar) +create function content_keyword__new (varchar,varchar,integer,integer,timestamptz,integer,varchar,varchar) returns integer as ' declare new__heading alias for $1; Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql,v diff -u -N -r1.30 -r1.31 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql 21 Dec 2002 22:32:31 -0000 1.30 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql 17 May 2003 09:43:09 -0000 1.31 @@ -13,7 +13,7 @@ -- create or replace package body content_revision -- function new -create function content_revision__new (varchar,varchar,timestamp with time zone,varchar,varchar,integer,integer,integer,timestamp with time zone,integer,varchar) +create function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar) returns integer as ' declare new__title alias for $1; @@ -65,7 +65,7 @@ end;' language 'plpgsql'; -create function content_revision__new(varchar,varchar,timestamp with time zone,varchar,text,integer) returns integer as ' +create function content_revision__new(varchar,varchar,timestamptz,varchar,text,integer) returns integer as ' declare new__title alias for $1; new__description alias for $2; -- default null @@ -89,7 +89,7 @@ end;' language 'plpgsql'; -create function content_revision__new (varchar,varchar,timestamp with time zone,varchar,varchar,text,integer,integer,timestamp with time zone,integer,varchar) +create function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,text,integer,integer,timestamptz,integer,varchar) returns integer as ' declare new__title alias for $1; @@ -120,7 +120,7 @@ end;' language 'plpgsql'; -- function new -create function content_revision__new (varchar,varchar,timestamp with time zone,varchar,varchar,text,integer,integer,timestamp with time zone,integer,varchar,integer) +create function content_revision__new (varchar,varchar,timestamptz,varchar,varchar,text,integer,integer,timestamptz,integer,varchar,integer) returns integer as ' declare new__title alias for $1; Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-schedule.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-schedule.sql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-schedule.sql 13 May 2001 04:41:01 -0000 1.7 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-schedule.sql 17 May 2003 09:43:09 -0000 1.8 @@ -31,8 +31,8 @@ create function cr_scheduled_release_exec () returns integer as ' declare - exec__last_exec timestamp; - exec__this_exec timestamp default now(); + exec__last_exec timestamptz; + exec__this_exec timestamptz default current_timestamp; exec__items_released integer default 0; exec__items_expired integer default 0; exec__err_num integer; -- sqlcode Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 21 Dec 2002 22:32:31 -0000 1.10 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 17 May 2003 09:43:09 -0000 1.11 @@ -12,7 +12,7 @@ -- create or replace package body content_symlink -- function new -create function content_symlink__new (varchar,varchar,integer,integer,integer,timestamp with time zone,integer,varchar) +create function content_symlink__new (varchar,varchar,integer,integer,integer,timestamptz,integer,varchar) returns integer as ' declare new__name alias for $1; -- default null Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql 21 Dec 2002 22:32:31 -0000 1.7 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql 17 May 2003 09:43:09 -0000 1.8 @@ -35,7 +35,7 @@ end;' language 'plpgsql'; -- function new -create function content_template__new (varchar,integer,integer,timestamp with time zone,integer,varchar) +create function content_template__new (varchar,integer,integer,timestamptz,integer,varchar) returns integer as ' declare new__name alias for $1; Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql,v diff -u -N -r1.27 -r1.28 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql 5 Mar 2003 17:02:10 -0000 1.27 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql 17 May 2003 09:43:09 -0000 1.28 @@ -723,7 +723,8 @@ select count(*) into v_exists from cr_type_children where parent_type = register_child_type__parent_type - and child_type = register_child_type__child_type; + and child_type = register_child_type__child_type + and relation_tag = register_child_type__relation_tag; if v_exists = 0 then Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-update.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-update.sql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-update.sql 21 Dec 2002 22:32:31 -0000 1.6 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-update.sql 17 May 2003 09:43:09 -0000 1.7 @@ -167,8 +167,8 @@ references cr_items constraint cr_release_periods_pk primary key, - start_when timestamp default now(), - end_when timestamp default now() + interval ''20 years'' + start_when timestamptz default current_timestamp, + end_when timestamptz default current_timestamp + interval ''20 years'' )''; end if; @@ -179,7 +179,7 @@ execute '' create table cr_scheduled_release_log ( - exec_date timestamp default now() not null, + exec_date timestamptz default current_timestamp not null, items_released integer not null, items_expired integer not null, err_num integer, @@ -195,7 +195,7 @@ execute '' create table cr_scheduled_release_job ( job_id integer, - last_exec timestamp + last_exec timestamptz )''; execute '' Index: openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql 25 May 2002 14:30:02 -0000 1.4 +++ openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql 17 May 2003 09:43:09 -0000 1.5 @@ -3,1755 +3,6 @@ -- \i content-util.sql \i content-update.sql --- create or replace package content_type AUTHID CURRENT_USER as --- --/** This package is used to manipulate content types and attributes --- -- --- --*/ --- --- procedure create_type ( --- --/** Create a new content type. Automatically create the attribute table --- -- for the type if the table does not already exist. --- -- @author Karl Goldstein --- -- @param content_type The name of the new type --- -- @param supertype The supertype, defaults to content_revision --- -- @param pretty_name Pretty name for the type, singular --- -- @param pretty_plural Pretty name for the type, plural --- -- @param table_name The name for the attribute table, defaults to --- -- the name of the supertype --- -- @param id_column The primary key for the table, defaults to 'XXX' --- -- @param name_method As in acs_object_type.create_type --- -- @see {acs_object_type.create_type} --- --*/ --- content_type in acs_object_types.object_type%TYPE, --- supertype in acs_object_types.object_type%TYPE --- default 'content_revision', --- pretty_name in acs_object_types.pretty_name%TYPE, --- pretty_plural in acs_object_types.pretty_plural%TYPE, --- table_name in acs_object_types.table_name%TYPE, --- id_column in acs_object_types.id_column%TYPE default 'XXX', --- name_method in acs_object_types.name_method%TYPE default null --- ); --- --- procedure drop_type ( --- --/** First drops all attributes related to a specific type, then drops type --- -- the given type. --- -- @author Simon Huynh --- -- @param content_type The content type to be dropped --- -- @param drop_children_p If 't', then the sub-types --- -- of the given content type and their associated tables --- -- are also dropped. --- --*/ --- content_type in acs_object_types.object_type%TYPE, --- drop_children_p in char default 'f', --- drop_table_p in char default 'f' --- --- ); --- --- --- function create_attribute ( --- --/** Create a new attribute for the specified type. Automatically create --- -- the column for the attribute if the column does not already exist. --- -- @author Karl Goldstein --- -- @param content_type The name of the type to alter --- -- @param attribute_name The name of the attribute to create --- -- @param pretty_name Pretty name for the new attribute, singular --- -- @param pretty_plural Pretty name for the new attribute, plural --- -- @param default_value The default value for the attribute, defaults to null --- -- @return The id of the newly created attribute --- -- @see {acs_object_type.create_attribute}, {content_type.create_type} --- --*/ --- content_type in acs_attributes.object_type%TYPE, --- attribute_name in acs_attributes.attribute_name%TYPE, --- datatype in acs_attributes.datatype%TYPE, --- pretty_name in acs_attributes.pretty_name%TYPE, --- pretty_plural in acs_attributes.pretty_plural%TYPE default null, --- sort_order in acs_attributes.sort_order%TYPE default null, --- default_value in acs_attributes.default_value%TYPE default null, --- column_spec in varchar2 default 'varchar2(4000)' --- ) return acs_attributes.attribute_id%TYPE; --- --- procedure drop_attribute ( --- --/** Drop an existing attribute. If you are using CMS, make sure to --- -- call cm_form_widget.unregister_attribute_widget before calling --- -- this function. --- -- @author Karl Goldstein --- -- @param content_type The name of the type to alter --- -- @param attribute_name The name of the attribute to drop --- -- @param drop_column If 't', will also alter the table and remove --- -- the column where the attribute is stored. The default is 'f' --- -- (leaves the table untouched). --- -- @see {acs_object.drop_attribute}, {content_type.create_attribute}, --- -- {cm_form_widget.unregister_attribute_widget} --- --*/ --- content_type in acs_attributes.object_type%TYPE, --- attribute_name in acs_attributes.attribute_name%TYPE, --- drop_column in varchar2 default 'f' --- ); --- --- procedure register_template ( --- --/** Register a template for the content type. This template may be used --- -- to render all items of that type. --- -- @author Karl Goldstein --- -- @param content_type The type for which the template is to be registered --- -- @param template_id The ID of the template to register --- -- @param use_context The context in which the template is appropriate, such --- -- as 'admin' or 'public' --- -- @param is_default If 't', this template becomes the default template for --- -- the type, default is 'f'. --- -- @see {content_item.register_template}, {content_item.unregister_template}, --- -- {content_item.get_template}, {content_type.unregister_template}, --- -- {content_type.set_default_template}, {content_type.get_template} --- --*/ --- content_type in cr_type_template_map.content_type%TYPE, --- template_id in cr_templates.template_id%TYPE, --- use_context in cr_type_template_map.use_context%TYPE, --- is_default in cr_type_template_map.is_default%TYPE default 'f' --- ); --- --- procedure set_default_template ( --- --/** Make the registered template a default template. The default template --- -- will be used to render all items of the type for which no individual --- -- template is registered. --- -- @author Karl Goldstein --- -- @param content_type The type for which the template is to be made default --- -- @param template_id The ID of the template to make default --- -- @param use_context The context in which the template is appropriate, such --- -- as 'admin' or 'public' --- -- @see {content_item.register_template}, {content_item.unregister_template}, --- -- {content_item.get_template}, {content_type.unregister_template}, --- -- {content_type.register_template}, {content_type.get_template} --- --*/ --- content_type in cr_type_template_map.content_type%TYPE, --- template_id in cr_templates.template_id%TYPE, --- use_context in cr_type_template_map.use_context%TYPE --- ); --- --- function get_template ( --- --/** Retrieve the appropriate template for rendering items of the specified type. --- -- @author Karl Goldstein --- -- @param content_type The type for which the template is to be retrieved --- -- @param use_context The context in which the template is appropriate, such --- -- as 'admin' or 'public' --- -- @return The ID of the template to use --- -- @see {content_item.register_template}, {content_item.unregister_template}, --- -- {content_item.get_template}, {content_type.unregister_template}, --- -- {content_type.register_template}, {content_type.set_default_template} --- --*/ --- content_type in cr_type_template_map.content_type%TYPE, --- use_context in cr_type_template_map.use_context%TYPE --- ) return cr_templates.template_id%TYPE; --- --- procedure unregister_template ( --- --/** Unregister a template. If the unregistered template was the default template, --- -- the content_type can no longer be rendered in the use_context, --- -- @author Karl Goldstein --- -- @param content_type The type for which the template is to be unregistered --- -- @param template_id The ID of the template to unregister --- -- @param use_context The context in which the template is to be unregistered --- -- @see {content_item.register_template}, {content_item.unregister_template}, --- -- {content_item.get_template}, {content_type.set_default_template}, --- -- {content_type.register_template}, {content_type.get_template} --- --*/ --- content_type in cr_type_template_map.content_type%TYPE default null, --- template_id in cr_templates.template_id%TYPE, --- use_context in cr_type_template_map.use_context%TYPE default null --- ); --- --- procedure refresh_view ( --- --/** Create a view for the type which joins all attributes of the type, --- -- including the inherited attributes. The view is named --- -- "X" --- -- Called by create_attribute and create_type. --- -- @author Karl Goldstein --- -- @param content_type The type for which the view is to be created. --- -- @see {content_type.create_type} --- --*/ --- content_type in cr_type_template_map.content_type%TYPE --- ); --- --- procedure register_relation_type ( --- --/** Register a relationship between a content type and another object --- -- type. This may then be used by the content_item.is_valid_relation --- -- function to validate any relationship between an item and another --- -- object. --- -- @author Karl Goldstein --- -- @param content_type The type of the item from which the relationship --- -- originated. --- -- @param target_type The type of the item to which the relationship --- -- is targeted. --- -- @param relation_tag A simple token used to identify a set of --- -- relations. --- -- @param min_n The minimun number of relationships of this type --- -- which an item must have to go live. --- -- @param max_n The minimun number of relationships of this type --- -- which an item must have to go live. --- -- @see {content_type.unregister_relation_type} --- --*/ --- content_type in cr_type_relations.content_type%TYPE, --- target_type in cr_type_relations.target_type%TYPE, --- relation_tag in cr_type_relations.relation_tag%TYPE default 'generic', --- min_n in integer default 0, --- max_n in integer default null --- ); --- --- procedure unregister_relation_type ( --- --/** Unregister a relationship between a content type and another object --- -- type. --- -- @author Karl Goldstein --- -- @param content_type The type of the item from which the relationship --- -- originated. --- -- @param target_type The type of the item to which the relationship --- -- is targeted. --- -- @param relation_tag A simple token used to identify a set of --- -- relations. --- -- @see {content_type.register_relation_type} --- --*/ --- content_type in cr_type_relations.content_type%TYPE, --- target_type in cr_type_relations.target_type%TYPE, --- relation_tag in cr_type_relations.relation_tag%TYPE default null --- ); --- --- procedure register_child_type ( --- --/** Register a parent-child relationship between a content type --- -- and another object --- -- type. This may then be used by the content_item.is_valid_relation --- -- function to validate the relationship between an item and a potential --- -- child. --- -- @author Karl Goldstein --- -- @param content_type The type of the item from which the relationship --- -- originated. --- -- @param child_type The type of the child item. --- -- @param relation_tag A simple token used to identify a set of --- -- relations. --- -- @param min_n The minimun number of parent-child --- -- relationships of this type --- -- which an item must have to go live. --- -- @param max_n The minimun number of relationships of this type --- -- which an item must have to go live. --- -- @see {content_type.register_relation_type}, {content_type.register_child_type} --- --*/ --- parent_type in cr_type_children.parent_type%TYPE, --- child_type in cr_type_children.child_type%TYPE, --- relation_tag in cr_type_children.relation_tag%TYPE default 'generic', --- min_n in integer default 0, --- max_n in integer default null --- ); --- --- procedure unregister_child_type ( --- --/** Register a parent-child relationship between a content type --- -- and another object --- -- type. This may then be used by the content_item.is_valid_relation --- -- function to validate the relationship between an item and a potential --- -- child. --- -- @author Karl Goldstein --- -- @param parent_type The type of the parent item. --- -- @param child_type The type of the child item. --- -- @param relation_tag A simple token used to identify a set of --- -- relations. --- -- @see {content_type.register_relation_type}, {content_type.register_child_type} --- --*/ --- parent_type in cr_type_children.parent_type%TYPE, --- child_type in cr_type_children.child_type%TYPE, --- relation_tag in cr_type_children.relation_tag%TYPE default null --- ); --- --- procedure register_mime_type ( --- content_type in cr_content_mime_type_map.content_type%TYPE, --- mime_type in cr_content_mime_type_map.mime_type%TYPE --- ); --- --- procedure unregister_mime_type ( --- content_type in cr_content_mime_type_map.content_type%TYPE, --- mime_type in cr_content_mime_type_map.mime_type%TYPE --- ); --- --- function is_content_type ( --- object_type in acs_object_types.object_type%TYPE --- ) return char; --- --- procedure rotate_template ( --- --/** Sets the default template for a content type and registers all the --- -- previously existing items of that content type to the original --- -- template --- -- @author Michael Pih --- -- @param template_id The template that will become the default --- -- registered template for the specified content type and use context --- -- @param v_content_type The content type --- -- @param use_context The context in which the template will be used --- --*/ --- template_id in cr_templates.template_id%TYPE, --- v_content_type in cr_items.content_type%TYPE, --- use_context in cr_type_template_map.use_context%TYPE --- ); --- --- --- end content_type; - --- show errors - --- create or replace package content_item --- as --- --- --/** --- --Content items store the overview of the content published on a --- --website. The actual content is stored in content revisions. It is --- --implemented this way so that there can be mulitple versions of the --- --actual content while the main idea remains constant. For example: If --- --there is a review for the movie "Terminator," there will exist a --- --content item by the name "terminator" with all the right parameters --- --(supertype, parent, etc), there will also exist at least one content --- --revision pointing to this item with the actual review content. --- --@see {content_revision}, {content_folder} --- --*/ --- --- c_root_folder_id constant integer := -100; --- --- function get_root_folder ( --- item_id in cr_items.item_id%TYPE default null --- ) return cr_folders.folder_id%TYPE; --- --- function new ( --- --/** Creates a new content item. If the data, title or text --- -- parameters are specified, also creates a revision for the item. --- -- @author Karl Goldstein --- -- @param name The name for the item, must be URL-encoded. --- -- If an item with this name already exists under the specified --- -- parent item, an error is thrown --- -- @param parent_id The parent of this item, defaults to null --- -- @param item_id The id of the new item. A new id will be allocated if this --- -- parameter is null --- -- @param locale The locale for this item, for use with Intermedia search --- -- @param item_subtype The type of the new item, defaults to 'content_item' --- -- This parameter is used to support inheritance, so that --- -- subclasses of content_item can call this function --- -- to initialize the parent class --- -- @param content_type The content type for the item, defaults to --- -- 'content_revision'. Only objects of this type --- -- may be used as revisions for the item --- -- @param title The user-readable title for the item, defaults to the item's --- -- name --- -- @param description A short description for the item (4000 characters maximum) --- -- @param mime_type The file type of the item, defaults to 'text/plain' --- -- @param nls_language The language for the item, used for Intermedia search --- -- @param text The text content of the new revision, 4000 charcters maximum. --- -- Cannot be specified simultaneously with the data --- -- parameter --- -- @param data The blob content of the new revision. Cannot be specified --- -- simultaneously with the text parameter --- -- @param relation_tag If a parent-child relationship is registered --- -- for these content types, use this tag to --- -- describe the parent-child relationship. Defaults --- -- to 'parent content type'-'child content type' --- -- @param is_live If 't', the new revision will become live --- -- @param context_id Security context id, as in acs_object.new --- -- If null, defaults to parent_id, and copies permissions --- -- from the parent into the current item --- -- @param others As in acs_object.new --- -- @return The id of the newly created item --- -- @see {acs_object.new} --- --*/ --- name in cr_items.name%TYPE, --- parent_id in cr_items.parent_id%TYPE default null, --- item_id in acs_objects.object_id%TYPE default null, --- locale in cr_items.locale%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE --- default sysdate, --- creation_user in acs_objects.creation_user%TYPE --- default null, --- context_id in acs_objects.context_id%TYPE default null, --- creation_ip in acs_objects.creation_ip%TYPE default null, --- item_subtype in acs_object_types.object_type%TYPE --- default 'content_item', --- content_type in acs_object_types.object_type%TYPE --- default 'content_revision', --- title in cr_revisions.title%TYPE default null, --- description in cr_revisions.description%TYPE default null, --- mime_type in cr_revisions.mime_type%TYPE default 'text/plain', --- nls_language in cr_revisions.nls_language%TYPE default null, --- text in varchar2 default null, --- data in cr_revisions.content%TYPE default null, --- relation_tag in cr_child_rels.relation_tag%TYPE default null, --- is_live in char default 'f' --- ) return cr_items.item_id%TYPE; --- --- --- function is_published ( --- --/** Determins whether an item is published or not. --- -- @author Michael Pih --- -- @param item_id The item ID --- -- @return 't' if the item is published, 'f' otherwise --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return char; --- --- --- function is_publishable ( --- --/** Determines if an item is publishable. Publishable items must --- -- meet the following criteria: --- -- 1) for each child type, the item has n children, min_n < n < max_n --- -- 2) for each relation type, the item has n relations, min_n < n < max_n --- -- 3) any 'publishing_wf' workflows are finished --- -- @author Michael Pih --- -- @param item_id The item ID --- -- @return 't' if the item is publishable in it's present state, --- -- Otherwise, returns 'f' --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return char; --- --- --- --- function is_valid_child ( --- --/** Determines if an item would be a valid child of another item by --- -- checking if the parent allows children of the would-be child's --- -- content type and if the parent already has n_max children of --- -- that content type. --- -- @author Michael Pih --- -- @param item_id The item ID of the potential parent --- -- @param content_type The content type of the potential child item --- -- @return 't' if the item would be a valid child, 'f' otherwise --- --*/ --- --- item_id in cr_items.item_id%TYPE, --- content_type in acs_object_types.object_type%TYPE --- ) return char; --- --- procedure delete ( --- --/** Deletes the specified content item, along with any revisions, symlinks, --- -- workflows, associated templates, associated keywords, --- -- child and item relationships for the item. Use with caution - this --- -- operation cannot be undone. --- -- @author Karl Goldstein --- -- @param item_id The id of the item to delete --- -- @see {acs_object.delete} --- --*/ --- item_id in cr_items.item_id%TYPE --- ); --- --- procedure rename ( --- --/** Renames the item. If an item with the specified name already exists --- -- under this item's parent, an error is thrown --- -- @author Karl Goldstein --- -- @param item_id The id of the item to rename --- -- @param name The new name for the item, must be URL-encoded --- -- @see {content_item.new} --- --*/ --- item_id in cr_items.item_id%TYPE, --- name in cr_items.name%TYPE --- ); --- --- function get_id ( --- --/** Takes in a path, such as "/tv/programs/star_trek/episode_203" --- -- and returns the id of the item with this path. Note: URLs are abstract (no --- -- extensions are allowed in content item names and extensions are stripped when --- -- looking up content items) --- -- @author Karl Goldstein --- -- @param item_path The path to be resolved --- -- @param root_folder_id Starts path resolution from this folder. Defaults to --- -- the root of the sitemap --- -- @param resolve_index Boolean flag indicating whether to return the --- -- id of the index page for folders (if one --- -- exists). Defaults to 'f'. --- -- @return The id of the item with the given path, or null if no such item exists --- -- @see {content_item.get_path} --- --*/ --- item_path in varchar2, --- root_folder_id in cr_items.item_id%TYPE default c_root_folder_id, --- resolve_index in char default 'f' --- ) return cr_items.item_id%TYPE; --- --- function get_path ( --- --/** Retrieves the full path to an item, in the form of --- -- "/tv/programs/star_trek/episode_203" --- -- @author Karl Goldstein --- -- @param item_id The item for which the path is to be retrieved --- -- @param root_folder_id Starts path resolution from this folder. --- -- Defaults to the root of the sitemap --- -- @return The path to the item --- -- @see {content_item.get_id}, {content_item.write_to_file} --- --*/ --- item_id in cr_items.item_id%TYPE, --- root_folder_id in cr_items.item_id%TYPE default null --- ) return varchar2; --- --- function get_virtual_path ( --- --/** Retrieves the virtual path to an item, in the form of --- -- "/tv/programs/star_trek/episode_203" --- -- @author Michael Pih --- -- @param item_id The item for which the path is to be retrieved --- -- @param root_folder_id Starts path resolution from this folder. --- -- Defaults to the root of the sitemap --- -- @return The virtual path to the item --- -- @see {content_item.get_id}, {content_item.write_to_file}, {content_item.get_path} --- --*/ --- item_id in cr_items.item_id%TYPE, --- root_folder_id in cr_items.item_id%TYPE default c_root_folder_id --- ) return varchar2; --- --- procedure write_to_file ( --- --/** Writes the content of the live revision of this item to a file, --- -- creating all the neccessary directories in the process --- -- @author Karl Goldstein --- -- @param item_id The item to be written to a file --- -- @param root_path The path in the filesystem to which the root of the --- -- sitemap corresponds --- -- @see {content_item.get_path} --- --*/ --- item_id in cr_items.item_id%TYPE, --- root_path in varchar2 --- ); --- --- procedure register_template ( --- --/** Registers a template which will be used to render this item. --- -- @author Karl Goldstein --- -- @param item_id The item for which the template will be registered --- -- @param template_id The template to be registered --- -- @param use_context The context in which the template is appropriate, such --- -- as 'admin' or 'public' --- -- @see {content_type.register_template}, {content_item.unregister_template}, --- -- {content_item.get_template} --- --*/ --- item_id in cr_items.item_id%TYPE, --- template_id in cr_templates.template_id%TYPE, --- use_context in cr_item_template_map.use_context%TYPE --- ); --- --- procedure unregister_template ( --- --/** Unregisters a template which will be used to render this item. --- -- @author Karl Goldstein --- -- @param item_id The item for which the template will be unregistered --- -- @param template_id The template to be registered --- -- @param use_context The context in which the template is appropriate, such --- -- as 'admin' or 'public' --- -- @see {content_type.register_template}, {content_item.register_template}, --- -- {content_item.get_template} --- --*/ --- item_id in cr_items.item_id%TYPE, --- template_id in cr_templates.template_id%TYPE default null, --- use_context in cr_item_template_map.use_context%TYPE default null --- ); --- --- function get_template ( --- --/** Retrieves the template which should be used to render this item. If no template --- -- is registered to specifically render the item in the given context, the --- -- default template for the item's type is returned. --- -- @author Karl Goldstein --- -- @param item_id The item for which the template will be unregistered --- -- @param use_context The context in the item is to be rendered, such --- -- as 'admin' or 'public' --- -- @return The id of the registered template, or null if no template could be --- -- found --- -- @see {content_type.register_template}, {content_item.register_template}, --- --*/ --- item_id in cr_items.item_id%TYPE, --- use_context in cr_item_template_map.use_context%TYPE --- ) return cr_templates.template_id%TYPE; --- --- function get_live_revision ( --- --/** Retrieves the id of the live revision for the item --- -- @param item_id The item for which the live revision is to be retrieved --- -- @return The id of the live revision for this item, or null if no live revision --- -- exists --- -- @see {content_item.set_live_revision}, {content_item.get_latest_revision} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return cr_revisions.revision_id%TYPE; --- --- procedure set_live_revision ( --- --/** Make the specified revision the live revision for the item --- -- @author Karl Goldstein --- -- @param revision_id The id of the revision which is to become live --- -- for its corresponding item --- -- @see {content_item.get_live_revision} --- --*/ --- revision_id in cr_revisions.revision_id%TYPE, --- publish_status in cr_items.publish_status%TYPE default 'ready' --- ); --- --- --- procedure unset_live_revision ( --- --/** Set the live revision to null for the item --- -- @author Michael Pih --- -- @param item_id The id of the item for which to unset the live revision --- -- @see {content_item.set_live_revision} --- item_id in cr_items.item_id%TYPE --- ); --- --- procedure set_release_period ( --- --/** Sets the release period for the item. This information may be --- -- used by applications to update the publishing status of items --- -- at periodic intervals. --- -- @author Karl Goldstein --- -- @param item_id The id the item. --- -- @param start_when The time and date when the item should be released. --- -- @param end_when The time and date when the item should be expired. --- --*/ --- item_id in cr_items.item_id%TYPE, --- start_when date default null, --- end_when date default null --- ); --- --- --- function get_revision_count ( --- --/** Return the total count of revisions for this item --- -- @author Karl Goldstein --- -- @param item_id The id the item --- -- @return The number of revisions for this item --- -- @see {content_revision.new} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return number; --- --- -- Return the object type of this item --- function get_content_type ( --- --/** Retrieve the content type of this item. Only objects of this type may be --- -- used as revisions for the item. --- -- @author Karl Goldstein --- -- @param item_id The item for which the content type is to be retrieved --- -- @return The content type of the item --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return cr_items.content_type%TYPE; --- --- function get_context ( --- --/** Retrieve the parent of the given item --- -- @author Karl Goldstein --- -- @param item_id The item for which the parent is to be retrieved --- -- @return The id of the parent for this item --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return acs_objects.context_id%TYPE; --- --- procedure move ( --- --/** Move the specified item to a different folder. If the target folder does --- -- not exist, or if the folder already contains an item with the same name --- -- as the given item, an error will be thrown. --- -- @author Karl Goldstein --- -- @param item_id The item to be moved --- -- @param target_folder_id The new folder for the item --- -- @see {content_item.new}, {content_folder.new}, {content_item.copy} --- --*/ --- item_id in cr_items.item_id%TYPE, --- target_folder_id in cr_folders.folder_id%TYPE --- ); --- --- procedure copy ( --- --/** Copies the item to a new location, creating an identical item with --- -- an identical latest revision (if any). If the target folder does --- -- not exist, or if the folder already contains an item with the same name --- -- as the given item, an error will be thrown. --- -- @author Karl Goldstein, Michael Pih --- -- @param item_id The item to be copied --- -- @param target_folder_id The folder where the item is to be copied --- -- @param creation_user The user_id of the creator --- -- @param creation_ip The IP address of the creator --- -- @see {content_item.new}, {content_folder.new}, {content_item.move} --- --*/ --- item_id in cr_items.item_id%TYPE, --- target_folder_id in cr_folders.folder_id%TYPE, --- creation_user in acs_objects.creation_user%TYPE, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ); --- --- function copy2 ( --- --/** Copies the item to a new location, creating an identical item with --- -- an identical latest revision (if any). If the target folder does --- -- not exist, or if the folder already contains an item with the same name --- -- as the given item, an error will be thrown. --- -- @author Karl Goldstein, Michael Pih --- -- @param item_id The item to be copied --- -- @param target_folder_id The folder where the item is to be copied --- -- @param creation_user The user_id of the creator --- -- @param creation_ip The IP address of the creator --- -- @return The item ID of the new copy. --- -- @see {content_item.new}, {content_folder.new}, {content_item.move} --- --*/ --- item_id in cr_items.item_id%TYPE, --- target_folder_id in cr_folders.folder_id%TYPE, --- creation_user in acs_objects.creation_user%TYPE, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_items.item_id%TYPE; --- --- -- get the latest revision for an item --- function get_latest_revision ( --- --/** Retrieves the id of the latest revision for the item (as opposed to the live --- -- revision) --- -- @author Karl Goldstein --- -- @param item_id The item for which the latest revision is to be retrieved --- -- @return The id of the latest revision for this item, or null if no revisions --- -- exist --- -- @see {content_item.get_live_revision} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return cr_revisions.revision_id%TYPE; --- --- --- function get_best_revision ( --- --/** Retrieves the id of the live revision for the item if one exists, --- -- otherwise retrieves the id of the latest revision if one exists. --- -- revision) --- -- @author Michael Pih --- -- @param item_id The item for which the revision is to be retrieved --- -- @return The id of the live or latest revision for this item, --- -- or null if no revisions exist --- -- @see {content_item.get_live_revision}, {content_item.get_latest_revision} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return cr_revisions.revision_id%TYPE; --- --- function get_title ( --- --/** Retrieves the title for the item, using either the latest or the live revision. --- -- If the specified item is in fact a folder, return the folder's label. --- -- In addition, this function will automatically resolve symlinks. --- -- @author Karl Goldstein --- -- @param item_id The item for which the title is to be retrieved --- -- @param is_live If 't', use the live revision to get the title. Otherwise, --- -- use the latest revision. The default is 'f' --- -- @return The title of the item --- -- @see {content_item.get_live_revision}, {content_item.get_latest_revision}, --- -- {content_symlink.resolve} --- --*/ --- item_id in cr_items.item_id%TYPE, --- is_live in char default 'f' --- ) return cr_revisions.title%TYPE; --- --- function get_publish_date ( --- --/** Retrieves the publish date for the item --- -- @author Karl Goldstein --- -- @param item_id The item for which the publish date is to be retrieved --- -- @param is_live If 't', use the live revision for the item. Otherwise, use --- -- the latest revision. The default is 'f' --- -- @return The publish date for the item, or null if the item has no revisions --- -- @see {content_item.get_live_revision}, {content_item.get_latest_revision}, --- --*/ --- item_id in cr_items.item_id%TYPE, --- is_live in char default 'f' --- ) return cr_revisions.publish_date%TYPE; --- --- function is_subclass ( --- --/** Determines if one type is a subclass of another. A class is always a subclass of --- -- itself. --- -- @author Karl Goldstein --- -- @param object_type The child class --- -- @param supertype The superclass --- -- @return 't' if the child class is a subclass of the superclass, 'f' otherwise --- -- @see {acs_object_type.create_type} --- --*/ --- object_type in acs_object_types.object_type%TYPE, --- supertype in acs_object_types.supertype%TYPE --- ) return char; --- --- function relate ( --- --/** Relates two content items --- -- @author Karl Goldstein --- -- @param item_id The item id --- -- @param object_id The item id of the related object --- -- @param relation_tag A tag to help identify the relation type, --- -- defaults to 'generic' --- -- @param order_n The order of this object among other objects --- -- of the same relation type, defaults to null. --- -- @param relation_type The object type of the relation, defaults to --- -- 'cr_item_rel' --- --*/ --- item_id in cr_items.item_id%TYPE, --- object_id in acs_objects.object_id%TYPE, --- relation_tag in cr_type_relations.relation_tag%TYPE default 'generic', --- order_n in cr_item_rels.order_n%TYPE default null, --- relation_type in acs_object_types.object_type%TYPE default 'cr_item_rel' --- ) return cr_item_rels.rel_id%TYPE; --- --- --- procedure unrelate ( --- --/** Delete the item relationship between two items --- -- @author Michael Pih --- -- @param rel_id The relationship id --- -- @see {content_item.relate} --- --*/ --- rel_id in cr_item_rels.rel_id%TYPE --- ); --- --- function is_index_page ( --- --/** Determine if the item is an index page for the specified folder. --- -- The item is an index page for the folder if it exists in the --- -- folder and its item name is "index". --- -- @author Karl Goldstein --- -- @param item_id The item id --- -- @param folder_id The folder id --- -- @return 't' if the item is an index page for the specified --- -- folder, 'f' otherwise --- -- @see {content_folder.get_index_page} --- --*/ --- item_id in cr_items.item_id%TYPE, --- folder_id in cr_folders.folder_id%TYPE --- ) return varchar2; --- --- --- function get_parent_folder ( --- --/** Get the parent folder. --- -- @author Michael Pih --- -- @param item_id The item id --- -- @return the folder_id of the parent folder, null otherwise --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return cr_folders.folder_id%TYPE; --- --- end content_item; - --- show errors - - --- create or replace package content_revision --- as --- --- function new ( --- --/** Create a new revision for an item. --- -- @author Karl Goldstein --- -- @param title The revised title for the item --- -- @param description A short description of this revision, 4000 characters maximum --- -- @param publish_date Publication date. --- -- @param mime_type The revised mime type of the item, defaults to 'text/plain' --- -- @param nls_language The revised language of the item, for use with Intermedia searching --- -- @param data The blob which contains the body of the revision --- -- @param item_id The id of the item being revised --- -- @param revision_id The id of the new revision. A new id will be allocated by default --- -- @param creation_date As in acs_object.new --- -- @param creation_ip As in acs_object.new --- -- @param creation_user As in acs_object.new --- -- @return The id of the newly created revision --- -- @see {acs_object.new}, {content_item.new} --- --*/ --- title in cr_revisions.title%TYPE, --- description in cr_revisions.description%TYPE default null, --- publish_date in cr_revisions.publish_date%TYPE default sysdate, --- mime_type in cr_revisions.mime_type%TYPE default 'text/plain', --- nls_language in cr_revisions.nls_language%TYPE default null, --- data in cr_revisions.content%TYPE, --- item_id in cr_items.item_id%TYPE, --- revision_id in cr_revisions.revision_id%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE --- default sysdate, --- creation_user in acs_objects.creation_user%TYPE --- default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_revisions.revision_id%TYPE; --- --- function new ( --- title in cr_revisions.title%TYPE, --- description in cr_revisions.description%TYPE default null, --- publish_date in cr_revisions.publish_date%TYPE default sysdate, --- mime_type in cr_revisions.mime_type%TYPE default 'text/plain', --- nls_language in cr_revisions.nls_language%TYPE default null, --- text in varchar2 default '', --- item_id in cr_items.item_id%TYPE, --- revision_id in cr_revisions.revision_id%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE default sysdate, --- creation_user in acs_objects.creation_user%TYPE default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_revisions.revision_id%TYPE; --- --- function copy ( --- --/** Creates a new copy of a revision, including all attributes and content --- -- and content, returning the ID of the new revision --- -- @author Karl Goldstein, Michael Pih --- -- @param revision_id The id of the revision to copy --- -- @param copy_id The id of the new copy (default null) --- -- @param target_item_id The id of the item which will own the copied revision. If null, the item that holds the original revision will own the copied revision. Defaults to null. --- -- @param creation_user The id of the creation user --- -- @param creation_ip The IP address of the creation user (default null) --- -- @return The id of the new revision --- -- @see {content_revision.new} --- --*/ --- revision_id in cr_revisions.revision_id%TYPE, --- copy_id in cr_revisions.revision_id%TYPE default null, --- target_item_id in cr_items.item_id%TYPE default null, --- creation_user in acs_objects.creation_user%TYPE default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_revisions.revision_id%TYPE; --- --- procedure delete ( --- --/** Deletes the revision. --- -- @author Karl Goldstein --- -- @param revision_id The id of the revision to delete --- -- @see {content_revision.new}, {acs_object.delete} --- --*/ --- revision_id in cr_revisions.revision_id%TYPE --- ); --- --- function get_number ( --- --/** Return the revision number of the specified revision, according to --- -- the chronological --- -- order in which revisions have been added for this item. --- -- @author Karl Goldstein --- -- @param revision_id The id the revision --- -- @return The number of the revision --- -- @see {content_revision.new} --- --*/ --- revision_id in cr_revisions.revision_id%TYPE --- ) return number; --- --- procedure index_attributes( --- --/** Generates an XML document for insertion into cr_revision_attributes, --- -- which is indexed by Intermedia for searching attributes. --- -- @author Karl Goldstein --- -- @param revision_id The id of the revision to index --- -- @see {content_revision.new} --- --*/ --- revision_id IN cr_revisions.revision_id%TYPE --- ); --- --- function export_xml ( --- revision_id IN cr_revisions.revision_id%TYPE --- ) return cr_xml_docs.doc_id%TYPE; --- --- function write_xml ( --- revision_id IN number, --- clob_loc IN clob --- ) return number as language --- java --- name --- 'com.arsdigita.content.XMLExchange.exportRevision( --- java.lang.Integer, oracle.sql.CLOB --- ) return int'; --- --- function import_xml ( --- item_id IN cr_items.item_id%TYPE, --- revision_id IN cr_revisions.revision_id%TYPE, --- doc_id IN number --- ) return cr_revisions.revision_id%TYPE; --- --- function read_xml ( --- item_id IN number, --- revision_id IN number, --- clob_loc IN clob --- ) return number as language --- java --- name --- 'com.arsdigita.content.XMLExchange.importRevision( --- java.lang.Integer, java.lang.Integer, oracle.sql.CLOB --- ) return int'; --- --- procedure to_html ( --- --/** Converts a revision uploaded as a binary document to html --- -- @author Karl Goldstein --- -- @param revision_id The id of the revision to index --- --*/ --- revision_id IN cr_revisions.revision_id%TYPE --- ); --- --- procedure replace( --- revision_id number, search varchar2, replace varchar2) --- as language --- java --- name --- 'com.arsdigita.content.Regexp.replace( --- int, java.lang.String, java.lang.String --- )'; --- --- function is_live ( --- -- /** Determine if the revision is live --- -- @author Karl Goldstein, Stanislav Freidin --- -- @param revision_id The id of the revision to check --- -- @return 't' if the revision is live, 'f' otherwise --- -- @see {content_revision.is_latest} --- --*/ --- revision_id in cr_revisions.revision_id%TYPE --- ) return varchar2; --- --- function is_latest ( --- -- /** Determine if the revision is the latest revision --- -- @author Karl Goldstein, Stanislav Freidin --- -- @param revision_id The id of the revision to check --- -- @return 't' if the revision is the latest revision for its item, 'f' otherwise --- -- @see {content_revision.is_live} --- --*/ --- revision_id in cr_revisions.revision_id%TYPE --- ) return varchar2; --- --- procedure to_temporary_clob ( --- revision_id in cr_revisions.revision_id%TYPE --- ); --- --- procedure content_copy ( --- -- /** Copies the content of the specified revision to the content --- -- of another revision --- -- @author Michael Pih --- -- @param revision_id The id of the revision with the content to be copied --- -- @param revision_id The id of the revision to be updated, defaults to the --- -- latest revision of the item with which the source revision is --- -- associated. --- --*/ --- revision_id in cr_revisions.revision_id%TYPE, --- revision_id_dest in cr_revisions.revision_id%TYPE default null --- ); --- --- end content_revision; - --- show errors - --- create or replace package content_symlink --- as --- --- function new ( --- --/** Create a new symlink, linking two items --- -- @author Karl Goldstein --- -- @param name The name for the new symlink, defaults to the name of the --- -- target item --- -- @param label The label of the symlink, defaults to 'Symlinke to ' --- -- @param target_id The item which the symlink will point to --- -- @param parent_id The parent folder for the symlink. This must actually be a folder --- -- and not a generic content item. --- -- @param symlink_id The id of the new symlink. A new id will be allocated by default --- -- @param creation_date As in acs_object.new --- -- @param creation_ip As in acs_object.new --- -- @param creation_user As in acs_object.new --- -- @return The id of the newly created symlink --- -- @see {acs_object.new}, {content_item.new}, {content_symlink.resolve} --- --*/ --- name in cr_items.name%TYPE default null, --- label in cr_symlinks.label%TYPE default null, --- target_id in cr_items.item_id%TYPE, --- parent_id in cr_items.parent_id%TYPE, --- symlink_id in cr_symlinks.symlink_id%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE --- default sysdate, --- creation_user in acs_objects.creation_user%TYPE --- default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_symlinks.symlink_id%TYPE; --- --- --- procedure delete ( --- --/** Deletes the symlink --- -- @author Karl Goldstein --- -- @param symlink_id The id of the symlink to delete --- -- @see {content_symlink.new}, {acs_object.delete} --- --*/ --- symlink_id in cr_symlinks.symlink_id%TYPE --- ); --- --- --- procedure copy ( --- --/** Copies the symlink itself to another folder, without resolving the symlink --- -- @author Karl Goldstein --- -- @param symlink_id The id of the symlink to copy --- -- @param target_folder_id The id of the folder where the symlink is to be copied --- -- @param creation_user The id of the creation user --- -- @param creation_ip The IP address of the creation user (defualt null) --- -- @see {content_symlink.new}, {content_item.copy} --- --*/ --- symlink_id in cr_symlinks.symlink_id%TYPE, --- target_folder_id in cr_folders.folder_id%TYPE, --- creation_user in acs_objects.creation_user%TYPE, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ); --- --- function is_symlink ( --- --/** Determines if the item is a symlink --- -- @author Karl Goldstein --- -- @param item_id The item id --- -- @return 't' if the item is a symlink, 'f' otherwise --- -- @see {content_symlink.new}, {content_symlink.resolve} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return char; --- --- --- function resolve ( --- --/** Resolves the symlink and returns the target item id. --- -- @author Karl Goldstein --- -- @param item_id The item id to be resolved --- -- @return The target item of the symlink, or the original item id if --- -- the item is not in fact a symlink --- -- @see {content_symlink.new}, {content_symlink.is_symlink} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return cr_items.item_id%TYPE; --- --- --- function resolve_content_type ( --- --/** Gets the content type of the target item. --- -- @author Michael Pih --- -- @param item_id The item id to be resolved --- -- @return The content type of the symlink target, otherwise null. --- -- the item is not in fact a symlink --- -- @see {content_symlink.resolve} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return cr_items.content_type%TYPE; --- --- --- end content_symlink; - --- show errors - --- create or replace package content_extlink --- as --- --- function new ( --- --/** Create a new extlink, an item pointing to an off-site resource --- -- @author Karl Goldstein --- -- @param name The name for the new extlink, defaults to the name of the --- -- target item --- -- @param url The URL of the item --- -- @param label The text label or title of the item --- -- @param description A brief description of the item --- -- @param parent_id The parent folder for the extlink. This must actually be a folder --- -- and not a generic content item. --- -- @param extlink_id The id of the new extlink. A new id will be allocated by default --- -- @param creation_date As in acs_object.new --- -- @param creation_ip As in acs_object.new --- -- @param creation_user As in acs_object.new --- -- @return The id of the newly created extlink --- -- @see {acs_object.new}, {content_item.new}, {content_extlink.resolve} --- --*/ --- name in cr_items.name%TYPE default null, --- url in cr_extlinks.url%TYPE, --- label in cr_extlinks.label%TYPE default null, --- description in cr_extlinks.description%TYPE default null, --- parent_id in cr_items.parent_id%TYPE, --- extlink_id in cr_extlinks.extlink_id%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE --- default sysdate, --- creation_user in acs_objects.creation_user%TYPE --- default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_extlinks.extlink_id%TYPE; --- --- --- procedure delete ( --- --/** Deletes the extlink --- -- @author Karl Goldstein --- -- @param extlink_id The id of the extlink to delete --- -- @see {content_extlink.new}, {acs_object.delete} --- --*/ --- extlink_id in cr_extlinks.extlink_id%TYPE --- ); --- --- --- function is_extlink ( --- --/** Determines if the item is a extlink --- -- @author Karl Goldstein --- -- @param item_id The item id --- -- @return 't' if the item is a extlink, 'f' otherwise --- -- @see {content_extlink.new}, {content_extlink.resolve} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return char; --- --- --- end content_extlink; - --- show errors - --- create or replace package content_folder --- as --- --- function new ( --- --/** Create a new folder --- -- @author Karl Goldstein --- -- @param label The label for the folder --- -- @param description A short description of the folder, 4000 characters maximum --- -- @param parent_id The parent of the folder --- -- @param folder_id The id of the new folder. A new id will be allocated by default --- -- @param context_id The context id. The parent id will be used as the default context --- -- @param creation_date As in acs_object.new --- -- @param creation_ip As in acs_object.new --- -- @param creation_user As in acs_object.new --- -- @return The id of the newly created folder --- -- @see {acs_object.new}, {content_item.new} --- --*/ --- name in cr_items.name%TYPE, --- label in cr_folders.label%TYPE, --- description in cr_folders.description%TYPE default null, --- parent_id in cr_items.parent_id%TYPE default null, --- context_id in acs_objects.context_id%TYPE default null, --- folder_id in cr_folders.folder_id%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE default sysdate, --- creation_user in acs_objects.creation_user%TYPE default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_folders.folder_id%TYPE; --- --- procedure delete ( --- --/** Delete a folder. An error is thrown if the folder is not empty --- -- @author Karl Goldstein --- -- @param folder_id The id of the folder to delete --- -- @see {acs_object.delete}, {content_item.delete} --- --*/ --- folder_id in cr_folders.folder_id%TYPE --- ); --- --- procedure rename ( --- --/** Change the name, label and/or description of the folder --- -- @author Karl Goldstein --- -- @param folder_id The id of the folder to modify --- -- @param name The new name for the folder. An error will be thrown if --- -- an item with this name already exists under this folder's --- -- parent. If this parameter is null, the old name will be preserved --- -- @param label The new label for the folder. The old label will be preserved if --- -- this parameter is null --- -- @param label The new description for the folder. The old description --- -- will be preserved if this parameter is null --- -- @see {content_folder.new} --- --*/ --- folder_id in cr_folders.folder_id%TYPE, --- name in cr_items.name%TYPE default null, --- label in cr_folders.label%TYPE default null, --- description in cr_folders.description%TYPE default null --- ); --- --- procedure move ( --- --/** Recursively move the folder and all items in into a new location. --- -- An error is thrown if either of the parameters is not a folder. --- -- The root folder of the sitemap and the root folder of the --- -- templates cannot be moved. --- -- @author Karl Goldstein --- -- @param folder_id The id of the folder to move --- -- @param target_folder_id The destination folder --- -- @see {content_folder.new}, {content_folder.copy} --- --*/ --- folder_id in cr_folders.folder_id%TYPE, --- target_folder_id in cr_folders.folder_id%TYPE --- ); --- --- procedure copy ( --- --/** Recursively copy the folder and all items in into a new location. --- -- An error is thrown if either of the parameters is not a folder. --- -- The root folder of the sitemap and the root folder of the --- -- templates cannot be copied --- -- @author Karl Goldstein --- -- @param folder_id The id of the folder to copy --- -- @param target_folder_id The destination folder --- -- @param creation_user The id of the creation user --- -- @param creation_ip The IP address of the creation user (defaults to null) --- -- @see {content_folder.new}, {content_folder.copy} --- --*/ --- folder_id in cr_folders.folder_id%TYPE, --- target_folder_id in cr_folders.folder_id%TYPE, --- creation_user in acs_objects.creation_user%TYPE, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ); --- --- function is_folder ( --- --/** Determine if the item is a folder --- -- @author Karl Goldstein --- -- @param item_id The item id --- -- @return 't' if the item is a folder, 'f' otherwise --- -- @see {content_folder.new}, {content_folder.is_sub_folder} --- --*/ --- item_id in cr_items.item_id%TYPE --- ) return char; --- --- function is_sub_folder ( --- --/** Determine if the item target_folder_id is a subfolder of --- -- the item folder_id --- -- @author Karl Goldstein --- -- @param folder_id The superfolder id --- -- @param target_folder_id The subfolder id --- -- @return 't' if the item target_folder_id is a subfolder of --- -- the item folder_id, 'f' otherwise --- -- @see {content_folder.is_folder} --- --*/ --- folder_id in cr_folders.folder_id%TYPE, --- target_folder_id in cr_folders.folder_id%TYPE --- ) return char; --- --- function is_empty ( --- --/** Determine if the folder is empty --- -- @author Karl Goldstein --- -- @param folder_id The folder id --- -- @return 't' if the folder contains no subfolders or items, 'f' otherwise --- -- @see {content_folder.is_folder} --- --*/ --- folder_id in cr_folders.folder_id%TYPE --- ) return varchar2; --- --- function is_root ( --- --/** Determine whether the folder is a root (has a parent_id of 0) --- -- @author Karl Goldstein --- -- @param folder_id The folder ID --- -- @return 't' if the folder is a root or 'f' otherwise --- --*/ --- folder_id in cr_folders.folder_id%TYPE --- ) return char; --- --- procedure register_content_type ( --- --/** Register a content type to the folder, if it is not already registered. --- -- Only items of the registered type(s) may be added to the folder. --- -- @author Karl Goldstein --- -- @param folder_id The folder id --- -- @param content_type The content type to be registered --- -- @see {content_folder.unregister_content_type}, --- -- {content_folder.is_registered} --- --*/ --- folder_id in cr_folders.folder_id%TYPE, --- content_type in cr_folder_type_map.content_type%TYPE, --- include_subtypes in varchar2 default 'f' --- ); --- --- procedure unregister_content_type ( --- --/** Unregister a content type from the folder, if it has been registered. --- -- Only items of the registered type(s) may be added to the folder. --- -- If the folder already contains items of the type to be unregistered, the --- -- items remain in the folder. --- -- @author Karl Goldstein --- -- @param folder_id The folder id --- -- @param content_type The content type to be unregistered --- -- @param include_subtypes If 't', all subtypes of content_type will be --- -- unregistered as well --- -- @see {content_folder.register_content_type}, {content_folder.is_registered} --- --*/ --- folder_id in cr_folders.folder_id%TYPE, --- content_type in cr_folder_type_map.content_type%TYPE, --- include_subtypes in varchar2 default 'f' --- ); --- --- -- change this to is_type_registered --- function is_registered ( --- --/** Determines if a content type is registered to the folder --- -- Only items of the registered type(s) may be added to the folder. --- -- @author Karl Goldstein --- -- @param folder_id The folder id --- -- @param content_type The content type to be checked --- -- @param include_subtypes If 't', all subtypes of the content_type --- -- will be checked, returning 't' if all of them are registered. If 'f', --- -- only an exact match with content_type will be --- -- performed. --- -- @return 't' if the type is registered to this folder, 'f' otherwise --- -- @see {content_folder.register_content_type}, {content_folder.unregister_content_type}, --- --*/ --- folder_id in cr_folders.folder_id%TYPE, --- content_type in cr_folder_type_map.content_type%TYPE, --- include_subtypes in varchar2 default 'f' --- ) return varchar2; --- --- --- function get_label ( --- --/** Returns the label for the folder. This function is the default name method --- -- for the folder object. --- -- @author Karl Goldstein --- -- @param folder_id The folder id --- -- @return The folder's label --- -- @see {acs_object_type.create_type}, the docs for the name_method parameter --- --*/ --- folder_id in cr_folders.folder_id%TYPE --- ) return cr_folders.label%TYPE; --- --- --- function get_index_page ( --- --/** Returns the item ID of the index page of the folder, null otherwise --- -- @author Michael Pih --- -- @param folder_id The folder id --- -- @return The item ID of the index page --- --*/ --- folder_id in cr_folders.folder_id%TYPE --- ) return cr_items.item_id%TYPE; --- --- --- --- end content_folder; - --- show errors - - - --- create or replace package content_template --- as --- --- c_root_folder_id constant integer := -200; --- --- function get_root_folder return cr_folders.folder_id%TYPE; --- --- function new ( --- --/** Creates a new content template which can be used to render content items. --- -- @author Karl Goldstein --- -- @param name The name for the template, must be a valid UNIX-like filename. --- -- If a template with this name already exists under the specified --- -- parent item, an error is thrown --- -- @param parent_id The parent of this item, defaults to null --- -- @param template_id The id of the new template. A new id will be allocated if this --- -- parameter is null --- -- @param creation_date As in acs_object.new --- -- @param creation_ip As in acs_object.new --- -- @param creation_user As in acs_object.new --- -- @return The id of the newly created template --- -- @see {acs_object.new}, {content_item.new}, {content_item.register_template}, --- -- {content_type.register_template} --- --*/ --- name in cr_items.name%TYPE, --- parent_id in cr_items.parent_id%TYPE default null, --- template_id in cr_templates.template_id%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE --- default sysdate, --- creation_user in acs_objects.creation_user%TYPE --- default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return cr_templates.template_id%TYPE; --- --- procedure delete ( --- --/** Deletes the specified template, and unregisters the template from --- -- all content types and content items. --- -- Use with caution - this operation cannot be undone. --- -- @author Karl Goldstein --- -- @param template_id The id of the template to delete --- -- @see {acs_object.delete}, {content_item.unregister_template}, --- -- {content_type.unregister_template}, --- --*/ --- template_id in cr_templates.template_id%TYPE --- ); --- --- function is_template ( --- --/** Determine if an item is a template. --- -- @author Karl Goldstein --- -- @param item_id The item id --- -- @return 't' if the item is a template, 'f' otherwise --- -- @see {content_template.new} --- --*/ --- template_id in cr_templates.template_id%TYPE --- ) return varchar2; --- --- function get_path ( --- --/** Retrieves the full path to the template, as described in content_item.get_path --- -- @author Karl Goldstein --- -- @param template_id The id of the template for which the path is to --- -- be retrieved --- -- @param root_folder_id Starts path resolution at this folder --- -- @return The path to the template, starting with the specified root folder --- -- @see {content_item.get_path} --- --*/ --- template_id in cr_templates.template_id%TYPE, --- root_folder_id in cr_folders.folder_id%TYPE default c_root_folder_id --- ) return varchar2; --- --- end content_template; - --- show errors - --- create or replace package content_keyword --- as --- --- function new ( --- --/** Creates a new keyword (also known as "subject category"). --- -- @author Karl Goldstein --- -- @param heading The heading for the new keyword --- -- @param description The description for the new keyword --- -- @param parent_id The parent of this keyword, defaults to null. --- -- @param keyword_id The id of the new keyword. A new id will be allocated if this --- -- parameter is null --- -- @param object_type The type for the new keyword, defaults to 'content_keyword'. --- -- This parameter may be used by subclasses of --- -- content_keyword to initialize the superclass. --- -- @param creation_date As in acs_object.new --- -- @param creation_ip As in acs_object.new --- -- @param creation_user As in acs_object.new --- -- @return The id of the newly created keyword --- -- @see {acs_object.new}, {content_item.new}, {content_keyword.item_assign}, --- -- {content_keyword.delete} --- --*/ --- heading in cr_keywords.heading%TYPE, --- description in cr_keywords.description%TYPE default null, --- parent_id in cr_keywords.parent_id%TYPE default null, --- keyword_id in cr_keywords.keyword_id%TYPE default null, --- creation_date in acs_objects.creation_date%TYPE --- default sysdate, --- creation_user in acs_objects.creation_user%TYPE --- default null, --- creation_ip in acs_objects.creation_ip%TYPE default null, --- object_type in acs_object_types.object_type%TYPE default 'content_keyword' --- ) return cr_keywords.keyword_id%TYPE; --- --- procedure delete ( --- --/** Deletes the specified keyword, which must be a leaf. Unassigns the --- -- keyword from all content items. Use with caution - this --- -- operation cannot be undone. --- -- @author Karl Goldstein --- -- @param keyword_id The id of the keyword to be deleted --- -- @see {acs_object.delete}, {content_keyword.item_unassign} --- --*/ --- keyword_id in cr_keywords.keyword_id%TYPE --- ); --- --- function get_heading ( --- --/** Retrieves the heading of the content keyword --- -- @author Karl Goldstein --- -- @param keyword_id The keyword id --- -- @return The heading for the specified keyword --- -- @see {content_keyword.set_heading}, {content_keyword.get_description} --- --*/ --- keyword_id in cr_keywords.keyword_id%TYPE --- ) return varchar2; --- --- function get_description ( --- --/** Retrieves the description of the content keyword --- -- @author Karl Goldstein --- -- @param keyword_id The keyword id --- -- @return The description for the specified keyword --- -- @see {content_keyword.get_heading}, {content_keyword.set_description} --- --*/ --- keyword_id in cr_keywords.keyword_id%TYPE --- ) return varchar2; --- --- procedure set_heading ( --- --/** Sets a new heading for the keyword --- -- @author Karl Goldstein --- -- @param keyword_id The keyword id --- -- @param heading The new heading --- -- @see {content_keyword.get_heading}, {content_keyword.set_description} --- --*/ --- keyword_id in cr_keywords.keyword_id%TYPE, --- heading in cr_keywords.heading%TYPE --- ); --- --- procedure set_description ( --- --/** Sets a new description for the keyword --- -- @author Karl Goldstein --- -- @param keyword_id The keyword id --- -- @param description The new description --- -- @see {content_keyword.set_heading}, {content_keyword.get_description} --- --*/ --- keyword_id in cr_keywords.keyword_id%TYPE, --- description in cr_keywords.description%TYPE --- ); --- --- function is_leaf ( --- --/** Determines if the keyword has no sub-keywords associated with it --- -- @author Karl Goldstein --- -- @param keyword_id The keyword id --- -- @return 't' if the keyword has no descendants, 'f' otherwise --- -- @see {content_keyword.new} --- --*/ --- keyword_id in cr_keywords.keyword_id%TYPE --- ) return varchar2; --- --- procedure item_assign ( --- --/** Assigns this keyword to a content item, creating a relationship between them --- -- @author Karl Goldstein --- -- @param item_id The item to be assigned to --- -- @param keyword_id The keyword to be assigned --- -- @param context_id As in acs_rel.new, deprecated --- -- @param creation_ip As in acs_rel.new, deprecated --- -- @param creation_user As in acs_rel.new, deprecated --- -- @see {acs_rel.new}, {content_keyword.item_unassign} --- --*/ --- item_id in cr_items.item_id%TYPE, --- keyword_id in cr_keywords.keyword_id%TYPE, --- context_id in acs_objects.context_id%TYPE default null, --- creation_user in acs_objects.creation_user%TYPE default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ); --- --- procedure item_unassign ( --- --/** Unassigns this keyword to a content item, removing a relationship between them --- -- @author Karl Goldstein --- -- @param item_id The item to be unassigned from --- -- @param keyword_id The keyword to be unassigned --- -- @see {acs_rel.delete}, {content_keyword.item_assign} --- --*/ --- item_id in cr_items.item_id%TYPE, --- keyword_id in cr_keywords.keyword_id%TYPE --- ); --- --- function is_assigned ( --- --/** Determines if the keyword is assigned to the item --- -- @author Karl Goldstein --- -- @param item_id The item id --- -- @param keyword_id The keyword id to be checked for assignment --- -- @param recurse Specifies if the keyword search is --- -- recursive. May be set to one of the following --- -- values:
      --- --
    • none: Not recursive. Look for an exact match.
    • --- --
    • up: Recursive from specific to general. A search for --- -- "attack dogs" will also match "dogs", "animals", "mammals", etc.
    • --- --
    • down: Recursive from general to specific. A search for --- -- "mammals" will also match "dogs", "attack dogs", "cats", "siamese cats", --- -- etc.
    --- -- @return 't' if the keyword may be matched to an item, 'f' otherwise --- -- @see {content_keyword.item_assign} --- --*/ --- item_id in cr_items.item_id%TYPE, --- keyword_id in cr_keywords.keyword_id%TYPE, --- recurse in varchar2 default 'none' --- ) return varchar2; --- --- function get_path ( --- --/** Retreives a path to the keyword/subject category, with the most general --- -- category at the root of the path --- -- @author Karl Goldstein --- -- @param keyword_id The keyword id --- -- @return The path to the keyword, or null if no such keyword exists --- -- @see {content_keyword.new} --- --*/ --- keyword_id in cr_keywords.keyword_id%TYPE --- ) return varchar2; --- --- end content_keyword; - --- show errors - - - - --- create or replace package content_permission --- is --- --- procedure inherit_permissions ( --- --/** Make the child object inherit all of the permissions of the parent --- -- object. Typically, this function is called whenever a new object --- -- is created under a given parent --- -- @author Karl Goldstein --- -- @param parent_object_id The parent object id --- -- @param child_object_id The child object id --- -- @see {content_permission.grant}, {acs_permission.grant_permission} --- --*/ --- parent_object_id in acs_objects.object_id%TYPE, --- child_object_id in acs_objects.object_id%TYPE, --- child_creator_id in parties.party_id%TYPE default null --- ); --- --- function has_grant_authority ( --- --/** Determine if the user may grant a certain permission to another --- -- user. The permission may only be granted if the user has --- -- the permission himself and posesses the cm_perm access, or if the --- -- user posesses the cm_perm_admin access. --- -- @author Karl Goldstein --- -- @param object_id The object whose permissions are to be changed --- -- @param holder_id The person who is attempting to grant the permissions --- -- @param privilege The privilege to be granted --- -- @return 't' if the donation is possible, 'f' otherwise --- -- @see {content_permission.grant_permission}, {content_permission.is_has_revoke_authority}, --- -- {acs_permission.grant_permission} --- --*/ --- object_id in acs_objects.object_id%TYPE, --- holder_id in parties.party_id%TYPE, --- privilege in acs_privileges.privilege%TYPE --- ) return varchar2; --- --- procedure grant_permission_h ( --- --/** This is a helper function for content_permission.grant_permission and --- -- should not be called individually.

    --- -- Grants a permission and revokes all descendants of the permission, since --- -- they are no longer relevant. --- -- @author Karl Goldstein --- -- @param object_id The object whose permissions are to be changed --- -- @param grantee_id The person who should gain the parent privilege --- -- @param privilege The parent privilege to be granted --- -- @see {content_permission.grant_permission} --- --*/ --- object_id in acs_objects.object_id%TYPE, --- grantee_id in parties.party_id%TYPE, --- privilege in acs_privileges.privilege%TYPE --- ); --- --- procedure grant_permission ( --- --/** Grant the specified privilege to another user. If the donation is --- -- not possible, the procedure does nothing. --- -- @author Karl Goldstein --- -- @param object_id The object whose permissions are to be changed --- -- @param holder_id The person who is attempting to grant the permissions --- -- @param privilege The privilege to be granted --- -- @param recepient_id The person who will gain the privilege --- -- @param is_recursive If 't', applies the donation recursively to --- -- all child objects of the object (equivalent to UNIX's chmod -r). --- -- If 'f', only affects the objects itself. --- -- @see {content_permission.has_grant_authority}, {content_permission.revoke_permission}, --- -- {acs_permission.grant_permission} --- --*/ --- object_id in acs_objects.object_id%TYPE, --- holder_id in parties.party_id%TYPE, --- privilege in acs_privileges.privilege%TYPE, --- recepient_id in parties.party_id%TYPE, --- is_recursive in varchar2 default 'f', --- object_type in acs_objects.object_type%TYPE default 'content_item' --- ); --- --- function has_revoke_authority ( --- --/** Determine if the user may take a certain permission away from another --- -- user. The permission may only be revoked if the user has --- -- the permission himself and posesses the cm_perm access, while the --- -- other user does not, or if the user posesses the cm_perm_admin access. --- -- @author Karl Goldstein --- -- @param object_id The object whose permissions are to be changed --- -- @param holder_id The person who is attempting to revoke the permissions --- -- @param privilege The privilege to be revoked --- -- @param revokee_id The user from whom the privilege is to be taken away --- -- @return 't' if it is possible to revoke the privilege, 'f' otherwise --- -- @see {content_permission.has_grant_authority}, {content_permission.revoke_permission}, --- -- {acs_permission.revoke_permission} --- --*/ --- object_id in acs_objects.object_id%TYPE, --- holder_id in parties.party_id%TYPE, --- privilege in acs_privileges.privilege%TYPE, --- revokee_id in parties.party_id%TYPE --- ) return varchar2; --- --- procedure revoke_permission_h ( --- --/** This is a helper function for content_permission.revoke_permission and --- -- should not be called individually.

    --- -- Revokes a permission but grants all child permissions to the holder, to --- -- ensure that the permission is not permanently lost --- -- @author Karl Goldstein --- -- @param object_id The object whose permissions are to be changed --- -- @param revokee_id The person who should lose the parent permission --- -- @param privilege The parent privilege to be revoked --- -- @see {content_permission.revoke_permission} --- --*/ --- object_id in acs_objects.object_id%TYPE, --- revokee_id in parties.party_id%TYPE, --- privilege in acs_privileges.privilege%TYPE --- ); --- --- procedure revoke_permission ( --- --/** Take the specified privilege away from another user. If the operation is --- -- not possible, the procedure does nothing. --- -- @author Karl Goldstein --- -- @param object_id The object whose permissions are to be changed --- -- @param holder_id The person who is attempting to revoke the permissions --- -- @param privilege The privilege to be revoked --- -- @param recepient_id The person who will lose the privilege --- -- @param is_recursive If 't', applies the operation recursively to --- -- all child objects of the object (equivalent to UNIX's chmod -r). --- -- If 'f', only affects the objects itself. --- -- @see {content_permission.grant_permission}, {content_permission.has_revoke_authority}, --- -- {acs_permission.revoke_permission} --- --*/ --- object_id in acs_objects.object_id%TYPE, --- holder_id in parties.party_id%TYPE, --- privilege in acs_privileges.privilege%TYPE, --- revokee_id in parties.party_id%TYPE, --- is_recursive in varchar2 default 'f', --- object_type in acs_objects.object_type%TYPE default 'content_item' --- ); --- --- function permission_p ( --- --/** Determine if the user has the specified permission on the specified --- -- object. Does NOT check objects recursively: that is, if the user has --- -- the permission on the parent object, he does not automatically gain --- -- the permission on all the child objects. --- -- @author Karl Goldstein --- -- @param object_id The object whose permissions are to be checked --- -- @param holder_id The person whose permissions are to be examined --- -- @param privilege The privilege to be checked --- -- @return 't' if the user has the specified permission on the object, --- -- 'f' otherwise --- -- @see {content_permission.grant_permission}, {content_permission.revoke_permission}, --- -- {acs_permission.permission_p} --- --*/ --- object_id in acs_objects.object_id%TYPE, --- holder_id in parties.party_id%TYPE, --- privilege in acs_privileges.privilege%TYPE --- ) return varchar2; --- --- function cm_admin_exists --- -- /** Determine if there exists a user who has administrative --- -- privileges on the entire content repository. --- -- @author Stanislav Freidin --- -- @return 't' if an administrator exists, 'f' otherwise --- -- @see {content_permission.grant_permission} --- return varchar2; --- --- end content_permission; - --- show errors - \i content-type.sql \i content-item.sql \i content-revision.sql Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.sql 17 May 2003 09:43:31 -0000 1.2 @@ -0,0 +1,12 @@ +-- Adds indexes for RI checking +-- +create index cr_cont_mimetypmap_mimetyp_idx ON cr_content_mime_type_map(mime_type); -- cr_mime_types.mime_type +create index cr_folder_typ_map_cont_typ_idx ON cr_folder_type_map(content_type); -- acs_object_types.object_type +create index cr_folders_package_id_idx ON cr_folders(package_id); -- apm_packages.package_id +create index cr_item_keyword_map_kw_id_idx ON cr_item_keyword_map(keyword_id); -- cr_keywords.keyword_id +create index cr_item_rels_rel_obj_id_idx ON cr_item_rels(related_object_id); -- acs_objects.object_id +create index cr_keywords_parent_id_idx ON cr_keywords(parent_id); -- cr_keywords.keyword_id +create index cr_revisions_lob_idx ON cr_revisions(lob); -- lobs.lob_id +create index cr_revisions_item_id_idx ON cr_revisions(item_id); -- cr_items.item_id +create index cr_type_children_chld_type_idx ON cr_type_children(child_type); -- acs_object_types.object_type +create index cr_type_relations_tgt_typ_idx ON cr_type_relations(target_type); -- acs_object_types.object_type Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.2-4.6.3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.2-4.6.3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.2-4.6.3.sql 17 May 2003 09:43:31 -0000 1.2 @@ -0,0 +1,483 @@ +-- This upgrade adds more mime types and +-- creates the cr_extension_mime_type_map +-- +-- Jeff Davis davis@xarg.net 2003-02-06 + +create table cr_extension_mime_type_map ( + extension varchar(200) + constraint cr_mime_type_extension_map_pk + primary key, + mime_type varchar(200) + constraint cr_mime_ext_map_mime_type_ref + references cr_mime_types +); +create index cr_extension_mime_type_map_idx on cr_extension_mime_type_map(mime_type); + +comment on table cr_extension_mime_type_map is ' + a mapping table for extension to mime_type in db version of ns_guesstype data +'; + +-- Quicky create some tmp tables. +create table tmp_cr_mime_types as select * from cr_mime_types where 0 = 1; +create table tmp_cr_extension_mime_type_map as select * from cr_extension_mime_type_map where 0 = 1; + +-- data from sql/common/mime-type-data.sql + +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Unkown' , '*/*' , '' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'AutoCAD drawing files' , 'application/acad' , 'dwg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Andrew data stream' , 'application/andrew-inset' , 'ez' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'ClarisCAD files' , 'application/clariscad' , 'ccad' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Comma separated value' , 'application/csv' , 'csv' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'MATRA Prelude drafting' , 'application/drafting' , 'drw' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'DXF (AutoCAD)' , 'application/dxf' , 'dxf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Filemaker Pro' , 'application/filemaker' , 'fm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Futuresplash' , 'application/futuresplash' , 'spl' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'NCSA HDF data format' , 'application/hdf' , 'hdf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'IGES graphics format' , 'application/iges' , 'iges' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Mac binhex 4.0' , 'application/mac-binhex40' , 'hqx' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Mac Compactpro' , 'application/mac-compactpro' , 'cpt' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Word' , 'application/msword' , 'doc' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Uninterpreted binary' , 'application/octet-stream' , 'bin' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'ODA ODIF' , 'application/oda' , 'oda' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'PDF' , 'application/pdf' , 'pdf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'PostScript' , 'application/postscript' , 'ps' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Rich Text Format' , 'application/rtf' , 'rtf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Stereolithography' , 'application/sla' , 'stl'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VCard' , 'application/vcard' , 'vcf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VDA-FS Surface data' , 'application/vda' , 'vda'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SSOYE Koan Files' , 'application/vnd.koan' , 'skp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'FrameMaker MIF format' , 'application/vnd.mif' , 'mif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Access file' , 'application/vnd.ms-access' , 'mdb' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Excel' , 'application/vnd.ms-excel' , 'xls' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft PowerPoint' , 'application/vnd.ms-powerpoint' , 'ppt' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft Project' , 'application/vnd.ms-project' , 'mpp' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WML XML in binary format', 'application/vnd.wap.wmlc' , 'wmlc'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WMLScript bytecode' , 'application/vnd.wap.wmlscriptc', 'wmlsc'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'CorelXARA' , 'application/vnd.xara' , 'xar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WordPerfect' , 'application/wordperfect' , 'wpd'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WordPerfect 6.0' , 'application/wordperfect6.0' , 'w60'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive ARJ ' , 'application/x-arj-compressed' , 'arj'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-bin' , 'aab' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-map' , 'aam' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Authorware' , 'application/x-authorware-seg' , 'aas' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Channel Definition' , 'application/x-cdf' , 'cdf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VCD' , 'application/x-cdlink' , 'vcd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Chess PGN file' , 'application/x-chess-pgn' , 'pgn'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive compres' , 'application/x-compress' , 'z'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive CPIO' , 'application/x-cpio' , 'cpio'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'C-shell script' , 'application/x-csh' , 'csh' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive Debian Package' , 'application/x-debian-package' , 'deb'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Director' , 'application/x-director' , 'dxr' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'TeX DVI file' , 'application/x-dvi' , 'dvi' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'GNU Tar' , 'application/x-gtar' , 'gtar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Compressed - gzip' , 'application/x-gzip' , 'gz' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'CGI Script' , 'application/x-httpd-cgi' , 'cgi'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Adobe Illustrator' , 'application/x-illustrator' , 'ai' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Installshield data' , 'application/x-installshield' , 'wis'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Java Network Launching Protocol', 'application/x-java-jnlp-file', 'jnlp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Javascript' , 'application/x-javascript' , 'js' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'LaTeX source' , 'application/x-latex' , 'latex' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmd)', 'application/x-ms-wmd' , 'wmd'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmz)', 'application/x-ms-wmz' , 'wmz'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Unidata netCDF' , 'application/x-netcdf' , 'cdf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Ogg Vorbis' , 'application/x-ogg' , 'ogg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Adobe PageMaker' , 'application/x-pagemaker' , 'p65' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Photoshop' , 'application/x-photoshop' , 'psd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Palm Pilot Data' , 'application/x-pilot' , 'prc' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Real' , 'application/x-pn-realmedia' , 'rp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Quattro Pro' , 'application/x-quattro-pro' , 'wq1'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive RAR' , 'application/x-rar-compressed' , 'rar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Session Description Protocol', 'application/sdp' , 'sdp' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Shockwave' , 'application/x-shockwave-flash' , 'swf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SQL' , 'application/x-sql' , 'sql' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Mac Stuffit compressed' , 'application/x-stuffit' , 'sit' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive SVR4 cpio' , 'application/x-sv4cpio' , 'sv4cpio'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive SVR4 crc' , 'application/x-sv4crc' , 'sv4crc'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Tar Archive' , 'application/x-tar' , 'tar' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'TeX source' , 'application/x-tex' , 'tex' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Texinfo (emacs)' , 'application/x-texinfo' , 'texinfo' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff' , 'application/x-troff' , 'tr' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff with MAN macros' , 'application/x-troff-man' , 'man' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff with ME macros' , 'application/x-troff-me' , 'me' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'troff with MS macros' , 'application/x-troff-ms' , 'ms' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive POSIX Tar' , 'application/x-ustar' , 'ustar'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X509 CA Cert' , 'application/x-x509-ca-cert' , 'cacert'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Archive Zip' , 'application/zip' , 'zip' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Basic audio (m-law PCM)' , 'audio/basic' , 'au' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Midi' , 'audio/midi' , 'midi'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio MPEG' , 'audio/x-mpeg' , 'mpga'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio MPEG-2' , 'audio/x-mpeg2' , 'mp2a'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Java Media Framework', 'audio/rmf' , 'rmf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Voice' , 'audio/voice' , 'voc' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio AIFF' , 'audio/x-aiff' , 'aif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Audio Mod' , 'audio/x-mod' , 'xm'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'mpeg url (m3u)' , 'audio/x-mpegurl' , 'm3u'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wma)', 'audio/x-ms-wma' , 'wma'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmv)', 'audio/x-ms-wmv' , 'wmv'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Realaudio' , 'audio/x-pn-realaudio' , 'ra' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Realaudio Plugin' , 'audio/x-pn-realaudio-plugin' , 'rm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Microsoft WAVE audio' , 'audio/x-wav' , 'wav' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Brookhaven PDB' , 'chemical/x-pdb' , 'pdb'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'XMol XYZ' , 'chemical/x-xyz' , 'xyz'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WHIP Web Drawing file' , 'drawing/x-dwf' , 'dwf'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - BMP' , 'image/bmp' , 'bmp' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Fractal Image Format' , 'image/fif' , 'fif'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Gif' , 'image/gif' , 'gif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image Exchange Format' , 'image/ief' , 'ief' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Jpeg' , 'image/jpeg' , 'jpg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PNG' , 'image/png' , 'png' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - TIFF' , 'image/tiff' , 'tif' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WAP wireless bitmap' , 'image/vnd.wap.wbmp' , 'wbmp'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - CMU Raster' , 'image/x-cmu-raster' , 'ras' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Flexible Image Transport', 'image/x-fits' , 'fit' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Macromedia Freehand' , 'image/x-freehand' , 'fh' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SVG' , 'image/xml+svg' , 'svg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PhotoCD' , 'image/x-photo-cd' , 'pcd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Mac pict' , 'image/x-pict' , 'pict' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PNM' , 'image/x-portable-anymap' , 'pnm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PBM' , 'image/x-portable-bitmap' , 'pbm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - PGM' , 'image/x-portable-graymap' , 'pgm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - Portable Pixmap' , 'image/x-portable-pixmap' , 'ppm'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Image - RGB' , 'image/x-rgb' , 'rgb'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X bitmap' , 'image/x-xbitmap' , 'xbm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X pixmap' , 'image/x-xpixmap' , 'xpm' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'X window dump (xwd)' , 'image/x-xwindowdump' , 'xwd' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'RFC822 Message' , 'message/rfc822' , 'mime'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Computational mesh' , 'model/mesh' , 'mesh'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'SGML Text' , 'text/sgml' , 'sgml'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Cascading style sheet' , 'text/css' , 'css' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'HTML text' , 'text/html' , 'html' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Plain text' , 'text/plain' , 'txt' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Text (flowed)' , 'text/plain; format=flowed' , 'text' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Enriched Text' , 'text/enriched' , 'rtx' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Tab separated values' , 'text/tab-separated-values' , 'tsv' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WMLScript' , 'text/vnd.wap.wmlscript' , 'wmls'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'WML' , 'text/vnd.wap.wml' , 'wml'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'XML Document' , 'text/xml' , 'xml' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Structured enhanced text', 'text/x-setext' , 'etx'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'XSL style sheet' , 'text/xsl' , 'xsl' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video FLI' , 'video/fli' , 'fli'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video MPEG' , 'video/mpeg' , 'mpg' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video MPEG-2' , 'video/mpeg2' , 'mpv2' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Quicktime' , 'video/quicktime' , 'mov' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video VDOlive streaming' , 'video/vdo' , 'vdo'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Vivo' , 'video/vnd.vivo' , 'vivo'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Microsoft ASF' , 'video/x-ms-asf' , 'asf' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wm)', 'video/x-ms-wm' , 'wm'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wvx)', 'video/x-ms-wvx' , 'wvx'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Windows Media Services (wmx)', 'video/x-mx-wmx' , 'wmx'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video Microsoft AVI' , 'video/x-msvideo' , 'avi' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Video SGI movie player' , 'video/x-sgi-movie' , 'movie' ); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Conference Cooltalk' , 'x-conference/x-cooltalk' , 'ice'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'VRML' , 'x-world/x-vrml' , 'vrml'); +insert into tmp_cr_mime_types (label,mime_type,file_extension) values ( 'Xuda' , 'xuda/gen-cert' , 'xuda'); + +-- Extension to mime type maps. + +-- text/plain for prog langs (maybe we should do application/x-LANG but then you can't look +-- at the code in the browser. +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'c', 'text/plain'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'c++', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cpp', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cxx', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cc', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'h', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'h++', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hxx', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tcl', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sql', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'csh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ksh', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'py', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'java', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xql', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'php', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm4', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pl', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pm', 'text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pod', 'text/plain' ); + +-- map a few to binary +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'o','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'so','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'a','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dll','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'exe','application/octet-stream' ); + +-- all the rest +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aab','application/x-authorware-bin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aam','application/x-authorware-map' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aas','application/x-authorware-seg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ai','application/x-illustrator'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aif','audio/x-aiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aifc','audio/x-aiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'aiff','audio/x-aiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ani','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'arj','application/x-arj-compressed' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'asc','text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'asf','video/x-ms-asf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'asx','video/x-ms-asf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'au','audio/basic' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'avi','video/x-msvideo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'bin','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'bmp','image/bmp' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'bqy','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cacert','application/x-x509-ca-cert' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ccad','application/clariscad' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cdf','application/x-netcdf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cgi','application/x-httpd-cgi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'class','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cpio','application/x-cpio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cpt','application/mac-compactpro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'css','text/css' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'csv','application/csv'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'cur','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dcr','application/x-director' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'deb','application/x-debian-package' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dhtml','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dir','application/x-director' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dms','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'doc','application/msword' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dot','application/msword' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'drw','application/drafting' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dump','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dvi','application/x-dvi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dwf','drawing/x-dwf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dwg','application/acad' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dxf','application/dxf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'dxr','application/x-director' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'eps','application/postscript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'etx','text/x-setext' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ez','application/andrew-inset' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh4','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh5','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh7','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fhc','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fh','image/x-freehand' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fif','image/fif' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fit','image/x-fits'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fli','video/fli' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'fm','application/filemaker'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gif','image/gif' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gtar','application/x-gtar' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gz','application/x-gzip' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'gzip','application/x-gzip' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hdf','application/hdf'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'hqx','application/mac-binhex40' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'html','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'htm','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ice','x-conference/x-cooltalk' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ico','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ief','image/ief' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'iges','application/iges' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'igs','application/iges' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jnlp','application/x-java-jnlp-file' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jpeg','image/jpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jpe','image/jpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'jpg','image/jpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'js','application/x-javascript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'kar','audio/midi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'latex','application/x-latex' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'lha','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'lzh','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm15','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm3u','audio/x-mpegurl' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'm3url','audio/x-mpegurl' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'man','application/x-troff-man' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mdb','application/vnd.ms-access'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'me','application/x-troff-me' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mesh','model/mesh' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mid','audio/midi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'midi','audio/midi' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mif','application/vnd.mif' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mime','message/rfc822' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'movie','video/x-sgi-movie' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mov','video/quicktime' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp2','audio/x-mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp2a','audio/x-mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp3','audio/x-mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp3a','audio/x-mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpeg','video/mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpe','video/mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpga','audio/x-mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpg','video/mpeg' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpv2','video/mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mp2v','video/mpeg2' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpp','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpc','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpt','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpx','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mpw','application/vnd.ms-project'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ms','application/x-troff-ms' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'msh','model/mesh' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'msw','application/msword' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'mtm','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'nc','application/x-netcdf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'oda','application/oda' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ogg','application/x-ogg'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'p65','application/x-pagemaker'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pbm','image/x-portable-bitmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pcd','image/x-photo-cd'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pdb','chemical/x-pdb' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pdf','application/pdf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pgm','image/x-portable-graymap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pgn','application/x-chess-pgn' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pict','image/x-pict' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'png','image/png' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pnm','image/x-portable-anymap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ppm','image/x-portable-pixmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ppt','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ppz','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pps','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'pot','application/vnd.ms-powerpoint' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'prc','application/x-pilot'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ps','application/postscript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'psd','application/x-photoshop'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'qt','video/quicktime' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ra','audio/x-pn-realaudio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ram','audio/x-pn-realaudio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rar','application/x-rar-compressed' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ras','image/x-cmu-raster' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rgb','image/x-rgb' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rmf', 'audio/rmf'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rm','audio/x-pn-realaudio-plugin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rmm','audio/x-pn-realaudio-plugin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'roff','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rp','application/x-pn-realmedia' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rpm','audio/x-pn-realaudio-plugin' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rr','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rtf','application/rtf' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'rtx','text/enriched' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 's3m','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sd2','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sdp','application/sdp' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sea','application/x-stuffit' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sgml','text/sgml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sgm','text/sgml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'shtml','text/html' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'silo','model/mesh' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sit','application/x-stuffit' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skd','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skm','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skp','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'skt','application/vnd.koan' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'snd','audio/basic' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'spl','application/futuresplash' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'stl','application/sla' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'stm','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sv4cpio','application/x-sv4cpio' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'sv4crc','application/x-sv4crc' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'svg','image/xml+svg'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'swf','application/x-shockwave-flash' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 't','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tar','application/x-tar' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tex','application/x-tex' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'texi','application/x-texinfo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'texinfo','application/x-texinfo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'text','text/plain; format=flowed'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tiff','image/tiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tif','image/tiff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tr','application/x-troff' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'tsv','text/tab-separated-values' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'txt','text/plain' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ult','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'ustar','application/x-ustar' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'uu','application/octet-stream' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vcd','application/x-cdlink' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vcf','application/vcard' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vdo','video/vdo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vda','application/vda' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vivo','video/vnd.vivo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'viv','video/vnd.vivo' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'voc','audio/voice'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vrml','x-world/x-vrml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'vrm','x-world/x-vrml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wav','audio/x-wav' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wb1','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wb2','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wb3','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wbmp','image/vnd.wap.wbmp' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'web','application/vnd.xara' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wis','application/x-installshield' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wma','audio/x-ms-wma' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmd','application/x-ms-wmd' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmlc','application/vnd.wap.wmlc' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmlsc','application/vnd.wap.wmlscriptc' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmls','text/vnd.wap.wmlscript' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wml','text/vnd.wap.wml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmv','audio/x-ms-wmv' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wm','video/x-ms-wm' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmx','video/x-mx-wmx' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wmz','application/x-ms-wmz' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wpd','application/wordperfect' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wq1','application/x-quattro-pro' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wrl','x-world/x-vrml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'wvx','video/x-ms-wvx' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xar','application/vnd.xara' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'w60','application/wordperfect6.0'); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xbm','image/x-xbitmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xlc','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xls','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xlm','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xlw','application/vnd.ms-excel' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xm','audio/x-mod' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xml','text/xml' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xpm','image/x-xpixmap' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xsl','text/xsl' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xuda','xuda/gen-cert' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xwd','image/x-xwindowdump' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'xyz','chemical/x-xyz' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'z','application/x-compress' ); +insert into tmp_cr_extension_mime_type_map (extension, mime_type) values ( 'zip','application/zip' ); + +-- Now update the existing data taking care not to mess anything up. + +-- Add the mime types that don't already exist. +-- don't add extensions yet since we do that later to prevent +-- duplicates in the +insert into cr_mime_types + select label, mime_type, null + from tmp_cr_mime_types n + where not exists ( + select 1 + from cr_mime_types o + where o.mime_type = n.mime_type); + +-- Provide extension for mime types with missing ones and which are +-- not in use for another mime type. +update cr_mime_types set label = ( + select label + from tmp_cr_mime_types n + where n.mime_type = cr_mime_types.mime_type) +where label is null; + +-- Add extensions, verify extension not already used by another mime type. +-- have to do this since we don't want to introduce duplicate +-- extensions since there is still code using the cr_mime_types table to +-- look up mime_type. + +update cr_mime_types set file_extension = ( + select file_extension from tmp_cr_mime_types m + where m.mime_type = cr_mime_types.mime_type + and not exists (select * from cr_mime_types c where m.file_extension = c.file_extension)) +where file_extension is null; + + +-- Create a mapping entry for existing mime types. +-- we make sure we only get one mapping per extension just in case +insert into cr_extension_mime_type_map (extension, mime_type) +select file_extension, min(mime_type) from cr_mime_types +where file_extension is not null group by file_extension; + +-- insert all the rest that are not being used +insert into cr_extension_mime_type_map + select extension, mime_type + from tmp_cr_extension_mime_type_map n + where not exists ( + select 1 from cr_extension_mime_type_map o + where o.extension = n.extension ); + +drop table tmp_cr_mime_types; +drop table tmp_cr_extension_mime_type_map; Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.4-4.6.5.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.4-4.6.5.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-4.6.4-4.6.5.sql 17 May 2003 09:43:31 -0000 1.2 @@ -0,0 +1,186 @@ +create or replace function content_item__copy2 (integer,integer,integer,varchar) +returns integer as ' +declare + copy2__item_id alias for $1; + copy2__target_folder_id alias for $2; + copy2__creation_user alias for $3; + copy2__creation_ip alias for $4; -- default null + v_current_folder_id cr_folders.folder_id%TYPE; + v_num_revisions integer; + v_name cr_items.name%TYPE; + v_content_type cr_items.content_type%TYPE; + v_locale cr_items.locale%TYPE; + v_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_is_registered boolean; + v_old_revision_id cr_revisions.revision_id%TYPE; + v_new_revision_id cr_revisions.revision_id%TYPE; + v_storage_type cr_items.storage_type%TYPE; +begin + + -- call content_folder.copy if the item is a folder + if content_folder__is_folder(copy2__item_id) = ''t'' then + PERFORM content_folder__copy( + copy2__item_id, + copy2__target_folder_id, + copy2__creation_user, + copy2__creation_ip + ); + -- call content_symlink.copy if the item is a symlink + else if content_symlink__is_symlink(copy2__item_id) = ''t'' then + PERFORM content_symlink__copy( + copy2__item_id, + copy2__target_folder_id, + copy2__creation_user, + copy2__creation_ip + ); + -- call content_extlink.copy if the item is an url + else if content_extlink__is_extlink(copy2__item_id) = ''t'' then + PERFORM content_extlink__copy( + copy2__item_id, + copy2__target_folder_id, + copy2__creation_user, + copy2__creation_ip + ); + -- make sure the target folder is really a folder + else if content_folder__is_folder(copy2__target_folder_id) = ''t'' then + + select + parent_id + into + v_current_folder_id + from + cr_items + where + item_id = copy2__item_id; + + -- can''t copy to the same folder + if copy2__target_folder_id != v_current_folder_id then + + select + content_type, name, locale, + coalesce(live_revision, latest_revision), storage_type + into + v_content_type, v_name, v_locale, v_revision_id, v_storage_type + from + cr_items + where + item_id = copy2__item_id; + + -- make sure the content type of the item is registered to the folder + v_is_registered := content_folder__is_registered( + copy2__target_folder_id, + v_content_type, + ''f'' + ); + + if v_is_registered = ''t'' then + -- create the new content item + v_item_id := content_item__new( + v_name, + copy2__target_folder_id, + null, + v_locale, + now(), + copy2__creation_user, + null, + copy2__creation_ip, + ''content_item'', + v_content_type, + null, + null, + ''text/plain'', + null, + null, + v_storage_type + ); + + -- get the latest revision of the old item + select + latest_revision into v_old_revision_id + from + cr_items + where + item_id = copy2__item_id; + + -- copy the latest revision (if any) to the new item + if v_old_revision_id is not null then + v_new_revision_id := content_revision__copy ( + v_old_revision_id, + null, + v_item_id, + copy2__creation_user, + copy2__creation_ip + ); + end if; + end if; + + + end if; + end if; end if; end if; end if; + + return v_item_id; + +end;' language 'plpgsql'; + +create or replace function content_extlink__copy (integer,integer,integer,varchar) +returns integer as ' +declare + copy__extlink_id alias for $1; + copy__target_folder_id alias for $2; + copy__creation_user alias for $3; + copy__creation_ip alias for $4; -- default null + v_current_folder_id cr_folders.folder_id%TYPE; + v_name cr_items.name%TYPE; + v_url cr_extlinks.url%TYPE; + v_description cr_extlinks.description%TYPE; + v_label cr_extlinks.label%TYPE; + v_extlink_id cr_extlinks.extlink_id%TYPE; +begin + + if content_folder__is_folder(copy__target_folder_id) = ''t'' then + select + parent_id + into + v_current_folder_id + from + cr_items + where + item_id = copy__extlink_id; + + -- can''t copy to the same folder + if copy__target_folder_id != v_current_folder_id then + + select + i.name, e.url, e.description, e.label + into + v_name, v_url, v_description, v_label + from + cr_extlinks e, cr_items i + where + e.extlink_id = i.item_id + and + e.extlink_id = copy__extlink_id; + + if content_folder__is_registered(copy__target_folder_id, + ''content_extlink'',''f'') = ''t'' then + + v_extlink_id := content_extlink__new( + v_name, + v_url, + v_label, + v_description, + copy__target_folder_id, + null, + current_timestamp, + copy__creation_user, + copy__creation_ip + ); + + end if; + end if; + end if; + + return 0; +end;' language 'plpgsql'; + Index: openacs-4/packages/acs-content-repository/tcl/extlink-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/Attic/extlink-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/tcl/extlink-procs-oracle.xql 17 May 2003 09:43:54 -0000 1.2 @@ -0,0 +1,56 @@ + + + oracle8.1.6 + + + + + begin + :1 := content_extlink.new ( + name => :name, + url => :url, + label => :label, + description => :description, + parent_id => :parent_id, + extlink_id => :extlink_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + + + + + + update acs_objects + set last_modified = sysdate, + modifying_user = :modifying_user, + modifying_ip = :modifying_ip + where object_id = :extlink_id + + + + + + + + begin + content_extlink.delete ( + extlink_id => :extlink_id + ); + end; + + + + + + + + select content_extlink.is_extlink (item => :item_id); + + + + + Index: openacs-4/packages/acs-content-repository/tcl/extlink-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/Attic/extlink-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/tcl/extlink-procs-postgresql.xql 17 May 2003 09:43:54 -0000 1.2 @@ -0,0 +1,55 @@ + + + postgresql7.1 + + + + + select content_extlink__new ( + :name, + :url, + :label, + :description, + :parent_id, + :extlink_id, + current_timestamp, + :creation_user, + :creation_ip + ); + + + + + + + + update acs_objects + set last_modified = current_timestamp, + modifying_user = :modifying_user, + modifying_ip = :modifying_ip + where object_id = :extlink_id + + + + + + + + select content_extlink__delete ( + :extlink_id + ); + + + + + + + + select content_extlink__is_extlink ( + :item_id + ); + + + + + Index: openacs-4/packages/acs-content-repository/tcl/extlink-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/Attic/extlink-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/tcl/extlink-procs.tcl 17 May 2003 09:43:54 -0000 1.2 @@ -0,0 +1,89 @@ +ad_library { + + Manage external links in the content repository + + @author Don Baccus (dhogaza@pacifier.com) + @cvs-d $Id: extlink-procs.tcl,v 1.2 2003/05/17 09:43:54 jeffd Exp $ + +} + +namespace eval content_extlink {} + +ad_proc content_extlink::new { + {-extlink_id ""} + -url:required + -parent_id:required + {-name ""} + {-label ""} + {-description ""} +} { + + Create a new external link. + + @extlink_id Optional pre-assigned object_id for the link + @url The URL of the external resource + @parent_id The folder that will contain this extlink + @name Name to assign the object (defaults to "link extlink_id") + @label Label for the extlink (defaults to the URL) + @description An extended description of the link (defaults to NULL) + +} { + + set creation_user [ad_conn user_id] + set creation_ip [ad_conn peeraddr] + + return [db_exec_plsql extlink_new {}] + +} + +ad_proc content_extlink::edit { + -extlink_id:required + -url:required + -label:required + -description:required +} { + + Edit an existing external link. The parameters are required because it + is assumed that the caller will be pulling the existing values out of + the database before editing them. + + @extlink_id Optional pre-assigned object_id for the link + @url The URL of the external resource + @label Label for the extlink (defaults to the URL) + @description An extended description of the link (defaults to NULL) + +} { + + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_transaction { + db_dml extlink_update_object {} + db_dml extlink_update_extlink {} + } + +} + +ad_proc content_extlink::delete { + -extlink_id:required +} { + + Delete an external link. + + @extlink_id The object id of the link to delete + +} { + db_exec_plsql extlink_delete {} +} + +ad_proc content_extlink::extlink_p { + -item_id:required +} { + + Returns true if the given item is an external link. + + @extlink_id The object id of the item to check. + +} { + return [db_string extlink_check {}] +} Index: openacs-4/packages/acs-content-repository/tcl/extlink-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/Attic/extlink-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/tcl/extlink-procs.xql 17 May 2003 09:43:54 -0000 1.2 @@ -0,0 +1,16 @@ + + + + + + + update cr_extlinks + set url = :url, + label = :label, + description = :description + where extlink_id = :extlink_id + + + + + Index: openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql 11 Jul 2002 12:56:28 -0000 1.5 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs-oracle.xql 17 May 2003 09:43:54 -0000 1.6 @@ -3,7 +3,7 @@ oracle8.1.6 - + , content.blob_to_string(content) as text Index: openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql 11 Jul 2002 12:56:28 -0000 1.7 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql 17 May 2003 09:43:54 -0000 1.8 @@ -2,7 +2,7 @@ postgresql7.1 - + , content as text Index: openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl 17 Sep 2002 19:06:45 -0000 1.11 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs.tcl 17 May 2003 09:43:54 -0000 1.12 @@ -123,17 +123,15 @@ ad_proc -public get_folder_labels { { varname "folders" } } { variable item_id - set url "" # this repeats the query used to look up the item in the first place # but there does not seem to be a clear way around this # build the folder URL out as we iterate over the query set query [db_map get_url] - uplevel 1 "db_multirow $varname ignore_get_url $query { - append url $name/ - set url ${url}index.acs - }" + db_multirow -extend {url} $varname ignore_get_url $query { + append url "$name/" + } } ad_proc -public get_content_value { revision_id } { Index: openacs-4/packages/acs-content-repository/tcl/filter-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/acs-content-repository/tcl/filter-procs.xql 13 Sep 2001 04:59:26 -0000 1.2 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs.xql 17 May 2003 09:43:54 -0000 1.3 @@ -43,6 +43,7 @@ x.*, :item_id as item_id $text_sql, :content_type as content_type + $text_sql from cr_revisions r, ${table_name}x x where Index: openacs-4/packages/acs-content-repository/tcl/item-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/Attic/item-procs-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-content-repository/tcl/item-procs-oracle.xql 17 Sep 2001 05:16:40 -0000 1.1 +++ openacs-4/packages/acs-content-repository/tcl/item-procs-oracle.xql 17 May 2003 09:43:54 -0000 1.2 @@ -39,4 +39,19 @@ + + + + begin + content_item.copy( + item_id => :item_id, + target_folder_id => :target_folder_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + + Index: openacs-4/packages/acs-content-repository/tcl/item-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/Attic/item-procs-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-content-repository/tcl/item-procs-postgresql.xql 17 Sep 2001 05:16:40 -0000 1.1 +++ openacs-4/packages/acs-content-repository/tcl/item-procs-postgresql.xql 17 May 2003 09:43:54 -0000 1.2 @@ -40,4 +40,18 @@ + + + + select content_item__copy( + :item_id, + :target_folder_id, + :creation_user, + :creation_ip + ) + + + + + Index: openacs-4/packages/acs-content-repository/tcl/item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/Attic/item-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-content-repository/tcl/item-procs.tcl 19 Sep 2002 13:08:43 -0000 1.5 +++ openacs-4/packages/acs-content-repository/tcl/item-procs.tcl 17 May 2003 09:43:54 -0000 1.6 @@ -229,7 +229,7 @@ if { ![template::util::is_nil template_revision_id] } { get_mime_info $template_revision_id mime_info - if { [info exists mime_info] } { + if { [info exists mime_info(file_extension)] } { set file_extension $mime_info(file_extension) } } @@ -252,10 +252,33 @@ } get_mime_info $revision_id mime_info - set file_extension $mime_info(file_extension) + if { [info exists mime_info(file_extension)] } { + set file_extension $mime_info(file_extension) + } else { + set file_extension "html" + } } append file_url ".$file_extension" return $file_url } + +ad_proc item::copy { + -item_id:required + -target_folder_id:required +} { + + Copy the given item. + + @param item_id The content item to copy + @param target_folder_id The folder which will hold the new copy + +} { + + set creation_user [ad_conn user_id] + set creation_ip [ad_conn peeraddr] + + db_exec_plsql copy_item {} + +} Index: openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql 14 Jun 2002 18:24:31 -0000 1.4 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql 17 May 2003 09:43:54 -0000 1.5 @@ -2,32 +2,6 @@ oracle8.1.6 - - - - begin - :1 := content_revision.new(title => :title, - item_id => :item_id, - v_content => null); - end; - - - - - - - - update - cr_revisions - set - content = empty_blob() - where - revision_id = :revision_id - returning content into :1 - - - - select r.mime_type, i.storage_type, i.storage_area_key, r.revision_id @@ -82,8 +56,10 @@ parent_id => :parent_id, item_id => :item_id, revision_id => :revision_id, + mime_type => :mime_type, creation_user => :creation_user, creation_ip => :creation_ip, + title => :title, content_type => :image_type, storage_type => :storage_type, height => :original_height, @@ -144,16 +120,6 @@ - - - - update cr_revisions - set filename = :filename, - content_length = :tmp_size - where revision_id = :revision_id - - - Index: openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql 15 Nov 2001 01:47:13 -0000 1.4 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql 17 May 2003 09:43:54 -0000 1.5 @@ -2,33 +2,6 @@ postgresql7.1 - - - - select content_revision__new(:title, - null, - now(), - 'text/plain', - ' ', - :item_id - ) - - - - - - - - update - cr_revisions - set - content = '[cr_create_content_file $item_id $revision_id $path]' - where - revision_id = :revision_id - - - - select i.storage_type, i.storage_area_key, r.mime_type, r.revision_id @@ -151,15 +124,6 @@ ); - - - - update cr_revisions - set content = :filename, - content_length = :tmp_size - where revision_id = :revision_id - - Index: openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 16 Jan 2003 13:29:27 -0000 1.8 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 17 May 2003 09:43:54 -0000 1.9 @@ -1,24 +1,5 @@ # upload an item revision from a file -ad_proc -public cr_revision_upload { title item_id path } { - - set revision_id [db_exec_plsql get_revision_id "begin - :1 := content_revision.new(title => :title, - item_id => :item_id, - v_content => null); - end;"] - - db_dml dml_revision_from_file "update - cr_revisions - set - content = empty_blob() - where - revision_id = :revision_id - returning content into :1" -blob_files [list $path] - - return $revision_id -} - ad_proc -public cr_write_content { -item_id -revision_id @@ -280,3 +261,90 @@ } { return [db_string registered_type_for_mime_type "" -default ""] } + + +ad_proc -public cr_filename_to_mime_type { + -create:boolean + filename +} { + given a filename, returns the mime type. If the -create flag is + given the mime type will be created; this assumes there is some + other way such as ns_guesstype to find the filename + + @param create flag whether to create the mime type the routine picks for filename + @param filename the filename to try to guess a mime type for (the file need not + exist, the routine does not attempt to access the file in any way) + + @return mimetype (or */* of unknown) + + @author Jeff Davis (davis@xarg.net) +} { + set extension [string tolower [string trimleft [file extension $filename] "."]] + + if {[empty_string_p $extension]} { + return "*/*" + } + + if {[db_0or1row lookup_mimetype { select mime_type from cr_extension_mime_type_map where extension = :extension }]} { + return $mime_type + } else { + set mime_type [string tolower [ns_guesstype $filename]] + ns_log Debug "guessed mime \"$mime_type\" create_p $create_p" + if {(!$create_p) || [string equal $mime_type "*/*"] || [empty_string_p $mime_type]} { + # we don't have anything meaningful for this mimetype + # so just */* it. + + return "*/*" + } + + # We guessed a type but there was no mapping + # create it and map it. We know the extension + cr_create_mime_type -extension $extension -mime_type $mime_type -description {} + + return $mime_type + } +} + +ad_proc -public cr_create_mime_type { + -extension + -mime_type + -description +} { + + Creates a mime type if it does not exist. Also maps extension to + mime_type (unless the extension is already mapped to another mime + type). + + @param extension the default extension for the given mime type + @param mime_type the mime_type to create + @param a plain text description of the mime type (< 200 characters) + + @author Jeff Davis (davis@xarg.net) +} { + # make both lower since that is the convention. + # should never pass in anything that is not lower cased + # already but just be safe. + + set mime_type [string tolower $mime_type] + set extension [string tolower $extension] + + db_dml maybe_create_mime { + insert into cr_mime_types (label, mime_type, file_extension) + select :description, :mime_type, :extension + from dual + where not exists (select 1 + from cr_mime_types + where mime_type = :mime_type) + } + + db_dml maybe_map_extension { + insert into cr_extension_mime_type_map (extension, mime_type) + select :extension, :mime_type + from dual + where not exists (select 1 + from cr_extension_mime_type_map + where extension = :extension) + } +} + + Index: openacs-4/packages/acs-content-repository/tcl/revision-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/acs-content-repository/tcl/revision-procs.xql 15 Nov 2001 01:47:13 -0000 1.2 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs.xql 17 May 2003 09:43:54 -0000 1.3 @@ -1,33 +1,6 @@ - - - - select content_revision__new(:title, - null, - now(), - 'text/plain', - ' ', - :item_id - ) - - - - - - - - update - cr_revisions - set - content = '[cr_create_content_file $item_id $revision_id $path]' - where - revision_id = :revision_id - - - - select i.storage_type, i.storage_area_key, r.mime_type, i.item_id @@ -53,6 +26,16 @@ + + + update cr_revisions + set content = :filename, + mime_type = :mime_type, + content_length = :tmp_size + where revision_id = :revision_id + + + select content_type Index: openacs-4/packages/acs-datetime/acs-datetime.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/acs-datetime.info,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-datetime/acs-datetime.info 16 Jan 2003 13:32:10 -0000 1.10 +++ openacs-4/packages/acs-datetime/acs-datetime.info 17 May 2003 09:44:17 -0000 1.11 @@ -20,41 +20,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs-postgresql.xql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs-postgresql.xql 8 Jan 2003 18:42:16 -0000 1.7 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs-postgresql.xql 17 May 2003 09:44:35 -0000 1.8 @@ -7,38 +7,38 @@ select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'D') as day_of_the_week, -next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') +cast(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') as date) as sunday_date, -to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday'),'J') +to_char(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday'),'J') as sunday_julian, -next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 1 +cast(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('1 day' as interval) as date) as monday_date, -to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 1,'J') +to_char(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('1 day' as interval),'J') as monday_julian, -next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 2 +cast(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('2 days' as interval) as date) as tuesday_date, -to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 2,'J') +to_char(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('2 days' as interval),'J') as tuesday_julian, -next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 3 +cast(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('3 days' as interval) as date) as wednesday_date, -to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 3,'J') +to_char(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('3 days' as interval),'J') as wednesday_julian, -next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 4 +cast(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('4 days' as interval) as date) as thursday_date, -to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 4,'J') +to_char(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('4 days' as interval),'J') as thursday_julian, -next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 5 +cast(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('5 days' as interval) as date) as friday_date, -to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 5,'J') +to_char(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('5 days' as interval),'J') as friday_julian, -next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 6 +cast(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('6 days' as interval) as date) as saturday_date, -to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'Sunday') + 6,'J') +to_char(next_day(to_date(:current_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('6 days' as interval),'J') as saturday_julian, -:current_date::timestamp - '7 days'::timespan as last_week, -to_char(:current_date::timestamp - '7 days'::interval, 'Month DD, YYYY') as last_week_pretty, -:current_date::timestamp + '7 days'::timespan as next_week, -to_char(:current_date::timestamp + '7 days'::interval, 'Month DD, YYYY') as next_week_pretty +cast(:current_date::timestamptz - cast('7 days' as interval) as date) as last_week, +to_char(:current_date::timestamptz - cast('7 days' as interval), 'Month DD, YYYY') as last_week_pretty, +cast(:current_date::timestamptz + cast('7 days' as interval) as date) as next_week, +to_char(:current_date::timestamptz + cast('7 days' as interval), 'Month DD, YYYY') as next_week_pretty from dual @@ -47,9 +47,9 @@ select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'Day, DD Month YYYY') as day_of_the_week, -to_char(to_date(:current_date, 'yyyy-mm-dd')-1, 'yyyy-mm-dd') +to_char(to_date(:current_date, 'yyyy-mm-dd') - cast('1 day' as interval), 'yyyy-mm-dd') as yesterday, -to_char(to_date(:current_date, 'yyyy-mm-dd')+1, 'yyyy-mm-dd') +to_char(to_date(:current_date, 'yyyy-mm-dd') + cast('1 day' as interval), 'yyyy-mm-dd') as tomorrow from dual Index: openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl,v diff -u -N -r1.37 -r1.38 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 13 Mar 2003 20:22:06 -0000 1.37 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 17 May 2003 09:44:35 -0000 1.38 @@ -250,7 +250,7 @@ set next_hour "" set start_time "" set odd_row_p 0 - set display_hour "\"No" + set display_hour "All day" append return_html "

    " append return_html "
    [subst $hour_template]" Index: openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 18 Nov 2002 18:01:12 -0000 1.7 +++ openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 17 May 2003 09:44:35 -0000 1.8 @@ -243,7 +243,12 @@ set month [expr $month + 1] } - return [clock format [clock scan $year-$month-01] -format %Y-%m-%d] + # jarkko: added this check to avoid calendars bombing when prev month goes + # beyond borders + if {[catch {set next_month [clock format [clock scan $year-$month-01] -format %Y-%m-%d]} err]} { + return "" + } + return $next_month } ad_proc dt_prev_month { @@ -259,7 +264,13 @@ set month [expr $month - 1] } - return [clock format [clock scan $year-$month-01] -format %Y-%m-%d] + # jarkko: added this check to avoid calendars bombing when prev month goes + # beyond borders + if {[catch {set prev_month [clock format [clock scan $year-$month-01] -format %Y-%m-%d]} err]} { + return "" + } + + return $prev_month } ad_proc dt_next_month_name { @@ -275,7 +286,14 @@ set month [expr $month + 1] } + # jarkko: added this check to avoid calendars bombing when next month goes + # beyond borders + if {[catch {set next_name [clock format [clock scan $year-$month-01] -format %B]} err]} { + return "" + } + return [lc_time_fmt [clock_to_ansi [clock scan $year-$month-01]] "%B"] + } ad_proc dt_prev_month_name { @@ -291,6 +309,13 @@ set month [expr $month - 1] } + # jarkko: added this check to avoid calendars bombing when prev month goes + # beyond borders + + if {[catch {set prev_name [clock format [clock scan $year-$month-01] -format %B]} err]} { + return "" + } + return [lc_time_fmt [clock_to_ansi [clock scan $year-$month-01]] "%B"] } Index: openacs-4/packages/acs-developer-support/acs-developer-support.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/acs-developer-support.info,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/acs-developer-support/acs-developer-support.info 23 Sep 2002 23:32:00 -0000 1.6 +++ openacs-4/packages/acs-developer-support/acs-developer-support.info 17 May 2003 09:45:08 -0000 1.7 @@ -18,24 +18,8 @@ 2001-01-24 ArsDigita Corporation - + - - - - - - - - - - - - - - - -