Index: openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl 20 Oct 2009 21:22:58 -0000 1.17 +++ openacs-4/packages/acs-templating/www/scripts/xinha/attach-file.tcl 27 Oct 2014 16:40:53 -0000 1.18 @@ -1,14 +1,15 @@ ad_page_contract { Simple file upload, attach image to object_id passed in, if no object_id, use the current package_id + @author Guenter Ernst guenter.ernst@wu-wien.ac.at, @author Gustaf Neumann neumann@wu-wien.ac.at @author Dave Bauer (dave@solutiongrove.com) @creation-date 13.07.2004 @cvs-id $Id$ } { - {parent_id:integer,optional} - {package_id ""} + {parent_id:naturalnum,optional} + {package_id:naturalnum ""} {selector_type "file"} {f_href ""} } @@ -100,7 +101,7 @@ element set_value upload_form f_href $f_href } # ensure that Link Title is specified - if { ![exists_and_not_null f_title] && [exists_and_not_null url_ok_btn] } { + if { (![info exists f_title] || $f_title eq "") && ([info exists url_ok_btn] && $url_ok_btn ne "") } { template::form::set_error upload_form f_title "Specify a [_ acs-templating.Link_Title]" } set error_p 0 @@ -206,7 +207,7 @@ } else { if {$choose_file ne ""} { set item_id $choose_file - set file_name [lindex [lindex $recent_files_options [util_search_list_of_lists $recent_files_options $item_id 1]] 0] + set file_name [lindex $recent_files_options [util_search_list_of_lists $recent_files_options $item_id 1] 0] # we have to get rid of the icon from the form. set file_name [regsub -all {<.*?>} $file_name {}] } @@ -225,7 +226,7 @@ # see the parent object set f_href "/image/${item_id}/private/${parent_id}/${file_name}" } else { - if { [exists_and_not_null f_url] && $url_ok_btn ne "" } { + if { ([info exists f_url] && $f_url ne "") && $url_ok_btn ne "" } { set f_href $f_url } else { set f_href "/file/${item_id}/${file_name}"