protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SelectAreas sa = new SelectAreas(); IList<Areas> areas = sa.GetAreas(Session["userid"].ToString()); foreach (Areas area in areas) { TreeNode tn = new TreeNode(); tn.Text = area.Area_Name; tn.Value = area.ID.ToString(); //suburb IList<Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString()); foreach (Areas suburb in suburbs) { TreeNode tv = new TreeNode(); tv.Text = suburb.Area_Name; tv.Value = suburb.ID.ToString(); TreeNode node = new TreeNode(); node.Text = ""; tv.ChildNodes.Add(node); tv.Expanded = false; tv.CollapseAll(); tn.ChildNodes.Add(tv); } TreeView1.Nodes.Add(tn); } } //SelectAreas sa = new SelectAreas(); //IList<Areas> areas = sa.GetAreas(Session["userid"].ToString()); //StringBuilder sb = new StringBuilder(); //foreach (Areas area in areas) //{ // sb.Append("<li><span>" + area.Area_Name + "</span>"); // sb.Append("<ul>"); // //suburb // IList<Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString()); // foreach (Areas suburb in suburbs) // { // sb.Append("<li id=\"" + suburb.ID.ToString() + "\" class=\"hasChildren\"><span>" + suburb.Area_Name + "</span>"); // sb.Append("<ul>"); // sb.Append("<li><span class=\"placeholder\"> </span></li>"); // sb.Append("</ul>"); // sb.Append("</li>"); // } // sb.Append("</ul>"); // sb.Append("</li>"); //} //ltlArea.Text = sb.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { using (ISession session = HibernateHelper.GetSession().OpenSession()) { ITransaction transaction = session.BeginTransaction(); try { List<Editor.BE.Model.Content> contList = new List<Editor.BE.Model.Content>(); contList = EditorServices.GetContents<Editor.BE.Model.Content>(session); foreach (Editor.BE.Model.Content cnt in contList) { TreeNode nodeContent = new TreeNode(cnt.Title, cnt.Contentid.ToString() + "|" + "0", "~/img/cont.gif"); nodeContent.Target = "mainFrame"; nodeContent.NavigateUrl = "EditContent.aspx?id="+cnt.Contentid; //1 liv var fist = (from f in cnt.Pages where f.Pageid == f.Parentpageid orderby f.Position ascending select f); foreach (Editor.BE.Model.Page pg in fist) { TreeNode nodePage = new TreeNode(pg.Publictitle, cnt.Contentid.ToString() + "|" + pg.Pageid.ToString(), "~/img/cild.gif"); nodePage.Target = "mainFrame"; nodePage.NavigateUrl = "EditPage.aspx?id="+pg.Pageid; nodeContent.ChildNodes.Add(nodePage); } //2 liv var sec = (from f in cnt.Pages join h in fist on f.Parentpageid equals h.Pageid where f.Pageid != f.Parentpageid orderby f.Position ascending select f); foreach (Editor.BE.Model.Page pg in sec) { TreeNode nodePage = new TreeNode(pg.Publictitle, cnt.Contentid.ToString() + "|" + pg.Pageid.ToString(), "~/img/cild.gif"); foreach (TreeNode temp in nodeContent.ChildNodes) { if (temp.Value == cnt.Contentid.ToString() + "|" + pg.Parentpageid.ToString()) { nodePage.Target = "mainFrame"; nodePage.NavigateUrl = "EditPage.aspx?id="+pg.Pageid; nodeContent.ChildNodes[nodeContent.ChildNodes.IndexOf(temp)].ChildNodes.Add(nodePage); } } } nodeContent.CollapseAll(); TreeView1.Nodes[0].ChildNodes.Add(nodeContent); } } catch (Exception ex) { transaction.Rollback(); throw ex; } finally { session.Flush(); session.Close(); } } } }
protected void Page_Load(object sender, EventArgs e) { WestgateEntities db = new WestgateEntities(); if (IsPostBack == false) { TreeNode categoriesNode = new TreeNode("Tags"); categoriesNode.NavigateUrl = "~/Admin/TagsList.aspx"; categoriesNode.Expand(); List<Tag> listTags = (from t in db.Tags orderby t.Name select t).ToList(); foreach (Tag tag in listTags) { TreeNode catNode = new TreeNode(tag.Name,tag.TagId.ToString()); catNode.NavigateUrl = "~/Admin/EditTag.aspx?tagId=" + tag.TagId; catNode.CollapseAll(); categoriesNode.ChildNodes.Add(catNode); } tvStructure.Nodes.Add(categoriesNode); tvStructure.Nodes.Add(new TreeNode("Add New Image", "Add New Image", "", "~/Admin/AddImageNew.aspx", "")); tvStructure.Nodes.Add(new TreeNode("Gallery", "Gallery", "", "~/Admin/Gallery.aspx", "")); tvStructure.Nodes.Add(new TreeNode("Order Tags", "Order Tags", "", "~/Admin/OrderTags.aspx", "")); } }
protected void Page_Load(object sender, EventArgs e) { WestgateEntities DatabaseContext = new WestgateEntities(); Repeater1.DataSource = (from row in DatabaseContext.Tags where row.ShowInTabs orderby row.OrderNumber select row).Take(7); Repeater1.DataBind(); if (IsPostBack == false) { TreeNode categoriesNode = new TreeNode("All"); categoriesNode.NavigateUrl = "~/Gallery.aspx"; categoriesNode.Expand(); List<Tag> listTags = (from t in DatabaseContext.Tags orderby t.Name select t).ToList(); foreach (Tag tag in listTags) { TreeNode catNode = new TreeNode(tag.Name, tag.TagId.ToString()); catNode.NavigateUrl = "~/Gallery.aspx?tagId=" + tag.TagId; catNode.CollapseAll(); categoriesNode.ChildNodes.Add(catNode); } tvStructure.Nodes.Add(categoriesNode); } }
/// <summary> Populates a tree view control with the hierarchical collection of volumes associated with the same title as a digital resource </summary> /// <param name="treeView1"> Treeview control to populate with the associated volumes </param> /// <param name="Volumes"> Source datatable with all affiliated volumes </param> protected internal void Build_Tree(TreeView treeView1, DataTable Volumes) { const int LINE_TO_LONG = 100; // Add the root node TreeNode rootNode = new TreeNode("<b>" + CurrentItem.Behaviors.GroupTitle + "</b>"); if (CurrentItem.Behaviors.GroupTitle.Length > LINE_TO_LONG) rootNode.Text = "<b>" + CurrentItem.Behaviors.GroupTitle.Substring(0, LINE_TO_LONG) + "...</b>"; rootNode.SelectAction = TreeNodeSelectAction.None; treeView1.Nodes.Add(rootNode); // Is this a newspaper? bool newspaper = false; if (CurrentItem.Behaviors.GroupType.ToUpper() == "NEWSPAPER") { newspaper = true; } // Add the first layer of nodes // Hashtable nodeHash = new Hashtable(); string lastNodeText1 = String.Empty; string lastNodeText2 = String.Empty; string lastNodeText3 = String.Empty; string lastNodeText4 = String.Empty; TreeNode lastNode1 = null; TreeNode lastNode2 = null; TreeNode lastNode3 = null; TreeNode lastNode4 = null; TreeNode currentSelectedNode = null; // Compute the base redirect URL string current_vid = CurrentMode.VID; CurrentMode.VID = "<%VID%>"; string redirect_url = CurrentMode.Redirect_URL(String.Empty); CurrentMode.VID = current_vid; // Get the data columns for quick access DataColumn level1_text_column = Volumes.Columns[2]; DataColumn level2_text_column = Volumes.Columns[4]; DataColumn level3_text_column = Volumes.Columns[6]; DataColumn level4_text_column = Volumes.Columns[8]; DataColumn level5_text_column = Volumes.Columns[10]; DataColumn vid_column = Volumes.Columns[13]; DataColumn title_column = Volumes.Columns[1]; DataColumn itemid_column = Volumes.Columns[0]; DataColumn visibility_column = Volumes.Columns[14]; //DataColumn level1_index_column = Volumes.Columns[3]; //DataColumn level2_index_column = Volumes.Columns[5]; //DataColumn level3_index_column = Volumes.Columns[7]; //DataColumn level4_index_column = Volumes.Columns[9]; //DataColumn level5_index_column = Volumes.Columns[11]; foreach (DataRow thisItem in Volumes.Rows) { // Do not show PRIVATE items in this tree view if (Convert.ToInt16(thisItem[visibility_column]) >= 0) { string level1_text = translator.Get_Translation(thisItem[level1_text_column].ToString(), CurrentMode.Language); string level2_text = String.Empty; string level3_text = String.Empty; string level4_text = String.Empty; string level5_text = String.Empty; string title = thisItem[title_column].ToString(); string vid = thisItem[vid_column].ToString(); int itemid = Convert.ToInt32(thisItem[itemid_column]); if (level1_text.Length == 0) { TreeNode singleNode = new TreeNode(title); if (title.Length > LINE_TO_LONG) singleNode.Text = title.Substring(0, LINE_TO_LONG) + "..."; if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode; singleNode.SelectAction = TreeNodeSelectAction.None; singleNode.Text = "<i>" + singleNode.Text + "</i>"; } else { singleNode.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } rootNode.ChildNodes.Add(singleNode); } // Look at the first level if (level1_text.Length > 0) { level2_text = translator.Get_Translation(thisItem[level2_text_column].ToString(), CurrentMode.Language); if (level2_text.Length == 0) { TreeNode singleNode1 = new TreeNode(level1_text); if (thisItem[level1_text_column].ToString().Length > LINE_TO_LONG) { singleNode1.ToolTip = singleNode1.Text; singleNode1.Text = level1_text.Substring(0, LINE_TO_LONG) + "..."; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode1; singleNode1.SelectAction = TreeNodeSelectAction.None; singleNode1.Text = "<i>" + singleNode1.Text + "</i>"; } else { singleNode1.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } rootNode.ChildNodes.Add(singleNode1); } else { if ((lastNode1 == null) || (lastNodeText1 != level1_text.ToUpper())) { lastNode1 = new TreeNode(level1_text); if (level1_text.Length > LINE_TO_LONG) { lastNode1.ToolTip = lastNode1.Text; lastNode1.Text = level1_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode1.SelectAction = TreeNodeSelectAction.None; lastNodeText1 = level1_text.ToUpper(); rootNode.ChildNodes.Add(lastNode1); lastNode2 = null; lastNodeText2 = String.Empty; lastNode3 = null; lastNodeText3 = String.Empty; lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the second level if ((level2_text.Length > 0) && (lastNode1 != null)) { level3_text = translator.Get_Translation(thisItem[level3_text_column].ToString(), CurrentMode.Language); if (level3_text.Length == 0) { TreeNode singleNode2 = new TreeNode(level2_text); if (level2_text.Length > LINE_TO_LONG) { singleNode2.ToolTip = singleNode2.Text; singleNode2.Text = level2_text.Substring(0, LINE_TO_LONG) + "..."; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode2; singleNode2.SelectAction = TreeNodeSelectAction.None; singleNode2.Text = "<i>" + singleNode2.Text + "</i>"; } else { singleNode2.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode1.ChildNodes.Add(singleNode2); } else { if ((lastNode2 == null) || (lastNodeText2 != level2_text.ToUpper())) { lastNode2 = new TreeNode(level2_text); if (level2_text.Length > LINE_TO_LONG) { lastNode2.ToolTip = lastNode2.Text; lastNode2.Text = level2_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode2.SelectAction = TreeNodeSelectAction.None; lastNodeText2 = level2_text.ToUpper(); lastNode1.ChildNodes.Add(lastNode2); lastNode3 = null; lastNodeText3 = String.Empty; lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the third level if ((level3_text.Length > 0) && (lastNode2 != null)) { level4_text = translator.Get_Translation(thisItem[level4_text_column].ToString(), CurrentMode.Language); if (level4_text.Length == 0) { TreeNode singleNode3 = new TreeNode(level3_text); if (level3_text.Length > LINE_TO_LONG) { singleNode3.ToolTip = singleNode3.Text; singleNode3.Text = level3_text.Substring(0, LINE_TO_LONG) + "..."; } if (newspaper) { singleNode3.Text = level2_text + " " + level3_text + ", " + level1_text; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode3; singleNode3.SelectAction = TreeNodeSelectAction.None; singleNode3.Text = "<i>" + singleNode3.Text + "</i>"; } else { singleNode3.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode2.ChildNodes.Add(singleNode3); } else { if ((lastNode3 == null) || (lastNodeText3 != level3_text.ToUpper())) { lastNode3 = new TreeNode(level3_text); if (level3_text.Length > LINE_TO_LONG) { lastNode3.ToolTip = lastNode3.Text; lastNode3.Text = level3_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode3.SelectAction = TreeNodeSelectAction.None; lastNodeText3 = level3_text.ToUpper(); lastNode2.ChildNodes.Add(lastNode3); lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the fourth level if ((level4_text.Length > 0) && (lastNode3 != null)) { translator.Get_Translation(thisItem[level5_text_column].ToString(), CurrentMode.Language); if (level5_text.Length == 0) { TreeNode singleNode4 = new TreeNode(level4_text); if (level4_text.Length > LINE_TO_LONG) { singleNode4.ToolTip = singleNode4.Text; singleNode4.Text = level4_text.Substring(0, LINE_TO_LONG) + "..."; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode4; singleNode4.SelectAction = TreeNodeSelectAction.None; singleNode4.Text = "<i>" + singleNode4.Text + "</i>"; } else { singleNode4.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode3.ChildNodes.Add(singleNode4); } else { if ((lastNode4 == null) || (lastNodeText4 != level4_text.ToUpper())) { lastNode4 = new TreeNode(level4_text); if (level4_text.Length > LINE_TO_LONG) { lastNode4.ToolTip = lastNode4.Text; lastNode4.Text = level4_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode4.SelectAction = TreeNodeSelectAction.None; lastNodeText4 = level4_text.ToUpper(); lastNode3.ChildNodes.Add(lastNode4); } } } // Look at the fifth level if ((level5_text.Length > 0) && (lastNode4 != null)) { TreeNode lastNode5 = new TreeNode(level5_text); if (level5_text.Length > LINE_TO_LONG) { lastNode5.ToolTip = lastNode5.Text; lastNode5.Text = level5_text.Substring(0, LINE_TO_LONG) + "..."; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = lastNode5; lastNode5.SelectAction = TreeNodeSelectAction.None; lastNode5.Text = "<i>" + lastNode5.Text + "</i>"; } else { lastNode5.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode4.ChildNodes.Add(lastNode5); } } } rootNode.CollapseAll(); rootNode.Expand(); if (currentSelectedNode == null) return; while ((currentSelectedNode != rootNode) && ( currentSelectedNode != null )) { currentSelectedNode.Expand(); currentSelectedNode = currentSelectedNode.Parent; } }
/// <summary> Populates a tree view control with the hierarchical collection of volumes associated with the same title as a digital resource </summary> /// <param name="TreeView1"> Treeview control to populate with the associated volumes </param> /// <param name="Volumes"> Source datatable with all affiliated volumes </param> protected internal void Build_Tree(TreeView TreeView1, DataTable Volumes) { const int LINE_TO_LONG = 100; // Add the root node TreeNode rootNode = new TreeNode("<span id=\"sbkMviv_TableGroupTitle\">" + CurrentItem.Behaviors.GroupTitle + "</span>"); if (CurrentItem.Behaviors.GroupTitle.Length > LINE_TO_LONG) rootNode.Text = "<span id=\"sbkMviv_TableGroupTitle\">" + CurrentItem.Behaviors.GroupTitle.Substring(0, LINE_TO_LONG) + "...</span>"; rootNode.SelectAction = TreeNodeSelectAction.None; TreeView1.Nodes.Add(rootNode); // Is this a newspaper? bool newspaper = CurrentItem.Behaviors.GroupType.ToUpper() == "NEWSPAPER"; // Add the first layer of nodes // Hashtable nodeHash = new Hashtable(); string lastNodeText1 = String.Empty; string lastNodeText2 = String.Empty; string lastNodeText3 = String.Empty; string lastNodeText4 = String.Empty; TreeNode lastNode1 = null; TreeNode lastNode2 = null; TreeNode lastNode3 = null; TreeNode lastNode4 = null; TreeNode currentSelectedNode = null; // Compute the base redirect URL string current_vid = CurrentMode.VID; CurrentMode.VID = "<%VID%>"; string redirect_url = UrlWriterHelper.Redirect_URL(CurrentMode, String.Empty); CurrentMode.VID = current_vid; // Get the data columns for quick access DataColumn level1_text_column = Volumes.Columns[2]; DataColumn level2_text_column = Volumes.Columns[4]; DataColumn level3_text_column = Volumes.Columns[6]; DataColumn level4_text_column = Volumes.Columns[8]; DataColumn level5_text_column = Volumes.Columns[10]; DataColumn vid_column = Volumes.Columns[13]; DataColumn title_column = Volumes.Columns[1]; DataColumn itemid_column = Volumes.Columns[0]; DataColumn visibility_column = Volumes.Columns[14]; DataColumn dark_column = Volumes.Columns[16]; //DataColumn level1_index_column = Volumes.Columns[3]; //DataColumn level2_index_column = Volumes.Columns[5]; //DataColumn level3_index_column = Volumes.Columns[7]; //DataColumn level4_index_column = Volumes.Columns[9]; //DataColumn level5_index_column = Volumes.Columns[11]; // Does this user have special rights on the item? bool specialRights = ((CurrentUser != null) && ((CurrentUser.Is_System_Admin) || (CurrentUser.Is_Internal_User) || (CurrentUser.Can_Edit_This_Item(CurrentItem.BibID, CurrentItem.Bib_Info.SobekCM_Type_String, CurrentItem.Bib_Info.Source.Code, CurrentItem.Bib_Info.HoldingCode, CurrentItem.Behaviors.Aggregation_Code_List)))); foreach (DataRow thisItem in Volumes.Rows) { // Do not show PRIVATE items in this tree view int access_int = Convert.ToInt32(thisItem[visibility_column]); bool dark = Convert.ToBoolean(thisItem[dark_column]); if (dark) access_int = -1; if (( access_int >= 0) || (specialRights)) { // Set the access string and span name string access_string = String.Empty; string access_span_start = String.Empty; string access_span_end = String.Empty; if (dark) { access_span_start = "<span class=\"sbkMviv_TreeDarkNode\">"; access_string = " ( dark )"; access_span_end = "</span>"; } else { if (access_int < 0) { access_span_start = "<span class=\"sbkMviv_TreePrivateNode\">"; access_string = " ( private )"; access_span_end = "</span>"; } else if (access_int > 0) { access_span_start = "<span class=\"sbkMviv_TreeRestrictedNode\">"; access_string = " ( some restrictions apply )"; access_span_end = "</span>"; } } // Determine the text for all the levels (and nodes) string level1_text = translator.Get_Translation(thisItem[level1_text_column].ToString(), CurrentMode.Language); string level2_text = String.Empty; string level3_text = String.Empty; string level4_text = String.Empty; string level5_text = String.Empty; string title = thisItem[title_column].ToString(); string vid = thisItem[vid_column].ToString(); int itemid = Convert.ToInt32(thisItem[itemid_column]); if (level1_text.Length == 0) { TreeNode singleNode = new TreeNode(access_span_start + title + access_string + access_span_end); if (title.Length > LINE_TO_LONG) { singleNode.ToolTip = title; title = title.Substring(0, LINE_TO_LONG) + "..."; singleNode.Text = access_span_start + title + access_string + access_span_end; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode; singleNode.SelectAction = TreeNodeSelectAction.None; singleNode.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + singleNode.Text + "</span>"; } else { singleNode.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } rootNode.ChildNodes.Add(singleNode); } // Look at the first level if (level1_text.Length > 0) { level2_text = translator.Get_Translation(thisItem[level2_text_column].ToString(), CurrentMode.Language); if (level2_text.Length == 0) { TreeNode singleNode1 = new TreeNode(access_span_start + level1_text + access_string + access_span_end); if (thisItem[level1_text_column].ToString().Length > LINE_TO_LONG) { singleNode1.ToolTip = level1_text; level1_text = level1_text.Substring(0, LINE_TO_LONG) + "..."; singleNode1.Text = access_span_start + level1_text + access_string + access_span_end; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode1; singleNode1.SelectAction = TreeNodeSelectAction.None; singleNode1.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + singleNode1.Text + "</span>"; } else { singleNode1.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } rootNode.ChildNodes.Add(singleNode1); } else { if ((lastNode1 == null) || (lastNodeText1 != level1_text.ToUpper())) { // Since this is the TOP level, let's look down and see if there are any non-private, non-dark items string nontranslated = thisItem[level1_text_column].ToString(); int index = Convert.ToInt32(thisItem["Level1_Index"]); DataRow[] test = Volumes.Select("(IP_Restriction_Mask >= 0 ) and ( Dark = 'false') and ( " + level1_text_column.ColumnName + "='" + nontranslated + "') and ( Level1_Index=" + index + ")"); bool allPrivate = test.Length == 0; lastNode1 = new TreeNode(level1_text); if (level1_text.Length > LINE_TO_LONG) { lastNode1.ToolTip = lastNode1.Text; level1_text = level1_text.Substring(0, LINE_TO_LONG) + "..."; lastNode1.Text = level1_text; } if (allPrivate) { lastNode1.Text = "<span class=\"sbkMviv_TreePrivateNode\">" + level1_text + " ( all private or dark )</span>"; } lastNode1.SelectAction = TreeNodeSelectAction.None; lastNodeText1 = level1_text.ToUpper(); rootNode.ChildNodes.Add(lastNode1); lastNode2 = null; lastNodeText2 = String.Empty; lastNode3 = null; lastNodeText3 = String.Empty; lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the second level if ((level2_text.Length > 0) && (lastNode1 != null)) { level3_text = translator.Get_Translation(thisItem[level3_text_column].ToString(), CurrentMode.Language); if (level3_text.Length == 0) { TreeNode singleNode2 = new TreeNode( access_span_start + level2_text + access_string + access_span_end ); if (level2_text.Length > LINE_TO_LONG) { singleNode2.ToolTip = level2_text; level2_text = level2_text.Substring(0, LINE_TO_LONG) + "..."; singleNode2.Text = access_span_start + level2_text + access_string + access_span_end; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode2; singleNode2.SelectAction = TreeNodeSelectAction.None; singleNode2.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level2_text + access_string + "</span>"; } else { singleNode2.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode1.ChildNodes.Add(singleNode2); } else { if ((lastNode2 == null) || (lastNodeText2 != level2_text.ToUpper())) { lastNode2 = new TreeNode(level2_text); if (level2_text.Length > LINE_TO_LONG) { lastNode2.ToolTip = lastNode2.Text; lastNode2.Text = level2_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode2.SelectAction = TreeNodeSelectAction.None; lastNodeText2 = level2_text.ToUpper(); lastNode1.ChildNodes.Add(lastNode2); lastNode3 = null; lastNodeText3 = String.Empty; lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the third level if ((level3_text.Length > 0) && (lastNode2 != null)) { level4_text = translator.Get_Translation(thisItem[level4_text_column].ToString(), CurrentMode.Language); if (level4_text.Length == 0) { TreeNode singleNode3 = new TreeNode(access_span_start + level3_text + access_string + access_span_end); if (level3_text.Length > LINE_TO_LONG) { singleNode3.ToolTip = level3_text; level3_text = level3_text.Substring(0, LINE_TO_LONG) + "..."; singleNode3.Text = access_span_start + level3_text + access_string + access_span_end; } if (newspaper) { level3_text = access_span_start + level2_text + " " + level3_text + ", " + level1_text + access_string + access_span_end; singleNode3.Text = level3_text; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode3; singleNode3.SelectAction = TreeNodeSelectAction.None; singleNode3.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level3_text + access_string + "</span>"; } else { singleNode3.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode2.ChildNodes.Add(singleNode3); } else { if ((lastNode3 == null) || (lastNodeText3 != level3_text.ToUpper())) { lastNode3 = new TreeNode(level3_text); if (level3_text.Length > LINE_TO_LONG) { lastNode3.ToolTip = lastNode3.Text; lastNode3.Text = level3_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode3.SelectAction = TreeNodeSelectAction.None; lastNodeText3 = level3_text.ToUpper(); lastNode2.ChildNodes.Add(lastNode3); lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the fourth level if ((level4_text.Length > 0) && (lastNode3 != null)) { translator.Get_Translation(thisItem[level5_text_column].ToString(), CurrentMode.Language); if (level5_text.Length == 0) { TreeNode singleNode4 = new TreeNode(access_span_start + level4_text + access_string + access_span_end); if (level4_text.Length > LINE_TO_LONG) { singleNode4.ToolTip = level4_text; level4_text = level4_text.Substring(0, LINE_TO_LONG) + "..."; singleNode4.Text = access_span_start + level4_text + access_string + access_span_end; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = singleNode4; singleNode4.SelectAction = TreeNodeSelectAction.None; singleNode4.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level4_text + access_string + "</span>"; } else { singleNode4.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode3.ChildNodes.Add(singleNode4); } else { if ((lastNode4 == null) || (lastNodeText4 != level4_text.ToUpper())) { lastNode4 = new TreeNode(level4_text); if (level4_text.Length > LINE_TO_LONG) { lastNode4.ToolTip = lastNode4.Text; lastNode4.Text = level4_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode4.SelectAction = TreeNodeSelectAction.None; lastNodeText4 = level4_text.ToUpper(); lastNode3.ChildNodes.Add(lastNode4); } } } // Look at the fifth level if ((level5_text.Length > 0) && (lastNode4 != null)) { TreeNode lastNode5 = new TreeNode(access_span_start + level5_text + access_string + access_span_end ); if (level5_text.Length > LINE_TO_LONG) { lastNode5.ToolTip = level5_text; level5_text = level5_text.Substring(0, LINE_TO_LONG) + "..."; lastNode5.Text = access_span_start + level5_text + access_string + access_span_end; } if (itemid == CurrentItem.Web.ItemID) { currentSelectedNode = lastNode5; lastNode5.SelectAction = TreeNodeSelectAction.None; lastNode5.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level5_text + access_string + "</span>"; } else { lastNode5.NavigateUrl = redirect_url.Replace("<%VID%>", vid); } lastNode4.ChildNodes.Add(lastNode5); } } } rootNode.CollapseAll(); rootNode.Expand(); if (currentSelectedNode == null) return; while ((currentSelectedNode != rootNode) && ( currentSelectedNode != null )) { currentSelectedNode.Expand(); currentSelectedNode = currentSelectedNode.Parent; } }
protected void showTreeOK(TreeNode logini, DateTime aux_dtIni) { //Variaveis... List<MPSfwk.Model.Audits> _lstOK; aud = new MPSfwk.Model.Audits(); //Seta os descendentes... TreeNode resOK = null; TreeNode classes = null; TreeNode servers = null; //------------------------------------------------ //Chama a rotina para ver as OK... aud.IDGeracao = aux_dtIni.ToString("yyyyMMdd"); _lstOK = SqlServer.AuditXML.lstAudits(aud, 3, ordBY[0]); // resOK = new TreeNode("OK: (" + _lstOK.Count + ")"); resOK.SelectAction = TreeNodeSelectAction.Expand; resOK.Text = "<div style='color:#006600;font-size:Small;font-weight:bold;'>" + resOK.Text + "</div>"; resOK.ToolTip = "Abaixo estão as Classes e Servidores Auditados com sucesso!"; logini.ChildNodes.Add(resOK); // string aux_cls = ""; int contOK = 0; foreach (MPSfwk.Model.Audits ax in _lstOK) { if (aux_cls != ax.IDClasse) { if (aux_cls != "") { classes.Text = classes.Text + " (" + contOK + ")"; } classes = new TreeNode("Classe: (" + ax.IDClasse.Trim() + ")"); classes.SelectAction = TreeNodeSelectAction.Expand; resOK.ChildNodes.Add(classes); servers = new TreeNode("Servidor: (" + ax.IDServer.Trim() + ")"); servers.SelectAction = TreeNodeSelectAction.Expand; classes.ChildNodes.Add(servers); contOK = 1; } else { servers = new TreeNode("Servidor: (" + ax.IDServer.Trim() + ")"); servers.SelectAction = TreeNodeSelectAction.Expand; classes.ChildNodes.Add(servers); contOK++; } aux_cls = ax.IDClasse; } if (aux_cls != "") { classes.Text = classes.Text + " (" + contOK + ")"; } if (servers != null) servers.CollapseAll(); if (classes != null) classes.CollapseAll(); resOK.CollapseAll(); // //------------------------------------------------ }
protected void showTreeFalhas() { //Variaveis... List<MPSfwk.Model.Audits> _lstNOK; aud = new MPSfwk.Model.Audits(); //Inicia o TreeView... TreeView1.Nodes.Clear(); TreeView1.Visible = true; TreeNode raiz = new TreeNode("_______________________________Conteudo________________________________"); raiz.SelectAction = TreeNodeSelectAction.Expand; TreeView1.Nodes.Add(raiz); //Seta os descendentes... TreeNode logini = null; TreeNode servers = null; TreeNode resNOK = null; //Seta Cabecalho do TreeView... DateTime aux_dtIni = DateTime.Now; dtSel3.Visible = true; dtSel3.Text = String.Format("LOG das Gerações Auditadas para os Ativos (Ultima Semana): {0} e {1}", aux_dtIni.ToString("dd/MM/yyyy"), aux_dtIni.AddDays(-7).ToString("dd/MM/yyyy")); //Seta os nos das Geracoes... Loop 7 ultimos dias... for (int i = 1; i <= 8; i++) { logini = new TreeNode("Geração: (" + aux_dtIni.ToString("dd/MM/yyyy") + ")"); logini.SelectAction = TreeNodeSelectAction.Expand; raiz.ChildNodes.Add(logini); //------------------------------------------------ //Chama a rotina para ver as falhas... aud.IDGeracao = aux_dtIni.ToString("yyyyMMdd"); _lstNOK = SqlServer.AuditXML.lstAudits(aud, 4, ordBY[0]); // resNOK = new TreeNode("FALHA: (" + _lstNOK.Count + ")"); resNOK.SelectAction = TreeNodeSelectAction.Expand; resNOK.Text = "<div style='color:#FF3300;font-size:Small;font-weight:bold;'>" + resNOK.Text + "</div>"; resNOK.ToolTip = "Por gentileza, verifique os LOGs dos Agendamentos para identificar a falha!"; logini.ChildNodes.Add(resNOK); // foreach (MPSfwk.Model.Audits ax in _lstNOK) { servers = new TreeNode("Servidor: (" + ax.IDServer.Trim() + ")"); servers.SelectAction = TreeNodeSelectAction.Expand; resNOK.ChildNodes.Add(servers); } resNOK.CollapseAll(); // //------------------------------------------------ //Chama a rotina para ver as OK... showTreeOK(logini, aux_dtIni); aux_dtIni = DateTime.Now.AddDays(-i); } }
/// <summary> Populates a tree view control with the hierarchical collection of volumes associated with the same title as a digital resource </summary> /// <param name="TreeView1"> Treeview control to populate with the associated volumes </param> protected internal void Build_Tree(TreeView TreeView1) { const int LINE_TO_LONG = 100; // Add the root node TreeNode rootNode = new TreeNode("<span id=\"sbkMviv_TableGroupTitle\">" + briefItem.Behaviors.GroupTitle + "</span>"); if (briefItem.Behaviors.GroupTitle.Length > LINE_TO_LONG) rootNode.Text = "<span id=\"sbkMviv_TableGroupTitle\">" + briefItem.Behaviors.GroupTitle.Substring(0, LINE_TO_LONG) + "...</span>"; rootNode.SelectAction = TreeNodeSelectAction.None; TreeView1.Nodes.Add(rootNode); // Is this a newspaper? bool newspaper = briefItem.Behaviors.GroupType.ToUpper() == "NEWSPAPER"; // Add the first layer of nodes // Hashtable nodeHash = new Hashtable(); string lastNodeText1 = String.Empty; string lastNodeText2 = String.Empty; string lastNodeText3 = String.Empty; string lastNodeText4 = String.Empty; TreeNode lastNode1 = null; TreeNode lastNode2 = null; TreeNode lastNode3 = null; TreeNode lastNode4 = null; TreeNode currentSelectedNode = null; // Compute the base redirect URL string current_vid = currentRequest.VID; currentRequest.VID = "<%VID%>"; string redirect_url = UrlWriterHelper.Redirect_URL(currentRequest, String.Empty); currentRequest.VID = current_vid; // Does this user have special rights on the item? bool specialRights = ((currentUser != null) && ((currentUser.Is_System_Admin) || (currentUser.Is_Internal_User) || (currentUser.Can_Edit_This_Item(briefItem.BibID, briefItem.Type, briefItem.Behaviors.Source_Institution_Aggregation, briefItem.Behaviors.Holding_Location_Aggregation, briefItem.Behaviors.Aggregation_Code_List)))); foreach (Item_Hierarchy_Details thisItem in allVolumes) { // Do not show PRIVATE items in this tree view int access_int = thisItem.IP_Restriction_Mask; bool dark = thisItem.Dark; if (dark) access_int = -1; if ((access_int >= 0) || (specialRights)) { // Set the access string and span name string access_string = String.Empty; string access_span_start = String.Empty; string access_span_end = String.Empty; if (dark) { access_span_start = "<span class=\"sbkMviv_TreeDarkNode\">"; access_string = " ( dark )"; access_span_end = "</span>"; } else { if (access_int < 0) { access_span_start = "<span class=\"sbkMviv_TreePrivateNode\">"; access_string = " ( private )"; access_span_end = "</span>"; } else if (access_int > 0) { access_span_start = "<span class=\"sbkMviv_TreeRestrictedNode\">"; access_string = " ( some restrictions apply )"; access_span_end = "</span>"; } } // Determine the text for all the levels (and nodes) string level1_text = UI_ApplicationCache_Gateway.Translation.Get_Translation(thisItem.Level1_Text, currentRequest.Language); string level2_text = String.Empty; string level3_text = String.Empty; string level4_text = String.Empty; string level5_text = String.Empty; string title = thisItem.Title; if (level1_text.Length == 0) { TreeNode singleNode = new TreeNode(access_span_start + title + access_string + access_span_end); if (title.Length > LINE_TO_LONG) { singleNode.ToolTip = title; title = title.Substring(0, LINE_TO_LONG) + "..."; singleNode.Text = access_span_start + title + access_string + access_span_end; } if (thisItem.ItemID == briefItem.Web.ItemID) { currentSelectedNode = singleNode; singleNode.SelectAction = TreeNodeSelectAction.None; singleNode.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + singleNode.Text + "</span>"; } else { singleNode.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID); } rootNode.ChildNodes.Add(singleNode); } // Look at the first level if (level1_text.Length > 0) { level2_text = UI_ApplicationCache_Gateway.Translation.Get_Translation(thisItem.Level2_Text, currentRequest.Language); if (level2_text.Length == 0) { TreeNode singleNode1 = new TreeNode(access_span_start + level1_text + access_string + access_span_end); if (thisItem.Level1_Text.Length > LINE_TO_LONG) { singleNode1.ToolTip = level1_text; level1_text = level1_text.Substring(0, LINE_TO_LONG) + "..."; singleNode1.Text = access_span_start + level1_text + access_string + access_span_end; } if (thisItem.ItemID == briefItem.Web.ItemID) { currentSelectedNode = singleNode1; singleNode1.SelectAction = TreeNodeSelectAction.None; singleNode1.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + singleNode1.Text + "</span>"; } else { singleNode1.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID); } rootNode.ChildNodes.Add(singleNode1); } else { if ((lastNode1 == null) || (lastNodeText1 != level1_text.ToUpper())) { // Since this is the TOP level, let's look down and see if there are any non-private, non-dark items string nontranslated = thisItem.Level1_Text; bool allPrivate = allVolumes.All(ThisVolume => (thisItem.IP_Restriction_Mask < 0) || (dark) || (String.Compare(ThisVolume.Level1_Text, nontranslated, StringComparison.OrdinalIgnoreCase) != 0) || (thisItem.Level1_Index != ThisVolume.Level1_Index)); lastNode1 = new TreeNode(level1_text); if (level1_text.Length > LINE_TO_LONG) { lastNode1.ToolTip = lastNode1.Text; level1_text = level1_text.Substring(0, LINE_TO_LONG) + "..."; lastNode1.Text = level1_text; } if (allPrivate) { lastNode1.Text = "<span class=\"sbkMviv_TreePrivateNode\">" + level1_text + " ( all private or dark )</span>"; } lastNode1.SelectAction = TreeNodeSelectAction.None; lastNodeText1 = level1_text.ToUpper(); rootNode.ChildNodes.Add(lastNode1); lastNode2 = null; lastNodeText2 = String.Empty; lastNode3 = null; lastNodeText3 = String.Empty; lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the second level if ((level2_text.Length > 0) && (lastNode1 != null)) { level3_text = UI_ApplicationCache_Gateway.Translation.Get_Translation(thisItem.Level3_Text, currentRequest.Language); if (level3_text.Length == 0) { TreeNode singleNode2 = new TreeNode(access_span_start + level2_text + access_string + access_span_end); if (level2_text.Length > LINE_TO_LONG) { singleNode2.ToolTip = level2_text; level2_text = level2_text.Substring(0, LINE_TO_LONG) + "..."; singleNode2.Text = access_span_start + level2_text + access_string + access_span_end; } if (thisItem.ItemID == briefItem.Web.ItemID) { currentSelectedNode = singleNode2; singleNode2.SelectAction = TreeNodeSelectAction.None; singleNode2.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level2_text + access_string + "</span>"; } else { singleNode2.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID); } lastNode1.ChildNodes.Add(singleNode2); } else { if ((lastNode2 == null) || (lastNodeText2 != level2_text.ToUpper())) { lastNode2 = new TreeNode(level2_text); if (level2_text.Length > LINE_TO_LONG) { lastNode2.ToolTip = lastNode2.Text; lastNode2.Text = level2_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode2.SelectAction = TreeNodeSelectAction.None; lastNodeText2 = level2_text.ToUpper(); lastNode1.ChildNodes.Add(lastNode2); lastNode3 = null; lastNodeText3 = String.Empty; lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the third level if ((level3_text.Length > 0) && (lastNode2 != null)) { level4_text = UI_ApplicationCache_Gateway.Translation.Get_Translation(thisItem.Level4_Text, currentRequest.Language); if (level4_text.Length == 0) { TreeNode singleNode3 = new TreeNode(access_span_start + level3_text + access_string + access_span_end); if (level3_text.Length > LINE_TO_LONG) { singleNode3.ToolTip = level3_text; level3_text = level3_text.Substring(0, LINE_TO_LONG) + "..."; singleNode3.Text = access_span_start + level3_text + access_string + access_span_end; } if (newspaper) { level3_text = access_span_start + level2_text + " " + level3_text + ", " + level1_text + access_string + access_span_end; singleNode3.Text = level3_text; } if (thisItem.ItemID == briefItem.Web.ItemID) { currentSelectedNode = singleNode3; singleNode3.SelectAction = TreeNodeSelectAction.None; singleNode3.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level3_text + access_string + "</span>"; } else { singleNode3.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID); } lastNode2.ChildNodes.Add(singleNode3); } else { if ((lastNode3 == null) || (lastNodeText3 != level3_text.ToUpper())) { lastNode3 = new TreeNode(level3_text); if (level3_text.Length > LINE_TO_LONG) { lastNode3.ToolTip = lastNode3.Text; lastNode3.Text = level3_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode3.SelectAction = TreeNodeSelectAction.None; lastNodeText3 = level3_text.ToUpper(); lastNode2.ChildNodes.Add(lastNode3); lastNode4 = null; lastNodeText4 = String.Empty; } } } // Look at the fourth level if ((level4_text.Length > 0) && (lastNode3 != null)) { UI_ApplicationCache_Gateway.Translation.Get_Translation(thisItem.Level5_Text, currentRequest.Language); if (level5_text.Length == 0) { TreeNode singleNode4 = new TreeNode(access_span_start + level4_text + access_string + access_span_end); if (level4_text.Length > LINE_TO_LONG) { singleNode4.ToolTip = level4_text; level4_text = level4_text.Substring(0, LINE_TO_LONG) + "..."; singleNode4.Text = access_span_start + level4_text + access_string + access_span_end; } if (thisItem.ItemID == briefItem.Web.ItemID) { currentSelectedNode = singleNode4; singleNode4.SelectAction = TreeNodeSelectAction.None; singleNode4.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level4_text + access_string + "</span>"; } else { singleNode4.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID); } lastNode3.ChildNodes.Add(singleNode4); } else { if ((lastNode4 == null) || (lastNodeText4 != level4_text.ToUpper())) { lastNode4 = new TreeNode(level4_text); if (level4_text.Length > LINE_TO_LONG) { lastNode4.ToolTip = lastNode4.Text; lastNode4.Text = level4_text.Substring(0, LINE_TO_LONG) + "..."; } lastNode4.SelectAction = TreeNodeSelectAction.None; lastNodeText4 = level4_text.ToUpper(); lastNode3.ChildNodes.Add(lastNode4); } } } // Look at the fifth level if ((level5_text.Length > 0) && (lastNode4 != null)) { TreeNode lastNode5 = new TreeNode(access_span_start + level5_text + access_string + access_span_end); if (level5_text.Length > LINE_TO_LONG) { lastNode5.ToolTip = level5_text; level5_text = level5_text.Substring(0, LINE_TO_LONG) + "..."; lastNode5.Text = access_span_start + level5_text + access_string + access_span_end; } if (thisItem.ItemID == briefItem.Web.ItemID) { currentSelectedNode = lastNode5; lastNode5.SelectAction = TreeNodeSelectAction.None; lastNode5.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level5_text + access_string + "</span>"; } else { lastNode5.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID); } lastNode4.ChildNodes.Add(lastNode5); } } } rootNode.CollapseAll(); rootNode.Expand(); if (currentSelectedNode == null) return; while ((currentSelectedNode != rootNode) && (currentSelectedNode != null)) { currentSelectedNode.Expand(); currentSelectedNode = currentSelectedNode.Parent; } }