private static void AddChildActions(ModuleAction objParentAction, Node objParentNode, Node objRootNode, IActionControl objActionControl, int intDepth)
 {
     bool blnPending;
     foreach (ModuleAction objAction in objParentAction.Actions)
     {
         blnPending = IsActionPending(objParentNode, objRootNode, intDepth);
         if (objAction.Title == "~")
         {
             if (blnPending == false)
             {
                 objParentNode.Nodes.AddBreak();
             }
         }
         else
         {
             if (objAction.Visible == true && (objAction.Secure != SecurityAccessLevel.Anonymous || ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "EDIT", objActionControl.ModuleControl.ModuleContext.Configuration)) && ModulePermissionController.HasModuleAccess(objAction.Secure, Null.NullString, objActionControl.ModuleControl.ModuleContext.Configuration))
             {
                 if (blnPending)
                 {
                     objParentNode.HasNodes = true;
                 }
                 else
                 {
                     Node objNode;
                     int i = objParentNode.Nodes.Add();
                     objNode = objParentNode.Nodes[i];
                     objNode.ID = objAction.ID.ToString();
                     objNode.Key = objAction.ID.ToString();
                     objNode.Text = objAction.Title;
                     if (!String.IsNullOrEmpty(objAction.ClientScript))
                     {
                         objNode.JSFunction = objAction.ClientScript;
                         objNode.ClickAction = eClickAction.None;
                     }
                     else
                     {
                         objNode.NavigateURL = objAction.Url;
                         if (objAction.UseActionEvent == false && !String.IsNullOrEmpty(objNode.NavigateURL))
                         {
                             objNode.ClickAction = eClickAction.Navigate;
                             if (objAction.NewWindow)
                             {
                                 objNode.Target = "_blank";
                             }
                         }
                         else
                         {
                             objNode.ClickAction = eClickAction.PostBack;
                         }
                     }
                     objNode.Image = objAction.Icon;
                     if (objAction.HasChildren())
                     {
                         AddChildActions(objAction, objNode, objRootNode, objActionControl, intDepth);
                     }
                 }
             }
         }
     }
 }
 private static void AddChildActions(ModuleAction objParentAction, Node objParentNode, IActionControl objActionControl)
 {
     AddChildActions(objParentAction, objParentNode, objParentNode, objActionControl, -1);
 }
 public static NodeCollection GetActionNodes(ModuleAction objActionRoot, Node objRootNode, Control objControl, int intDepth)
 {
     NodeCollection objCol = objRootNode.ParentNode.Nodes;
     IActionControl objActionControl = objControl as IActionControl;
     if (objActionControl != null)
     {
         AddChildActions(objActionRoot, objRootNode, objRootNode, objActionControl, intDepth);
     }
     return objCol;
 }
 public static NodeCollection GetNavigationNodes(Node objRootNode, ToolTipSource eToolTips, int intStartTabId, int intDepth, int intNavNodeOptions)
 {
     int i;
     PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings();
     bool blnFoundStart = intStartTabId == -1;
     Hashtable objBreadCrumbs = new Hashtable();
     Hashtable objTabLookup = new Hashtable();
     NodeCollection objRootNodes = objRootNode.Nodes;
     int intLastBreadCrumbId = 0;
     for (i = 0; i <= (objPortalSettings.ActiveTab.BreadCrumbs.Count - 1); i++)
     {
         objBreadCrumbs.Add(((TabInfo)objPortalSettings.ActiveTab.BreadCrumbs[i]).TabID, 1);
         intLastBreadCrumbId = ((TabInfo)objPortalSettings.ActiveTab.BreadCrumbs[i]).TabID;
     }
     TabController objTabController = new TabController();
     List<TabInfo> portalTabs = TabController.GetTabsBySortOrder(objPortalSettings.PortalId);
     List<TabInfo> hostTabs = TabController.GetTabsBySortOrder(Null.NullInteger);
     foreach (TabInfo objTab in portalTabs)
     {
         objTabLookup.Add(objTab.TabID, objTab);
     }
     foreach (TabInfo objTab in hostTabs)
     {
         objTabLookup.Add(objTab.TabID, objTab);
     }
     foreach (TabInfo objTab in portalTabs)
     {
         try
         {
             ProcessTab(objRootNode, objTab, objTabLookup, objBreadCrumbs, intLastBreadCrumbId, eToolTips, intStartTabId, intDepth, intNavNodeOptions);
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
     foreach (TabInfo objTab in hostTabs)
     {
         try
         {
             ProcessTab(objRootNode, objTab, objTabLookup, objBreadCrumbs, intLastBreadCrumbId, eToolTips, intStartTabId, intDepth, intNavNodeOptions);
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
     return objRootNodes;
 }
 private static bool IsTabPending(TabInfo objTab, Node objParentNode, Node objRootNode, int intDepth, Hashtable objBreadCrumbs, int intLastBreadCrumbId, bool blnPOD)
 {
     if (intDepth == -1)
         return false;
     if (objParentNode.Level + 1 - objRootNode.Level <= intDepth)
         return false;
     if (blnPOD)
     {
         if (objBreadCrumbs.Contains(objTab.TabID))
             return false;
         if (objBreadCrumbs.Contains(objTab.ParentId) && intLastBreadCrumbId != objTab.ParentId)
             return false;
     }
     return true;
 }
 private static void ProcessTab(Node objRootNode, TabInfo objTab, Hashtable objTabLookup, Hashtable objBreadCrumbs, int intLastBreadCrumbId, ToolTipSource eToolTips, int intStartTabId, int intDepth, int intNavNodeOptions)
 {
     PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings();
     NodeCollection objRootNodes = objRootNode.Nodes;
     if (CanShowTab(objTab, TabPermissionController.CanAdminPage(), true))
     {
         NodeCollection objParentNodes;
         Node objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString());
         bool blnParentFound = objParentNode != null;
         if (objParentNode == null)
             objParentNode = objRootNode;
         objParentNodes = objParentNode.Nodes;
         if (objTab.TabID == intStartTabId)
         {
             if ((intNavNodeOptions & (int)NavNodeOptions.IncludeParent) != 0)
             {
                 if (objTabLookup[objTab.ParentId] != null)
                 {
                     AddNode((TabInfo)objTabLookup[objTab.ParentId], objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
                     objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString());
                     objParentNodes = objParentNode.Nodes;
                 }
             }
             if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) != 0)
             {
                 AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
             }
         }
         else if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) && IsTabSibling(objTab, intStartTabId, objTabLookup))
         {
             AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
         }
         else
         {
             if (blnParentFound)
             {
                 if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) || IsTabSibling(objTab, intStartTabId, objTabLookup) == false)
                 {
                     bool blnPOD = (intNavNodeOptions & (int)NavNodeOptions.MarkPendingNodes) != 0;
                     if (IsTabPending(objTab, objParentNode, objRootNode, intDepth, objBreadCrumbs, intLastBreadCrumbId, blnPOD))
                     {
                         if (blnPOD)
                         {
                             objParentNode.HasNodes = true;
                         }
                     }
                     else
                     {
                         AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
                     }
                 }
             }
             else if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) == 0 && objTab.ParentId == intStartTabId)
             {
                 AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips);
             }
         }
     }
 }
 // Node
 public int Add()
 {
     Node objNode = new Node();
     this.XMLNode.AppendChild(this.XMLDoc.ImportNode(objNode.XmlNode, false));
     objNode.ID = objNode.ParentNameSpace + "_" + XMLNode.ChildNodes.Count;
     return this.XMLNode.ChildNodes.Count - 1;
     //Return objNode
 }
 public int Import(Node objNode)
 {
     return Import(objNode, true);
 }
 public void Remove(Node value)
 {
     this.XMLNode.RemoveChild(value.XmlNode);
 }
        //Protected Overrides Sub OnInsert(ByVal index As Integer, ByVal value As Object)
        //      If m_bNodeCollectionInterfaceCall = False Then Me.InsertAfter(index, CType(value, Node))
        //End Sub

        //Protected Overrides Sub OnRemove(ByVal index As Integer, ByVal value As Object)
        //      If m_bNodeCollectionInterfaceCall = False Then Me.Remove(CType(value, Node))
        //End Sub

        //Protected Overrides Sub OnSet(ByVal index As Integer, ByVal oldValue As Object, ByVal newValue As Object)
        //      Me.Item(index) = CType(newValue, Node)
        //End Sub

        //Protected Overrides Sub OnClear()
        //      Me.Clear()
        //End Sub

        //Public Shadows 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(Node value)
        {
            if (this.FindNode(value.ID) == null)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
 public void InsertBefore(int index, Node value)
 {
     XmlNode objXmlNode = this.XMLDoc.ImportNode(value.XmlNode, true);
     this.XMLNode.InsertBefore(objXmlNode, this.XMLNode.ChildNodes[index]);
 }
 public int IndexOf(Node value)
 {
     int i;
     for (i = 0; i <= this.XMLNode.ChildNodes.Count - 1; i++)
     {
         if (new Node(this.XMLNode.ChildNodes[i]).ID == value.ID)
         {
             return i;
         }
     }
     return -1;
 }
        // Node
        public int Import(Node objNode, bool blnDeep)
        {
            XmlNode objXmlNode = this.XMLDoc.ImportNode(objNode.XmlNode, blnDeep);
            this.XMLNode.AppendChild(objXmlNode);

            return this.XMLNode.ChildNodes.Count - 1;
        }
示例#14
0
 private static void AddNode(TabInfo objTab, NodeCollection objNodes, Hashtable objBreadCrumbs, PortalSettings objPortalSettings, ToolTipSource eToolTips)
 {
     Node objNode = new Node();
     if (objTab.Title == "~")
     {
         objNodes.AddBreak();
     }
     else
     {
         if (objBreadCrumbs.Contains(objTab.TabID))
         {
             objNode.BreadCrumb = true;
             if (objTab.TabID == objPortalSettings.ActiveTab.TabID)
             {
                 objNode.Selected = true;
             }
         }
         if (objTab.DisableLink)
             objNode.Enabled = false;
         objNode.ID = objTab.TabID.ToString();
         objNode.Key = objNode.ID;
         objNode.Text = objTab.LocalizedTabName;
         objNode.NavigateURL = objTab.FullUrl;
         objNode.ClickAction = eClickAction.Navigate;
         objNode.Image = objTab.IconFile;
         switch (eToolTips)
         {
             case ToolTipSource.TabName:
                 objNode.ToolTip = objTab.LocalizedTabName;
                 break;
             case ToolTipSource.Title:
                 objNode.ToolTip = objTab.Title;
                 break;
             case ToolTipSource.Description:
                 objNode.ToolTip = objTab.Description;
                 break;
         }
         objNodes.Add(objNode);
     }
 }
示例#15
0
 private static bool IsActionPending(Node objParentNode, Node objRootNode, int intDepth)
 {
     if (intDepth == -1)
         return false;
     if (objParentNode.Level + 1 - objRootNode.Level <= intDepth)
         return false;
     return true;
 }
 public NodeCollection GetNavigationNodes(Node objNode)
 {
     int intRootParent = PortalSettings.ActiveTab.TabID;
     NodeCollection objNodes = null;
     Navigation.ToolTipSource eToolTips;
     int intNavNodeOptions = 0;
     int intDepth = ExpandDepth;
     switch (Level.ToLower())
     {
         case "child":
             break;
         case "parent":
             intNavNodeOptions = (int)CommonLibrary.UI.Navigation.NavNodeOptions.IncludeParent + (int)CommonLibrary.UI.Navigation.NavNodeOptions.IncludeSelf;
             break;
         case "same":
             intNavNodeOptions = (int)CommonLibrary.UI.Navigation.NavNodeOptions.IncludeSiblings + (int)CommonLibrary.UI.Navigation.NavNodeOptions.IncludeSelf;
             break;
         default:
             intRootParent = -1;
             intNavNodeOptions = (int)CommonLibrary.UI.Navigation.NavNodeOptions.IncludeSiblings + (int)CommonLibrary.UI.Navigation.NavNodeOptions.IncludeSelf;
             break;
     }
     switch (ToolTip.ToLower())
     {
         case "name":
             eToolTips = CommonLibrary.UI.Navigation.ToolTipSource.TabName;
             break;
         case "title":
             eToolTips = CommonLibrary.UI.Navigation.ToolTipSource.Title;
             break;
         case "description":
             eToolTips = CommonLibrary.UI.Navigation.ToolTipSource.Description;
             break;
         default:
             eToolTips = CommonLibrary.UI.Navigation.ToolTipSource.None;
             break;
     }
     if (this.PopulateNodesFromClient && Control.SupportsPopulateOnDemand)
     {
         intNavNodeOptions += (int)CommonLibrary.UI.Navigation.NavNodeOptions.MarkPendingNodes;
     }
     if (this.PopulateNodesFromClient && Control.SupportsPopulateOnDemand == false)
     {
         ExpandDepth = -1;
     }
     if (StartTabId != -1)
         intRootParent = StartTabId;
     if (objNode != null)
     {
         intRootParent = Convert.ToInt32(objNode.ID);
         intNavNodeOptions = (int)CommonLibrary.UI.Navigation.NavNodeOptions.MarkPendingNodes;
         objNodes = Navigation.GetNavigationNodes(objNode, eToolTips, intRootParent, intDepth, intNavNodeOptions);
     }
     else
     {
         objNodes = Navigation.GetNavigationNodes(Control.ClientID, eToolTips, intRootParent, intDepth, intNavNodeOptions);
     }
     return objNodes;
 }
 // Node
 public int Add(Node objNode)
 {
     XmlNode objXmlNode = this.XMLDoc.ImportNode(objNode.XmlNode, true);
     this.XMLNode.AppendChild(objXmlNode);
     objNode.AssociateXmlNode(objXmlNode);
     return this.XMLNode.ChildNodes.Count - 1;
 }