/// <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(); }
private void Page_Init(System.Object sender, System.EventArgs e) { //CODEGEN: This method call is required by the Web Form Designer //Do not modify it using the code editor. InitializeComponent(); _locApi = new Ektron.Cms.Framework.Localization.LocaleManager(); }
protected string CallbackDoAction(string key, Dictionary<string, string> data) { InitFromCallback(data); string what = data["action"]; string sselected = data["selected"]; List<long> selected = sselected.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll<long>(new Converter<string, long>(delegate(string s) { return long.Parse(s); })); Ektron.Cms.CommonApi commonApi = new CommonApi(); Ektron.Cms.Content.EkContent contentManager = new Ektron.Cms.Content.EkContent(commonApi.RequestInformationRef); Ektron.Cms.API.Content.Content capi = new Ektron.Cms.API.Content.Content(); Ektron.Cms.Framework.Localization.LocaleManager localeApi = new Ektron.Cms.Framework.Localization.LocaleManager(); Ektron.Cms.Framework.Localization.LocalizationObject lobjApi = new Ektron.Cms.Framework.Localization.LocalizationObject(); Ektron.Cms.API.Content.Taxonomy taxonomyApi = new Ektron.Cms.API.Content.Taxonomy(); string title = string.Empty, html = string.Empty, okclick = string.Empty, action = string.Empty; switch (what) { case "locales": { action = "showmodal"; bool? addRemoveReplace = null; if (data.ContainsKey("mode")) if (data["mode"] == "add") addRemoveReplace = true; else if (data["mode"] == "del") addRemoveReplace = false; title = (addRemoveReplace == null ? this.GetMessage("lbl Change selected locales") : (addRemoveReplace == true ? "Add locale(s)" : "Remove locale(s)")) + " " + this.GetMessage("generic for") + " " + (selected.Count == 1 ? "1 item" : (selected.Count.ToString() + " " + this.GetMessage("generic items"))); html = GenerateLocaleList(selected, CurrentLanguageId, addRemoveReplace); okclick = this.ClientID + (addRemoveReplace == null ? "_LocaleSet" : (addRemoveReplace == true ? "_LocaleAdd" : "_LocaleDel")); } break; case "localeset": { List<int> locales = data["locales"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList<string>().ConvertAll<int>(new Converter<string, int>(delegate(string s) { return int.Parse(s); })); bool? addRemoveReplace = null; if (data.ContainsKey("mode")) if (data["mode"] == "add") addRemoveReplace = true; else if (data["mode"] == "del") addRemoveReplace = false; SetLocales(selected, locales, CurrentLanguageId, addRemoveReplace); action = "hidemodal"; title = ""; Fill(); html = RenderControl(plcRenderMe); okclick = ""; } break; case "transstatus": { action = "showmodal"; title = "Set Translation Readiness"; // ##TODO: Check current translation status html = RenderControl(pnlSetTransStatus); okclick = this.ClientID + "_TransStatusSet"; } break; case "settranstatus": { string status = data["status"].ToLower(); foreach (long id in selected) { Ektron.Cms.Localization.LocalizableCmsObjectType objectType = Ektron.Cms.Localization.LocalizableCmsObjectType.Content; Ektron.Cms.Framework.Localization.LocalizationObject lobj = new Ektron.Cms.Framework.Localization.LocalizationObject(); switch (status) { case "ready": lobjApi.MarkReadyForTranslation(objectType, id, CurrentLanguageId); break; case "notready": lobjApi.MarkNotReadyForTranslation(objectType, id, CurrentLanguageId); break; case "donottranslate": lobjApi.MarkDoNotTranslate(objectType, id, CurrentLanguageId); break; } } action = "hidemodal"; title = string.Empty; Fill(); html = RenderControl(plcRenderMe); okclick = string.Empty; } break; case "notes": { action = "showmodal"; title = "Add notes for " + (selected.Count == 1 ? "1 item" : (selected.Count.ToString() + " items")); lNoteN.Visible = selected.Count > 1; if (selected.Count == 1) // Load notes if there is only one piece of content { // ##TODO: Add this! } html = RenderControl(pnlNotes); okclick = this.ClientID + "_NotesSet"; } break; case "setnotes": { string notes = data["notes"]; long metadataId = commonApi.EkContentRef.GetMetadataTypeId("XliffNote", CurrentLanguageId, 0); foreach (long cid in selected) { capi.UpdateContentMetaData(cid, metadataId, notes); } action = "hidemodal"; title = string.Empty; Fill(); html = RenderControl(plcRenderMe); okclick = string.Empty; } break; case "pseudo": { action = "showmodal"; title = "Pseudo Localize " + (selected.Count == 1 ? "1 item" : (selected.Count.ToString() + " items")) + "."; Ektron.Cms.Framework.Localization.LocaleManager locale = new Ektron.Cms.Framework.Localization.LocaleManager(); List<Ektron.Cms.Localization.LocaleData> pseudoLocales = locale.GetEnabledLocales().FindAll(d => d.XmlLang.Contains("-x-pseudo")); if (pseudoLocales.Count > 0) foreach (Ektron.Cms.Localization.LocaleData pseudoLocale in pseudoLocales) { CheckBox pseudoLoc = new CheckBox() { ID = "chkPS" + pseudoLocale.Id.ToString(), Checked = true, Text = pseudoLocale.Loc + " " + pseudoLocale.EnglishName }; pnlPseudo.Controls.Add(pseudoLoc); pnlPseudo.Controls.Add(new LiteralControl("<br />")); } else lblPseudoInstructions.Text = "There are no Pseudo localization enabled locales."; html = RenderControl(pnlPseudo); okclick = this.ClientID + "_PseudoSet"; } break; case "setpseudo": { action = "showmodal"; title = "Pseudo Localize " + (selected.Count == 1 ? "1 item" : (selected.Count.ToString() + " items")) + "."; string selectedIds = string.Join(",", selected.ConvertAll<string>(delegate(long i) { return i.ToString(); }).ToArray()); string pseudoLocaleIds = data["locales"]; ektronExportPseudoIframe.Attributes["src"] = "widgets/Modal/localizationjobs.aspx?action=pseudo&contentIds=" + selectedIds + "&languageIds=" + pseudoLocaleIds; html = RenderControl(pnlSetPseudo); okclick = this.ClientID + "_PseudoReset"; } break; case "pseudocomplete": { action = "hidemodal"; title = string.Empty; Fill(); html = RenderControl(plcRenderMe); okclick = string.Empty; } break; default: { action = "showmodal"; title = "Invalid selection"; html = "The option that was selected is not available."; okclick = this.ClientID + "_CloseModalDialog"; } break; } Dictionary<string, string> output = new Dictionary<string, string>(); output["action"] = action; output["title"] = title; output["html"] = html; output["okclick"] = okclick; return ConvertDictionaryToQueryString(output); }
protected string GenerateLocaleList(List<long> selections, int defaultLocale, bool? addRemoveReplace) { plcLangsSelected.Visible = addRemoveReplace == null; Ektron.Cms.Framework.Localization.LocaleManager locale = new Ektron.Cms.Framework.Localization.LocaleManager(); Ektron.Cms.Framework.Localization.LocalizationObject lobj = new Ektron.Cms.Framework.Localization.LocalizationObject(); List<Ektron.Cms.Localization.LocaleData> locales = locale.GetEnabledLocales(); // If not adding/deleting, loop through each of the selected content items to try and find selected locales List<int> selectedLocales = new List<int>(); if (addRemoveReplace == null) { List<int> contentLocales = new List<int>(); lMultiNotice.Visible = false; foreach (long item in selections) { contentLocales = lobj.GetObjectLanguages(Ektron.Cms.Localization.LocalizableCmsObjectType.Content, item); contentLocales.Sort(); if (selectedLocales.Count == 0) selectedLocales.AddRange(contentLocales); if (!LocaleListsMatch(selectedLocales, contentLocales)) { selectedLocales = new List<int>(); lMultiNotice.Visible = true; break; } } if (!selectedLocales.Contains(defaultLocale)) selectedLocales.Add(defaultLocale); } DataTable dt = new DataTable("locales"); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Enabled", typeof(bool)); dt.Columns.Add("EnglishName", typeof(string)); dt.Columns.Add("Loc", typeof(string)); dt.Columns.Add("CombinedName", typeof(string)); dt.Columns.Add("FlagUrl", typeof(string)); dt.Columns.Add("Default", typeof(bool)); DataRow dr; foreach (Ektron.Cms.Localization.LocaleData ld in locales) { dr = dt.NewRow(); dr.ItemArray = new object[] { ld.Id, selectedLocales.Contains(ld.Id) || ld.Id == CurrentLanguageId, ld.EnglishName, ld.Loc, ld.CombinedName, ld.FlagUrl, ld.Id == defaultLocale }; dt.Rows.Add(dr); } DataTable sdt, adt; sdt = GetRowsFromArray(dt.Select("Enabled = true", "Loc")); adt = GetRowsFromArray(dt.Select("Enabled = false", "Loc")); // Databind rptSelectedLangs.DataSource = sdt; rptAvailableLangs.DataSource = adt; pnlLangSelector.DataBind(); List<int> availableLocales = locales.ConvertAll<int>(new Converter<Ektron.Cms.Localization.LocaleData, int>(delegate(Ektron.Cms.Localization.LocaleData ld) { return ld.Id; })); foreach (int l in selectedLocales) if (availableLocales.Contains(l)) availableLocales.Remove(l); // Set up the links plcSelectLinks.Controls.Clear(); if (adt.Rows.Count > 0) { string links = "<a onclick=\"" + SelectAllScript(true, availableLocales) + " return false;\" href=\"#\" title=\"" + GetMessage("lbl select all languages") + "\">" + GetMessage("lbl select all languages") + "</a> | " + "<a onclick=\"" + SelectAllScript(false, availableLocales) + " return false;\" href=\"#\" title=\"" + GetMessage("lbl deselect all languages") + "\">" + GetMessage("lbl deselect all languages") + "</a>"; plcSelectLinks.Controls.Add(new LiteralControl(links)); } else { rptAvailableLangs.Visible = false; } // Render return RenderControl(pnlLangSelector); }
/// <param name="addRemoveReplace">true for add, false for remove, null for replace</param> protected void SetLocales(List<long> selections, List<int> selectedLocales, int defaultLocale, bool? addRemoveReplace) { Ektron.Cms.Framework.Localization.LocaleManager locale = new Ektron.Cms.Framework.Localization.LocaleManager(); Ektron.Cms.Framework.Localization.LocalizationObject lobj = new Ektron.Cms.Framework.Localization.LocalizationObject(); List<Ektron.Cms.Localization.LocaleData> locales = locale.GetEnabledLocales(); // Loop through each of the selected content items to try and find selected locales List<int> contentLocales = new List<int>(); if (!selectedLocales.Contains(defaultLocale)) selectedLocales.Add(defaultLocale); selectedLocales.Sort(); List<int> localesToDelete = new List<int>(); List<int> localesToAdd = new List<int>(); List<Ektron.Cms.Localization.LocalizationObjectData> localeData = new List<Ektron.Cms.Localization.LocalizationObjectData>(); foreach (long item in selections) { Ektron.Cms.Localization.LocalizableCmsObjectType objectType = Ektron.Cms.Localization.LocalizableCmsObjectType.Content; contentLocales = lobj.GetObjectLanguages(Ektron.Cms.Localization.LocalizableCmsObjectType.Content, item); if (contentLocales.Count == 0) { objectType = Ektron.Cms.Localization.LocalizableCmsObjectType.DmsAsset; contentLocales = lobj.GetObjectLanguages(Ektron.Cms.Localization.LocalizableCmsObjectType.DmsAsset, item); } bool skip = true; if (addRemoveReplace == null && !LocaleListsMatch(selectedLocales, contentLocales)) skip = false; if (addRemoveReplace == true && !LocaleListContains(contentLocales, selectedLocales)) skip = false; if (addRemoveReplace == false && LocaleListContains(contentLocales, selectedLocales)) skip = false; if (!skip) { localeData = lobj.GetLocalizationObjectList(objectType, item, -1); localesToDelete.Clear(); localesToAdd.Clear(); if (addRemoveReplace == null || addRemoveReplace == true) foreach (int i in selectedLocales) if (!contentLocales.Contains(i)) localesToAdd.Add(i); if (addRemoveReplace == null) foreach (int i in contentLocales) if (!selectedLocales.Contains(i)) localesToDelete.Add(i); if (addRemoveReplace == false) foreach (int i in contentLocales) if (selectedLocales.Contains(i)) localesToDelete.Add(i); foreach (int i in localesToDelete) foreach (Ektron.Cms.Localization.LocalizationObjectData ldata in localeData) if (ldata.ObjectLanguage == i) lobj.Delete(ldata.Id); foreach (int i in localesToAdd) lobj.MarkReadyForTranslation(objectType, item, i); } } }
public Dictionary<int, string> GetShortLocaleList() { _shortLocaleList = (Dictionary<int, string>)Cache[shortLocaleCacheKey]; if (_shortLocaleList == null) lock (_shortLocaleListLock) if (_shortLocaleList == null) { Ektron.Cms.Framework.Localization.LocaleManager locale = new Ektron.Cms.Framework.Localization.LocaleManager(); Criteria<Ektron.Cms.Localization.LocaleProperty> criteria = new Criteria<Ektron.Cms.Localization.LocaleProperty>(Ektron.Cms.Localization.LocaleProperty.LangCode, EkEnumeration.OrderByDirection.Ascending); criteria.AddFilter(Ektron.Cms.Localization.LocaleProperty.Enabled, CriteriaFilterOperator.EqualTo, true); criteria.PagingInfo.RecordsPerPage = int.MaxValue - 1; List<Ektron.Cms.Localization.LocaleData> locales = locale.GetList(criteria); _shortLocaleList = new Dictionary<int, string>(); foreach (Ektron.Cms.Localization.LocaleData l in locales) if (!_shortLocaleList.ContainsKey(l.Id)) _shortLocaleList.Add(l.Id, l.Loc); Cache.Add(shortLocaleCacheKey, _shortLocaleList, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 20, 0), System.Web.Caching.CacheItemPriority.Normal, null); } return _shortLocaleList; }
/// <summary> /// Override OnInit to assign control properties /// </summary> /// <param name="e">The event arguments</param> protected override void OnInit(EventArgs e) { base.OnInit(e); this.locApi = new Ektron.Cms.Framework.Localization.LocaleManager(); revLoc.ValidationExpression = @"[A-Za-z0-9_\-]{1,20}"; valLoc.ValidateEmptyText = false; valLoc.ServerValidate += new ServerValidateEventHandler(this.ServerValidateHandler); revPrivateUseSubtag.ValidationExpression = @"[A-Za-z0-9]{1,8}"; // http://www.rfc-editor.org/rfc/rfc5646.txt revNativeName.ValidationExpression = @"[^\<\>\x22\r\n]{1,50}"; revEnglishName.ValidationExpression = revNativeName.ValidationExpression; }
protected void displayProperties() { if (PageID == -1 || (Page as PageBuilder).Status == Mode.AnonViewing) { propsmenu.Visible = false; } else { propsmenu.Visible = true; try { PageBuilder mypage = (Page as PageBuilder); WireframeModel wfm = new WireframeModel(); ContentBase baseData = mypage.Basedata; if (baseData == null) baseData = Capi.EkContentRef.LoadContent(PageID, true, EkEnumeration.CMSContentSubtype.PageBuilderData); Ektron.Cms.Framework.Localization.LocaleManager _locApi = new Ektron.Cms.Framework.Localization.LocaleManager(); LocaleData langData = null; langData = _locApi.GetItem(baseData.Language); ContentStateData state = null; WireframeData wireframe = null; if (PageID > -1) { state = Capi.GetContentState(PageID); wireframe = wfm.FindByPageID(PageID); } spnContentPath.InnerText = m_refMsg.GetMessage("generic path"); spnCurrentEditor.InnerText = m_refMsg.GetMessage("status:checked out by"); spnDateCreated.InnerText = m_refMsg.GetMessage("generic datecreated"); spnLanguage.InnerText = m_refMsg.GetMessage("lbl language"); spnLastEditDate.InnerText = m_refMsg.GetMessage("generic date modified"); spnLastEditor.InnerText = m_refMsg.GetMessage("generic last editor"); spnMode.InnerText = m_refMsg.GetMessage("lbl pagebuilder current mode"); spnPageID.InnerText = m_refMsg.GetMessage("lbl pagebuilder page id"); spnStatus.InnerText = m_refMsg.GetMessage("generic status"); spnTitle.InnerText = m_refMsg.GetMessage("generic title"); spnWireframeFile.InnerText = m_refMsg.GetMessage("lbl pagebuilder wireframe template path"); trCheckedOut.Visible = false; lblDatecreated.Text = baseData.DisplayDateCreated; lblLanguage.Text = langData.EnglishName + " (" + baseData.Language.ToString() + ")"; lblLasteditdate.Text = baseData.DisplayDateModified; lblLasteditor.Text = baseData.LastEditorFname + " " + baseData.LastEditorLname; lblPath.Text = PagePath; if (wireframe != null) { lblWireframe.Text = wireframe.Path; } lblPageid.Text = PageID.ToString(); lblTitle.Text = state.Title; if (state != null) { switch (state.Status) { case "A": lblStatus.Text = m_refMsg.GetMessage("status:approved (published)"); break; case "S": lblStatus.Text = m_refMsg.GetMessage("status:submitted for approval"); break; case "I": lblStatus.Text = m_refMsg.GetMessage("status:checked in"); break; case "M": lblStatus.Text = m_refMsg.GetMessage("status:submitted for deletion"); break; case "P": lblStatus.Text = m_refMsg.GetMessage("status:approved (pgld)"); break; case "O": trCheckedOut.Visible = true; lblStatus.Text = m_refMsg.GetMessage("status:checked out"); if (state != null) { lblUserCheckedOut.Text = state.CurrentEditorFirstName + " " + state.CurrentEditorLastName; lblUserCheckedOut.ToolTip = lblUserCheckedOut.Text; } break; case "T": lblStatus.Text = m_refMsg.GetMessage("lbl pagebuilder pending tasks"); break; default: lblStatus.Text = ""; break; } if (state.ContType == 3) { lblStatus.Text = m_refMsg.GetMessage("lbl pagebuilder expired"); } } switch (mypage.Status) { case Mode.AuthorViewing: if ((Page as PageBuilder).viewType == layoutVersion.Staged) lblMode.Text = m_refMsg.GetMessage("pagebuilder viewing staged"); else lblMode.Text = m_refMsg.GetMessage("pagebuilder viewing published"); break; case Mode.Editing: lblMode.Text = m_refMsg.GetMessage("pagebuilder editing"); break; case Mode.Preview: lblMode.Text = m_refMsg.GetMessage("pagebuilder preview"); break; default: lblMode.Text = ""; break; } } catch (Exception e) { string error = e.ToString(); } } }
private void AddLanguageMenu(StringBuilder result) { if (_EnableMultilingual == 1) { result.Append(" var languagemenu = new Menu( \"language\" );" + Environment.NewLine); result.Append(" viewmenu.addBreak();" + Environment.NewLine); string strSelectedLanguageName = ""; string strName; strName = "All"; if (_ContentLanguage == -1) { strName = "<b>" + strName + "</b>"; } result.Append(" languagemenu.addItem(\" <img src=\'" + _ContentApi.AppImgPath + "flags/flag0000.gif\' alt=\\\"" + strName + "\\\" /> " + strName + "\", function() { LoadLanguage(\'-1\'); } );" + Environment.NewLine); Ektron.Cms.Framework.Localization.LocaleManager locApi = new Ektron.Cms.Framework.Localization.LocaleManager(); Ektron.Cms.Localization.LocaleData locData; List<Ektron.Cms.Localization.LocaleData> locDataList; Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy locTaxApi = new Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy(_Common.RequestInformationRef); List<int> locList = locTaxApi.GetLocaleIdListForFolder(_FolderData.Id, this._ContentLanguage); if (locList.Count > 0) { locDataList = locApi.GetEnabledLocales(locList); } else { locDataList = locApi.GetEnabledLocales(); } for (int i = 0; i <= (locDataList.Count - 1); i++) { locData = locDataList[i]; strName = locData.CombinedName; if (_ContentLanguage == locData.Id) { strSelectedLanguageName = locData.EnglishName; strName = "<b>" + strName + "</b>"; } result.AppendLine(" languagemenu.addItem(\" <img src=\'" + locData.FlagUrl + "\' /> " + Ektron.Cms.API.JS.Escape(strName) + "\", function() { LoadLanguage(\'" + locData.Id + "\'); } );"); } //result.AppendLine(" viewmenu.addMenu("" <img src='" & _LocalizationApi.GetFlagUrlByLanguageID(_ContentLanguage) & "' alt=\""" & strSelectedLanguageName & "\"" /> " & _MessageHelper.GetMessage("lbl Language") & """, languagemenu);") result.Append(" viewmenu.addMenu(\" <img src=\'" + _LocalizationApi.GetFlagUrlByLanguageID(_ContentLanguage) + "\' alt=\\\"" + strSelectedLanguageName + "\\\" /> " + _MessageHelper.GetMessage("lbl Language") + "\", languagemenu);" + Environment.NewLine); } }
private void Populate_ViewCatalogGrid(EkContentCol folder_data, System.Collections.Generic.List<EntryData> entryList) { System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); string strTag; string strtag1; string langDesc = string.Empty; string imageDirection = string.Empty; if (Request.QueryString["orderbydirection"] == null) direction = "desc"; else if (Request.QueryString["orderbydirection"] == "desc") { imageDirection = " <img src=\"" + _ContentApi.ApplicationPath + "images/ui/icons/arrowHeadDownGrey.png\" \" />"; direction = "asc"; } else if (Request.QueryString["orderbydirection"] == "asc") { imageDirection = " <img src=\"" + _ContentApi.ApplicationPath + "images/ui/icons/arrowHeadUpGrey.png\" \" />"; direction = "desc"; } strTag = "<a href=\"content.aspx?LangType=" + _ContentLanguage + "&action=" + _PageAction + "&orderbydirection=" + direction + "&orderby="; strtag1 = "&id=" + _Id + (_ContentTypeQuerystringParam != "" ? "&" + _ContentTypeUrlParam + "=" + _ContentTypeQuerystringParam : "") + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">"; colBound.DataField = "TITLE"; if (!string.IsNullOrEmpty(Request.QueryString["orderby"]) && Request.QueryString["orderby"].ToString().ToLower() == "title") colBound.HeaderText = strTag + "Title" + strtag1 + _MessageHelper.GetMessage("generic title") + imageDirection + "</a>"; else colBound.HeaderText = strTag + "Title" + strtag1 + _MessageHelper.GetMessage("generic title") + "</a>"; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.CssClass = "left"; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "CONTENTTYPE"; colBound.HeaderText = strTag + "Type" + strtag1 + _MessageHelper.GetMessage("lbl product type xml config") + "</a>"; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.CssClass = "left"; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "LANGUAGE"; if (!string.IsNullOrEmpty(Request.QueryString["orderby"]) && Request.QueryString["orderby"].ToString().ToLower() == "language") colBound.HeaderText = strTag + "language" + strtag1 + _MessageHelper.GetMessage("generic language") + imageDirection + "</a>"; else colBound.HeaderText = strTag + "language" + strtag1 + _MessageHelper.GetMessage("generic language") + "</a>"; colBound.HeaderStyle.CssClass = "title-header center"; colBound.ItemStyle.CssClass = "center"; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "ID"; if (!string.IsNullOrEmpty(Request.QueryString["orderby"]) && Request.QueryString["orderby"].ToString().ToLower() == "id") colBound.HeaderText = strTag + "ID" + strtag1 + _MessageHelper.GetMessage("generic ID") + imageDirection + "</a>"; else colBound.HeaderText = strTag + "ID" + strtag1 + _MessageHelper.GetMessage("generic ID") + "</a>"; colBound.HeaderStyle.CssClass = "title-header center"; colBound.ItemStyle.CssClass = "center"; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "STATUS"; if (!string.IsNullOrEmpty(Request.QueryString["orderby"]) && Request.QueryString["orderby"].ToString().ToLower() == "status") colBound.HeaderText = strTag + "status" + strtag1 + _MessageHelper.GetMessage("generic Status") + imageDirection + "</a>"; else colBound.HeaderText = strTag + "status" + strtag1 + _MessageHelper.GetMessage("generic Status") + "</a>"; colBound.HeaderStyle.CssClass = "title-header center"; colBound.ItemStyle.CssClass = "center"; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "TYPE"; colBound.HeaderText = strTag + "entrytype" + strtag1 + _MessageHelper.GetMessage("lbl product type class") + "</a>"; colBound.HeaderStyle.CssClass = "title-header center"; colBound.ItemStyle.CssClass = "center"; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "SALEPRICE"; if (!string.IsNullOrEmpty(Request.QueryString["orderby"]) && Request.QueryString["orderby"].ToString().ToLower() == "sale") colBound.HeaderText = strTag + "sale" + strtag1 + _MessageHelper.GetMessage("lbl sale price") + imageDirection + "</a>"; else colBound.HeaderText = strTag + "sale" + strtag1 + _MessageHelper.GetMessage("lbl sale price") + "</a>"; colBound.HeaderStyle.CssClass = "title-header center"; colBound.ItemStyle.CssClass = "right"; FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "LISTPRICE"; if (!string.IsNullOrEmpty(Request.QueryString["orderby"]) && Request.QueryString["orderby"].ToString().ToLower() == "list") colBound.HeaderText = strTag + "list" + strtag1 + _MessageHelper.GetMessage("lbl list price") + imageDirection + "</a>"; else colBound.HeaderText = strTag + "list" + strtag1 + _MessageHelper.GetMessage("lbl list price") + "</a>"; colBound.HeaderStyle.CssClass = "title-header center"; colBound.ItemStyle.CssClass = "right"; FolderDataGrid.Columns.Add(colBound); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("CONTENTTYPE", typeof(string))); dt.Columns.Add(new DataColumn("LANGUAGE", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(long))); dt.Columns.Add(new DataColumn("STATUS", typeof(string))); dt.Columns.Add(new DataColumn("TYPE", typeof(string))); dt.Columns.Add(new DataColumn("SALEPRICE", typeof(string))); dt.Columns.Add(new DataColumn("LISTPRICE", typeof(string))); string ViewUrl = ""; int i; for (i = 0; i <= (entryList.Count - 1); i++) { dr = dt.NewRow(); if (entryList[i].ContentStatus == "A") { ViewUrl = (string)("content.aspx?action=View&folder_id=" + _Id + "&id=" + entryList[i].Id + "&LangType=" + entryList[i].LanguageId + "&callerpage=content.aspx&origurl=" + EkFunctions.UrlEncode(Request.ServerVariables["QUERY_STRING"])); } else { ViewUrl = (string)("content.aspx?action=ViewStaged&folder_id=" + _Id + "&id=" + entryList[i].Id + "&LangType=" + entryList[i].LanguageId + "&callerpage=content.aspx&origurl=" + EkFunctions.UrlEncode(Request.ServerVariables["QUERY_STRING"])); } string dmsMenuGuid; dmsMenuGuid = (string)(System.Guid.NewGuid().ToString()); string makeUnique = (string)(entryList[i].Id + entryList[i].LanguageId + dmsMenuGuid); long contentType = Convert.ToInt64(EkEnumeration.CMSContentType.CatalogEntry); dr[0] = "<div class=\"dmsWrapper\""; dr[0] = dr[0] + " id=\"dmsWrapper" + makeUnique + "\">"; dr[0] = dr[0] + "<p class=\"dmsItemWrapper\""; dr[0] = dr[0] + " id=\"dmsItemWrapper" + makeUnique + "\""; dr[0] = dr[0] + " title=\"View Menu\""; dr[0] = dr[0] + " style=\"overflow:visible;\""; dr[0] = dr[0] + ">"; dr[0] = dr[0] + "<input type=\"hidden\" value=\'{\"id\":" + entryList[i].Id + ","; dr[0] = dr[0] + "\"parentId\":" + entryList[i].FolderId + ","; dr[0] = dr[0] + "\"languageId\":" + entryList[i].LanguageId + ","; dr[0] = dr[0] + "\"status\":\"" + entryList[i].ContentStatus + "\","; dr[0] = dr[0] + "\"guid\":\"" + dmsMenuGuid + "\","; dr[0] = dr[0] + "\"communityDocumentsMenu\": \"\","; dr[0] = dr[0] + "\"contentType\":" + contentType + ","; dr[0] = dr[0] + "\"dmsSubtype\":\"\"}\'"; dr[0] = dr[0] + " id=\"dmsContentInfo" + makeUnique + "\" />"; if (entryList[i].EntryType == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct) { dr[0] = dr[0] + "<img src=\"" + _ContentApi.AppPath + "images/ui/icons/bookGreen.png" + "\" onclick=\"event.cancelBubble=true;\" />"; } else if (entryList[i].EntryType == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product) { dr[0] = dr[0] + "<img src=\"" + _ContentApi.AppPath + "Images/ui/icons/brick.png" + "\" onclick=\"event.cancelBubble=true;\" />"; } else if (entryList[i].EntryType == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct) { dr[0] = dr[0] + "<img src=\"" + _ContentApi.AppPath + "Images/ui/icons/bricks.png" + "\" onclick=\"event.cancelBubble=true;\" />"; } else if (entryList[i].EntryType == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit) { dr[0] = dr[0] + "<img src=\"" + _ContentApi.AppPath + "Images/ui/icons/box.png" + "\" onclick=\"event.cancelBubble=true;\" />"; } else if (entryList[i].EntryType == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle) { dr[0] = dr[0] + "<img src=\"" + _ContentApi.AppPath + "Images/ui/icons/package.png\" onclick=\"event.cancelBubble=true;\" />"; } dr[0] = dr[0] + "<a"; dr[0] = dr[0] + " id=\"dmsViewItemAnchor" + makeUnique + "\""; dr[0] = dr[0] + " class=\"dmsViewItemAnchor\""; dr[0] = dr[0] + " onclick=\"event.cancelBubble=true;\""; dr[0] = dr[0] + " href=\"" + ViewUrl + "\""; dr[0] = dr[0] + " title=\"View " + entryList[i].Title + "\""; dr[0] = dr[0] + ">" + entryList[i].Title; dr[0] = dr[0] + "</a>"; dr[0] = dr[0] + "</p>"; dr[0] = dr[0] + "</div>"; Ektron.Cms.Framework.Localization.LocaleManager _locApi = new Ektron.Cms.Framework.Localization.LocaleManager(); LocaleData langData = _locApi.GetItem(System.Convert.ToInt32(entryList[i].LanguageId)); if (langData != null) { langDesc = langData.EnglishName; } dr[1] = GetContentTypeText(contentType, entryList[i].ProductType.Id, 0, ""); dr[2] = "<a href=\"#Language\" onclick=\"return false;\" onmouseover=\"ddrivetip(\'" + langDesc.ToString() + "\',\'ADC5EF\', 100);\" onmouseout=\"hideddrivetip()\" style=\"text-decoration:none;\">" + "<img src=\'" + _LocalizationApi.GetFlagUrlByLanguageID(System.Convert.ToInt32(entryList[i].LanguageId)) + "\' alt=\"Flag\" />" + "</a>"; dr[3] = entryList[i].Id; dr[4] = _StyleHelper.StatusWithToolTip((string)(entryList[i].ContentStatus)); dr[5] = entryList[i].EntryType.ToString(); dr[6] = Ektron.Cms.Common.EkFunctions.FormatCurrency(System.Convert.ToDecimal(entryList[i].SalePrice), _ContentApi.RequestInformationRef.CommerceSettings.CurrencyCultureCode); dr[7] = Ektron.Cms.Common.EkFunctions.FormatCurrency(System.Convert.ToDecimal(entryList[i].ListPrice), _ContentApi.RequestInformationRef.CommerceSettings.CurrencyCultureCode); dt.Rows.Add(dr); } DataView dv = new DataView(dt); FolderDataGrid.DataSource = dv; FolderDataGrid.DataBind(); }
public Dictionary<int, string> GetShortLocaleList() { if (_shortLocaleList == null) lock (_shortLocaleListLock) if (_shortLocaleList == null) { Ektron.Cms.Framework.Localization.LocaleManager locale = new Ektron.Cms.Framework.Localization.LocaleManager(); Criteria<Ektron.Cms.Localization.LocaleProperty> criteria = new Criteria<Ektron.Cms.Localization.LocaleProperty>(); criteria.AddFilter(Ektron.Cms.Localization.LocaleProperty.Enabled, CriteriaFilterOperator.EqualTo, true); List<Ektron.Cms.Localization.LocaleData> locales = locale.GetList(criteria); _shortLocaleList = new Dictionary<int, string>(); foreach (Ektron.Cms.Localization.LocaleData l in locales) if (!_shortLocaleList.ContainsKey(l.LCID)) _shortLocaleList.Add(l.LCID, l.Loc); } return _shortLocaleList; }
/// <summary> /// Get all the Enabled locales from CMS. /// </summary> private void PopulateLocaleGrid() { string applicationpath = new Ektron.Cms.CommonApi().ApplicationPath; Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronStringJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronXmlJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronSmartFormJS); Ektron.Cms.API.JS.RegisterJSInclude(this, applicationpath + "java/ektron.workarea.js", "ektronWorkareaJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekxbrowser.js", "ekxbrowserJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekutil.js", "ekutilJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../RadWindow.js", "RadWindowJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekformfields.js", "ekformfieldsJS"); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronJFunctJS); this.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitializeRadWindow", "InitializeRadWindow();", true); EnabledLocaleList.Columns.Add(this.styleHelper.CreateBoundField("Include", this.GetMessage("lbl include locales header for content"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); EnabledLocaleList.Columns.Add(this.styleHelper.CreateBoundField("Exclude", this.GetMessage("lbl exclude locales header for content"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); EnabledLocaleList.Columns.Add(this.styleHelper.CreateBoundField("Combined Name", this.GetMessage("lbl Name"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false)); EnabledLocaleList.Columns.Add(this.styleHelper.CreateBoundField("Loc", this.GetMessage("lbl loc header for content"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false)); EnabledLocaleList.Columns.Add(this.styleHelper.CreateBoundField("Id", this.GetMessage("lbl id header of locale for content"), "title-header", HorizontalAlign.Right, HorizontalAlign.Right, Unit.Percentage(30), Unit.Percentage(30), false, false)); DataTable localeDataTable = new DataTable(); DataRow localeDataRow = default(DataRow); localeDataTable.Columns.Add(new DataColumn("Include", typeof(string))); localeDataTable.Columns.Add(new DataColumn("Exclude", typeof(string))); localeDataTable.Columns.Add(new DataColumn("Combined Name", typeof(string))); localeDataTable.Columns.Add(new DataColumn("Loc", typeof(string))); localeDataTable.Columns.Add(new DataColumn("Id", typeof(string))); Ektron.Cms.Framework.Localization.LocaleManager localeApi = new Ektron.Cms.Framework.Localization.LocaleManager(); List<LocaleData> locales = localeApi.GetEnabledLocales(); if (locales.Count > 0) { for (int b = 0; b < locales.Count; b++) { string includeMessage = this.GetMessage("lbl include locales title for include checkbox of localization"); string excludeMessage = this.GetMessage("lbl exclude locales title for include checkbox of localization"); localeDataRow = localeDataTable.NewRow(); localeDataRow["Include"] = "<input type=\"checkbox\" title=\"" + includeMessage + "\" class=" + locales[b].Id + " name=\"include_items\" id=\"include_items" + locales[b].Id + "\" value=\"" + locales[b].Loc + "\" onclick=\"disableIncludeCheck('exclude_items" + locales[b].Id + "','include_items" + locales[b].Id + "');\">"; localeDataRow["Exclude"] = "<input type=\"checkbox\" title=\"" + excludeMessage + "\" class=" + locales[b].Id + " name=\"exclude_items\" id=\"exclude_items" + locales[b].Id + "\" value=\"" + locales[b].Loc + "\" onclick=\"disableIncludeCheck('include_items" + locales[b].Id + "','exclude_items" + locales[b].Id + "');\">"; localeDataRow["Combined Name"] = "<img title=" + locales[b].EnglishName + " alt=" + locales[b].EnglishName + " src='" + this.objLocalizationApi.GetFlagUrlByLanguageID(locales[b].Id) + "' /> " + locales[b].CombinedName; localeDataRow["Loc"] = locales[b].Loc; localeDataRow["Id"] = locales[b].Id; localeDataTable.Rows.Add(localeDataRow); } } DataView dataView = new DataView(localeDataTable); EnabledLocaleList.DataSource = dataView; EnabledLocaleList.DataBind(); }
private void PopulateLocaleContentGridData(List<int> langList,List<int> parenttaxonomyLanguageList) { VisiblePageControls(false); 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 = default(DataRow); 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))); Ektron.Cms.Framework.Localization.LocaleManager locApi = new Ektron.Cms.Framework.Localization.LocaleManager(); List<LocaleData> locales = locApi.GetEnabledLocales(langList); List<LocaleData> parentEnabledlocales = locApi.GetEnabledLocales(parenttaxonomyLanguageList); //get the list of all the languages assigned to the top level locale taxonomy. List<int> localeIdsOfPackage = new List<int>(); if (locales != null && locales.Count > 0) { AddDeleteIcon = true; for (int i = 0; i <= (locales.Count - 1); i++) { localeIdsOfPackage.Add(locales[i].Id); if (locales[i].Id == TaxonomyLanguage) { dr = dt.NewRow(); dr["CHECK"] = "<input type=\"checkbox\" name=\"disabled_items\" disabled id=\"disabled_items\" value=\"" + locales[i].Id + "\" onclick=\"checkAll('selected_items',true);\">"; dr["TITLE"] = "<img src='" + locales[i].FlagUrl + "' /> " + locales[i].CombinedName; dr["ID"] = locales[i].Id; dt.Rows.Add(dr); } else { dr = dt.NewRow(); dr["CHECK"] = "<input type=\"checkbox\" name=\"selected_items\" id=\"selected_items\" value=\"" + locales[i].Id + "\" onclick=\"checkAll('selected_items',true);\">"; dr["TITLE"] = "<img src='" + locales[i].FlagUrl + "' /> " + locales[i].CombinedName; dr["ID"] = locales[i].Id; dt.Rows.Add(dr); } } DataView dv = new DataView(dt); TaxonomyItemList.DataSource = dv; TaxonomyItemList.DataBind(); } else { dr = dt.NewRow(); dt.Rows.Add(dr); TaxonomyItemList.GridLines = GridLines.None; } if (parentEnabledlocales != null && parentEnabledlocales.Count > 0) { for (int i = 0; i <= (parentEnabledlocales.Count - 1); i++) { if (!localeIdsOfPackage.Contains(parentEnabledlocales[i].Id)) { dr = dt.NewRow(); dr["CHECK"] = "<input type=\"checkbox\" name=\"disabled_items\" disabled id=\"disabled_items\" value=\"" + parentEnabledlocales[i].Id + "\" onclick=\"checkAll('selected_items',true);\">"; dr["TITLE"] = "<img src='" + parentEnabledlocales[i].FlagUrl + "' /> " + parentEnabledlocales[i].CombinedName; dr["ID"] = parentEnabledlocales[i].Id; dt.Rows.Add(dr); } } DataView dv = new DataView(dt); TaxonomyItemList.DataSource = dv; TaxonomyItemList.DataBind(); } else { dr = dt.NewRow(); dt.Rows.Add(dr); TaxonomyItemList.GridLines = GridLines.None; } }