/// <summary> /// Handles the Populating the content Grid Data when the user clicks on assign the items or folders to a locale taxonomy. /// </summary> private void PopulateGridData() { if ((TaxonomyItemList.Columns.Count == 0)) { TaxonomyItemList.Columns.Add(m_refstyle.CreateBoundField("ITEM1", string.Empty, "info", HorizontalAlign.NotSet, HorizontalAlign.NotSet, Unit.Percentage(0), Unit.Percentage(0), false, false)); } string iframe = string.Empty; if ((Request.QueryString["iframe"] != null && !string.IsNullOrEmpty(Request.QueryString["iframe"]))) { iframe = "&iframe=true"; } DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("ITEM1", typeof(string))); dr = dt.NewRow(); if ((this.m_strPageAction == "additem") && this.m_ObjectType == EkEnumeration.CMSObjectTypes.User) { dr[0] = this.m_refMsg.GetMessage("lbl select users") + "<br/>"; } else if ((m_strPageAction == "additem") && this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup) { dr[0] = this.m_refMsg.GetMessage("lbl select cgroups") + "<br/>"; } else if ((m_strPageAction == "additem") && this.m_ObjectType == EkEnumeration.CMSObjectTypes.TaxonomyNode) { dr[0] = this.m_refMsg.GetMessage("lbl assign locale taxonomy item") + "<br/>"; } else if ((m_strPageAction == "additem") && this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale) { dr[0] = this.m_refMsg.GetMessage("assigntaxonomylocalelabel") + "<br/>"; } else if ((this.m_strPageAction == "additem")) { dr[0] = this.m_refMsg.GetMessage("assigntaxonomyitemlabel") + "<br/>"; } else { dr[0] = this.m_refMsg.GetMessage("assigntaxonomyfolderlabel") + "<br/>"; } dt.Rows.Add(dr); if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.Content && (m_LocaleObjectType != EkEnumeration.TaxonomyItemType.Locale)) { dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("generic Path") + FolderPath; dt.Rows.Add(dr); dr = dt.NewRow(); if ((FolderId != 0)) { dr[0] = "<a href=\"LocaleTaxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + FolderParentId + "&parentid=" + FolderParentId + iframe; dr[0] = dr[0] + "&title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\"><img src=\"" + m_refContentApi.AppPath + "images/ui/icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" align=\"absbottom\">..</a>"; } dt.Rows.Add(dr); if ((folder_data_col != null)) { foreach (Collection folder in folder_data_col) { dr = dt.NewRow(); dr[0] = "<a href=\"LocaleTaxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + folder["id"] + "&parentid=" + FolderParentId + iframe; dr[0] += "&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\"><img src=\""; switch ((EkEnumeration.FolderType)folder["FolderType"]) { case EkEnumeration.FolderType.Catalog: dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderGreen.png"; break; case EkEnumeration.FolderType.Community: dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderCommunity.png"; break; case EkEnumeration.FolderType.Blog: dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBlog.png"; break; case EkEnumeration.FolderType.DiscussionBoard: dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png"; break; case EkEnumeration.FolderType.DiscussionForum: dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderBoard.png"; break; case EkEnumeration.FolderType.Calendar: dr[0] += m_refContentApi.AppPath + "images/ui/icons/folderCalendar.png"; break; case EkEnumeration.FolderType.Domain: dr[0] += m_refContentApi.AppPath + "images/ui/icons/foldersite.png"; break; default: dr[0] += m_refContentApi.AppPath + "images/ui/icons/folder.png"; break; } dr[0] += "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" align=\"absbottom\"></a> "; dr[0] += "<a href=\"LocaleTaxonomy.aspx?action=" + m_strPageAction + "&taxonomyid=" + TaxonomyId + "&folderid=" + folder["id"] + "&parentid=" + FolderParentId + iframe + "&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\">" + folder["Name"] + "</a>"; dt.Rows.Add(dr); } } if ((m_strPageAction == "additem")) { ContentData[] taxonomy_unassigneditem_arr = null; TaxonomyRequest request = new TaxonomyRequest(); request.TaxonomyId = TaxonomyId; request.TaxonomyLanguage = TaxonomyLanguage; request.FolderId = FolderId; if ((contentFetchType.ToLower() == "activecontent")) { request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.ActiveContent; } else if ((contentFetchType.ToLower() == "archivedcontent")) { request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.ArchivedContent; } else { request.TaxonomyItemType = 0; } //// get total #pages first because the API doesn't return it (lame slow way to do this)-: request.PageSize = 99999999; request.CurrentPage = 1; Ektron.Cms.BusinessObjects.Localization.L10nManager l10nMgr = new Ektron.Cms.BusinessObjects.Localization.L10nManager(m_refContentApi.RequestInformationRef); Criteria<FolderData> criteria = new Criteria<FolderData>(); criteria.PagingInfo.RecordsPerPage = 500; List<ILocalizable> donotTranslateList = l10nMgr.GetDoNotTranslateList(FolderId, true, TaxonomyLanguage, Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes, criteria); List<long> NonTranslatedList = new List<long>(); if (donotTranslateList.Count > 0) { for (int l = 0; l < donotTranslateList.Count; l++) { NonTranslatedList.Add(donotTranslateList[l].Id); } } taxonomy_unassigneditem_arr = m_refContent.ReadAllUnAssignedTaxonomyItems(request); this.m_intTotalPages = Convert.ToInt32((taxonomy_unassigneditem_arr.Length + (m_refContentApi.RequestInformationRef.PagingSize - 1)) / m_refContentApi.RequestInformationRef.PagingSize); //// get the real page data set request.PageSize =this.m_refContentApi.RequestInformationRef.PagingSize; request.CurrentPage = this.m_intCurrentPage; taxonomy_unassigneditem_arr = this.m_refContent.ReadAllUnAssignedTaxonomyItems(request); LibraryData library_dat = default(LibraryData); foreach (ContentData taxonomy_item in taxonomy_unassigneditem_arr) { if (!NonTranslatedList.Contains(taxonomy_item.Id)) { dr = dt.NewRow(); if (taxonomy_item.Type == 1 | taxonomy_item.Type == 2) { dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> " + GetTypeIcon(taxonomy_item.Type, taxonomy_item.SubType) + " " + taxonomy_item.Title; } else if (taxonomy_item.Type == 3) { dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/contentArchived.png" + "\" border=\"0\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; } else if (taxonomy_item.Type == 1111) { dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/asteriskOrange.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; } else if (taxonomy_item.Type == 1112) { dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/tree/folderBlog.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; } else if (taxonomy_item.Type == 7) { library_dat = this.m_refContentApi.GetLibraryItemByContentID(taxonomy_item.Id); if (library_dat != null && !string.IsNullOrEmpty(library_dat.FileName)) { string extension = ""; extension = System.IO.Path.GetExtension(library_dat.FileName); switch (extension.ToLower()) { case ".doc": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/word.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case ".ppt": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/powerpoint.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case ".pdf": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/acrobat.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case ".xls": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/excel.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case ".jpg": case ".jpeg": case ".png": case ".gif": case ".bmp": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/image.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; default: //// other files dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; } } } else if (taxonomy_item.Type == 3333) { dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/brick.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; } else if (string.IsNullOrEmpty(taxonomy_item.AssetData.ImageUrl) & (taxonomy_item.Type != 1 & taxonomy_item.Type != 2 & taxonomy_item.Type != 3 & taxonomy_item.Type != 1111 & taxonomy_item.Type != 1112 & taxonomy_item.Type != 3333)) { dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; } else { ////Bad Approach however no other way untill AssetManagement/Images/ are updated with version 8 images or DMS points to workarea images if (string.IsNullOrEmpty(taxonomy_item.AssetData.ImageUrl)) { dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/book.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; } else { switch (Path.GetFileName(taxonomy_item.AssetData.ImageUrl).ToLower()) { case "ms-word.gif": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/word.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case "ms-excel.gif": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/excel.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case "ms-powerpoint.gif": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/powerpoint.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case "adobe-pdf.gif": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/acrobat.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; case "image.gif": dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + m_refContentApi.AppPath + "images/ui/icons/FileTypes/image.png" + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; default: dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + taxonomy_item.Id + "\"/> <img src=\"" + taxonomy_item.AssetData.ImageUrl + "\" alt=\"" + taxonomy_item.AssetData.FileName + "\"></img> " + taxonomy_item.Title; break; } } } dt.Rows.Add(dr); } } } } else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup) { CollectSearchText(); dr = dt.NewRow(); dr[0] = "<input type=text size=25 id=\"txtSearch\" name=\"txtSearch\" value=\"" + this.m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">"; dr[0] += "<input type=button value=\"Search\" id=\"btnSearch\" name=\"btnSearch\" class=\"ektronWorkareaSearch\" onclick=\"searchuser();\" title=\"Search Users\">"; dt.Rows.Add(dr); this.GetAssignedCommunityGroups(); this.GetCommunityGroups(); if (this.cgroup_list != null) { for (int j = 0; j <= (cgroup_list.Length - 1); j++) { dr = dt.NewRow(); if (DoesGroupExistInList(cgroup_list[j].GroupId)) { dr[0] = " " + GetTypeIcon(EkEnumeration.CMSObjectTypes.User.GetHashCode(), EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\" id=\"itemlistNoId\" name=\"itemlistNoId\" value=\"" + cgroup_list[j].GroupId + "\"/>" + cgroup_list[j].GroupName; } else { dr[0] = " " + GetTypeIcon(EkEnumeration.CMSObjectTypes.User.GetHashCode(), EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + cgroup_list[j].GroupId + "\"/>" + cgroup_list[j].GroupName; } dt.Rows.Add(dr); } } } else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.User) { CollectSearchText(); dr = dt.NewRow(); dr[0] = "<input type=text size=25 id=\"txtSearch\" name=\"txtSearch\" value=\"" + this.m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">"; dr[0] += "<select id=\"searchlist\" name=\"searchlist\">"; dr[0] += "<option value=-1" + IsSelected("-1") + ">All</option>"; dr[0] += "<option value=\"last_name\"" + IsSelected("last_name") + ">Last Name</option>"; dr[0] += "<option value=\"first_name\"" + IsSelected("first_name") + ">First Name</option>"; dr[0] += "<option value=\"user_name\"" + IsSelected("user_name") + ">User Name</option>"; dr[0] += "</select><input type=button value=\"Search\" id=\"btnSearch\" name=\"btnSearch\" class=\"ektronWorkareaSearch\" onclick=\"searchuser();\" title=\"Search Users\">"; dt.Rows.Add(dr); GetUsers(); if (userList != null) { for (int j = 0; j <= (userList.Length - 1); j++) { dr = dt.NewRow(); dr[0] = " " + GetTypeIcon(EkEnumeration.CMSObjectTypes.User.GetHashCode(), EkEnumeration.CMSContentSubtype.Content) + "<input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + userList[j].Id + "\"/>" + (!string.IsNullOrEmpty(userList[j].DisplayName) ? userList[j].DisplayName : userList[j].Username); dt.Rows.Add(dr); } } } else if (this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale) { List<int> langList = new List<int>(); Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy api = new Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy(m_refCommonApi.RequestInformationRef); langList = api.GetLocaleIdList(TaxonomyId, TaxonomyLanguage,true); Ektron.Cms.Framework.Localization.LocaleManager localizationApi = new Ektron.Cms.Framework.Localization.LocaleManager(); List<Ektron.Cms.Localization.LocaleData> locData = localizationApi.GetEnabledLocales(); ////Disable the checkbox for Default Language.and loop through all the enabled Languages. for (int k = 0; k < locData.Count; k++) { Boolean taxonomyItemAlreadyExists = langList.Contains(locData[k].Id); //// Boolean isTaxonomyItemDefault = langList.Contains(TaxonomyLanguage); if (!taxonomyItemAlreadyExists) { if (locData[k].Id == TaxonomyLanguage) { dr = dt.NewRow(); dr[0] = " <input type=\"checkbox\" id=\"itemlist\" disabled name=\"itemlist\" value=\"" + locData[k].Id + "\"/> <img src='" + objLocalizationApi.GetFlagUrlByLanguageID(locData[k].Id) + "' /> " + locData[k].CombinedName; dt.Rows.Add(dr); } else { dr = dt.NewRow(); dr[0] = " <input type=\"checkbox\" id=\"itemlist\" name=\"itemlist\" value=\"" + locData[k].Id + "\"/> <img src='" + objLocalizationApi.GetFlagUrlByLanguageID(locData[k].Id) + "' /> " + locData[k].CombinedName; dt.Rows.Add(dr); } } } } DataView dv = new DataView(dt); TaxonomyItemList.DataSource = dv; TaxonomyItemList.DataBind(); }
/// <summary> /// Handles the Populating the taxonomy content grid Data Display page settings. /// </summary> private void DisplayPage() { if (this.m_strPageAction != "addfolder") { this.PopulateGridData(); } else { this.m_selectedFoldersCSV = string.Empty; this.m_prevFolderDescendantsCSV = string.Empty; this.m_prevFolderChildrenCSV = string.Empty; Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy api = new Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy(m_refCommonApi.RequestInformationRef); List<LocalizableItem> folderItemList = api.GetList(TaxonomyId, m_refCommonApi.ContentLanguage, false); if (folderItemList != null && folderItemList.Count > 0) { for (int i = 0; i < folderItemList.Count; i++) { if (LocalizableCmsObjectType.FolderContents == folderItemList[i].LocalizableType) { string folderId = folderItemList[i].Id.ToString(); if (folderItemList[i].Recursive) { if (this.m_prevFolderDescendantsCSV.Length > 0) { this.m_prevFolderDescendantsCSV += ","; } this.m_prevFolderDescendantsCSV += folderId; } else { if (this.m_prevFolderChildrenCSV.Length > 0) { this.m_prevFolderChildrenCSV += ","; } this.m_prevFolderChildrenCSV += folderId; } if (this.m_selectedFoldersCSV.Length > 0) { this.m_selectedFoldersCSV += ","; } this.m_selectedFoldersCSV += folderId; } } // loop } //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_selectedFoldersCSV.Length > 0)) // { // this.m_selectedFoldersCSV = this.m_selectedFoldersCSV + "," + taxonomy_sync_folder[cnt].FolderId; // } // else // { // this.m_selectedFoldersCSV = taxonomy_sync_folder[cnt].FolderId.ToString(); // } // } //} } }