Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan 1 post 21 karma points
    Apr 12, 2010 @ 18:46
    Dan
    0

    Problem: removing 'Delete' from the context menu.

    Version: 4

    .net: 3.5

    OS / IIS: 7 / 7

     

    When removing delete from the context menu with the following code:

    -------------------------------------------------------------------------------------------------------------------

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    // use the constructer to wire up the events

     

     

    public

    EventService()

    {

    umbraco.cms.presentation.Trees.

     

    BaseTree.BeforeNodeRender += new umbraco.cms.presentation.Trees.BaseTree.BeforeNodeRenderEventHandler

    (BaseTree_BeforeNodeRender);

    }

     

    // Before the loading of each node, we are going to check it and see if it has children and the current user is an admin.

     

     

    void BaseTree_BeforeNodeRender(ref umbraco.cms.presentation.Trees.XmlTree sender, ref umbraco.cms.presentation.Trees.XmlTreeNode node, EventArgs

    e)

    {

     

    //if the current user is an admin or there are no child nodes.. show the delete, otherwise remove it.

     

    if (node.HasChildren && !User

    .GetCurrent().IsAdmin() )

    {

    node.Menu.Remove(umbraco.BusinessLogic.Actions.

     

    ActionDelete

    .Instance);

    ------------------------------------------------------------------------------------------------------------------------------------------------------

    This is correctly removing 'Delete' from the context menu (when the if evaluates to true), but when rendering the media picker (when the if evaluates to true) it doesn't render any of the sub media folders. It simply shows the 'Media' folder with no sub folders etc. Removing this code makes the media picker behave correctly again.

    Is there a quick fix for this? Please let me know.

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Apr 12, 2010 @ 23:45
    Aaron Powell
    0

    Can't you just use user permissions to remove delete?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies