Ejemplo n.º 1
0
 protected internal override void RemoveNode(SiteMapNode node)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     lock (base._lock)
     {
         SiteMapNode node2 = (SiteMapNode)this.ParentNodeTable[node];
         if (this.ParentNodeTable.Contains(node))
         {
             this.ParentNodeTable.Remove(node);
         }
         if (node2 != null)
         {
             SiteMapNodeCollection nodes = (SiteMapNodeCollection)this.ChildNodeCollectionTable[node2];
             if ((nodes != null) && nodes.Contains(node))
             {
                 nodes.Remove(node);
             }
         }
         string url = node.Url;
         if (((url != null) && (url.Length > 0)) && this.UrlTable.Contains(url))
         {
             this.UrlTable.Remove(url);
         }
         string key = node.Key;
         if (this.KeyTable.Contains(key))
         {
             this.KeyTable.Remove(key);
         }
     }
 }
Ejemplo n.º 2
0
        protected internal override void RemoveNode(SiteMapNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            lock (_lock) {
                SiteMapNode oldParent = (SiteMapNode)ParentNodeTable[node];
                if (ParentNodeTable.Contains(node))
                {
                    ParentNodeTable.Remove(node);
                }

                if (oldParent != null)
                {
                    SiteMapNodeCollection collection = (SiteMapNodeCollection)ChildNodeCollectionTable[oldParent];
                    if (collection != null && collection.Contains(node))
                    {
                        collection.Remove(node);
                    }
                }

                string url = node.Url;
                if (url != null && url.Length > 0 && UrlTable.Contains(url))
                {
                    UrlTable.Remove(url);
                }

                string key = node.Key;
                if (KeyTable.Contains(key))
                {
                    KeyTable.Remove(key);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Context.User.Identity.IsAuthenticated)
              {
            NdiPrincipal principal = (NdiPrincipal)Context.User;

            m_organisationIdentifier = principal.OrganisationID;
              }
              else
              {
            m_organisationIdentifier = Guid.Empty;
              }

              m_programIdentifier = Guid.Empty;
              if (Session[Context.User.Identity.Name + "programIdentifier"] != null)
              {
            try
            {
              m_programIdentifier = new Guid(Session[Context.User.Identity.Name + "programIdentifier"].ToString());
            }
            catch
            {
              Session[Context.User.Identity.Name + "programIdentifier"] = null;
              m_programIdentifier = Guid.Empty;
            }
              }

              m_joboIdentifier = Guid.Empty;
              if (Session[Context.User.Identity.Name + "joboIdentifier"] != null)
              {
            try
            {
              m_joboIdentifier = new Guid(Session[Context.User.Identity.Name + "joboIdentifier"].ToString());
            }
            catch
            {
              Session[Context.User.Identity.Name + "joboIdentifier"] = null;
              m_joboIdentifier = Guid.Empty;
            }
              }

              m_jobfIdentifier = Guid.Empty;
              if (Session[Context.User.Identity.Name + "jobfIdentifier"] != null)
              {
            try
            {
              m_jobfIdentifier = new Guid(Session[Context.User.Identity.Name + "jobfIdentifier"].ToString());
            }
            catch
            {
              Session[Context.User.Identity.Name + "jobfIdentifier"] = null;
              m_jobfIdentifier = Guid.Empty;
            }
              }

              //hány elem van egy oszlopban
              if (ConfigurationManager.AppSettings["MenuRowCount"] != null && ConfigurationManager.AppSettings["MenuRowCountGuest"] != null)
              {
            if ((!int.TryParse(ConfigurationManager.AppSettings["MenuRowCount"], out m_menuSize)) || (!int.TryParse(ConfigurationManager.AppSettings["MenuRowCountGuest"], out m_menuSizeGuest)))
            {
              m_menuSize = 5;
              m_menuSizeGuest = 4;
            }
              }
              bool registered = false;
              if (Context.User is NdiPrincipal)
              {
            string role1 = ((NdiPrincipal)Context.User).OrganisationID + ".Writer";
            string role2 = ((NdiPrincipal)Context.User).OrganisationID + ".Reader";
            registered = !Context.User.IsInRole(role1) && !Context.User.IsInRole(role2);
              }
              if (!Context.User.Identity.IsAuthenticated || registered)

            m_menuSize = m_menuSizeGuest;

              //a menu sitemapomat használom a menu megjelenítéshez
              m_prov = SiteMap.Providers[SiteMapProviderName];

              //Itt át kell szerveznünk az egész menünket

              //Megcsináljuk a menünket
              SiteMapNodeCollection nodesLeft = new SiteMapNodeCollection();
              SiteMapNodeCollection nodesMiddle = new SiteMapNodeCollection();

              m_selectedNode = m_prov.CurrentNode;

              if (m_selectedNode != null)
              {
            if (m_selectedNode.ParentNode != null && m_selectedNode.ParentNode.ParentNode != null)
              m_parentNode = m_selectedNode.ParentNode;
              }

              //Bal oszlop
              int last = m_prov.RootNode.ChildNodes.Count > m_menuSize ? m_menuSize : m_prov.RootNode.ChildNodes.Count;
              for (int i = 0; i < last; i++)
              {
            SiteMapNode node = ExpandUrl(m_prov.RootNode.ChildNodes[i]);
            if (node["ProgramSelected"] == null)
            {
              nodesLeft.Add(node);
            }
            else
            {
              if (m_programIdentifier != Guid.Empty)
              {
            nodesLeft.Add(node);
              }
            }
              }
              RepeaterLeft.DataSource = nodesLeft;
              RepeaterLeft.DataBind();

              //van középső oszlopunk
              if (m_prov.RootNode.ChildNodes.Count > m_menuSize)
              {
            for (int i = last; i < m_prov.RootNode.ChildNodes.Count; i++)
            {
              if (!GetMenuVisibility("DictionaryMenu.Visibility") && m_prov.RootNode.ChildNodes[i].Title == "Szótár")
              {
              }
              else
              {
              SiteMapNode node = ExpandUrl(m_prov.RootNode.ChildNodes[i]);
            if (node["ProgramSelected"] == null)
            {
              nodesMiddle.Add(node);
            }
            else
            {
              if (m_programIdentifier != Guid.Empty)
              {
                nodesMiddle.Add(node);
              }
            }
              }
            }
            RepeaterCenter.DataSource = nodesMiddle;
            RepeaterCenter.DataBind();
              }
              else
              {
            RepeaterCenter.Visible = false;
              }

              //jobb menu
              if (m_selectedNode != null)
              {
            //almenü van kiválasztva
            if (nodesLeft.Contains(m_selectedNode) || nodesMiddle.Contains(m_selectedNode))
            {
              RepeaterRight.DataSource = (m_selectedNode.ChildNodes);
              RepeaterRight.DataBind();
            }
            else
            {
              //ha nem akarjuk, hoyg az összes főmenü itt legyen
              if (m_selectedNode.ParentNode != m_selectedNode.RootNode)
              {
            RepeaterRight.DataSource = (m_selectedNode.ParentNode.ChildNodes);
            RepeaterRight.DataBind();
              }
            }

              }
        }
 public override bool Contains(SiteMapNode node)
 {
     return(_internalCollection.Contains(node));
 }