///<summary> /// This class returns taxonomy childeren /// /// Fields: TaxID , TaxName , TaxDescription , TaxCategoryURL /// /// </summary> public static DataTable getTaxonomyTree(long ParentTaxID) { // Dictionary<long, string> TaxonomyList = new Dictionary<long, string>(); DataTable taxDataTable = new DataTable(); taxDataTable.Columns.Add("TaxID", typeof(long)); taxDataTable.Columns.Add("TaxName", typeof(string)); taxDataTable.Columns.Add("TaxDescription", typeof(string)); taxDataTable.Columns.Add("TaxCategoryURL", typeof(string)); taxData = createTaxonomyTree(ParentTaxID); if (taxData.Taxonomy != null) { try { for (int i = 0; i < taxData.Taxonomy.Length; i++) { taxDataTable.Rows.Add(taxData.Taxonomy[i].TaxonomyId, taxData.Taxonomy[i].Name, taxData.Taxonomy[i].Description, taxData.Taxonomy[i].CategoryUrl); } } catch { } } return taxDataTable; }
public static TaxonomyData createTaxonomyTree(long TaxonomyId) { TaxonomyRequest taxonomyRequest = new TaxonomyRequest(); Ektron.Cms.API.Content.Taxonomy tax1 = new Taxonomy(); // Ektron.Cms.TaxonomyData taxData = new TaxonomyData(); try { taxonomyRequest.TaxonomyId = TaxonomyId; // taxonomyRequest.Page = Page; taxonomyRequest.TaxonomyLanguage = 1033; // taxonomyRequest.PageSize = contentApi.RequestInformationRef.PagingSize; taxonomyRequest.Depth = -1; taxonomyRequest.ReadCount = true; taxonomyRequest.TaxonomyType = 0; //0 = content; 1 = user; 2 = group; taxonomyRequest.IncludeItems = false; // taxonomyRequest.SortOrder = "last_edit_date"; // taxonomyRequest.SortDirection = "desc"; taxData = tax1.LoadTaxonomy(ref taxonomyRequest); TaxonomyBaseData[] taxonomyDataArray = new CommonApi().EkContentRef.ReadAllSubCategories(taxonomyRequest); } catch (Exception) { } return taxData; }
/// <summary> /// Page Init /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Init(object sender, EventArgs e) { if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { contentId = long.Parse(Request.QueryString["id"]); // this.GetContentData(contentId); // XmlDocument xmlD = commonfunctions.getContentXML(contentId); } //Resource Type Taxonomy ResourceTypeTaxonomy.DataSource = AdminFunc.ResourceTypeTaxonomyDataTable; // commonfunctions.sortDataTable(commonfunctions.getTaxonomyTree(123), "TaxName", "ASC"); ResourceTypeTaxonomy.DataBind(); //ListItem li = new ListItem(); //li.Text = "All Resources"; //li.Value = ""; //li.Selected = true; //ResourceTypeTaxonomy.Items.Add(li); } RightSideContent.ccontentID = mainContent.EkItem.Id.ToString(); RightSideContent.cfolderID = mainContent.EkItem.FolderId.ToString(); uxPageTitle.pgTitle = mainContent.EkItem.Title.ToString(); uxPageTitle.pageId = mainContent.EkItem.Id.ToString(); uxBreadcrumb.contentID = mainContent.EkItem.Id.ToString(); mainContent.Text = "<!-- -->"; uxPageTitle.ResourceTypeId = "2"; XmlDocument XMLDoc = new XmlDocument(); XMLDoc.LoadXml(mainContent.EkItem.Html); SActive = commonfunctions.getFieldValue(XMLDoc, "Active", "/SubjectAreas"); if (SActive == "true") { SATitle = commonfunctions.getFieldValue(XMLDoc, "Name", "/SubjectAreas"); string sadescript = commonfunctions.getFieldValue(XMLDoc, "FullDescription", "/SubjectAreas"); int maxAllowedshown = 400; int wholeLength = sadescript.Length; if (wholeLength > maxAllowedshown) { SADescription = sadescript.Substring(0, maxAllowedshown) + "<a href=\"#\" class=\"show_text\">show more >></a>"; SADescription += " <span class='slidingDiv hide'>" + sadescript.Substring(maxAllowedshown, wholeLength - maxAllowedshown) + "<a href='#' class='hide_text'> << show less</a></span>"; } else { SADescription = sadescript; } string allTaxonomy = commonfunctions.GetAssignedTaxonomyList(contentId); //make sure this is a subject area taxonomy - just in case this content is attached to many taxonomies string[] txIds = allTaxonomy.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (var taxID in txIds) { Ektron.Cms.Controls.Directory taxControl = new Ektron.Cms.Controls.Directory(); taxControl.TaxonomyId = long.Parse(taxID); taxControl.Page = this.Page; taxControl.Fill(); Ektron.Cms.TaxonomyData taxData = new Ektron.Cms.TaxonomyData(); taxData = taxControl.TaxonomyTreeData; long parentId = taxData.ParentId; if (parentId == 136) { SubjectAreaTaxID = taxID; SubjectAreaTaxIDHF.Value = taxID; break; } } } // myFavCollection = commonfunctions.getAllmyFavorites(); // Response.Write(SubjectAreaTaxID); if (IsPostBack) { ClientScript.RegisterStartupScript(this.GetType(), "hash", "location.hash = '#MOVEHERE';", true); } }