+1-888-365-2779
Try Now
More in this section

Forums / Security / Pages: Allow edition, but not moving pages

Pages: Allow edition, but not moving pages

11 posts, 0 answered
  1. Lucas
    Lucas avatar
    65 posts
    Registered:
    22 Mar 2010
    10 Sep 2010
    Link to this post
    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
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Sep 2010
    Link to this post
    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
  3. Lucas
    Lucas avatar
    65 posts
    Registered:
    22 Mar 2010
    10 Sep 2010
    Link to this post
    So there's no "Don't touch that frikking sitemap" user right?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Sep 2010
    Link to this post
    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
  5. Lucas
    Lucas avatar
    65 posts
    Registered:
    22 Mar 2010
    10 Sep 2010
    Link to this post
    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.
  6. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    29 Oct 2010
    Link to this post
    Hi,

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

    Thanks

    Olivier
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Oct 2010
    Link to this post
    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
  8. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    02 Nov 2010
    Link to this post
    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
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Nov 2010
    Link to this post
    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
  10. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    02 Nov 2010
    Link to this post
    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
  11. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    21 Apr 2011
    Link to this post
    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
Register for webinar
11 posts, 0 answered