Copied to clipboard

Flag this post as spam?

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


  • Kevon K. Hayes 255 posts 281 karma points
    Jan 10, 2011 @ 19:13
    Kevon K. Hayes
    0

    XSLT Node not rendering when I add the following Context Menu???

    Not sure what but something in my code is causing my XSLT Node in teh Dev section to not render it's childnodes.  If I remove the solution for the /bin it XSLT node renders fine.

    namespace corMailContextMenu
    {
        public class corMailContextMenuItem:ApplicationBase
        {
            Node node1;

            public corMailContextMenuItem()
            {
                umbraco.cms.presentation.Trees.BaseTree.BeforeNodeRender += new umbraco.cms.presentation.Trees.BaseTree.BeforeNodeRenderEventHandler(BaseTree_BeforeNodeRender);
            }

            void BaseTree_BeforeNodeRender(ref umbraco.cms.presentation.Trees.XmlTree sender, ref umbraco.cms.presentation.Trees.XmlTreeNode node, EventArgs e)
            {
                node1 = new Node(Convert.ToInt16(node.NodeID));

                if (node.NodeType == "content" && node1.NodeTypeAlias == "corNewsletter")
                {
                    try
                    {
                        node.Menu.Insert(14, new MailActionItem());
                    }
                    catch(Exception ExActionItemAdd)
                    {
                        umbraco.BusinessLogic.Log.Add(LogTypes.Error, Convert.ToInt16(node.NodeID), ExActionItemAdd.StackTrace.ToString());
                    }

                }
            }
        }

        public class MailActionItem : umbraco.interfaces.IAction
        {
            #region IAction Members
            private string _alias = "Mail it Out";
            public string Alias
            {
                get { return _alias; }
            }

            public bool CanBePermissionAssigned
            {
                get { return true; }
            }

            public string Icon
            {
                get { return "http://me.kevon.me/media/mail.png"; }
            }

            public string JsFunctionName
            {
                get
                {
                    //return "CallAlert();";
                    return "GetMailForm();";
                }
            }

            public string JsSource
            {
                get
                {
                    //return "function CallAlert(){ alert('Hey'); }";

                    return "function GetMailForm() { UmbClientMgr.openModalWindow('/umbraco/dialogs/mailform.aspx' , 'Mailer', true,  400, 450, '', '', '', '');}";

                }
            }

            public char Letter
            {
                get { return 'ยจ'; }
            }

            public bool ShowInNotifier
            {
                get { return false; }
            }

            #endregion
        }
    }

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 10, 2011 @ 20:07
    Dirk De Grave
    0

    For sake of testing, have you tried the AfterNodeRender event instead of BeforeNodeRender?

     

    Cheers,

    /Dirk

  • Kevon K. Hayes 255 posts 281 karma points
    Jan 10, 2011 @ 21:37
    Kevon K. Hayes
    0

    Dirk that didnt work either. Log just shows  Treeservice error... this has been common since i installed Umbraco.

  • Kevon K. Hayes 255 posts 281 karma points
    Mar 15, 2011 @ 17:51
    Kevon K. Hayes
    0

    <freezingInTheColdForMonths>
          faint cry for help as he takes his last breaths...
    </freezingInTheColdForMonths>

  • Alex 78 posts 136 karma points
    Mar 15, 2011 @ 18:41
    Alex
    0

    I have no experience what so ever with the Context Menu, but my first inital thought would be perhaps your node1 load is throwing an error. I would split your if criteria into 2 seperate statements and move your node1 load inside the first as a quick test.

                if (node.NodeType == "content")
               
    {
                   
    try
                   
    { node1 = new Node(Convert.ToInt16(node.NodeID)); if (node1.NodeTypeAlias == "corNewsletter") {
                        node
    .Menu.Insert(14, new MailActionItem()); }
                   
    }
                   
    catch(Exception ExActionItemAdd)
                   
    {
                        umbraco
    .BusinessLogic.Log.Add(LogTypes.Error, Convert.ToInt16(node.NodeID), ExActionItemAdd.StackTrace.ToString());
                   
    }

               
    }
  • 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