private void PopulateContentGridData() { if (m_strPageAction == "removeitems") { TaxonomyItemList.Columns.Add(m_refstyle.CreateBoundField("CHECK", "<input type=\"Checkbox\" name=\"checkall\" onclick=\"javascript:checkAll(\'selected_items\',false);\">", "title-header", HorizontalAlign.Center, HorizontalAlign.Center, Unit.Percentage(2), Unit.Percentage(2), false, false)); } TaxonomyItemList.Columns.Add(m_refstyle.CreateBoundField("TITLE", m_refMsg.GetMessage("generic title"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(88), false, false)); TaxonomyItemList.Columns.Add(m_refstyle.CreateBoundField("ID", m_refMsg.GetMessage("generic id"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); TaxonomyItemList.Columns.Add(m_refstyle.CreateBoundField("LANGUAGE", m_refMsg.GetMessage("generic language"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); DataTable dt = new DataTable(); DataRow dr; ContentAPI m_refContentApi = new ContentAPI(); if (m_strPageAction == "removeitems") { dt.Columns.Add(new DataColumn("CHECK", typeof(string))); } dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(string))); dt.Columns.Add(new DataColumn("LANGUAGE", typeof(string))); if (m_strViewItem != "folder") { PageSettings(); if ((taxonomy_data != null)&& (taxonomy_data.TaxonomyItems != null)&& taxonomy_data.TaxonomyItems.Length > 0) { AddDeleteIcon = true; string icon = ""; string title = ""; string link = ""; string backPage = ""; foreach (TaxonomyItemData item in taxonomy_data.TaxonomyItems) { dr = dt.NewRow(); if (m_strPageAction == "removeitems") { dr["CHECK"] = "<input type=\"checkbox\" name=\"selected_items\" id=\"selected_items\" value=\"" + item.TaxonomyItemId + "\" onClick=\"javascript:checkAll(\'selected_items\',true);\">"; } if (item.ContentType =="1") { if (item.ContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData) { icon = " <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/layout.png\" /> "; } else if (item.ContentSubType == EkEnumeration.CMSContentSubtype.WebEvent) { icon = " <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/calendar.png" + "\" /> "; } else { icon = " <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/contentHtml.png" + "\" /> "; } } else if (item.ContentType == "2") { icon = " <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/contentForm.png" + "\" /> "; } else if (item.ContentType == "1111") { icon = " <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/tree/folderBoard.png" + "\" alt=\"" + item.TaxonomyItemAssetInfo.FileName + "\" /> "; } else if (item.ContentType == "1112") { icon = " <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/tree/folderBlog.png" + "\" alt=\"" + item.TaxonomyItemAssetInfo.FileName + "\" /> "; } else if (item.ContentType == "3333") { icon = " <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/brick.png" + "\" alt=\"" + item.TaxonomyItemAssetInfo.FileName + "\" /> "; } else { icon = " <img src=\"" + item.TaxonomyItemAssetInfo.ImageUrl + "\" alt=\"" + item.TaxonomyItemAssetInfo.FileName + "\" /> "; } if (string.IsNullOrEmpty(item.TaxonomyItemAssetInfo.ImageUrl) & (item.ContentType != "1" & item.ContentType != "2" & item.ContentType != "1111" & item.ContentType != "1112" & item.ContentType != "3333")) { icon = " <img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + item.TaxonomyItemAssetInfo.FileName + "\" /> "; } title = (string) (m_refMsg.GetMessage("generic View") + " \"" + item.TaxonomyItemTitle.Replace(" \'", "`") + "\""); backPage = EkFunctions.UrlEncode((string) ("Action=viewcontent&view=item&taxonomyid=" + TaxonomyId)); if (item.ContentSubType == EkEnumeration.CMSContentSubtype.WebEvent && item.ContentType == "1") { long fid = m_refContentApi.EkContentRef.GetFolderIDForContent(item.TaxonomyItemId); link = "<a href=\'content.aspx?action=ViewContentByCategory&LangType=" + item.TaxonomyItemLanguage + "&id=" + fid + "&callerpage=taxonomy.aspx&origurl=" + backPage + "\' title=\'" + title + "\'>" + item.TaxonomyItemTitle + "</a>"; } else { link = "<a href=\'content.aspx?action=View&LangType=" + item.TaxonomyItemLanguage + "&id=" + item.TaxonomyItemId + "&callerpage=taxonomy.aspx&origurl=" + backPage + "\' title=\'" + title + "\'>" + item.TaxonomyItemTitle + "</a>"; } dr["TITLE"] = icon + link; dr["ID"] = item.TaxonomyItemId; dr["LANGUAGE"] = item.TaxonomyItemLanguage; dt.Rows.Add(dr); } } else { dr = dt.NewRow(); dt.Rows.Add(dr); TaxonomyItemList.GridLines = GridLines.None; } } else { VisiblePageControls(false); TaxonomyFolderSyncData[] taxonomy_sync_folder = null; TaxonomyBaseRequest tax_sync_folder_req = new TaxonomyBaseRequest(); tax_sync_folder_req.TaxonomyId = TaxonomyId; tax_sync_folder_req.TaxonomyLanguage = TaxonomyLanguage; taxonomy_sync_folder = m_refContent.GetAllAssignedCategoryFolder(tax_sync_folder_req); if ((taxonomy_sync_folder != null)&& taxonomy_sync_folder.Length > 0) { AddDeleteIcon = true; for (int i = 0; i <= taxonomy_sync_folder.Length - 1; i++) { dr = dt.NewRow(); dr["CHECK"] = "<input type=\"checkbox\" name=\"selected_items\" id=\"selected_items\" value=\"" + taxonomy_sync_folder[i].FolderId + "\" onClick=\"javascript:checkAll(\'selected_items\',true);\">"; dr["TITLE"] = taxonomy_sync_folder[i].FolderTitle; //& GetRecursiveTitle(item.FolderRecursive) dr["ID"] = taxonomy_sync_folder[i].FolderId; dr["LANGUAGE"] = taxonomy_sync_folder[i].TaxonomyLanguage; dt.Rows.Add(dr); } } else { dr = dt.NewRow(); dt.Rows.Add(dr); TaxonomyItemList.GridLines = GridLines.None; } } DataView dv = new DataView(dt); TaxonomyItemList.DataSource = dv; TaxonomyItemList.DataBind(); }
private void PopulateContentGridData() { TaxonomyItemList.Columns.Add(_StyleHelper.CreateBoundField("CHECK", "<input type=\"checkbox\" name=\"checkall\" onclick=\"checkAll(\'selected_items\',false);\">", "title-header", HorizontalAlign.Center, HorizontalAlign.Center, Unit.Percentage(2), Unit.Percentage(2), false, false)); TaxonomyItemList.Columns.Add(_StyleHelper.CreateBoundField("TITLE", _MessageHelper.GetMessage("generic title"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(50), false, false)); TaxonomyItemList.Columns.Add(_StyleHelper.CreateBoundField("ID", _MessageHelper.GetMessage("generic id"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); TaxonomyItemList.Columns.Add(_StyleHelper.CreateBoundField("LANGUAGE", _MessageHelper.GetMessage("generic language"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); TaxonomyItemList.Columns.Add(_StyleHelper.CreateBoundField("URL", _MessageHelper.GetMessage("generic url link"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(30), false, false)); TaxonomyItemList.Columns.Add(_StyleHelper.CreateBoundField("ARCHIVED", _MessageHelper.GetMessage("lbl archived"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); DataTable dt = new DataTable(); DataRow dr; LibraryData libraryInfo; ContentData contData = new ContentData(); dt.Columns.Add(new DataColumn("CHECK", typeof(string))); dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(string))); dt.Columns.Add(new DataColumn("LANGUAGE", typeof(string))); dt.Columns.Add(new DataColumn("URL", typeof(string))); dt.Columns.Add(new DataColumn("ARCHIVED", typeof(string))); if (_ViewItem != "folder") { PageSettings(); if ((taxonomy_data != null)&& (taxonomy_data.TaxonomyItems != null)&& taxonomy_data.TaxonomyItems.Length > 0) { AddDeleteIcon = true; foreach (TaxonomyItemData item in taxonomy_data.TaxonomyItems) { TaxonomyItemCount++; dr = dt.NewRow(); dr["CHECK"] = "<input type=\"checkbox\" name=\"selected_items\" id=\"selected_items\" value=\"" + item.TaxonomyItemId + "\" onclick=\"checkAll(\'selected_items\',true);\">"; string contenturl = ""; switch (Convert.ToInt32(item.ContentType)) { case 1: if (item.ContentSubType == EkEnumeration.CMSContentSubtype.WebEvent) { long fid = _Common.EkContentRef.GetFolderIDForContent(item.TaxonomyItemId); contenturl = (string) ("content.aspx?action=ViewContentByCategory&LangType=" + item.TaxonomyItemLanguage + "&id=" + fid + "&callerpage=taxonomy.aspx&origurl=" + EkFunctions.UrlEncode((string) ("action=view&view=item&taxonomyid=" + TaxonomyId + "&treeViewId=-1&LangType=" + TaxonomyLanguage))); } else { contenturl = (string) ("content.aspx?action=View&LangType=" + item.TaxonomyItemLanguage + "&id=" + item.TaxonomyItemId + "&callerpage=taxonomy.aspx&origurl=" + EkFunctions.UrlEncode((string) ("action=view&view=item&taxonomyid=" + TaxonomyId + "&treeViewId=-1&LangType=" + TaxonomyLanguage))); } break; case 7: // Library Item libraryInfo = m_refContentApi.GetLibraryItemByContentID(item.TaxonomyItemId); if(libraryInfo != null) contenturl = (string) ("library.aspx?LangType=" + libraryInfo.LanguageId + "&action=ViewLibraryItem&id=" + libraryInfo.Id + "&parent_id=" + libraryInfo.ParentId); break; case 1111: // forum id, board id, taskid DiscussionBoard board_data = _Content.GetTopicbyID(item.TaxonomyItemId.ToString()); string taskId = GetTaskIdForTopic(m_refContentApi.EkTaskRef.GetTopicReplies(item.TaxonomyItemId, board_data.Id), item.TaxonomyItemId); contenturl = (string)("threadeddisc/addeditreply.aspx?action=Edit&topicid=" + item.TaxonomyItemId.ToString() + "&forumid=" + board_data.Forums[0].Id.ToString() + "&id=" + taskId.ToString() + "&boardid=" + board_data.Id.ToString()); break; default: contenturl = (string) ("content.aspx?action=View&LangType=" + item.TaxonomyItemLanguage + "&id=" + item.TaxonomyItemId + "&callerpage=taxonomy.aspx&origurl=" + EkFunctions.UrlEncode((string) ("action=view&view=item&taxonomyid=" + TaxonomyId + "&treeViewId=-1&LangType=" + TaxonomyLanguage))); break; } dr["TITLE"] = m_refContentApi.GetDmsContextMenuHTML(item.TaxonomyItemId, Convert.ToInt64(item.TaxonomyItemLanguage), Convert.ToInt64(item.ContentType),Convert.ToInt32(item.ContentSubType), item.TaxonomyItemTitle.ToString(), _MessageHelper.GetMessage("generic Title") + " " + item.TaxonomyItemTitle.ToString(), contenturl, item.TaxonomyItemAssetInfo.FileName, item.TaxonomyItemAssetInfo.ImageUrl); //dr["TITLE"] = m_refContentApi.GetDmsContextMenuHTML(item.TaxonomyItemId, item.TaxonomyItemLanguage, item.ContentType, item.ContentSubType, item.TaxonomyItemTitle, (string) (_MessageHelper.GetMessage("generic Title") + " " + item.TaxonomyItemTitle), contenturl, item.TaxonomyItemAssetInfo.FileName, item.TaxonomyItemAssetInfo.ImageUrl); dr["ID"] = item.TaxonomyItemId; dr["LANGUAGE"] = item.TaxonomyItemLanguage; switch (Convert.ToInt32(item.ContentType)) { case 102: // ManagedAsset (non-office documents) libraryInfo = m_refContentApi.GetLibraryItemByContentID(item.TaxonomyItemId); if(libraryInfo != null) dr["URL"] = libraryInfo.FileName.Replace("//", "/"); break; case 103: // Generic asset content type libraryInfo = m_refContentApi.GetLibraryItemByContentID(item.TaxonomyItemId); if (libraryInfo != null) dr["URL"] = libraryInfo.FileName.Replace("//", "/"); break; case 106: // All images have content_Type 106 libraryInfo = m_refContentApi.GetLibraryItemByContentID(item.TaxonomyItemId); if (libraryInfo != null) dr["URL"] = libraryInfo.FileName.Replace("//", "/"); break; default: Ektron.Cms.API.Content.Content api = new Ektron.Cms.API.Content.Content(); contData = api.GetContent(item.TaxonomyItemId); //contData = m_refContentApi.GetContentById(item.TaxonomyItemId) dr["URL"] = contData.Quicklink; break; } if (item.ContentType == Convert.ToInt32(EkEnumeration.CMSContentType.Archive_Content).ToString() || item.ContentType == Convert.ToInt32(EkEnumeration.CMSContentType.Archive_Forms).ToString() || item.ContentType == Convert.ToInt32(EkEnumeration.CMSContentType.Archive_Media).ToString() || (Convert.ToInt32(item.ContentType) >= EkConstants.Archive_ManagedAsset_Min && Convert.ToInt32(item.ContentType) < EkConstants.Archive_ManagedAsset_Max && Convert.ToInt32(item.ContentType) != 3333 && Convert.ToInt32(item.ContentType) != 1111)) { dr["ARCHIVED"] = "<span class=\"Archived\"></span>"; } dt.Rows.Add(dr); } } else { dr = dt.NewRow(); dt.Rows.Add(dr); TaxonomyItemList.GridLines = GridLines.None; } } else { VisiblePageControls(false); TaxonomyFolderSyncData[] taxonomy_sync_folder = null; TaxonomyBaseRequest tax_sync_folder_req = new TaxonomyBaseRequest(); tax_sync_folder_req.TaxonomyId = TaxonomyId; tax_sync_folder_req.TaxonomyLanguage = TaxonomyLanguage; taxonomy_sync_folder = _Content.GetAllAssignedCategoryFolder(tax_sync_folder_req); if ((taxonomy_sync_folder != null)&& taxonomy_sync_folder.Length > 0) { AddDeleteIcon = true; for (int i = 0; i <= taxonomy_sync_folder.Length - 1; i++) { TaxonomyItemCount++; dr = dt.NewRow(); dr["CHECK"] = "<input type=\"checkbox\" name=\"selected_items\" id=\"selected_items\" value=\"" + taxonomy_sync_folder[i].FolderId + "\" onclick=\"checkAll(\'selected_items\',true);\">"; string contenturl; contenturl = "content.aspx?action=ViewContentByCategory&id=" + taxonomy_sync_folder[i].FolderId + "&treeViewId=0"; dr["TITLE"] = "<a href=\"" + contenturl + "\">"; dr["TITLE"] += "<img src=\""; switch ((EkEnumeration.FolderType)taxonomy_sync_folder[i].FolderType) { case EkEnumeration.FolderType.Catalog: dr["TITLE"] += m_refContentApi.AppPath + "images/ui/icons/folderGreen.png"; break; case EkEnumeration.FolderType.Community: dr["TITLE"] += m_refContentApi.AppPath + "images/ui/icons/folderCommunity.png"; break; case EkEnumeration.FolderType.Blog: dr["TITLE"] += m_refContentApi.AppPath + "images/ui/icons/folderBlog.png"; break; case EkEnumeration.FolderType.DiscussionBoard: dr["TITLE"] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png"; break; case EkEnumeration.FolderType.DiscussionForum: dr["TITLE"] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png"; break; default: dr["TITLE"] += m_refContentApi.AppPath + "images/ui/icons/folder.png"; break; } dr["TITLE"] += "\"></img>"; dr["TITLE"] += "</a><a href=\"" + contenturl + "\">"; dr["TITLE"] += taxonomy_sync_folder[i].FolderTitle; //& GetRecursiveTitle(item.FolderRecursive) dr["TITLE"] += "</a>"; dr["ID"] = taxonomy_sync_folder[i].FolderId; dr["LANGUAGE"] = taxonomy_sync_folder[i].TaxonomyLanguage; dt.Rows.Add(dr); } } else { dr = dt.NewRow(); dt.Rows.Add(dr); TaxonomyItemList.GridLines = GridLines.None; } } DataView dv = new DataView(dt); TaxonomyItemList.DataSource = dv; TaxonomyItemList.DataBind(); }
private void DisplayPage() { if (m_strPageAction != "addfolder") { PopulateGridData(); } else { TaxonomyFolderSyncData[] taxonomy_sync_folder = null; TaxonomyBaseRequest tax_sync_folder_req = new TaxonomyBaseRequest(); tax_sync_folder_req.TaxonomyId = TaxonomyId; tax_sync_folder_req.TaxonomyLanguage = TaxonomyLanguage; taxonomy_sync_folder = m_refContent.GetAllAssignedCategoryFolder(tax_sync_folder_req); if ((taxonomy_sync_folder != null)&& taxonomy_sync_folder.Length > 0) { for (int cnt = 0; cnt <= taxonomy_sync_folder.Length - 1; cnt++) { if (m_selectedFolderList.Length > 0) { m_selectedFolderList = m_selectedFolderList + "," + taxonomy_sync_folder[cnt].FolderId.ToString(); } else { m_selectedFolderList = taxonomy_sync_folder[cnt].FolderId.ToString(); } } } // add to the body's onload event to load up the folder tree } }