RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Third Party Contributions > Plug-Ins

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 10-18-2006, 06:58 PM
Registered User
 
Join Date: Oct 2006
Posts: 8
Downloads: 0
Uploads: 0
Default Download attachment link in message view

I figured out how to add a download attachments link when viewing the messages.

modify the code in program/steps/mail/show.inc line 112
from:
Code:
    $out .= sprintf('<li><a href="%s&amp;_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n",
            htmlentities($GET_URL),
            $attach_prop['part_id'],
            $JS_OBJECT_NAME,
            $attach_prop['part_id'],
            $attach_prop['mimetype'],
            $attach_prop['filename']);
To:
Code:
    $out .= sprintf('<li><a href="%s&amp;_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a> [<a href="%s&amp;_part=%s&amp;_download=1">%s</a>]</li>'."\n",
            htmlentities($GET_URL),
            $attach_prop['part_id'],
            $JS_OBJECT_NAME,
            $attach_prop['part_id'],
            $attach_prop['mimetype'],
            $attach_prop['filename'],
            htmlentities($GET_URL),
            $attach_prop['part_id'],
          	rcube_label('download'));
This puts a download link next to the link with the attachment name.

Don't forget to back up the original file.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 10-18-2006, 11:44 PM
Registered User
 
Join Date: Oct 2006
Posts: 8
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

Thanks for an excellent and useful modification
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 10-20-2006, 02:24 PM
Registered User
 
Join Date: Oct 2006
Posts: 8
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

glad to help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-01-2007, 01:57 PM
kmn kmn is offline
Registered User
 
Join Date: May 2007
Posts: 41
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

Hello,

The code hack above does not apply to latest rc. What change does it need?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 08-09-2007, 05:31 AM
Registered User
 
Join Date: Aug 2007
Posts: 1
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

I'm using the SVN #657. I suppose that for other versions this should work (in 0.1-rc1 this code starts on line 130).

You should replace this:
Code:
    $out .= sprintf('<li><a href="%s&amp;_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n",
            htmlspecialchars($GET_URL),
            $attach_prop->mime_id,
            JS_OBJECT_NAME,
            $attach_prop->mime_id,
            $attach_prop->mimetype,
            $attach_prop->filename);
with this:

Code:
    $out .= sprintf('<li><a href="%s&amp;_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a> [<a href="%s&amp;_part=%s&amp;_download=1">%s</a>]</li>'."\n",
            htmlspecialchars($GET_URL),
            $attach_prop->mime_id,
            JS_OBJECT_NAME,
            $attach_prop->mime_id,
            $attach_prop->mimetype,
            $attach_prop->filename,
            htmlspecialchars($GET_URL),
            $attach_prop->mime_id,
            rcube_label('download'));
Thanks qpmailman!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 08-15-2007, 11:24 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

Here Is Another Method Just Showing 1 Link To Click On Saying Download Attachment - filename
( ie [Download Attachment - roundcube.zip )

this is what the user will see not the filename which they were also able to click on as well as the download link, meaning it had 2 links to download the attachment

i come to an conclusion that i only needed 1 link and not 2 with the filename showing also

So here is how i achieved this method

Open show.inc ( program/steps/mail )

Find

$out .= sprintf('<li><a href="%s&amp;_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n",
htmlspecialchars($GET_URL),
$attach_prop->mime_id,
JS_OBJECT_NAME,
$attach_prop->mime_id,
$attach_prop->mimetype,
$attach_prop->filename);

Replace With

$out .= sprintf('<li><a href="%s&amp;_part=%s&amp;_download=1">%s</a> - %s</li>'."\n",
htmlspecialchars($GET_URL),
$attach_prop->mime_id,
rcube_label('Download Attachment'),
$attach_prop->filename);

The Above Will Show [Download Attachment] - filename.zip

(instead of just file name without the filename being a link)

Hope This Helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 09-14-2007, 06:18 PM
kmn kmn is offline
Registered User
 
Join Date: May 2007
Posts: 41
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

Thanks rhuckle.

Exactly what I was looking for.

Regards

kmn
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 03-11-2008, 08:40 PM
Registered User
 
Join Date: Mar 2008
Posts: 1
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

Just an after thought, but where you're using rube_label('Download Attachment'), it would be better to put something like rcube_label('download_attachment'). Then you can add download_attachment to your localization file, with a full description... Something like $labels['download_attachment'] = "Download this attachment".
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 03-12-2008, 09:40 PM
Registered User
 
Join Date: Oct 2006
Posts: 8
Downloads: 0
Uploads: 0
Default Re: Download attachment link in message view

I'm using SVN 1190, and the download link added in by the code in Light Shadow's post doesn't seem to work properly.

It behaves the same as me clicking on the attachment link - starts loading the binary file (doc, pdf, etc) in the current window as text. When I right click and choose save link as, the filename has .htm appended to it.

What can I do to fix this?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 09:28 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community