Index: openacs-4/packages/file-storage/www/folder-zip-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-zip-add.tcl,v diff -u -r1.4.6.2 -r1.4.6.3 --- openacs-4/packages/file-storage/www/folder-zip-add.tcl 9 Sep 2013 16:44:27 -0000 1.4.6.2 +++ openacs-4/packages/file-storage/www/folder-zip-add.tcl 3 Oct 2013 08:33:58 -0000 1.4.6.3 @@ -20,7 +20,7 @@ lock_title_p:onevalue } -validate { file_id_or_folder_id { - if {[exists_and_not_null file_id] && ![exists_and_not_null folder_id]} { + if {([info exists file_id] && $file_id ne "") && (![info exists folder_id] || $folder_id eq "")} { set folder_id [db_string get_folder_id "select parent_id as folder_id from cr_items where item_id=:file_id" -default ""] } if {![fs_folder_p $folder_id]} { @@ -61,7 +61,7 @@ {upload_file:file {label \#file-storage.Upload_a_file\#} {html "size 30"}} } -if {[exists_and_not_null return_url]} { +if {([info exists return_url] && $return_url ne "")} { ad_form -extend -name file_add -form { {return_url:text(hidden) {value $return_url}} } @@ -88,14 +88,14 @@ # create a new folder to hold the zip contents # TODO make sure its name is unique? - if {[empty_string_p $title]} { + if {$title eq ""} { set title [file rootname [list [template::util::file::get_property filename $upload_file]]] } set folder_id [content::folder::new -name $title -parent_id $folder_id -label $title] set unzip_binary [string trim [parameter::get -parameter UnzipBinary]] - if { ![empty_string_p $unzip_binary] } { + if { $unzip_binary ne "" } { set unzip_path [ns_tmpnam] file mkdir $unzip_path @@ -138,14 +138,14 @@ set p_f_id $folder_id set file_paths [file split [file dirname $upload_file]] ns_log notice "\n DAVEB1 \n '${file_paths}'" - if {![string equal "." $file_paths] && [llength $file_paths]} { + if {"." ne $file_paths && [llength $file_paths]} { # make sure every folder exists set path "" foreach p $file_paths { append path /${p} if {![info exists paths($path)]} { set f_id [content::item::get_id -item_path $path -root_folder_id $p_f_id] - if {[string equal "" $f_id]} { + if {$f_id eq ""} { set p_f_id [content::folder::new -parent_id $p_f_id -name $p -label $p] set paths($path) $p_f_id } @@ -162,7 +162,7 @@ set existing_item_id [fs::get_item_id -name $upload_file -folder_id $this_folder_id] - if {![empty_string_p $existing_item_id]} { + if {$existing_item_id ne ""} { # file with the same name already exists # in this folder, create a new revision set this_file_id $existing_item_id @@ -185,7 +185,7 @@ file delete $tmpfile incr i - if {![empty_string_p $rev_id]} { + if {$rev_id ne ""} { set this_file_id [db_string get_item_id { select item_id from cr_revisions @@ -198,7 +198,7 @@ } } - if {![string equal "" $unzip_path]} { + if {$unzip_path ne ""} { file delete -force $unzip_path } file delete $upload_file.tmpfile @@ -214,7 +214,7 @@ } -after_submit { - if {[exists_and_not_null return_url]} { + if {([info exists return_url] && $return_url ne "")} { ad_returnredirect $return_url } else { ad_returnredirect "./?[export_vars -url {folder_id}]" @@ -223,6 +223,6 @@ } -set unpack_available_p [expr ![empty_string_p [string trim [parameter::get -parameter UnzipBinary]]]] +set unpack_available_p [expr {[string trim [parameter::get -parameter UnzipBinary]] ne ""}] ad_return_template \ No newline at end of file