Index: openacs-4/packages/acs-content-repository/tcl/content-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-content-repository/tcl/content-procs.tcl 30 Apr 2001 05:33:14 -0000 1.1
@@ -0,0 +1,52 @@
+# The location for files
+proc cr_fs_path {} {
+ return "[file dirname [string trimright [ns_info tcllib] "/"]]/content-repository-content-files"
+}
+
+# This will generate the filename and set up the directory to it, too.
+# This needs to scale to lots of files, and the location doesn't have to
+# be meaningful.
+
+# lifted from new-file-storage (DanW - OpenACS)
+
+proc cr_create_content_file { item_id revision_id client_filename } {
+
+ # Split out the version_id by groups of 2.
+ set item_id_length [string length $item_id]
+ set path "/"
+
+ for {set i 0} {$i < $item_id_length} {incr i} {
+ append path [string range $item_id $i $i]
+ if {($i % 2) == 1} {
+ if {$i < $item_id_length} {
+ # Check that the directory exists
+ if {![file exists [cr_fs_path]$path]} {
+ ns_mkdir [cr_fs_path]$path
+ }
+
+ append path "/"
+ }
+ }
+ }
+
+ # Check that the directory exists
+ if {![file exists [cr_fs_path]$path]} {
+ ns_mkdir [cr_fs_path]$path
+ }
+
+ if {![string equal [string index $path end] "/"]} {
+ append path "/"
+ }
+
+ ns_log Notice "path = $path, revision_id = $revision_id"
+
+ set content_file "${path}${revision_id}"
+ set ifp [open $client_filename r]
+ set ofp [open [cr_fs_path]$content_file w]
+
+ ns_cpfp $ifp $ofp
+ close $ifp
+ close $ofp
+
+ return $content_file
+}
Index: openacs-4/packages/acs-subsite/www/shared/portrait-bits-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/Attic/portrait-bits-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-subsite/www/shared/portrait-bits-postgresql.xql 30 Apr 2001 05:33:14 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+ postgresql7.1
+
+
+
+
+ select content
+ from cr_revisions
+ where revision_id = $revision_id
+
+
+
+
+
Index: openacs-4/packages/acs-subsite/www/user/portrait/upload-2-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/portrait/Attic/upload-2-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-subsite/www/user/portrait/upload-2-oracle.xql 30 Apr 2001 05:33:14 -0000 1.1
@@ -0,0 +1,76 @@
+
+
+ oracle8.1.6
+
+
+
+
+ begin
+ :1 := content_item.new(
+ name => :name,
+ creation_ip => :creation_ip);
+ end;
+
+
+
+
+
+
+
+ begin
+ :1 := acs_rel.new (
+ rel_type => 'user_portrait_rel',
+ object_id_one => :user_id,
+ object_id_two => :item_id);
+ end;
+
+
+
+
+
+
+
+ begin
+ :1 := content_revision.new(
+ title => :title,
+ description => :portrait_comment,
+ text => 'not_important',
+ mime_type => :guessed_file_type,
+ item_id => :item_id,
+ creation_user => :user_id,
+ creation_ip => :creation_ip
+ );
+
+ update cr_items
+ set live_revision = :1
+ where item_id = :item_id;
+ end;
+
+
+
+
+
+
+
+ update cr_revisions
+ set content = empty_blob()
+ where revision_id = :revision_id
+ returning content into :1
+
+
+
+
+
+
+
+ update cr_revisions
+ set description = :portrait_comment,
+ publish_date = sysdate,
+ mime_type = :guessed_file_type,
+ title = :title
+ where revision_id = :revision_id"
+
+
+
+
+
Index: openacs-4/packages/acs-subsite/www/user/portrait/upload-2-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/portrait/Attic/upload-2-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-subsite/www/user/portrait/upload-2-postgresql.xql 30 Apr 2001 05:33:14 -0000 1.1
@@ -0,0 +1,103 @@
+
+
+ postgresql7.1
+
+
+
+
+ select content_item__new(
+ :name,
+ null,
+ null,
+ null,
+ now(),
+ null,
+ null,
+ :creation_ip,
+ 'content_item',
+ 'content_revision',
+ null,
+ null,
+ 'text/plain',
+ null,
+ null,
+ 'file'
+ )
+
+
+
+
+
+
+
+
+ select acs_rel__new (
+ null,
+ 'user_portrait_rel',
+ :user_id,
+ :item_id,
+ null,
+ null,
+ null
+ )
+
+
+
+
+
+
+
+
+ declare
+ v_revision_id integer;
+ begin
+
+ v_revision_id := content_revision__new(
+ :title,
+ :portrait_comment,
+ now(),
+ :guessed_file_type,
+ null,
+ 'not_important',
+ :item_id,
+ null,
+ now(),
+ :user_id,
+ :creation_ip
+ );
+
+ update cr_items
+ set live_revision = v_revision_id
+ where item_id = :item_id;
+
+ return v_revision_id;
+
+ end;
+
+
+
+
+
+
+
+ update cr_revisions
+ set content = '[cr_create_content_file $item_id $revision_id $tmp_filename]'
+ where revision_id = :revision_id
+
+
+
+
+
+
+
+ update cr_revisions
+ set description = :portrait_comment,
+ publish_date = now(),
+ mime_type = :guessed_file_type,
+ title = :title
+ where revision_id = :revision_id
+
+
+
+
+
Index: openacs-4/packages/acs-subsite/www/user/portrait/upload-2.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/portrait/Attic/upload-2.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-subsite/www/user/portrait/upload-2.xql 30 Apr 2001 05:33:14 -0000 1.1
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+ select object_id_two as item_id
+ from acs_rels
+ where object_id_one = :user_id
+ and rel_type = 'user_portrait_rel'
+
+
+
+
+
+
+
+ insert into images
+ (image_id, width, height)
+ values
+ (:revision_id, :original_width, :original_height)
+
+
+
+
+
+
+
+ select live_revision as revision_id
+ from cr_items
+ where item_id = :item_id
+
+
+
+
+
+
+
+ update images
+ set width = :original_width, height = :original_height
+ where image_id = :revision_id"
+
+
+
+
+
Index: openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs-postgresql.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 24 Apr 2001 23:59:24 -0000 1.5
+++ openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 30 Apr 2001 05:33:14 -0000 1.6
@@ -80,12 +80,12 @@
set function_name "__exec_${unique_id}_${fname}"
- ns_log Notice "PLPGSQL: converted: $sql to: select $function_name ()"
# insert tcl variable values (Openacs - Dan)
if {![string equal $sql $pre_sql]} {
set sql [uplevel 2 [list subst -nobackslashes $sql]]
}
+ ns_log Notice "PLPGSQL: converted: $sql to: select $function_name ()"
# create a function definition statement for the inline code
# binding is emulated in tcl. (OpenACS - Dan)
@@ -112,17 +112,18 @@
[DoubleApos $proc_sql]
' language 'plpgsql'"
+ ns_log Notice "proc_sql = $proc_sql"
set ret_val [ns_db 0or1row $db "select $function_name ()"]
-
+ ns_log Notice "anon func selected"
# drop the anonymous function (OpenACS - Dan)
ns_db dml $db "drop function $function_name ()"
-
+ ns_log Notice "anon func dropped $ret_val"
return $ret_val
} error]
# error in the plsql anonymous function - try and drop it.
- catch {ns_db dml $db "drop function $function_name ()"}
+ ns_log Notice "errno = $errno"
global errorInfo errorCode
set errinfo $errorInfo
@@ -132,6 +133,8 @@
if { $errno == 2 } {
return $error
+ } else {
+ catch {ns_db dml $db "drop function $function_name ()"}
}
return -code $errno -errorinfo $errinfo -errorcode $errcode $error
@@ -244,7 +247,7 @@
unbounded compressed text columns. BLOBs are handled much differently,
to.
} {
- ad_arg_parser { bind } $args
+ ad_arg_parser { bind blob_files } $args
# Query Dispatcher (OpenACS - ben)
set full_statement_name [db_qd_get_fullname $statement_name]