Disable Directory Deleting and Renaming

2 posts, 0 answers
  1. Stephanie
    Stephanie avatar
    139 posts
    Member since:
    Aug 2013

    Posted 03 Sep Link to this post

    How do I disable the rename and delete options for the context menu for the Image Manager window? I see the info about using external dialogs, but how do I set that up when the ImageManager is being called from within the Editor?
  2. Rumen
    Rumen avatar
    12782 posts

    Posted 05 Sep Link to this post


    There are two approaches that you can try and/or combine to achieve your scenario:

    Approach 1) The permissions given to the Image Manager depend on the paths set to its ViewPaths, UploadPaths and DeletePaths properties.

    For example, if you have the following folder structure:

          - Root
                  - Folder1
                  - Folder2

    the configuration below will give all permissions to Folder1, view and delete permissions to Folder2 and only view permissions to the Root directory:
    Copy Code
    <telerik:RadEditor runat="server" ID="RadEditor1">
        <ImageManager ViewPaths="~/Root" DeletePaths="~/Root/Folder1, ~/Root/Folder2" UploadPaths="~/Root/Folder1"/>

    Approach 2) If the above configuration is not enough, you can customize the FileBrowser dialog. You can read more about that here—http://demos.telerik.com/aspnet-ajax/editor/examples/externaldialogspath/defaultcs.aspx.

    Further, once getting the FileBrowser.ascx file you can use the FileExplorer's OnClientLoad and OnClientMove events to change the desired UI elements:
    Copy Code
        function OnClientLoad(sender, args) {
            // Remove rename option from grid's context menu
            var gridRenameCmd = sender.get_gridContextMenu().findItemByText("Rename");
            // Remove rename option from tree's context menu
            var treeRenameCmd = sender.get_tree().get_contextMenus()[0].findItemByText("Rename");
            // The same can be done for the delete option
                 //disable drag and drop
        function OnClientMove(sender, args) {
    <telerik:RadFileExplorer ID="RadFileExplorer1" Height="450px" Width="400px" TreePaneWidth="150px"
        runat="Server" EnableOpenFile="false" AllowPaging="true" PageSize="100" OnClientLoad="OnClientLoad" OnClientMove="OnClientMove"/>

    You can find attached an example that illustrates the suggestion above.

    Best regards,
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top