Sitefinity ASP.NET CMS - Content Management System

Support Forum Thread

Home >  Support >  Forums home > Sitefinity 3.x > Suggestions > download=true

Reply
Darren, 7/1/2008 9:31:53 AM
When adding a new document through the rad editor, it would be useful to be able to indicate whether to add 'download=true' to the link without having to switch to the HTML view.
While I don't mind making the modification myself through the HTML view I've had clients ask if this can be done without resorting to editing in HTML.

Reply
Darren, 7/1/2008 9:37:49 AM
Incidentally, this stemmed from an issue I'm investigating in a particular site where theres links to .sflb documents in a news article which are not being mapped back to the original .doc or .pdf documents.
All images in image libraries are working fine but the only way I can get the documents to work without using the document library controls is to edit the link and add ?download=true on the end.


Do you have any idea whether theres some way to allow documents to be added through the rad editor from a document library and downloaded/opened without making this amend to the link?

Thanks


Reply
, 7/4/2008 8:20:41 AM
Hi Darren,

Actually, you could achieve this behavior pretty easily. You should open the ~/Sitefinity/Admin/ControlTemplates/Libraries/Dialogs/DocumentEditorDialog.ascx file and in the editHolder Panel, add a checkbox input which would determine whether the file will be downloadable:

<span>Make it downloadable:</span> 
<input type="checkbox" id="downloadble" /> 

After that, in the same file, you will need to modify the insertLink function, by finding the checkbox added previously and add to the document url the download=true query string if checked:

downloadble = document.getElementById('downloadble');  
 
if (downloadble.checked)  
        closeArgument.href = selValue.value + '?download=true';  
   else 
        closeArgument.href = selValue.value; 

This should do the trick. Hope it helps.

Greetings,
Vassil Daskalov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center