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 -r1.30 -r1.31 --- openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 2 Mar 2011 04:30:27 -0000 1.30 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 27 Oct 2014 16:39:12 -0000 1.31 @@ -30,7 +30,7 @@ } { if { [info exists revision_id] && [info exists item_id] } { - ad_return -code error "Both revision_id and item_id were specfied" + error "Both revision_id and item_id were specfied" } if { [info exists item_id] } { @@ -42,13 +42,14 @@ error "There is no content that matches revision_id '$revision_id'" {} NOT_FOUND } } else { - ad_return -code error "Either revision_id or item_id must be specified" + error "Either revision_id or item_id must be specified" } - if { $storage_type ne "file" && \ - $storage_type ne "text" && \ - $storage_type ne "lob" } { - ad_return -code error "Storage type '$storage_type' is invalid." + if { $storage_type ne "file" + && $storage_type ne "text" + && $storage_type ne "lob" + } { + error "Storage type '$storage_type' is invalid." } # I set content length to 0 here because otherwise I need to do @@ -63,14 +64,14 @@ if { $string_p } { return $text } - ReturnHeaders $mime_type - ns_write $text + ns_return 200 $mime_type $text } file { set path [cr_fs_path $storage_area_key] set filename [db_string write_file_content ""] if {$filename eq ""} { - ad_return -code error "No content for the revision $revision_id. This seems to be an error which occured during the upload of the file" + error "No content for the revision $revision_id.\ + This seems to be an error which occured during the upload of the file" } else { if { $string_p } { set fd [open $filename "r"] @@ -92,7 +93,7 @@ ns_set put [ns_conn outputheaders] "Content-Length" 0 ns_return 200 text/plain {} } else { - if {[info command ad_returnfile_background] eq "" || [security::secure_conn_p]} { + if {[info commands ad_returnfile_background] eq "" || [security::secure_conn_p]} { ns_returnfile 200 $mime_type $filename } else { ad_returnfile_background 200 $mime_type $filename @@ -217,16 +218,16 @@ db_transaction { - if { [empty_string_p [db_string is_registered "" -default ""]] } { + if { [db_string is_registered "" -default ""] eq "" } { db_dml mime_type_insert "" db_exec_plsql mime_type_register "" } switch $content_type { image { - if { [db_string image_subclass ""] eq "f" } { - ad_return -code error "Image file must be stored in an image object" + if { [db_string image_subclass ""] == "f" } { + error "Image file must be stored in an image object" } set what_aolserver_told_us "" @@ -238,14 +239,15 @@ # we don't have built in png size detection # but we want to allow upload of png images } else { - ad_return -code error "Unknown image type" + error "Unknown image type" } # the AOLserver jpegsize command has some bugs where the height comes # through as 1 or 2 - if { $what_aolserver_told_us ne "" && \ - [lindex $what_aolserver_told_us 0] > 10 && \ - [lindex $what_aolserver_told_us 1] > 10 } { + if { $what_aolserver_told_us ne "" + && [lindex $what_aolserver_told_us 0] > 10 + && [lindex $what_aolserver_told_us 1] > 10 + } { set original_width [lindex $what_aolserver_told_us 0] set original_height [lindex $what_aolserver_told_us 1] } else { @@ -264,11 +266,11 @@ default { if { $image_only_p } { - ad_return -code error "The file you uploaded was not an image (.gif, .jpg or .jpeg) file" + error "The file you uploaded was not an image (.gif, .jpg or .jpeg) file" } - if { [db_string content_revision_subclass ""] eq "f" } { - ad_return -code error "Content must be stored in a content revision object" + if { [db_string content_revision_subclass ""] == "f" } { + error "Content must be stored in a content revision object" } if { !$old_item_p } { @@ -306,8 +308,8 @@ } { @param image_sql Optional SQL to extend the base image type @param other_sql Optional SQL to extend the base content revision type - @mime_type Mime type of the new revision - @revision_id The revision we're setting live + @param mime_type Mime type of the new revision + @param revision_id The revision we're setting live If provided execute the appropriate SQL in the caller's context, then set the given revision live. @@ -332,7 +334,7 @@ } { Return the type registered for this mime type. - @mime_type param The mime type + @param mime_type param The mime type } { return [db_string registered_type_for_mime_type "" -default ""] }