/// <summary> /// Retrieve a list of albums that are in the heirarchical path between the specified album and a node in the treeview. /// The node that is discovered as the ancestor of the album is assigned to the existingParentNode parameter. /// </summary> /// <param name="treeview">The treeview with at least one node added to it. At least one node must be an ancestor of the /// specified album.</param> /// <param name="album">An album. This method navigates the ancestors of this album until it finds a matching node in the treeview.</param> /// <param name="existingParentNode">The existing node in the treeview that is an ancestor of the specified album is assigned to /// this parameter.</param> /// <returns>Returns a list of albums where the first album (the one returned by calling Pop) is a child of the album /// represented by the existingParentNode treeview node, and each subsequent album is a child of the previous album. /// The final album is the same album specified in the album parameter.</returns> private static Stack <IAlbum> GetAlbumsBetweenTopLevelNodeAndAlbum(ComponentArt.Web.UI.TreeView treeview, IAlbum album, out TreeViewNode existingParentNode) { if (treeview.Nodes.Count == 0) { throw new ArgumentException("The treeview must have at least one top-level node before calling the function GetAlbumsBetweenTopLevelNodeAndAlbum()."); } Stack <IAlbum> albumParents = new Stack <IAlbum>(); albumParents.Push(album); IAlbum parentAlbum = (IAlbum)album.Parent; albumParents.Push(parentAlbum); // Navigate up from the specified album until we find an album that exists in the treeview. Remember, // the treeview has been built with the root node and the first level of albums, so eventually we // should find an album. If not, just return without showing the current album. while ((existingParentNode = treeview.FindNodeById(parentAlbum.Id.ToString(CultureInfo.InvariantCulture))) == null) { parentAlbum = parentAlbum.Parent as IAlbum; if (parentAlbum == null) { break; } albumParents.Push(parentAlbum); } // Since we found a node in the treeview we don't need to add the most recent item in the stack. Pop it off. albumParents.Pop(); return(albumParents); }
protected override void CreateChildControls() { Panel container = new Panel(); container.CssClass = cssClass; Controls.Add(container); tree = new ComponentArt.Web.UI.TreeView(); tree.ID = ID + "_Tree"; tree.SelectedNodeCssClass = selectedNodeCssClass; tree.HoverNodeCssClass = hoverNodeCssClass; tree.NodeEditCssClass = nodeEditCssClass; tree.LineImageHeight = lineImageHeight; tree.LineImageWidth = lineImageWidth; tree.DefaultImageWidth = defaultImageWidth; tree.DefaultImageHeight = defaultImageHeight; tree.ItemSpacing = itemSpacing; tree.NodeLabelPadding = nodeLabelPadding; tree.ParentNodeImageUrl = parentNodeImageUrl; tree.LeafNodeImageUrl = leafNodeImageUrl; tree.ShowLines = showLines; tree.LineImagesFolderUrl = lineImagesFolderUrl; tree.CssClass = treeCssClass; tree.NodeCssClass = nodeCssClass; tree.EnableViewState = EnableViewState; tree.Width = width; tree.Height = height; container.Controls.Add(tree); ChildControlsCreated = true; }
private TreeView GenerateTreeview() { // We'll use a TreeView instance to generate the appropriate XML structure ComponentArt.Web.UI.TreeView tv = new ComponentArt.Web.UI.TreeView(); string handlerPath = String.Concat(Utils.GalleryRoot, "/handler/gettreeviewxml.ashx"); IAlbum parentAlbum = AlbumController.LoadAlbumInstance(this._albumId, true); string securityActionParm = String.Empty; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { securityActionParm = String.Format(CultureInfo.CurrentCulture, "&secaction={0}", (int)this._securityAction); } foreach (IAlbum childAlbum in parentAlbum.GetChildGalleryObjects(GalleryObjectType.Album, true, !Utils.IsAuthenticated)) { TreeViewNode node = new TreeViewNode(); node.Text = Utils.RemoveHtmlTags(childAlbum.Title); node.Value = childAlbum.Id.ToString(CultureInfo.InvariantCulture); node.ID = childAlbum.Id.ToString(CultureInfo.InvariantCulture); if (!String.IsNullOrEmpty(_navigateUrl)) { node.NavigateUrl = Utils.AddQueryStringParameter(_navigateUrl, String.Concat("aid=", childAlbum.Id.ToString(CultureInfo.InvariantCulture))); node.HoverCssClass = "tv0HoverTreeNodeLink"; } bool isUserAuthorized = true; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { isUserAuthorized = Utils.IsUserAuthorized(_securityAction, RoleController.GetGalleryServerRolesForUser(), childAlbum.Id, childAlbum.GalleryId, childAlbum.IsPrivate); } node.ShowCheckBox = isUserAuthorized && _showCheckbox; node.Selectable = isUserAuthorized; if (!isUserAuthorized) { node.HoverCssClass = String.Empty; } if (childAlbum.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0) { string handlerPathWithAlbumId = Utils.AddQueryStringParameter(handlerPath, String.Concat("aid=", childAlbum.Id.ToString(CultureInfo.InvariantCulture))); node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}{1}&sc={2}&nurl={3}", handlerPathWithAlbumId, securityActionParm, node.ShowCheckBox, Utils.UrlEncode(_navigateUrl)); } tv.Nodes.Add(node); } return(tv); }
private TreeView GenerateTreeview() { // We'll use a TreeView instance to generate the appropriate XML structure ComponentArt.Web.UI.TreeView tv = new ComponentArt.Web.UI.TreeView(); string handlerPath = String.Concat(Util.GalleryRoot, "/handler/gettreeviewxml.ashx"); IAlbum parentAlbum = Factory.LoadAlbumInstance(this._albumId, true); string securityActionParm = String.Empty; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { securityActionParm = String.Format(CultureInfo.CurrentCulture, "&secaction={0}", (int)this._securityAction); } foreach (IAlbum childAlbum in parentAlbum.GetChildGalleryObjects(GalleryObjectType.Album, true)) { TreeViewNode node = new TreeViewNode(); node.Text = Util.RemoveHtmlTags(childAlbum.Title); node.Value = childAlbum.Id.ToString(CultureInfo.InvariantCulture); node.ID = childAlbum.Id.ToString(CultureInfo.InvariantCulture); bool isUserAuthorized = true; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { isUserAuthorized = Util.IsUserAuthorized(_securityAction, RoleController.GetGalleryServerRolesForUser(), childAlbum.Id, childAlbum.IsPrivate); } node.ShowCheckBox = isUserAuthorized; node.Selectable = isUserAuthorized; if (!isUserAuthorized) { node.HoverCssClass = String.Empty; } if (childAlbum.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0) { node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}?aid={1}{2}", handlerPath, childAlbum.Id.ToString(CultureInfo.InvariantCulture), securityActionParm); } tv.Nodes.Add(node); } return(tv); }
private TreeView GenerateTreeview() { // We'll use a TreeView instance to generate the appropriate XML structure ComponentArt.Web.UI.TreeView tv = new ComponentArt.Web.UI.TreeView(); string handlerPath = String.Concat(Util.GalleryRoot, "/handler/gettreeviewxml.ashx"); IAlbum parentAlbum = Factory.LoadAlbumInstance(this._albumId, true); string securityActionParm = String.Empty; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { securityActionParm = String.Format(CultureInfo.CurrentCulture, "&secaction={0}", (int)this._securityAction); } foreach (IAlbum childAlbum in parentAlbum.GetChildGalleryObjects(GalleryObjectType.Album, true)) { TreeViewNode node = new TreeViewNode(); node.Text = Util.RemoveHtmlTags(childAlbum.Title); node.Value = childAlbum.Id.ToString(CultureInfo.InvariantCulture); node.ID = childAlbum.Id.ToString(CultureInfo.InvariantCulture); bool isUserAuthorized = true; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { isUserAuthorized = Util.IsUserAuthorized(_securityAction, RoleController.GetGalleryServerRolesForUser(), childAlbum.Id, childAlbum.IsPrivate); } node.ShowCheckBox = isUserAuthorized; node.Selectable = isUserAuthorized; if (!isUserAuthorized) node.HoverCssClass = String.Empty; if (childAlbum.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0) { node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}?aid={1}{2}", handlerPath, childAlbum.Id.ToString(CultureInfo.InvariantCulture), securityActionParm); } tv.Nodes.Add(node); } return tv; }
public static void Setup(ComponentArt.Web.UI.TreeView treeView, string clientSideNodeChangedCallback) { treeView.DragAndDropEnabled = false; treeView.NodeEditingEnabled = false; treeView.KeyboardEnabled = true; treeView.CssClass = "TreeView"; treeView.NodeCssClass = "TreeNode"; treeView.SelectedNodeCssClass = "SelectedTreeNode"; treeView.NodeEditCssClass = "NodeEdit"; treeView.LineImageWidth = 13; treeView.LineImageHeight = 20; treeView.DefaultImageWidth = 10; treeView.DefaultImageHeight = 10; treeView.ItemSpacing = 0; treeView.NodeLabelPadding = 3; treeView.ParentNodeImageUrl = "~/include/ComponentArt/TreeView/images/page.gif"; treeView.LeafNodeImageUrl = "~/include/ComponentArt/TreeView/images/page.gif"; treeView.ShowLines = true; treeView.LineImagesFolderUrl = "~/include/ComponentArt/TreeView/images/lines"; treeView.EnableViewState = true; treeView.ClientSideOnNodeCheckChanged = clientSideNodeChangedCallback; }
protected void Page_Load(object sender, EventArgs e) { string strPaperCategoryId = Request.QueryString.Get("id"); string strflag = Request.QueryString.Get("flag"); if (!string.IsNullOrEmpty(strPaperCategoryId)) { int nPaperCategoryId = -1; try { nPaperCategoryId = Convert.ToInt32(strPaperCategoryId); } catch { } ComponentArt.Web.UI.TreeView tv = new ComponentArt.Web.UI.TreeView(); PaperBLL paperBLL = new PaperBLL(); IList <RailExam.Model.Paper> papers = paperBLL.GetPaperByCategoryID(nPaperCategoryId); if (papers.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Paper paper in papers) { tvn = new TreeViewNode(); tvn.ID = paper.PaperId.ToString(); tvn.Value = paper.PaperId.ToString(); tvn.Text = paper.PaperName; tvn.ToolTip = paper.PaperName; tvn.Attributes.Add("isPaper", "true"); tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif"; if (strflag != null && strflag == "1") { tvn.ShowCheckBox = true; } tv.Nodes.Add(tvn); } } Response.Clear(); Response.ClearHeaders(); Response.ContentType = "text/xml"; Response.Cache.SetNoStore(); string strXmlEncoding = string.Empty; try { strXmlEncoding = System.Configuration.ConfigurationManager.AppSettings["CallbackEncoding"]; } catch { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("Error Accessing Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } if (string.IsNullOrEmpty(strXmlEncoding)) { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("CallbackEncoding Empty in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } else { try { System.Text.Encoding enc = System.Text.Encoding.GetEncoding(strXmlEncoding); } catch { #if DEBUG System.Diagnostics.Debug.WriteLine("Invalid Encoding in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif strXmlEncoding = "gb2312"; } } Response.Write("<?xml version=\"1.0\" encoding=\"" + strXmlEncoding + "\" standalone=\"yes\" ?>\r\n" + tv.GetXml()); Response.Flush(); Response.End(); } }
// 手动绑定KNOWLEDGE TreeView private void KnowledgeTreeNodeBind(int?postID, string whereClause, TreeViewNode tvNode) { ComponentArt.Web.UI.TreeView virtualTree = new ComponentArt.Web.UI.TreeView(); KnowledgeBLL knowledgeBLL = new KnowledgeBLL(); IList <RailExam.Model.Knowledge> knowledgeList; if (String.IsNullOrEmpty(whereClause)) { knowledgeList = knowledgeBLL.GetKnowledges(); } else { knowledgeList = knowledgeBLL.GetKnowledgesByWhereClause(whereClause, "level_num, order_index"); } if (knowledgeList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Knowledge knowledge in knowledgeList) { tvn = new TreeViewNode(); tvn.ID = knowledge.KnowledgeId.ToString(); tvn.Value = postID == null ? String.Empty : postID.ToString(); tvn.Text = knowledge.KnowledgeName; tvn.ToolTip = knowledge.KnowledgeName; if (knowledge.ParentId == 0) { if (tvNode == null) { this.tvKnowledge.Nodes.Add(tvn); } else { virtualTree.Nodes.Add(tvn); } } else { try { if (tvNode == null) { tvKnowledge.FindNodeById(knowledge.ParentId.ToString()).Nodes.Add(tvn); } else { virtualTree.FindNodeById(knowledge.ParentId.ToString()).Nodes.Add(tvn); } } catch { tvKnowledge.Nodes.Clear(); return; } } } if (tvNode != null) { foreach (TreeViewNode node in virtualTree.Nodes) { tvNode.Nodes.Add(node); } } } }
protected void Page_Load(object sender, EventArgs e) { string strBookChapterId = Request.QueryString.Get("id"); ItemBLL objItemBll = new ItemBLL(); string strItemTypeID = Request.QueryString.Get("itemTypeID"); if (!string.IsNullOrEmpty(strBookChapterId)) { ComponentArt.Web.UI.TreeView tvBookChapterChapter = new ComponentArt.Web.UI.TreeView(); BookChapterBLL bookChapterBLL = new BookChapterBLL(); IList <RailExam.Model.BookChapter> bookChapterList = bookChapterBLL.GetBookChapterByBookID(int.Parse(strBookChapterId)); if (bookChapterList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.BookChapter bookChapter in bookChapterList) { if (bookChapter.IsMotherItem) { continue; } tvn = new TreeViewNode(); tvn.ID = bookChapter.ChapterId.ToString(); tvn.Value = bookChapter.ChapterId.ToString(); if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no") { tvn.Text = bookChapter.ChapterName; } else { int n = objItemBll.GetItemsByBookChapterIdPath(bookChapter.IdPath, Convert.ToInt32(strItemTypeID)); if (n > 0) { tvn.Text = bookChapter.ChapterName + "(" + n + "题)"; } else { tvn.Text = bookChapter.ChapterName; } } tvn.ToolTip = bookChapter.ChapterName; string strflag = Request.QueryString.Get("flag"); if (strflag != null && (strflag == "2" || strflag == "1")) { tvn.ShowCheckBox = true; } if (Request.QueryString.Get("state") != null) { tvn.Checked = Convert.ToBoolean(Request.QueryString.Get("state")); } else { if (Request.QueryString.Get("StrategyID") != null) { string str = "," + Request.QueryString.Get("StrategyID") + ","; if (str.IndexOf("," + tvn.ID + ",") != -1) { tvn.Checked = true; } } } tvn.Attributes.Add("isChapter", "true"); tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Chapter.gif"; if (bookChapter.ParentId == 0) { tvBookChapterChapter.Nodes.Add(tvn); } else { tvBookChapterChapter.FindNodeById(bookChapter.ParentId.ToString()).Nodes.Add(tvn); } } } Response.Clear(); Response.ClearHeaders(); Response.ContentType = "text/xml"; Response.Cache.SetNoStore(); string strXmlEncoding = string.Empty; try { strXmlEncoding = System.Configuration.ConfigurationManager.AppSettings["CallbackEncoding"]; } catch { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("Error Accessing Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } if (string.IsNullOrEmpty(strXmlEncoding)) { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("CallbackEncoding Empty in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } else { try { System.Text.Encoding enc = System.Text.Encoding.GetEncoding(strXmlEncoding); } catch { #if DEBUG System.Diagnostics.Debug.WriteLine("Invalid Encoding in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif strXmlEncoding = "gb2312"; } } Response.Write("<?xml version=\"1.0\" encoding=\"" + strXmlEncoding + "\" standalone=\"yes\" ?>\r\n" + tvBookChapterChapter.GetXml()); Response.Flush(); Response.End(); } }
private TreeView GenerateTreeview() { // We'll use a TreeView instance to generate the appropriate XML structure ComponentArt.Web.UI.TreeView tv = new ComponentArt.Web.UI.TreeView(); string handlerPath = String.Concat(Utils.GalleryRoot, "/handler/gettreeviewxml.ashx"); IAlbum parentAlbum = AlbumController.LoadAlbumInstance(this._albumId, true); string securityActionParm = String.Empty; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { securityActionParm = String.Format(CultureInfo.CurrentCulture, "&secaction={0}", (int)this._securityAction); } foreach (IAlbum childAlbum in parentAlbum.GetChildGalleryObjects(GalleryObjectType.Album, true, !Utils.IsAuthenticated)) { TreeViewNode node = new TreeViewNode(); node.Text = Utils.RemoveHtmlTags(childAlbum.Title); node.Value = childAlbum.Id.ToString(CultureInfo.InvariantCulture); node.ID = childAlbum.Id.ToString(CultureInfo.InvariantCulture); if (!String.IsNullOrEmpty(_navigateUrl)) { node.NavigateUrl = Utils.AddQueryStringParameter(_navigateUrl, String.Concat("aid=", childAlbum.Id.ToString(CultureInfo.InvariantCulture))); node.HoverCssClass = "tv0HoverTreeNodeLink"; } bool isUserAuthorized = true; if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction)) { isUserAuthorized = Utils.IsUserAuthorized(_securityAction, RoleController.GetGalleryServerRolesForUser(), childAlbum.Id, childAlbum.GalleryId, childAlbum.IsPrivate); } node.ShowCheckBox = isUserAuthorized && _showCheckbox; node.Selectable = isUserAuthorized; if (!isUserAuthorized) node.HoverCssClass = String.Empty; if (childAlbum.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0) { string handlerPathWithAlbumId = Utils.AddQueryStringParameter(handlerPath, String.Concat("aid=", childAlbum.Id.ToString(CultureInfo.InvariantCulture))); node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}{1}&sc={2}&nurl={3}", handlerPathWithAlbumId, securityActionParm, node.ShowCheckBox, Utils.UrlEncode(_navigateUrl)); } tv.Nodes.Add(node); } return tv; }
private void GetDataAccessLevelsRoot_MultiLevelsDataAccessLevels(ComponentArt.Web.UI.TreeView trvDataAccessLevels, DataAccessLevelsType Dalt, DataAccessParts DataAccessLevelKey, DataAccessLevelOperationType?Dalot, DataAccessLevelOperationState?Dalos, decimal UserID, UserSearchKeys?SearchKey, string SearchTerm) { DataAccessProxy rootDals = null; string rootDalsNodeText = string.Empty; if (Dalot == DataAccessLevelOperationType.Group && Dalos == DataAccessLevelOperationState.After) { UserID = BUser.CurrentUser.ID; } switch (DataAccessLevelKey) { case DataAccessParts.Department: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentRoot(Dalt, UserID); if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; case DataAccessParts.OrganizationUnit: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationRoot(Dalt, UserID); if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; case DataAccessParts.Report: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetReportRoot(Dalt, UserID); if (GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; case DataAccessParts.RuleGroup: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetRuleRoot(Dalt, UserID); if (GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; } TreeViewNode rootDalsNode = new TreeViewNode(); rootDalsNode.ID = rootDals.ID.ToString(); rootDalsNode.Text = rootDalsNodeText; rootDalsNode.Value = rootDals.DeleteEnable.ToString().ToLower(); string ImagePath = string.Empty; string ImageUrl = string.Empty; if (rootDals.DeleteEnable) { if (DataAccessLevelKey != DataAccessParts.Report) { ImagePath = "\\Images\\TreeView\\folder_blue.gif"; ImageUrl = "Images/TreeView/folder_blue.gif"; } else { ImagePath = "\\Images\\TreeView\\group.png"; ImageUrl = "Images/TreeView/group.png"; } } else { if (DataAccessLevelKey != DataAccessParts.Report) { ImagePath = "\\Images\\TreeView\\folder.gif"; ImageUrl = "Images/TreeView/folder.gif"; } else { ImagePath = "\\Images\\TreeView\\group_silver.png"; ImageUrl = "Images/TreeView/group_silver.png"; } } if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImagePath)) { rootDalsNode.ImageUrl = ImageUrl; } trvDataAccessLevels.Nodes.Add(rootDalsNode); rootDalsNode.Expanded = true; switch (Dalot) { case DataAccessLevelOperationType.Single: this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, null, UserID, SearchKey, string.Empty, rootDalsNode, rootDals); break; case DataAccessLevelOperationType.Group: switch (Dalos) { case DataAccessLevelOperationState.Before: break; case DataAccessLevelOperationState.After: this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, SearchTerm, rootDalsNode, rootDals); break; } break; default: if (Dalt == DataAccessLevelsType.Source) { this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, SearchTerm, rootDalsNode, rootDals); } break; } }
public void MakeJsonObjectListString(List <ConceptExpression> organizationUnitChlidList, ComponentArt.Web.UI.TreeView rootCncptExprsnNode, string languageId, bool editable) { foreach (ConceptExpression childCncptExprsn in organizationUnitChlidList//.OrderBy(x => x.SortOrder) ) { var conceptExpressionNode = new TreeViewNode { ID = childCncptExprsn.ID.ToString(CultureInfo.InvariantCulture), Text = BLanguage.CurrentLocalLanguage == LanguagesName.Parsi ? childCncptExprsn.ScriptBeginFa : childCncptExprsn.ScriptBeginEn, EditingEnabled = editable && childCncptExprsn.CanEditInFinal, Value = MakeJsonObjectListString(childCncptExprsn) }; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl_Yellow)) { conceptExpressionNode.ImageUrl = imagePath_Yellow; } if (childCncptExprsn.CanEditInFinal) { conceptExpressionNode.ImageUrl = imageUrl_Blue; } if (!childCncptExprsn.CanAddToFinal) { conceptExpressionNode.ImageUrl = imageUrl_silver; } conceptExpressionNode.ContentCallbackUrl = "XmlConceptExpressionLoadOnDemand.aspx?CncptExprsnId=" + childCncptExprsn.ID + "&LangID=" + languageId + "&Editable=" + editable; if (BConceptExpression.GetByParentId(childCncptExprsn.ID).Count > 0) { conceptExpressionNode.Nodes.Add(new TreeViewNode()); } else { conceptExpressionNode.Nodes.Clear(); } rootCncptExprsnNode.Nodes.Add(conceptExpressionNode); } }
protected void Page_Load(object sender, EventArgs e) { string strKnowledgeId = Request.QueryString.Get("id"); string strflag = Request.QueryString.Get("flag"); string strItemTypeID = Request.QueryString.Get("itemTypeID"); ItemBLL objItemBll = new ItemBLL(); string strBook = ""; if (!string.IsNullOrEmpty(strKnowledgeId)) { ComponentArt.Web.UI.TreeView tvBookBook = new ComponentArt.Web.UI.TreeView(); BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = null; if (strflag != null && strflag == "2") { int knowledgeID = Convert.ToInt32(strKnowledgeId); int postID = Convert.ToInt32(Request.QueryString.Get("PostID")); int orgID = Convert.ToInt32(Request.QueryString.Get("OrgID")); int leader = Convert.ToInt32(Request.QueryString.Get("Leader")); int techID = Convert.ToInt32(Request.QueryString.Get("Tech")); bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(knowledgeID, orgID, postID, leader, techID, 0); } else { if (PrjPub.CurrentLoginUser.SuitRange == 0 && Request.QueryString.Get("source") == "itemlist") { bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId, PrjPub.CurrentLoginUser.StationOrgID); if (!string.IsNullOrEmpty(Request.QueryString.Get("postId"))) { string postID = Request.QueryString.Get("postId"); OracleAccess oa = new OracleAccess(); string sql = String.Format( @"select book_id from BOOK_RANGE_POST t where post_id = {0} or post_id in (select post_id from POST t where parent_id = {0})", postID ); IList <RailExam.Model.Book> booksViaPosts = new List <RailExam.Model.Book>(); DataSet dsBookIDs = oa.RunSqlDataSet(sql); if (dsBookIDs != null && dsBookIDs.Tables.Count > 0) { foreach (RailExam.Model.Book book in bookList) { DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId); if (drs.Length > 0) { booksViaPosts.Add(book); } } bookList.Clear(); bookList = booksViaPosts; } } } else { if (!string.IsNullOrEmpty(Request.QueryString.Get("RandomExamID"))) { string examId = Request.QueryString.Get("RandomExamID"); RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam objexam = objBll.GetExam(Convert.ToInt32(examId)); string strPost = objexam.PostID; if (objexam.AutoSaveInterval == 1) { strPost = ""; } bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId); OracleAccess oa = new OracleAccess(); if (strPost != "") { string sql = @"select book_id from BOOK_RANGE_POST t where post_id in (" + strPost + @")"; DataTable dt = oa.RunSqlDataSet(sql).Tables[0]; IList <RailExam.Model.Book> objList = new List <RailExam.Model.Book>(); foreach (RailExam.Model.Book book in bookList) { DataRow[] dr = dt.Select("book_id=" + book.bookId); if (dr.Length > 0) { objList.Add(book); } } bookList.Clear(); bookList = objList; } if (objexam.HasTrainClass) { string sql = "select * from ZJ_Train_Class_Subject_Book a " + " inner join ZJ_Train_Class_Subject b on a.Train_Class_Subject_ID = b.Train_Class_Subject_ID " + " where b.Train_Class_ID in (select Train_Class_ID from Random_Exam_Train_Class " + " where Random_Exam_ID=" + objexam.RandomExamId + ")"; DataTable dt = oa.RunSqlDataSet(sql).Tables[0]; foreach (DataRow dr in dt.Rows) { if (strBook == "") { strBook += dr["Book_ID"].ToString(); } else { strBook += "," + dr["Book_ID"]; } } } } else { bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId); OracleAccess oa = new OracleAccess(); IList <RailExam.Model.Book> booksViaPosts = new List <RailExam.Model.Book>(); if (!string.IsNullOrEmpty(Request.QueryString.Get("postId"))) { string postID = Request.QueryString.Get("postId"); string sql = String.Format( @"select book_id from BOOK_RANGE_POST t where post_id = {0} or post_id in (select post_id from POST t where parent_id = {0})", postID ); DataSet dsBookIDs = oa.RunSqlDataSet(sql); if (dsBookIDs != null && dsBookIDs.Tables.Count > 0) { foreach (RailExam.Model.Book book in bookList) { DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId); if (drs.Length > 0) { booksViaPosts.Add(book); } } bookList.Clear(); bookList = booksViaPosts; } } //铁路系统权限 int railSystemid = PrjPub.RailSystemId(); if (railSystemid != 0) { string sql = String.Format( @"select book_id from BOOK_RANGE_ORG t where org_Id in (select org_id from org where rail_System_Id={0} and level_num=2) ", railSystemid ); DataSet dsBookIDs = oa.RunSqlDataSet(sql); if (dsBookIDs != null && dsBookIDs.Tables.Count > 0) { foreach (RailExam.Model.Book book in bookList) { DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId); if (drs.Length > 0) { booksViaPosts.Add(book); } } bookList.Clear(); bookList = booksViaPosts; } } } } } if (bookList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Book book in bookList) { tvn = new TreeViewNode(); tvn.ID = book.bookId.ToString(); tvn.Value = book.bookId.ToString(); if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no") { tvn.Text = book.bookName; } else { int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID)); if (n > 0) { tvn.Text = book.bookName + "(" + n + "题)"; } else { tvn.Text = book.bookName; } } if (("," + strBook + ",").IndexOf("," + book.bookId + ",") >= 0) { tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/RedBook.gif"; } else { tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif"; } tvn.ToolTip = book.bookName; tvn.Attributes.Add("isBook", "true"); if (strflag != null && (strflag == "2" || strflag == "3" || strflag == "4")) { tvn.ShowCheckBox = true; if (strflag == "4") { string strBookIds = Request.QueryString.Get("bookIds"); if (("|" + strBookIds + "|").IndexOf("|" + book.bookId + "|") >= 0) { tvn.Checked = true; } } } //没有题目数量显示 if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no") { if (strflag != null) { if (strflag == "2") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" + book.bookId; } //屏蔽教材 else if (strflag == "1") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" + book.bookId + "&StrategyID=" + Request.QueryString.Get("StrategyID"); } } else { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&id=" + book.bookId; } } else { if (strflag != null) { if (strflag == "2") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" + book.bookId; } //屏蔽教材 else if (strflag == "1") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" + book.bookId + "&StrategyID=" + Request.QueryString.Get("StrategyID"); } } else { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&id=" + book.bookId; } } tvBookBook.Nodes.Add(tvn); } } Response.Clear(); Response.ClearHeaders(); Response.ContentType = "text/xml"; Response.Cache.SetNoStore(); string strXmlEncoding = string.Empty; try { strXmlEncoding = System.Configuration.ConfigurationManager.AppSettings["CallbackEncoding"]; } catch { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("Error Accessing Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } if (string.IsNullOrEmpty(strXmlEncoding)) { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("CallbackEncoding Empty in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } else { try { System.Text.Encoding enc = System.Text.Encoding.GetEncoding(strXmlEncoding); } catch { #if DEBUG System.Diagnostics.Debug.WriteLine("Invalid Encoding in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif strXmlEncoding = "gb2312"; } } Response.Write("<?xml version=\"1.0\" encoding=\"" + strXmlEncoding + "\" standalone=\"yes\" ?>\r\n" + tvBookBook.GetXml()); Response.Flush(); Response.End(); } }
public static void BuildComponentArtTreeView(ComponentArt.Web.UI.TreeView tvTargetTree, IList list, string strIdProperty, string strParentIdProperty, string strTextProperty, string strTooltipProperty, string strValueProperty, string strNavigateUrlProperty, string strImageUrlProperty, string strTarget) { ComponentArt.Web.UI.TreeViewNode node = null; if (list.Count > 0) { Type objType = list[0].GetType(); string strParentId = string.Empty; foreach (object o in list) { node = new TreeViewNode(); // ID if (string.IsNullOrEmpty(strIdProperty)) { throw new Exception("树节点ID属性不能为空!"); } node.ID = objType.GetProperty(strIdProperty).GetValue(o, null).ToString(); // ParentId if (string.IsNullOrEmpty(strParentIdProperty)) { throw new Exception("树节点父ID属性不能为空!"); } strParentId = objType.GetProperty(strParentIdProperty).GetValue(o, null).ToString(); // Text if (string.IsNullOrEmpty(strTextProperty)) { throw new Exception("树节点Text属性不能为空!"); } node.Text = objType.GetProperty(strTextProperty).GetValue(o, null).ToString(); // Tooltip if (!string.IsNullOrEmpty(strTooltipProperty)) { node.ToolTip = objType.GetProperty(strTooltipProperty).GetValue(o, null).ToString(); } // Value if (!string.IsNullOrEmpty(strValueProperty)) { node.Value = objType.GetProperty(strValueProperty).GetValue(o, null).ToString(); } else { node.Value = objType.GetProperty(strValueProperty).GetValue(o, null).ToString(); } // NavigateUrl if (!string.IsNullOrEmpty(strNavigateUrlProperty)) { node.NavigateUrl = objType.GetProperty(strNavigateUrlProperty).GetValue(o, null).ToString(); } // ImageUrl if (!string.IsNullOrEmpty(strImageUrlProperty)) { node.ImageUrl = objType.GetProperty(strImageUrlProperty).GetValue(o, null).ToString(); } // Target if (!string.IsNullOrEmpty(strTarget)) { node.Target = objType.GetProperty(strTarget).GetValue(o, null).ToString(); } // Append node if (strParentId == "0") {// Root node tvTargetTree.Nodes.Add(node); } else { tvTargetTree.FindNodeById(strParentId).Nodes.Add(node); } } } }
protected void Page_Load(object sender, EventArgs e) { string strKnowledgeId = Request.QueryString.Get("id"); ItemBLL objItemBll = new ItemBLL(); string strItemTypeID = Request.QueryString.Get("itemTypeID"); if (!string.IsNullOrEmpty(strKnowledgeId)) { ComponentArt.Web.UI.TreeView tvBookBook = new ComponentArt.Web.UI.TreeView(); string strflag = Request.QueryString.Get("flag"); BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = null; if (strflag != null && strflag == "2") { int trainTypeID = Convert.ToInt32(strKnowledgeId); int postID = Convert.ToInt32(Request.QueryString.Get("PostID")); int orgID = Convert.ToInt32(Request.QueryString.Get("OrgID")); int leader = Convert.ToInt32(Request.QueryString.Get("Leader")); int techID = Convert.ToInt32(Request.QueryString.Get("Tech")); bookList = bookBLL.GetEmployeeStudyBookInfoByTrainTypeID(trainTypeID, orgID, postID, leader, techID, 0); } else { bookList = bookBLL.GetBookByTrainTypeIDPath(strKnowledgeId); } if (bookList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Book book in bookList) { tvn = new TreeViewNode(); tvn.ID = book.bookId.ToString(); tvn.Value = book.bookId.ToString(); if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no") { tvn.Text = book.bookName; } else { int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID)); if (n > 0) { tvn.Text = book.bookName + "(" + n + ")"; } else { tvn.Text = book.bookName; } } tvn.ToolTip = book.bookName; tvn.Attributes.Add("isBook", "true"); tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif"; if (strflag != null && (strflag == "2" || strflag == "3")) { tvn.ShowCheckBox = true; } if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no") { if (strflag != null) { if (strflag != "3") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" + book.bookId; } } else { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&id=" + book.bookId; } } else { if (strflag != null) { if (strflag != "3") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" + book.bookId; } } else { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&id=" + book.bookId; } } tvBookBook.Nodes.Add(tvn); } } Response.Clear(); Response.ClearHeaders(); Response.ContentType = "text/xml"; Response.Cache.SetNoStore(); string strXmlEncoding = string.Empty; try { strXmlEncoding = System.Configuration.ConfigurationManager.AppSettings["CallbackEncoding"]; } catch { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("Error Accessing Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } if (string.IsNullOrEmpty(strXmlEncoding)) { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("CallbackEncoding Empty in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } else { try { System.Text.Encoding enc = System.Text.Encoding.GetEncoding(strXmlEncoding); } catch { #if DEBUG System.Diagnostics.Debug.WriteLine("Invalid Encoding in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif strXmlEncoding = "gb2312"; } } Response.Write("<?xml version=\"1.0\" encoding=\"" + strXmlEncoding + "\" standalone=\"yes\" ?>\r\n" + tvBookBook.GetXml()); Response.Flush(); Response.End(); } }