Index: openacs-4/packages/xowiki/www/xinha/file-selector.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/xinha/file-selector.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/xinha/file-selector.adp 5 Jan 2007 12:11:03 -0000 1.3 +++ openacs-4/packages/xowiki/www/xinha/file-selector.adp 2 Oct 2008 07:43:37 -0000 1.4 @@ -110,9 +110,14 @@ border="0"/> @up_name@
@folder_name@
-
- -
+ +
+ +
+
+ + @error_msg@ + Index: openacs-4/packages/xowiki/www/xinha/file-selector.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/xinha/file-selector.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/xowiki/www/xinha/file-selector.tcl 8 Jun 2007 12:04:14 -0000 1.9 +++ openacs-4/packages/xowiki/www/xinha/file-selector.tcl 2 Oct 2008 07:43:37 -0000 1.10 @@ -11,6 +11,24 @@ {file_types "*"} } +set HTML_NothingSelected [_ acs-templating.HTMLArea_SelectImageNothingSelected] +switch $selector_type { + "image" { + set HTML_Title [_ acs-templating.HTMLArea_SelectImageTitle] + set HTML_Legend [_ acs-templating.HTMLArea_SelectImage] + set HTML_Preview [_ acs-templating.HTMLArea_SelectImagePreview] + set HTML_UploadTitle [_ acs-templating.HTMLArea_SelectImageUploadTitle] + set HTML_Context "COMMUNITY NAME" + } + "file" { + set HTML_Title [_ acs-templating.HTMLArea_SelectFileTitle] + set HTML_Legend [_ acs-templating.HTMLArea_SelectFile] + set HTML_Preview [_ acs-templating.HTMLArea_SelectImagePreview] + set HTML_UploadTitle [_ acs-templating.HTMLArea_SelectFileUploadTitle] + set HTML_Context "COMMUNITY NAME" + } +} + if {![info exists fs_package_id]} { # we have not filestore package_id. This must be the first call. if {[info exists folder_id]} { @@ -37,22 +55,42 @@ # probably not what user wants; could return error instead set id [apm_version_id_from_package_key $key] set mount_url [site_node::get_children -all -package_key $key -node_id $id] - array set site_node [site_node::get -url $mount_url] - set fs_package_id $site_node(package_id) + if {$mount_url ne ""} { + array set site_node [site_node::get -url $mount_url] + set fs_package_id $site_node(package_id) + } } } } +set write_p 0 +set error_msg "" +set folder_name "*** unknown ***" +array set formerror [list upload_file $error_msg] + if {![info exists folder_id]} { + if {![info exists fs_package_id]} { + # The folder_id was not specified, the fs_package_id was not + # specified, and we could not locate any usable file-storage. We + # give up with a semi-i18ned message, nobody should ever see + # this... + set error_msg "[_ file-storage.lt_bad_folder_id_folder_].\nPerhaps you have no file-storage package mounted?" + array set formerror [list upload_file $error_msg] + ad_complain $error_msg + return + } set folder_id [fs_get_root_folder -package_id $fs_package_id] set root_folder_id $folder_id } if {![fs_folder_p $folder_id]} { - ad_complain [_ file-storage.lt_The_specified_folder__1] + set error_msg [_ file-storage.lt_The_specified_folder__1] + array set formerror [list upload_file $error_msg] + ad_complain $error_msg return } + # now we have at least a valid folder_id and a valid fs_package_id if {![info exists root_folder_id]} { set root_folder_id [fs_get_root_folder -package_id $fs_package_id] @@ -147,11 +185,8 @@ } } -} else { - set write_p 0 } - # display the contents set folder_name [lang::util::localize [fs::get_object_name -object_id $folder_id]] @@ -297,23 +332,7 @@ regsub -all {\#} $file_url {%23} file_url } -set HTML_NothingSelected [_ acs-templating.HTMLArea_SelectImageNothingSelected] -switch $selector_type { - "image" { - set HTML_Title [_ acs-templating.HTMLArea_SelectImageTitle] - set HTML_Legend [_ acs-templating.HTMLArea_SelectImage] - set HTML_Preview [_ acs-templating.HTMLArea_SelectImagePreview] - set HTML_UploadTitle [_ acs-templating.HTMLArea_SelectImageUploadTitle] - set HTML_Context "COMMUNITY NAME" - } - "file" { - set HTML_Title [_ acs-templating.HTMLArea_SelectFileTitle] - set HTML_Legend [_ acs-templating.HTMLArea_SelectFile] - set HTML_Preview [_ acs-templating.HTMLArea_SelectImagePreview] - set HTML_UploadTitle [_ acs-templating.HTMLArea_SelectFileUploadTitle] - set HTML_Context "COMMUNITY NAME" - } -} + ad_return_template