public override void Initialize() { m_objTree = new DNNTree(); Tree.ID = m_strControlID; Tree.NodeClick += new DNNTree.DNNTreeNodeClickHandler(DNNTree_NodeClick); Tree.PopulateOnDemand += new DNNTree.DNNTreeEventHandler(DNNTree_PopulateOnDemand); }
/// <summary> /// Loads suported locales and shows default values /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// </remarks> /// <history> /// [vmasanas] 04/10/2004 Created /// [vmasanas] 25/03/2006 Modified to support new host resources and incremental saving /// </history> protected void Page_Load(Object sender, EventArgs e) { try { if (!Page.IsPostBack) { ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); // initialized available locales BindLocaleList(); // init tree InitTree(); // If returning from full editor, use params // else load system global resource file by default if (Request.QueryString["locale"] != null) { cboLocales.SelectedValue = Request.QueryString["locale"].ToString(); } else { cboLocales.SelectedValue = Localization.SystemLocale; } if (PortalSettings.ActiveTab.ParentId == PortalSettings.AdminTabId) { rbMode.SelectedValue = "Portal"; rowMode.Visible = false; } else { // portal mode only available on admin menu rbMode.Items.RemoveAt(2); string mode = Request.QueryString["mode"]; if (!String.IsNullOrEmpty(mode) && rbMode.Items.FindByValue(mode) != null) { rbMode.SelectedValue = mode; } } if (Request.QueryString["resourcefile"] != null) { SelectedResourceFile = Server.MapPath("~/" + Globals.QueryStringDecode(Request.QueryString["resourcefile"])); } else { SelectedResourceFile = Server.MapPath(Localization.GlobalResourceFile); } DNNTree.SelectNodeByKey(SelectedResourceFile); BindGrid(); } } catch (Exception exc) //Module failed to load { Exceptions.Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// The BuildTree helper method is used to build the tree /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 12/8/2004 Created /// [Jon Henning] 3/21/06 Updated to handle Auto-expand and AddUpNode /// </history> private void BuildTree(DNNNode objNode, bool blnPODRequest) //JH - POD { bool blnAddUpNode = false; DNNNodeCollection objNodes; objNodes = GetNavigationNodes(objNode); if (blnPODRequest == false) { switch (Level.ToLower()) { case "root": break; case "child": blnAddUpNode = true; break; default: if (Level.ToLower() != "root" && PortalSettings.ActiveTab.BreadCrumbs.Count > 1) { blnAddUpNode = true; } break; } } //add goto Parent node if (blnAddUpNode) { DNNNode objParentNode = new DNNNode(); objParentNode.ID = PortalSettings.ActiveTab.ParentId.ToString(); objParentNode.Key = objParentNode.ID; objParentNode.Text = Localization.GetString("Parent", Localization.GetResourceFile(this, MyFileName)); objParentNode.ToolTip = Localization.GetString("GoUp", Localization.GetResourceFile(this, MyFileName)); objParentNode.CSSClass = NodeCssClass; objParentNode.Image = ResolveUrl(TreeGoUpImage); objParentNode.ClickAction = eClickAction.PostBack; objNodes.InsertBefore(0, objParentNode); } DNNNode objPNode; foreach (DNNNode tempLoopVar_objPNode in objNodes) //clean up to do in processnodes??? { objPNode = tempLoopVar_objPNode; ProcessNodes(objPNode); } this.Bind(objNodes); //technically this should always be a dnntree. If using dynamic controls Nav.ascx should be used. just being safe. if (this.Control.NavigationControl is DNNTree) { DNNTree objTree = (DNNTree)this.Control.NavigationControl; if (objTree.SelectedTreeNodes.Count > 0) { TreeNode objTNode = (TreeNode)objTree.SelectedTreeNodes[0]; if (objTNode.DNNNodes.Count > 0) //only expand it if nodes are not pending { objTNode.Expand(); } } } }