Document Manager Link tool

2 posts, 0 answers
  1. Peter Livsey
    Peter Livsey avatar
    44 posts
    Member since:
    Aug 2012

    Posted 18 Nov 2008 Link to this post


    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 of the editor.

  2. Stanimir
    Stanimir avatar
    1654 posts

    Posted 18 Nov 2008 Link to this post

    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/ .

    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;  
        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);  
        return false;  

    I hope this helps.

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top