Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Security > Pages: Allow edition, but not moving pages

Pages: Allow edition, but not moving pages

  • Lucas avatar

    Posted on Sep 10, 2010 (permalink)

    Hi,

    Is there a way to allow users to edit pages, but not creating/deleting/moving them?
    I have tried
    - View OK
    - Create --
    - Modify OK
    - Delete --
    - Change Properties OK
    - Modify Layout --

    but they are still able to drag pages around in the administration

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Sep 10, 2010 (permalink)

    Hello Lucas,

    You can modify RadTreeView inside Sitefinity\Admin\ControlTemplates\Pages\SiteMapPanel.ascx and set EnableDragAndDropBetweenNodes to false.  You could also disable LinkButtons inside SiteMapTools div.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Lucas avatar

    Posted on Sep 10, 2010 (permalink)

    So there's no "Don't touch that frikking sitemap" user right?

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Sep 10, 2010 (permalink)

    Hi Lucas,

    There is no right that you can use to stop drag and drop for a single page. The permissions you have set works for a single page in the entire tree, but DragAndDrop option comes form the RadTreeView control. You can create some granularity by seting AllowDrag and AllowDrop properties for specific nodes only, but this require to set these permissions from the control instance.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Lucas avatar

    Posted on Sep 10, 2010 (permalink)

    Ok.

    If you review the user rights, I think allowing users to update page content without allowing them to modify the sitemap would be great (otherwise, the "Delete" right serves little purpose since users can move the page to an other location).

    Thanks for your help.

    Reply

  • Olivier avatar

    Posted on Oct 29, 2010 (permalink)

    Hi,

    Then, is it possible to easily display a prompt or warning message when someone moves a page, to avoid accidents ?

    Thanks

    Olivier

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Oct 29, 2010 (permalink)

    Hi Olivier,

    You can subscribe for TreeViewBeforeDropHandler function from the client.

    <script type="text/javascript">
     
        function TreeViewBeforeDropHandler(sender, eventArgs) {
            alert('test');
        }
    </script>


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Olivier avatar

    Posted on Nov 2, 2010 (permalink)

    Hi Ivan,

    I added the function in Pages.aspx and even if the function is empty, after a drag and drop, there's a postback but the page doesnt move.

    The function is called, when I manually cancel ( eventArgs.set_cancel(true); ) it works well and there's no postback.

    Am I missing something ?

    Thank you,

    Olivier

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Nov 2, 2010 (permalink)

    Hi Olivier,

    You should implement methods for moving the node or canceling the event

    <script type="text/javascript">
     
        function TreeViewBeforeDropHandler(sender, eventArgs) {
            confirmFn(eventArgs);
        }
     
        function confirmFn(arg) {
            if (confirm("Are you sure?")) {
                var sourceNode = arg.get_sourceNode();
                var destNode = arg.get_destNode();
                var dropPosition = arg.get_dropPosition();
     
                if (sourceNode && destNode)
                    siteMapPanel.ChangeParent(sourceNode.get_value(), destNode.get_value(), dropPosition)
            }
            else {
                alert("Drag-and-drop has been canceled");
            }
     
        }
    </script>

    You can gather more information about the Client-Side API at Client-Side Programming Basics

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Olivier avatar

    Posted on Nov 2, 2010 (permalink)

    Thank you, it's exactly what I was missing and what I needed.

    I didnt realize we had to call ChangeParent...

    And btw, adding a "args.set_cancel(true);" to the else will save from a postback.

    Olivier

    Reply

  • Connections Academy Developer Intermediate avatar

    Posted on Apr 21, 2011 (permalink)

    I had to edit Ivan's code block to fix an IE8 issue; one line was missing (line 16 below).

    01.<script type="text/javascript">
    02.  
    03.    function TreeViewBeforeDropHandler(sender, eventArgs) {
    04.        confirmFn(eventArgs);
    05.    }
    06.  
    07.    function confirmFn(arg) {
    08.        if (confirm("Are you sure?")) {
    09.            var sourceNode = arg.get_sourceNode();
    10.            var destNode = arg.get_destNode();
    11.            var dropPosition = arg.get_dropPosition();
    12.  
    13.            if (sourceNode && destNode)
    14.                siteMapPanel.ChangeParent(sourceNode.get_value(), destNode.get_value(), dropPosition);
    15. 
    16.            arg.set_cancel(true); // Ivan's post was missing this line.
    17.        }
    18.        else {
    19.            alert("Drag-and-drop has been canceled");
    20.        }
    21.  
    22.    }
    23.</script>

    Thanks,

    Michael Snyder
    ConnectionsAcademy.com

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Security > Pages: Allow edition, but not moving pages