This is a migrated thread and some comments may be shown as answers.

Document Manager Link tool

1 Answer 70 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Peter Livsey
Top achievements
Rank 1
Peter Livsey asked on 18 Nov 2008, 10:03 AM
Hi

We have added the document manager to our toolsfile.xml - 
    <tool name="DocumentManager"/> - and are using this to allow content editors to add links to documents in the site collection documents library.  They can also upload documents if needed.  When the link is added to the page it adds the following markup:

<a href="/sites/sitename/SiteCollectionDocuments/somedocument.pdf">somedocument.pdf</a>

What we would like to do is expand of the markup that is added to do the following:
  • Add an appropriate image befoere the links (pfd icon, word icon etc)
  • Add the document file size

The markup added would ideally be

<img src="/sites/sitename/Style%20Library/en-us/Images/icon_pdf.gif" alt="PDF Icon" title="PDF Icon" /><a href="/sites/sitename/SiteCollectionDocuments/somedocument.pdf" title="somedocument.pdf">somedocument.pdf</a> (32kb)

Is it possible to amend the functionality of the Document Manager to capture/add the extra information to the markup that is return? Or is there any existing functionality that we can use?

We are currently using version 5.2.0.0 of the editor.

Thanks
Peter

1 Answer, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 18 Nov 2008, 04:13 PM
Hi Peter,

You can modify the content that DocumentManager returns by adding the following java script code in MOSSEditorTools.js file. This file is located at /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.2.3.0__1f131a624888eeed/Resources/ .

Telerik.Web.UI.Editor.CommandList["DocumentManager"] = function(commandName, editor, args)  
{  
    var argument = {};  
    var callbackFunction = function(sender, args)  
    {  
        //args.Result - is the anchor dom element  
        //this the html that you want to paste  
        var htmlResult = args.Result.outerHTML;  
        editor.pasteHtml(htmlResult);  
    }  
  
    var oldAdditionalQueryString = editor.get_dialogOpener().get_additionalQueryString();  
    var selectedElement = editor.getSelectedElement();  
    if (selectedElement && selectedElement.tagName.toLowerCase() == "a")  
    {  
        editor.get_dialogOpener().set_additionalQueryString(oldAdditionalQueryString + "&PreselectedItemUrl=" + encodeURIComponent(selectedElement.href));  
    }  
  
    editor.showDialog("DocumentManager", argument, callbackFunction);  
    editor.get_dialogOpener().set_additionalQueryString(oldAdditionalQueryString);  
    return false;  
};  


I hope this helps.


Sincerely yours,
Stanimir
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
WebParts for SharePoint
Asked by
Peter Livsey
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Share this question
or