Index: openacs-4/packages/attachments/www/attach.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/attach.adp,v diff -u -r1.11 -r1.12 --- openacs-4/packages/attachments/www/attach.adp 9 Nov 2008 23:29:22 -0000 1.11 +++ openacs-4/packages/attachments/www/attach.adp 29 May 2009 16:16:10 -0000 1.12 @@ -2,91 +2,81 @@ #attachments.lt_Attach_a_File_to_pret# @context;noquote@ -#attachments.lt_You_are_attaching_a_d# +

#attachments.lt_You_are_attaching_a_d#

-

+

#attachments.lt_To_attach_a_file_alre#

- -#attachments.lt_To_attach_a_file_alre# - - -

-@fs_context_bar_html;noquote@ -

-#attachments.attach_new#    #attachments.File# +#attachments.attach_new# +   + #attachments.File#   |   - #attachments.URL# + #attachments.URL# -

+ + +

@fs_context_bar_html;noquote@

+ - - - - - - - - - +
 #attachments.Name##attachments.Action##attachments.Size##attachments.Type##attachments.Last_Modified#
+ + + + + + + + + + - - - + + - - - - - + + - - - + + + + + + + + + + - - - - - - - - - - + - + +
#attachments.Type##attachments.Name##attachments.Action##attachments.Size##attachments.Last_Modified#
- @contents.name@ -( new ) + #file-storage.Folder# + #file-storage.folder_type_pretty_name# + @contents.name@ +   #attachments.lt_contentscontent_size_#s #file-storage.folder_type_pretty_name# @contents.last_modified@ - @contents.name@ -( new ) + @contents.type@ + @contents.type@ - [ -#attachments.Choose# - ] -  @contents.type@@contents.name@ + #attachments.Choose# +   + @contents.name@ + @contents.title@ + + #attachments.Choose# + #attachments.lt_contentscontent_size__1#s @contents.last_modified@ - @contents.name@ - @contents.title@ - - ( new ) - - - [ -#attachments.Choose# - ] - #attachments.lt_contentscontent_size__1#s@contents.type@@contents.last_modified@
Index: openacs-4/packages/attachments/www/attach.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/attach.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/attachments/www/attach.tcl 13 Jan 2005 13:56:08 -0000 1.9 +++ openacs-4/packages/attachments/www/attach.tcl 29 May 2009 16:16:10 -0000 1.10 @@ -15,12 +15,18 @@ set user_id [ad_conn user_id] +# Since object_id varname is also used for fs objects in the multirow +# let's keep the object_id to attach to in another var, otherwise +# choosing an existing file wouldn't work... + +set to_object_id $object_id + # We require the write permission on an object -permission::require_permission -object_id $object_id -privilege write +permission::require_permission -object_id $to_object_id -privilege write # Give the object a nasty name if it doesn't have a pretty name if {[empty_string_p $pretty_object_name]} { - set pretty_object_name "[_ attachments.Object] #$object_id" + set pretty_object_name "[_ attachments.Object] #$to_object_id" } # Load up file storage information @@ -47,13 +53,30 @@ set folder_name [lang::util::localize [fs::get_object_name -object_id $folder_id]] # Folder contents -db_multirow -unclobber contents select_folder_contents {} { +db_multirow -unclobber -extend {name_url action_url} contents select_folder_contents {} { set name [lang::util::localize $name] + if { $type eq "folder" } { + set name_url [export_vars -base "attach" { {folder_id $object_id} {object_id $to_object_id} return_url pretty_object_name}] + } else { + set action_url [export_vars -base "attach-2" {{item_id $object_id} {object_id $to_object_id} return_url pretty_object_name}] + } + } -set passthrough_vars "object_id=$object_id&return_url=[ns_urlencode $return_url]&pretty_object_name=[ns_urlencode $pretty_object_name]" +set passthrough_vars "object_id=$to_object_id&return_url=[ns_urlencode $return_url]&pretty_object_name=[ns_urlencode $pretty_object_name]" set fs_context_bar_html [attachments::context_bar -extra_vars $passthrough_vars -folder_id $folder_id] set context "[_ attachments.Attach]" +template::head::add_style -style " +.attach-fs-bar { + background-color: #F0EFF0; + color: inherit; + border-bottom: thin solid #555; +}" + +# Build URLs +set file_add_url [export_vars -base "file-add" { {object_id $to_object_id} folder_id return_url pretty_object_name}] + +set simple_add_url [export_vars -base "simple-add" { {object_id $to_object_id} folder_id return_url pretty_object_name}]