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.18 -r1.19 --- openacs-4/packages/xowiki/www/xinha/file-selector.tcl 26 Jun 2015 20:47:40 -0000 1.18 +++ openacs-4/packages/xowiki/www/xinha/file-selector.tcl 7 Aug 2017 23:48:31 -0000 1.19 @@ -29,6 +29,16 @@ } } +template::add_event_listener -id "body" -event "blur" -script { + myFocus(); +} +template::add_event_listener -id "ok_button" -script { + onOK(); +} +template::add_event_listener -id "cancel_button" -script { + onCancel(); +} + if {![info exists fs_package_id]} { # we have not filestore package_id. This must be the first call. if {[info exists folder_id]} { @@ -90,7 +100,6 @@ 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] @@ -212,18 +221,16 @@ display_template { + id="oi@contents.object_id@" /> - #file-storage.@contents.type@# - onclick="selectImage('@contents.object_id@','@contents.file_url@','@contents.type@');return false;">@contents.name@ + #file-storage.@contents.type@# + @contents.name@ } orderby_desc {name desc} orderby_asc {name asc} @@ -281,21 +288,23 @@ icon last_modified_pretty content_size_pretty properties_link properties_url folder_p title } contents get_fs_contents $fs_sql { - set last_modified_ansi [lc_time_system_to_conn $last_modified_ansi] + set last_modified_ansi [lc_time_system_to_conn $last_modified_ansi] set last_modified_pretty [lc_time_fmt $last_modified_ansi "%x %X"] - set content_size_pretty [lc_numeric $content_size] + set content_size_pretty [lc_numeric $content_size] if {$type eq "folder"} { # append content_size_pretty " [_ file-storage.items]" set content_size_pretty "" } else { append content_size_pretty " [_ file-storage.bytes]" } - if {$title eq ""} {set title $name} + if {$title eq ""} { + set title $name + } set file_upload_name [fs::remove_special_file_system_characters \ -string $file_upload_name] - + if { $content_size ne "" } { incr content_size_total $content_size } @@ -322,14 +331,29 @@ } } - # We need to encode the hashes in any i18n message keys (.LRN plays # this trick on some of its folders). If we don't, the hashes will cause # the path to be chopped off (by ns_conn url) at the leftmost hash. regsub -all {\#} $file_url {%23} file_url + + # + # Register listeners + # + template::add_event_listener -id "oi$object_id" -script [subst { + onPreview('$file_url','$type'); + }] + if {$folder_p == 0} { + template::add_event_listener -id "link$object_id" -script [subst { + selectImage('$object_id','$file_url','$type'); + }] + } } - - ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: