Index: openacs-4/packages/xowiki/tcl/link-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/link-procs.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/packages/xowiki/tcl/link-procs.tcl 27 Jul 2007 21:52:56 -0000 1.29 +++ openacs-4/packages/xowiki/tcl/link-procs.tcl 28 Jul 2007 13:01:57 -0000 1.30 @@ -144,9 +144,10 @@ set item_id [my resolve] #my log "-- image resolve for $page returned $item_id (name=$name, label=$label) " if {$item_id} { - set base [::[my package_id] pretty_link -absolute [$page absolute_links] $name] + set link [[my package_id] pretty_link -download true \ + -absolute [$page absolute_links] $name] #my log "--l fully quali [$page absolute_links], base=$base" - set link [export_vars -base $base {{m download}} ] + #set link [export_vars -base $base {{m download}} ] $page lappend references [list $item_id [my type]] my render_found $link $label } else { Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.74 -r1.75 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 26 Jul 2007 00:30:31 -0000 1.74 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 28 Jul 2007 13:01:57 -0000 1.75 @@ -104,13 +104,15 @@ ressources 1 revisions 1 view-default 1 view-links 1 view-plain 1 oacs-view 1 oacs-view2 1 oacs-view3 1 + download 1 } Package ad_instproc pretty_link { {-anchor ""} {-absolute:boolean false} {-siteurl ""} {-lang ""} + {-download false} name } { Generate a (minimal) link to a wiki page with the specified name. @@ -120,16 +122,15 @@ @param anchor anchor to be added to the link @param absolute make an absolute link (including protocol and host) @param lang use the specified 2 character language code (rather than computing the value) + @param download create download link (without m=download) @param name name of the wiki page } { - #my log "--u name=<$name> // lang=$lang" + #my msg "input name=$name, lang=$lang" set default_lang [my default_language] if {$lang eq ""} { if {![regexp {^(..):(.*)$} $name _ lang name]} { if {![regexp {^(file|image|swf):(.*)$} $name _ lang name]} { set lang $default_lang - } else { - set lang file } } } @@ -141,11 +142,16 @@ # don't compact the the path for images etc. to avoid conflicts with e.g. //../image/* set package_prefix [my package_url] } - if {$lang ne $default_lang || [[self class] exists www-file($name)]} { - return ${host}${package_prefix}${lang}/[ad_urlencode $name]$anchor + #my msg "lang=$lang name=$name" + set encoded_name [string map [list %2d - %5f _ %2e .] [ns_urlencode $name]] + if {$download} { + set url ${host}${package_prefix}download/${lang}/$encoded_name$anchor + } elseif {$lang ne $default_lang || [[self class] exists www-file($name)]} { + set url ${host}${package_prefix}${lang}/$encoded_name$anchor } else { - return ${host}${package_prefix}[ad_urlencode $name]$anchor + set url ${host}${package_prefix}$encoded_name$anchor } + return $url } Package instproc init {} { @@ -393,7 +399,7 @@ if {[regexp {^pages/(..)/(.*)$} $path _ lang local_name]} { } elseif {[regexp {^(..)/(.*)$} $path _ lang local_name]} { } elseif {[regexp {^(..):(.*)$} $path _ lang local_name]} { - } elseif {[regexp {^(file|image)/(.*)$} $path _ lang local_name]} { + } elseif {[regexp {^(file|image|download)/(.*)$} $path _ lang local_name]} { } else { set key queryparm(lang) if {[info exists $key]} { @@ -421,12 +427,10 @@ my get_name_and_lang_from_path $path lang local_name set name ${lang}:$local_name set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id] - my log "--try $name -> $item_id // ::Generic::CrItem lookup -name $name -parent_id $folder_id" - if {$item_id == 0 && $lang eq "file" && [regexp {(.+)/download.} $local_name _ base_name]} { - set item_id [::Generic::CrItem lookup -name file:$base_name -parent_id $folder_id] - if {$item_id == 0} { - set item_id [::Generic::CrItem lookup -name swf:$base_name -parent_id $folder_id] - } + #my log "--try $name -> $item_id // ::Generic::CrItem lookup -name $name -parent_id $folder_id" + if {$item_id == 0 && $lang eq "download" + && [regexp {^([^/]+)/(.*)$} $local_name _ prefix base_name]} { + set item_id [::Generic::CrItem lookup -name ${prefix}:$base_name -parent_id $folder_id] if {$item_id != 0} { upvar $method_var method set method download Index: openacs-4/packages/xowiki/tcl/syndicate-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/syndicate-procs.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 25 Jul 2007 23:59:24 -0000 1.16 +++ openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 28 Jul 2007 13:01:57 -0000 1.17 @@ -257,7 +257,7 @@ if {$title eq ""} {set title $name} #set time "[clock format [clock scan $time] -format {%a, %d %b %Y %T}] ${tz}00" - set link [::$package_id pretty_link -absolute true -siteurl $siteurl $name]/download.$file_extension + set link [::$package_id pretty_link -download true -absolute true -siteurl $siteurl $name] append content [my item \ -author $creator -title $title -subtitle $subtitle \ -description $description \ Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v diff -u -r1.82 -r1.83 --- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 25 Jul 2007 23:59:24 -0000 1.82 +++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 28 Jul 2007 13:01:57 -0000 1.83 @@ -141,6 +141,7 @@ switch [file extension $fn] { .mp3 {set mime audio/mpeg} .cdf {set mime application/x-netcdf} + .flv {set mime video/x-flv} } } return $mime @@ -370,7 +371,15 @@ if {$upload_file ne "" && $upload_file ne "{}"} { $data set upload_file $upload_file $data set import_file [$data form_parameter upload_file.tmpfile] - $data set mime_type [$data form_parameter upload_file.content-type] + set mime_type [$data form_parameter upload_file.content-type] + if {$mime_type eq "application/octet-stream"} { + set guessed_mime_type [::xowiki::guesstype $upload_file] + my msg guess=$guessed_mime_type + if {$guessed_mime_type ne "*/*"} { + set mime_type $guessed_mime_type + } + } + $data set mime_type $mime_type } elseif {[$data exists name]} { # my log "--F no upload_file provided [lsort [$data info vars]]" if {[$data exists mime_type]} {