Beispiel #1
0
        public string RaiseClientAPICallbackEvent(string eventArgument)
        {
            string[]           aryArgs    = eventArgument.Split(ClientAPI.COLUMN_DELIMITER.ToCharArray()[0]);
            string             strNodeXml = "<root>" + aryArgs[0] + "</root>";
            MenuNodeCollection objNodes   = new MenuNodeCollection(strNodeXml, "", this);

            MenuNode objNode = objNodes[0];

            if (objNode != null)
            {
                if (PopulateOnDemandEvent != null)
                {
                    PopulateOnDemandEvent(this, new DNNMenuEventArgs(objNode));
                }
                MenuNode objTNode = this.FindNode(objNode.ID);   //if whole Menu was populated (i.e. LoadXml, then use the node from the Menu

                if (objTNode != null)
                {
                    return(objTNode.XmlNode.InnerXml);
                }
                else //if only passed in node object was updated then use that xml.
                {
                    return(objNode.XmlNode.InnerXml);
                }
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        public int Add(string strID, string strKey, string strText, string strNavigateURL, string strJSFunction, string strTarget, string strToolTip, bool blnEnabled, string strCSSClass, string strCSSClassSelected,
                       // MenuNode
                       string strCSSClassHover, bool blnSelected, eClickAction enumClickAction, string strCssClassOver, int intImageIndex)
        {
            int      intIndex = this.Add();
            MenuNode objNode  = this[intIndex];

            if (!String.IsNullOrEmpty(strID))
            {
                objNode.ID = strID;
            }
            else
            {
                objNode.ID = objNode.ParentNameSpace + "_" + this.XMLNode.ChildNodes.Count;
            }
            objNode.Key              = strKey;
            objNode.Text             = strText;
            objNode.NavigateURL      = strNavigateURL;
            objNode.JSFunction       = strJSFunction;
            objNode.Target           = strTarget;
            objNode.ToolTip          = strToolTip;
            objNode.Enabled          = blnEnabled;
            objNode.CSSClass         = strCSSClass;
            objNode.CSSClassSelected = strCSSClassSelected;
            objNode.CSSClassHover    = strCSSClassHover;
            objNode.Selected         = blnSelected;
            objNode.ClickAction      = enumClickAction;
            //objNode.CheckBox = blnCheckBox
            objNode.CssClassOver = strCssClassOver;
            objNode.ImageIndex   = intImageIndex;

            return(intIndex);
        }
Beispiel #3
0
        private string GetNodeCss(MenuNode oNode)
        {
            string sNodeCss = oNode.DNNMenu.CssClass;

            if (oNode.Level > 0)
            {
                sNodeCss = oNode.DNNMenu.DefaultChildNodeCssClass;
            }
            if (!String.IsNullOrEmpty(oNode.CSSClass))
            {
                sNodeCss = oNode.CSSClass;
            }

            if (oNode.Selected)
            {
                if (!String.IsNullOrEmpty(oNode.CSSClassSelected))
                {
                    sNodeCss += " " + oNode.CSSClassSelected;
                }
                else
                {
                    sNodeCss += " " + oNode.DNNMenu.DefaultNodeCssClassSelected;
                }
            }

            return(sNodeCss);
        }
 public int Add( string strText ) // MenuNode
 {
     MenuNode objNode = new MenuNode();
     int intIndex = this.Add( objNode );
     objNode.Text = strText;
     return intIndex;
 }
Beispiel #5
0
		public void LocaliseNode(MenuNode node)
		{
            var tab = (node.TabId > 0) ? TabController.Instance.GetTab(node.TabId, Null.NullInteger, false) : null;
			if (tab != null)
			{
				var localised = LocaliseTab(tab);
				tab = localised ?? tab;

				if (localised != null)
				{
					node.TabId = tab.TabID;
					node.Text = tab.TabName;
					node.Enabled = !tab.DisableLink;
					if (!tab.IsVisible)
					{
						node.TabId = -1;
					}
				}

				node.Title = tab.Title;
				node.Description = tab.Description;
				node.Keywords = tab.KeyWords;
			}
			else
			{
				node.TabId = -1;
			}

			node.Children.ForEach(LocaliseNode);
		}
Beispiel #6
0
        // MenuNode
        public int Add(string strText)
        {
            MenuNode objNode  = new MenuNode();
            int      intIndex = this.Add(objNode);

            objNode.Text = strText;
            return(intIndex);
        }
Beispiel #7
0
        //Public Sub Clear()
        //	Dim i As Integer
        //	For i = Me.XMLNode.ChildNodes.Count - 1 To 0 Step -1
        //		Me.XMLNode.RemoveChild(Me.XMLNode.ChildNodes[i])
        //	Next
        //End Sub

        public bool Contains(MenuNode value)
        {
            if (this.FindNode(value.ID) == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #8
0
        public int Add(MenuNode objNode)   // MenuNode
        {
            int intIndex = base.Add(objNode);

            objNode.SetDNNMenu(m_objDNNMenu);
            //ChildNodes.count is not guaranteed to be unique... GetHashCode should be a little safer (I assume it is medium trust safe...
            if (objNode.ID.Length == 0)
            {
                objNode.ID = objNode.ParentNameSpace + "_" + objNode.GetHashCode(); //Me.XMLNode.ChildNodes.Count
            }
            return(intIndex);
        }
Beispiel #9
0
        //public new MenuNode this[string index]
        //{
        //    get
        //    {
        //        int idx;
        //        if (int.TryParse(index, out idx))
        //        {
        //            return this[idx];
        //        }
        //        return null;
        //    }
        //    set { throw new Exception("Cannot Assign Node Directly"); }
        //}

        public int IndexOf(MenuNode value)
        {
            int i;

            for (i = 0; i <= this.XMLNode.ChildNodes.Count; i++)
            {
                if (new MenuNode(this.XMLNode.ChildNodes[i], m_objDNNMenu).ID == value.ID)
                {
                    return(i);
                }
            }
            return(-1);
        }
Beispiel #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="eventArgument"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [Jon Henning]	5/6/2005	Created
        /// </history>
        public virtual void RaisePostBackEvent(string eventArgument)
        {
            string[] args = eventArgument.Split(ClientAPI.COLUMN_DELIMITER.ToCharArray()[0]);

            MenuNode Node = MenuNodes.FindNode(args[0]);

            if (!(Node == null))
            {
                if (args.Length > 1)
                {
                    switch (args[1])
                    {
                    case "Click":

                        Node.Click();
                        break;

                    case "Checked":

                        Node.Selected = !Node.Selected;
                        break;

                    case "OnDemand":

                        if (PopulateOnDemandEvent != null)
                        {
                            PopulateOnDemandEvent(this, new DNNMenuEventArgs(Node));
                        }
                        break;
                    }
                }
                else
                {
                    //assume an event with no specific argument to be a click
                    Node.Click();
                }
            }
        }
Beispiel #11
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [jhenning]	9/21/2005	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Render(HtmlTextWriter writer)
        {
            MenuNode objLastNode = null;
            string   strParentID = "";

            if (m_objNode.DNNMenu.SelectedMenuNodes.Count > 0)
            {
                objLastNode = (MenuNode)m_objNode.DNNMenu.SelectedMenuNodes[m_objNode.DNNMenu.SelectedMenuNodes.Count];
            }

            if ((m_objNode.Parent != null))
            {
                strParentID = m_objNode.Parent.ID;
            }

            if (objLastNode == null || m_objNode.Selected || objLastNode.ID == m_objNode.ID || objLastNode.ID == strParentID || this.ForceFullMenu)
            {
                RenderContents(writer);
            }

            if (m_objNode.HasNodes && (m_objNode.Selected || this.ForceFullMenu))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Child");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                if (this.ForceFullMenu || this.Orientation == Orientation.Vertical)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                }
                else
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                }
                RenderChildren(writer);
                writer.RenderEndTag();
            }
        }
Beispiel #12
0
 public void Remove(MenuNode value)
 {
     this.XMLNode.RemoveChild(value.XmlNode);
 }
Beispiel #13
0
 public void Insert(int index, MenuNode value)
 {
     this.XMLNode.InsertAfter(this.XMLNode.ChildNodes[index], value.XmlNode);
 }
        //Public Sub Clear()
        //	Dim i As Integer
        //	For i = Me.XMLNode.ChildNodes.Count - 1 To 0 Step -1
        //		Me.XMLNode.RemoveChild(Me.XMLNode.ChildNodes(i))
        //	Next
        //End Sub

        public bool Contains( MenuNode value )
        {
            if( this.FindNode( value.ID ) == null )
            {
                return false;
            }
            else
            {
                return true;
            }
        }
 public DNNMenuNodeClickEventArgs( MenuNode Node )
 {
     this._node = Node;
 }
        private string GetNodeCss( MenuNode oNode )
        {
            string sNodeCss = oNode.DNNMenu.CssClass;

            if( oNode.Level > 0 )
            {
                sNodeCss = oNode.DNNMenu.DefaultChildNodeCssClass;
            }
            if( oNode.CSSClass.Length > 0 )
            {
                sNodeCss = oNode.CSSClass;
            }

            if( oNode.Selected )
            {
                if( oNode.CSSClassSelected.Length > 0 )
                {
                    sNodeCss += " " + oNode.CSSClassSelected;
                }
                else
                {
                    sNodeCss += " " + oNode.DNNMenu.DefaultNodeCssClassSelected;
                }
            }

            return sNodeCss;
        }
Beispiel #17
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="Node"></param>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///     [jhenning]	9/21/2005	Created
 /// </history>
 /// -----------------------------------------------------------------------------
 public void RenderNode(HtmlTextWriter writer, MenuNode Node)
 {
     m_objNode = Node;
     Render(writer);
 }
 public int Add( MenuNode objNode ) // MenuNode
 {
     int intIndex = base.Add( objNode );
     objNode.SetDNNMenu( m_objDNNMenu );
     //ChildNodes.count is not guaranteed to be unique... GetHashCode should be a little safer (I assume it is medium trust safe...
     if( objNode.ID.Length == 0 )
     {
         objNode.ID = objNode.ParentNameSpace + "_" + objNode.GetHashCode(); //Me.XMLNode.ChildNodes.Count
     }
     return intIndex;
 }
Beispiel #19
0
 public DNNMenuEventArgs(MenuNode node)
 {
     this._node = node;
 }
 public DNNMenuEventArgs( MenuNode node )
 {
     this._node = node;
 }
		private string GetNodeCss(MenuNode oNode)
		{
			string sNodeCss = oNode.DNNMenu.CssClass;

			if (oNode.Level > 0) sNodeCss = oNode.DNNMenu.DefaultChildNodeCssClass; 
			if (!String.IsNullOrEmpty(oNode.CSSClass)) sNodeCss = oNode.CSSClass; 

			if (oNode.Selected)
			{
				if (!String.IsNullOrEmpty(oNode.CSSClassSelected))
				{
                        sNodeCss += " " + oNode.CSSClassSelected;
				}
				else
				{
                        sNodeCss += " " + oNode.DNNMenu.DefaultNodeCssClassSelected;
				}
			}

			return sNodeCss;
		}
 private void AddSeparator(string strType, DNNNode objPrevNode, DNNNode objNextNode, MenuNode objMenuItem)
 {
     string strLeftHTML = SeparatorLeftHTML + SeparatorLeftHTMLBreadCrumb + SeparatorLeftHTMLActive;
     string strRightHTML = SeparatorRightHTML + SeparatorRightHTMLBreadCrumb + SeparatorRightHTMLActive;
     string strHTML = SeparatorHTML + strLeftHTML + strRightHTML;
     if (!String.IsNullOrEmpty(strHTML))
     {
         string strSeparator = "";
         string strSeparatorLeftHTML = "";
         string strSeparatorRightHTML = "";
         string strSeparatorClass = "";
         string strLeftSeparatorClass = "";
         string strRightSeparatorClass = "";
         if (string.IsNullOrEmpty(strLeftHTML) == false)
         {
             strLeftSeparatorClass = GetSeparatorText(CSSLeftSeparator, CSSLeftSeparatorBreadCrumb, CSSLeftSeparatorSelection, objNextNode);
             strSeparatorLeftHTML = GetSeparatorText(SeparatorLeftHTML, SeparatorLeftHTMLBreadCrumb, SeparatorLeftHTMLActive, objNextNode);
         }
         if (string.IsNullOrEmpty(SeparatorHTML) == false)
         {
             if (!String.IsNullOrEmpty(CSSSeparator))
             {
                 strSeparatorClass = CSSSeparator;
             }
             strSeparator = SeparatorHTML;
         }
         if (string.IsNullOrEmpty(strRightHTML) == false)
         {
             strRightSeparatorClass = GetSeparatorText(CSSRightSeparator, CSSRightSeparatorBreadCrumb, CSSRightSeparatorSelection, objNextNode);
             strSeparatorRightHTML = GetSeparatorText(SeparatorRightHTML, SeparatorRightHTMLBreadCrumb, SeparatorRightHTMLActive, objNextNode);
         }
         if (string.IsNullOrEmpty(strSeparatorRightHTML) == false)
         {
             objMenuItem.RightHTML += GetSeparatorMarkup(strRightSeparatorClass, strSeparatorRightHTML);
         }
         if (string.IsNullOrEmpty(strSeparator) == false && strType == "All")
         {
             objMenuItem.LeftHTML += GetSeparatorMarkup(strSeparatorClass, strSeparator);
         }
         if (string.IsNullOrEmpty(strSeparatorLeftHTML) == false)
         {
             objMenuItem.LeftHTML += GetSeparatorMarkup(strLeftSeparatorClass, strSeparatorLeftHTML);
         }
     }
 }
 public void Insert( int index, MenuNode value )
 {
     this.XMLNode.InsertAfter( this.XMLNode.ChildNodes[index], value.XmlNode );
 }
Beispiel #24
0
 public DNNMenuNodeClickEventArgs(MenuNode Node)
 {
     this._node = Node;
 }
 public void Remove( MenuNode value )
 {
     this.XMLNode.RemoveChild( value.XmlNode );
 }
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// 
		/// </summary>
		/// <param name="writer"></param>
		/// <param name="Node"></param>
		/// <remarks>
		/// </remarks>
		/// <history>
		/// 	[jhenning]	9/21/2005	Created
		/// </history>
		/// -----------------------------------------------------------------------------
		public void RenderNode(HtmlTextWriter writer, MenuNode Node)
		{
			m_objNode = Node;
			Render(writer);
		}
 public int IndexOf( MenuNode value )
 {
     int i;
     for( i = 0; i <= this.XMLNode.ChildNodes.Count; i++ )
     {
         if( new MenuNode( this.XMLNode.ChildNodes[i], m_objDNNMenu ).ID == value.ID )
         {
             return i;
         }
     }
     return 0;
 }