private void OnGetRankedTaxonomy(TaxonomyData taxonomyData, string data) { if (taxonomyData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", taxonomyData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", taxonomyData.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", taxonomyData.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", taxonomyData.text); if (taxonomyData.taxonomy == null) { Log.Debug("ExampleAlchemyLanguage", "No taxonomy found!"); } else if (taxonomyData.taxonomy == null || taxonomyData.taxonomy.Length == 0) { Log.Warning("ExampleAlchemyLanguage", "No taxonomy results!"); } else { foreach (Taxonomy taxonomy in taxonomyData.taxonomy) { Log.Debug("ExampleAlchemyLanguage", "label: {0}, score: {1}", taxonomy.label, taxonomy.score); } } } else { Log.Debug("ExampleAlchemyLanguage", "Failed to find Relations!"); } }
/// <summary> /// Gets a partial virtual path for a content item during routing. /// </summary> /// <param name="content">The content to generate a virtual path for.</param> /// <param name="language">The language to generate the url for.</param> /// <param name="routeValues">The route values.</param> /// <param name="requestContext">The request context.</param> /// <returns> /// A <see cref="PartialRouteData"/> containing the partial virtual path /// for the content and a <see cref="ContentReference"/> to the item to get base /// path from or null if the remaining part did not match. /// </returns> public PartialRouteData GetPartialVirtualPath(TaxonomyData content, string language, RouteValueDictionary routeValues, RequestContext requestContext) { // No need for routing in edit mode. if (requestContext.IsInEditMode()) { return(null); } TForPageType currentPage = null; if (requestContext.HttpContext != null) { // TODO: Is there a better way to get the current page from requestContext? currentPage = this.urlResolver.Route(new UrlBuilder(requestContext.HttpContext.Request.Url)) as TForPageType; } // We should only use this router if the current page type is matching our instance. if (currentPage == null) { return(null); } var basePathRoot = this.GetBasePathRoot(currentPage); return(new PartialRouteData { BasePathRoot = basePathRoot, PartialVirtualPath = this.GetPartialVirtualPath(basePathRoot, content) }); }
public void Display_View() { int m_intTotalFav = 0; m_FavoritesDir = m_refFavoritesApi.GetFavoritesDirectoryForUser(this.m_refContentApi.UserId, this.m_iID, m_intCurrentPage, System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0), ref m_intTotalPages, ref m_intTotalFav); m_aFavs = StepTo(m_FavoritesDir.TaxonomyItems); Populate_ViewFavsGrid(m_FavoritesDir, m_aFavs); }
private static string GetPathString(TaxonomyData data) { // TaxonomyId (note, for items which are MC + LM, split the LM on the - from the MC // /IndigoInStoreCategory/(Specific L1)/MC/LM var innerPath = data.IsGeneralMerchandise ? "/L1-GeneralMerchandise/" + data.TaxonomyId.Replace('-', '/') : "/L1-Books/" + data.TaxonomyId.Replace('-', '/'); return("/IndigoInStoreCategory" + innerPath); }
public DataResult GetData(StringDictionary attributeDictionary, IDataReader reader, string catalog, RunType runType) { var taxonomyData = new TaxonomyData { TaxonomyId = reader["TaxonomyId"].ToString(), IsGeneralMerchandise = reader["TaxonomyId"].ToString().StartsWith("P", StringComparison.OrdinalIgnoreCase), Description_En = reader["Description_En"] == DBNull.Value ? null : reader["Description_En"].ToString(), Description_Fr = reader["Description_Fr"] == DBNull.Value ? null : reader["Description_Fr"].ToString() }; return(new DataResult { ExportData = taxonomyData }); }
private TaxonomyData GetTaxonomyDataRecursively(SegmentContext segmentContext) { var contentReference = this.taxonomyRoot; var loaderOptions = new LoaderOptions { LanguageLoaderOption.FallbackWithMaster(CultureInfo.GetCultureInfo(segmentContext.Language)) }; TaxonomyData taxonomyData = null; while (true) { var segment = segmentContext.GetNextValue(segmentContext.RemainingPath); if (string.IsNullOrEmpty(segment.Next)) { break; } var content = this.contentLoader.GetBySegment(contentReference, segment.Next, loaderOptions); if (content == null) { break; } contentReference = content.ContentLink; if (content is TaxonomyData) { taxonomyData = content as TaxonomyData; // Only set remaining path if we found what we were looking for, // otherwise let others try to parse the URL. segmentContext.RemainingPath = segment.Remaining; } } return(taxonomyData); }
private TaxonomyData GetTaxonomyDataRecursively(SegmentContext segmentContext) { var contentReference = this.taxonomyRoot; var loaderOptions = new LoaderOptions { LanguageLoaderOption.FallbackWithMaster(CultureInfo.GetCultureInfo(segmentContext.Language)) }; TaxonomyData taxonomyData = null; while (true) { var segment = this.ReadNextSegment(segmentContext); if (string.IsNullOrEmpty(segment.Next)) { break; } var content = this.contentLoader.GetBySegment(contentReference, segment.Next, loaderOptions); if (content == null) { break; } contentReference = content.ContentLink; if (content is TaxonomyData) { taxonomyData = content as TaxonomyData; } } return(taxonomyData); }
private string GetPartialVirtualPath(ContentReference basePathRoot, TaxonomyData content) { var virtualPath = string.Empty; var cacheKey = $"Taxonomy-Url:{basePathRoot}:{content.ContentLink}"; if (this.cache.TryGet(cacheKey, ReadStrategy.Wait, out virtualPath) == false) { var dependencies = new List <string>(); var ancestors = this.contentLoader.GetAncestors(content.ContentLink).ToList(); var path = new StringBuilder(); ancestors.Insert(0, content); foreach (var ancestor in ancestors) { if (ancestor is TaxonomyRoot) { break; } var routable = ancestor as IRoutable; dependencies.Add(this.contentCacheKeyCreator.CreateCommonCacheKey(ancestor.ContentLink)); path.Insert(0, "/"); path.Insert(0, routable.RouteSegment); } virtualPath = path.ToString(); this.cache.Insert(cacheKey, virtualPath, new CacheEvictionPolicy(dependencies)); } return(virtualPath); }
protected void Page_Load(object sender, System.EventArgs e) { m_refMsg = m_refCommon.EkMsgRef; AppImgPath = m_refCommon.AppImgPath; m_strPageAction = Request.QueryString["action"]; Utilities.SetLanguage(m_refCommon); TaxonomyLanguage = m_refCommon.ContentLanguage; TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); taxonomy_request = new TaxonomyRequest(); taxonomy_request.TaxonomyId = TaxonomyId; taxonomy_request.TaxonomyLanguage = TaxonomyLanguage; m_refContent = m_refCommon.EkContentRef; Util_RegisterResources(); Util_SetServerJSVariables(); litEnable.Text = m_refMsg.GetMessage("js:Confirm enable taxonomy all languages"); litDisable.Text = m_refMsg.GetMessage("js:Confirm disable taxonomy all languages"); if (Page.IsPostBack) { if (Request.Form["submittedaction"] == "delete") { m_refContent.DeleteTaxonomy(taxonomy_request); Response.Redirect((string)("taxonomy.aspx?LangType=" + TaxonomyLanguage), true); } else if (Request.Form["submittedaction"] == "deletenode") { long CurrentDeleteId = TaxonomyId; if ((Request.Form["LastClickedOn"] != null) && Request.Form["LastClickedOn"] != "") { CurrentDeleteId = Convert.ToInt64(Request.Form["LastClickedOn"]); } taxonomy_request.TaxonomyId = CurrentDeleteId; m_refContent.DeleteTaxonomy(taxonomy_request); if (CurrentDeleteId == TaxonomyId) { Response.Redirect((string)("taxonomy.aspx?taxonomyid=" + TaxonomyId), true); } else { Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true); } } else if (Request.Form["submittedaction"] == "enable") { long CurrentEnableId = TaxonomyId; if ((Request.Form["LastClickedOn"] != null) && Request.Form["LastClickedOn"] != "") { CurrentEnableId = Convert.ToInt64(Request.Form["LastClickedOn"]); } if (Request.Form[alllanguages.UniqueID] == "true") { m_refContent.UpdateTaxonomyVisible(CurrentEnableId, -1, true); } else { m_refContent.UpdateTaxonomyVisible(CurrentEnableId, TaxonomyLanguage, true); } Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true); } else if (Request.Form["submittedaction"] == "disable") { long CurrentDisableId = TaxonomyId; if ((Request.Form["LastClickedOn"] != null) && Request.Form["LastClickedOn"] != "") { CurrentDisableId = Convert.ToInt64(Request.Form["LastClickedOn"]); } if (Request.Form[alllanguages.UniqueID] == "true") { m_refContent.UpdateTaxonomyVisible(CurrentDisableId, -1, false); } else { m_refContent.UpdateTaxonomyVisible(CurrentDisableId, TaxonomyLanguage, false); } Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true); } } else { taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request); if (taxonomy_data != null) { TaxonomyParentId = taxonomy_data.TaxonomyParentId; m_strTaxonomyName = taxonomy_data.TaxonomyName; } AncestorTaxonomyId = TaxonomyId; m_selectedTaxonomyList = Convert.ToString(TaxonomyId); TaxonomyToolBar(); } }
private void OnGetRankedTaxonomyUrl(TaxonomyData taxonomyData, string data) { Log.Debug("ExampleAlchemyLanguage", "Alchemy Language - Get ranked taxonomy response url: {0}", data); _getRankedTaxonomyURLTested = true; }
private void FormBreadCrumb(TaxonomyData taxonomy_data) { //form the BreadCrumb Link. string[] taxonomyPathArray = new string[] { }; string[] taxonomyIdPathArray = new string[] { }; string taxonomyBreadCrumbWithLinks = string.Empty; if (taxonomy_data.TaxonomyPath != string.Empty) { taxonomyPathArray = taxonomy_data.TaxonomyPath.Split('\\'); } if (taxonomy_data.TaxonomyIdPath != string.Empty) { taxonomyIdPathArray = taxonomy_data.TaxonomyIdPath.Split('/'); } //form the taxonomy Bread Crumb Links. for (int k = 1; k < taxonomyPathArray.Length; k++) { int taxonomyIdForBreadCrumb = 0; int.TryParse(taxonomyIdPathArray[k], out taxonomyIdForBreadCrumb); if (taxonomyIdForBreadCrumb == TaxonomyId) { if (taxonomyBreadCrumbWithLinks == string.Empty) { taxonomyBreadCrumbWithLinks = taxonomyPathArray[k]; } else { taxonomyBreadCrumbWithLinks += " > " + taxonomyPathArray[k]; } } else { if (taxonomyBreadCrumbWithLinks == string.Empty) { taxonomyBreadCrumbWithLinks = "<a id=" + taxonomyIdPathArray[k] + " href=\"localeTaxonomy.aspx?action=view&view=locale&taxonomyid=" + taxonomyIdPathArray[k] + "&treeViewId=-1&LangType=" + TaxonomyLanguage + "\" class=\"linkStyle\">" + taxonomyPathArray[k] + " </a>"; } else { taxonomyBreadCrumbWithLinks += " > <a id=" + taxonomyIdPathArray[k] + " href=\"localeTaxonomy.aspx?action=view&view=locale&taxonomyid=" + taxonomyIdPathArray[k] + "&treeViewId=-1&LangType=" + TaxonomyLanguage + "\" class=\"linkStyle\">" + taxonomyPathArray[k] + " </a>"; } } } // <a id="136" href="localeTaxonomy.aspx?action=view&view=locale&taxonomyid=136&treeViewId=-1&LangType=1033" class="linkStyle">chanduila </a> // m_strCurrentBreadcrumb = mainTranslationPackageLink + taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "); if (taxonomyBreadCrumbWithLinks != string.Empty) { m_strCurrentBreadcrumb = mainTranslationPackageLink + " > " + taxonomyBreadCrumbWithLinks; } else { m_strCurrentBreadcrumb = mainTranslationPackageLink; } if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb))) { m_strCurrentBreadcrumb = mainTranslationPackageLink; } if (taxonomy_data.TaxonomyParentId == 0) { parentTaxonomyPath = taxonomy_data.TaxonomyPath.Replace("\\" + taxonomy_data.TaxonomyName, "\\"); } else { parentTaxonomyPath = taxonomy_data.TaxonomyPath.Replace("\\" + taxonomy_data.TaxonomyName, ""); } hdn_parentTaxonomyPath.Value = parentTaxonomyPath; }
protected void Process_MoveItems() { string[] aUid = new List<string>().ToArray(); long iTarget = 0; int m_intTotalFav = 0; m_FavoritesDir = m_refFavoritesApi.GetFavoritesDirectoryForUser(this.m_refContentApi.UserId, this.m_iID, m_intCurrentPage, System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0), ref m_intTotalPages, ref m_intTotalFav); for (int i = 0; i <= (Request.Form.Count - 1); i++) { if (Request.Form.Keys[i].ToLower().IndexOf("mvdir") == 0) { iTarget = Convert.ToInt64(Request.Form[i].Substring(System.Convert.ToInt32(("_mv_").Length))); } } aUid = Strings.Split(Request.Form["req_deleted_users"], ",", -1, 0); if ((aUid != null) && aUid.Length > 0) { for (int i = 0; i <= (aUid.Length - 1); i++) { if (aUid[i].IndexOf("f_") == 0) { if (Information.IsNumeric(aUid[i].Substring(2).Trim())) { TaxonomyRequest tReq = new TaxonomyRequest(); tReq.TaxonomyId = Convert.ToInt64(aUid[i].Substring(2)); tReq.TaxonomyLanguage = this.m_refContentApi.ContentLanguage; if (tReq.TaxonomyId > 0) { this.m_refContentApi.EkContentRef.MoveTaxonomy(Convert.ToInt64(aUid[i].Substring(2)), iTarget, true); } } } else if (aUid[i].IndexOf("i_") == 0) { if (Information.IsNumeric(aUid[i].Substring(2).Trim())) { m_refFavoritesApi.MoveContentFavoriteForUser(Convert.ToInt64(aUid[i].Substring(2)), this.m_refFavoritesApi.UserId, iTarget); } } } } Response.Redirect((string)("MyFavorites.aspx" + (this.m_iID > 0 ? "?id=" + this.m_iID : "")), false); }
protected void Process_AddFolder() { string foldername = Request.Form["myfavorites_fName"]; string folderdesc = Request.Form["myfavorites_fDesc"]; int m_intTotalFav = 0; if ((folderdesc != null) && folderdesc.Length > this.m_iMaxLength) { folderdesc = folderdesc.Substring(0, m_iMaxLength); } m_FavoritesDir = m_refFavoritesApi.GetFavoritesDirectoryForUser(this.m_refContentApi.UserId, this.m_iID, m_intCurrentPage, System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0), ref m_intTotalPages, ref m_intTotalFav); this.m_refContentApi.AddPersonalDirectoryFolder(m_FavoritesDir.TaxonomyId, foldername, folderdesc); if (this.m_iID > 0) { Response.Redirect((string)("MyFavorites.aspx?id=" + m_FavoritesDir.TaxonomyId), false); } else { Response.Redirect("MyFavorites.aspx", false); } }
private void DisplayPage() { switch (_ViewItem.ToLower()) { case "user": DirectoryUserRequest uReq = new DirectoryUserRequest(); DirectoryAdvancedUserData uDirectory = new DirectoryAdvancedUserData(); uReq.GetItems = true; uReq.DirectoryId = TaxonomyId; uReq.DirectoryLanguage = TaxonomyLanguage; uReq.PageSize = _Common.RequestInformationRef.PagingSize; uReq.CurrentPage = m_intCurrentPage; uDirectory = this._Content.LoadDirectory(ref uReq); if (uDirectory != null) { TaxonomyParentId = uDirectory.DirectoryParentId; lbltaxonomyid.Text = uDirectory.DirectoryId.ToString(); lbltaxonomyid.ToolTip = lbltaxonomyid.Text; taxonomytitle.Text = uDirectory.DirectoryName; taxonomytitle.ToolTip = taxonomytitle.Text; _TaxonomyName = uDirectory.DirectoryName; taxonomydescription.Text = uDirectory.DirectoryDescription; taxonomydescription.ToolTip = taxonomydescription.Text; taxonomy_image_thumb.ImageUrl = _Common.AppImgPath + "spacer.gif"; m_strCurrentBreadcrumb = (string) (uDirectory.DirectoryPath.Remove(0, 1).Replace("\\", " > ")); if (m_strCurrentBreadcrumb == "") { m_strCurrentBreadcrumb = "Root"; } else { if (uDirectory.DirectoryParentId == 0) { parentTaxonomyPath = uDirectory.DirectoryPath.Replace("\\" + uDirectory.DirectoryName, "\\"); } else { parentTaxonomyPath = uDirectory.DirectoryPath.Replace("\\" + uDirectory.DirectoryName, ""); } hdn_parentTaxonomyPath.Value = parentTaxonomyPath; } if (uDirectory.TemplateName == "") { lblTemplate.Text = "[None]"; lblTemplate.ToolTip = lblTemplate.Text; } else { lblTemplate.Text = uDirectory.TemplateName; lblTemplate.ToolTip = lblTemplate.Text; } if (uDirectory.InheritTemplate) { lblTemplateInherit.Text = "Yes"; lblTemplateInherit.ToolTip = lblTemplateInherit.Text; } else { lblTemplateInherit.Text = "No"; lblTemplateInherit.ToolTip = lblTemplateInherit.Text; } m_intTotalPages = uReq.TotalPages; } PopulateUserGridData(uDirectory); TaxonomyToolBar(); break; case "cgroup": DirectoryAdvancedGroupData dagdRet = new DirectoryAdvancedGroupData(); DirectoryGroupRequest cReq = new DirectoryGroupRequest(); cReq.CurrentPage = m_intCurrentPage; cReq.PageSize = _Common.RequestInformationRef.PagingSize; cReq.DirectoryId = TaxonomyId; cReq.DirectoryLanguage = TaxonomyLanguage; cReq.GetItems = true; cReq.SortDirection = ""; dagdRet = this._Common.CommunityGroupRef.LoadDirectory(ref cReq); if (dagdRet != null) { TaxonomyParentId = dagdRet.DirectoryParentId; lbltaxonomyid.Text = dagdRet.DirectoryId.ToString(); lbltaxonomyid.ToolTip = lbltaxonomyid.Text; taxonomytitle.Text = dagdRet.DirectoryName; taxonomytitle.ToolTip = taxonomytitle.Text; _TaxonomyName = dagdRet.DirectoryName; taxonomydescription.Text = dagdRet.DirectoryDescription; taxonomydescription.ToolTip = taxonomydescription.Text; taxonomy_image_thumb.ImageUrl = _Common.AppImgPath + "spacer.gif"; m_strCurrentBreadcrumb = (string) (dagdRet.DirectoryPath.Remove(0, 1).Replace("\\", " > ")); if (m_strCurrentBreadcrumb == "") { m_strCurrentBreadcrumb = "Root"; } else { if (dagdRet.DirectoryParentId == 0) { parentTaxonomyPath = dagdRet.DirectoryPath.Replace("\\" + dagdRet.DirectoryName, "\\"); } else { parentTaxonomyPath = dagdRet.DirectoryPath.Replace("\\" + dagdRet.DirectoryName, ""); } hdn_parentTaxonomyPath.Value = parentTaxonomyPath; } if (dagdRet.TemplateName == "") { lblTemplate.Text = "[None]"; lblTemplate.ToolTip = lblTemplate.Text; } else { lblTemplate.Text = dagdRet.TemplateName; lblTemplate.ToolTip = lblTemplate.Text; } if (dagdRet.InheritTemplate) { lblTemplateInherit.Text = "Yes"; lblTemplateInherit.ToolTip = lblTemplateInherit.Text; } else { lblTemplateInherit.Text = "No"; lblTemplateInherit.ToolTip = lblTemplateInherit.Text; } m_intTotalPages = cReq.TotalPages; } PopulateCommunityGroupGridData(dagdRet); TaxonomyToolBar(); break; default: // Content taxonomy_request.IncludeItems = true; taxonomy_request.PageSize = _Common.RequestInformationRef.PagingSize; taxonomy_request.CurrentPage = m_intCurrentPage; taxonomy_data = _Content.ReadTaxonomy(ref taxonomy_request); if (taxonomy_data != null) { TaxonomyParentId = taxonomy_data.TaxonomyParentId; lbltaxonomyid.Text = taxonomy_data.TaxonomyId.ToString(); lbltaxonomyid.ToolTip = lbltaxonomyid.Text; taxonomytitle.Text = taxonomy_data.TaxonomyName; taxonomytitle.ToolTip = taxonomytitle.Text; _TaxonomyName = taxonomy_data.TaxonomyName; if (taxonomy_data.TaxonomyDescription == "") { taxonomydescription.Text = "[None]"; taxonomydescription.ToolTip = taxonomydescription.Text; } else { taxonomydescription.Text = Server.HtmlEncode(taxonomy_data.TaxonomyDescription); taxonomydescription.ToolTip = taxonomydescription.Text; } if (taxonomy_data.TaxonomyImage == "") { taxonomy_image.Text = "[None]"; } else { taxonomy_image.Text = taxonomy_data.TaxonomyImage; } taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage; if (taxonomy_data.CategoryUrl == "") { catLink.Text = "[None]"; catLink.ToolTip = catLink.Text; } else { catLink.Text = taxonomy_data.CategoryUrl; catLink.ToolTip = catLink.Text; } if (_Content.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage)) { ltrTaxSynch.Text = _MessageHelper.GetMessage("enabled"); } else { ltrTaxSynch.Text = _MessageHelper.GetMessage("disabled"); } if (taxonomy_data.Visible == true) { ltrStatus.Text = "Enabled"; } else { ltrStatus.Text = "Disabled"; } if (taxonomy_data.TaxonomyImage.Trim() != "") { taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0) ? taxonomy_data.TaxonomyImage : _Common.SitePath + taxonomy_data.TaxonomyImage; } else { taxonomy_image_thumb.ImageUrl = _Common.AppImgPath + "spacer.gif"; } m_strCurrentBreadcrumb = (string) (taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > ")); if (m_strCurrentBreadcrumb == "") { m_strCurrentBreadcrumb = "Root"; } else { if (taxonomy_data.TaxonomyParentId == 0) { parentTaxonomyPath = taxonomy_data.TaxonomyPath.Replace("\\" + taxonomy_data.TaxonomyName, "\\"); } else { parentTaxonomyPath = taxonomy_data.TaxonomyPath.Replace("\\" + taxonomy_data.TaxonomyName, ""); } hdn_parentTaxonomyPath.Value = parentTaxonomyPath; } if (taxonomy_data.TemplateName == "") { lblTemplate.Text = "[None]"; lblTemplate.ToolTip = lblTemplate.Text; } else { lblTemplate.Text = taxonomy_data.TemplateName; lblTemplate.ToolTip = lblTemplate.Text; } if (taxonomy_data.TemplateInherited) { lblTemplateInherit.Text = "Yes"; lblTemplateInherit.ToolTip = lblTemplateInherit.Text; } else { lblTemplateInherit.Text = "No"; lblTemplateInherit.ToolTip = lblTemplateInherit.Text; } m_intTotalPages = taxonomy_request.TotalPages; } if (reloadTree) { ReloadClientScript(taxonomy_data.IdPath); } PopulateContentGridData(); TaxonomyToolBar(); break; } DisplayTaxonomyMetadata(); if (TaxonomyParentId == 0) { tr_config.Visible = true; List<int> config_list = _Content.GetAllConfigIdListByTaxonomy(TaxonomyId, TaxonomyLanguage); configlist.Text = ""; configlist.ToolTip = configlist.Text; for (int i = 0; i <= config_list.Count - 1; i++) { if (configlist.Text == "") { configlist.Text = ConfigName(System.Convert.ToInt32(config_list[i])); configlist.ToolTip = configlist.Text; } else { configlist.Text = configlist.Text + ";" + ConfigName(System.Convert.ToInt32(config_list[i])); configlist.ToolTip = configlist.Text; } } if (configlist.Text == "") { configlist.Text = "None"; configlist.ToolTip = configlist.Text; } } else { tr_config.Visible = false; } // display counts ltrCatCount.Text = TaxonomyCategoryCount.ToString(); ltrItemCount.Text = taxonomy_request.RecordsAffected.ToString(); }
private static long IdsOnly(TaxonomyData input) { return(input.Id); }
private void DisplayPage() { taxonomy_request.IncludeItems = true; taxonomy_request.PageSize = m_refCommon.RequestInformationRef.PagingSize; taxonomy_request.CurrentPage = m_intCurrentPage; taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request); if ((taxonomy_data != null)) { TaxonomyParentId = taxonomy_data.TaxonomyParentId; lbltaxonomyid.Text = taxonomy_data.TaxonomyId.ToString(); taxonomytitle.Text = taxonomy_data.TaxonomyName; m_strTaxonomyName = taxonomy_data.TaxonomyName; if (string.IsNullOrEmpty(taxonomy_data.TaxonomyDescription)) { taxonomydescription.Text = "[None]"; } else { taxonomydescription.Text = taxonomy_data.TaxonomyDescription; } if (string.IsNullOrEmpty(taxonomy_data.TaxonomyImage)) { taxonomy_image.Text = "[None]"; } else { taxonomy_image.Text = taxonomy_data.TaxonomyImage; } taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage; if (string.IsNullOrEmpty(taxonomy_data.CategoryUrl)) { catLink.Text = "[None]"; } else { catLink.Text = taxonomy_data.CategoryUrl; } if (taxonomy_data.Visible == true) { ltrStatus.Text = "Enabled"; } else { ltrStatus.Text = "Disabled"; } if (!string.IsNullOrEmpty(taxonomy_data.TaxonomyImage.Trim())) { taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0 ? taxonomy_data.TaxonomyImage : m_refCommon.SitePath + taxonomy_data.TaxonomyImage); } else { taxonomy_image_thumb.ImageUrl = m_refCommon.AppImgPath + "spacer.gif"; } m_strCurrentBreadcrumb = taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "); if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb))) { m_strCurrentBreadcrumb = "Root"; } if ((string.IsNullOrEmpty(taxonomy_data.TemplateName))) { lblTemplate.Text = "[None]"; } else { lblTemplate.Text = taxonomy_data.TemplateName; } if ((taxonomy_data.TemplateInherited)) { lblTemplateInherit.Text = "Yes"; } else { lblTemplateInherit.Text = "No"; } m_intTotalPages = taxonomy_request.TotalPages; } TaxonomyToolBar(); if ((TaxonomyParentId == 0)) { tr_config.Visible = true; List<Int32> config_list = m_refContent.GetAllConfigIdListByTaxonomy(TaxonomyId, TaxonomyLanguage); configlist.Text = ""; for (int i = 0; i <= config_list.Count - 1; i++) { if ((string.IsNullOrEmpty(configlist.Text))) { configlist.Text = ConfigName(config_list[i]); } else { configlist.Text = configlist.Text + ";" + ConfigName(config_list[i]); } } if ((string.IsNullOrEmpty(configlist.Text))) { configlist.Text = "None"; } } else { tr_config.Visible = false; } }
private static TaxonomyItemData CheckForExistingTaxonomyDataItem( IEnumerable<TaxonomyItemData> existingDataItems, TaxonomyData tax, DataRow row) { TaxonomyItemData data = existingDataItems.FirstOrDefault(d => d.TaxonomyId == tax.Id); if (data != null) { row.LogContentInfo( "Found an existing taxonomy data item for taxonomy '{0}'", tax.Name); } else { data = new TaxonomyItemData(); row.LogContentInfo( "Did not find an existing taxonomy data item for taxonomy '{0}'", tax.Name); } return data; }
private void DisplayPage() { List<int> langList = new List<int>(); List<int> parenttaxonomyLanguageList = new List<int>(); switch (_ViewItem.ToLower()) { case "user": DirectoryUserRequest uReq = new DirectoryUserRequest(); DirectoryAdvancedUserData uDirectory = new DirectoryAdvancedUserData(); uReq.GetItems = true; uReq.DirectoryId = TaxonomyId; uReq.DirectoryLanguage = TaxonomyLanguage; uReq.PageSize = _Common.RequestInformationRef.PagingSize; uReq.CurrentPage = m_intCurrentPage; uDirectory = this._Content.LoadDirectory(ref uReq); if ((uDirectory != null)) { TaxonomyParentId = uDirectory.DirectoryParentId; lbltaxonomyid.Text = uDirectory.DirectoryId.ToString(); taxonomytitle.Text = uDirectory.DirectoryName; _TaxonomyName = uDirectory.DirectoryName; taxonomydescription.Text = uDirectory.DirectoryDescription; ////taxonomy_image_thumb.ImageUrl = _Common.AppImgPath + "spacer.gif"; string[] taxonomyPathArray = new string[] { }; string[] taxonomyIdPathArray = new string[] { }; string taxonomyBreadCrumbWithLinks = string.Empty; if (uDirectory.DirectoryPath != string.Empty) { taxonomyPathArray = uDirectory.DirectoryPath.Split('\\'); } if (uDirectory.DirectoryIDPath != string.Empty) { taxonomyIdPathArray = uDirectory.DirectoryIDPath.Split('/'); } //form the taxonomy Bread Crumb Links. for (int k = 1; k < taxonomyPathArray.Length; k++) { int taxonomyIdForBreadCrumb =0; int.TryParse(taxonomyIdPathArray[k],out taxonomyIdForBreadCrumb); if (taxonomyIdForBreadCrumb == TaxonomyId) { if (taxonomyBreadCrumbWithLinks == string.Empty) { taxonomyBreadCrumbWithLinks = taxonomyPathArray[k]; } else { taxonomyBreadCrumbWithLinks += " > " + taxonomyPathArray[k]; } } else { if (taxonomyBreadCrumbWithLinks == string.Empty) { taxonomyBreadCrumbWithLinks = "<a id=" + taxonomyIdPathArray[k] + " href=\"localeTaxonomy.aspx?action=view&view=locale&taxonomyid=" + taxonomyIdPathArray[k] + "&treeViewId=-1&LangType=" + TaxonomyLanguage + "\" class=\"linkStyle\">" + taxonomyPathArray[k] + " </a>"; } else { taxonomyBreadCrumbWithLinks += " > <a id=" + taxonomyIdPathArray[k] + " href=\"localeTaxonomy.aspx?action=view&view=locale&taxonomyid=" + taxonomyIdPathArray[k] + "&treeViewId=-1&LangType=" + TaxonomyLanguage + "\" class=\"linkStyle\">" + taxonomyPathArray[k] + " </a>"; } } } if (taxonomyBreadCrumbWithLinks != string.Empty) { m_strCurrentBreadcrumb = mainTranslationPackageLink + " > " + taxonomyBreadCrumbWithLinks; } else { m_strCurrentBreadcrumb = mainTranslationPackageLink; } if (uDirectory.DirectoryParentId == 0) { parentTaxonomyPath = uDirectory.DirectoryPath.Replace("\\" + uDirectory.DirectoryName, "\\"); } else { parentTaxonomyPath = uDirectory.DirectoryPath.Replace("\\" + uDirectory.DirectoryName, ""); } hdn_parentTaxonomyPath.Value = parentTaxonomyPath; //if ((string.IsNullOrEmpty(uDirectory.TemplateName))) //{ // lblTemplate.Text = "[None]"; //} //else //{ // lblTemplate.Text = uDirectory.TemplateName; //} //if ((uDirectory.InheritTemplate)) //{ // lblTemplateInherit.Text = "Yes"; //} //else //{ // lblTemplateInherit.Text = "No"; //} m_intTotalPages = uReq.TotalPages; } PopulateUserGridData(uDirectory); TaxonomyToolBar(); //ltrItemCount.Text = uDirectory.DirectoryItems.Length.ToString(); break; case "cgroup": DirectoryAdvancedGroupData dagdRet = new DirectoryAdvancedGroupData(); DirectoryGroupRequest cReq = new DirectoryGroupRequest(); cReq.CurrentPage = m_intCurrentPage; cReq.PageSize = _Common.RequestInformationRef.PagingSize; cReq.DirectoryId = TaxonomyId; cReq.DirectoryLanguage = TaxonomyLanguage; cReq.GetItems = true; cReq.SortDirection = ""; dagdRet = this._Common.CommunityGroupRef.LoadDirectory(ref cReq); if ((dagdRet != null)) { TaxonomyParentId = dagdRet.DirectoryParentId; lbltaxonomyid.Text = dagdRet.DirectoryId.ToString(); taxonomytitle.Text = dagdRet.DirectoryName; _TaxonomyName = dagdRet.DirectoryName; taxonomydescription.Text = dagdRet.DirectoryDescription; //taxonomy_image_thumb.ImageUrl = _Common.AppImgPath + "spacer.gif"; //form the BreadCrumb Link. string[] taxonomyPathArray = new string[] { }; string[] taxonomyIdPathArray = new string[] { }; string taxonomyBreadCrumbWithLinks = string.Empty; if (dagdRet.DirectoryPath != string.Empty) { taxonomyPathArray = dagdRet.DirectoryPath.Split('\\'); } if (dagdRet.DirectoryIDPath != string.Empty) { taxonomyIdPathArray = dagdRet.DirectoryIDPath.Split('/'); } //form the taxonomy Bread Crumb Links. for (int k = 1; k < taxonomyPathArray.Length; k++) { int taxonomyIdForBreadCrumb =0; int.TryParse(taxonomyIdPathArray[k],out taxonomyIdForBreadCrumb); if (taxonomyIdForBreadCrumb == TaxonomyId) { if (taxonomyBreadCrumbWithLinks == string.Empty) { taxonomyBreadCrumbWithLinks = taxonomyPathArray[k]; } else { taxonomyBreadCrumbWithLinks += " > " + taxonomyPathArray[k]; } } else { if (taxonomyBreadCrumbWithLinks == string.Empty) { taxonomyBreadCrumbWithLinks = "<a id=" + taxonomyIdPathArray[k] + " href=\"localeTaxonomy.aspx?action=view&view=locale&taxonomyid=" + taxonomyIdPathArray[k] + "&treeViewId=-1&LangType=" + TaxonomyLanguage + "\" class=\"linkStyle\">" + taxonomyPathArray[k] + " </a>"; } else { taxonomyBreadCrumbWithLinks += " > <a id=" + taxonomyIdPathArray[k] + " href=\"localeTaxonomy.aspx?action=view&view=locale&taxonomyid=" + taxonomyIdPathArray[k] + "&treeViewId=-1&LangType=" + TaxonomyLanguage + "\" class=\"linkStyle\">" + taxonomyPathArray[k] + " </a>"; } } } // <a id="136" href="localeTaxonomy.aspx?action=view&view=locale&taxonomyid=136&treeViewId=-1&LangType=1033" class="linkStyle">chanduila </a> // m_strCurrentBreadcrumb = mainTranslationPackageLink + taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "); if (taxonomyBreadCrumbWithLinks != string.Empty) { m_strCurrentBreadcrumb = mainTranslationPackageLink + " > " + taxonomyBreadCrumbWithLinks; } else { m_strCurrentBreadcrumb = mainTranslationPackageLink; } if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb))) { m_strCurrentBreadcrumb = mainTranslationPackageLink; } if (dagdRet.DirectoryParentId == 0) { parentTaxonomyPath = dagdRet.DirectoryPath.Replace("\\" + dagdRet.DirectoryName, "\\"); } else { parentTaxonomyPath = dagdRet.DirectoryPath.Replace("\\" + dagdRet.DirectoryName, ""); } hdn_parentTaxonomyPath.Value = parentTaxonomyPath; //if ((string.IsNullOrEmpty(dagdRet.TemplateName))) //{ // lblTemplate.Text = "[None]"; //} //else //{ // lblTemplate.Text = dagdRet.TemplateName; //} //if ((dagdRet.InheritTemplate)) //{ // lblTemplateInherit.Text = "Yes"; //} //else //{ // lblTemplateInherit.Text = "No"; //} m_intTotalPages = cReq.TotalPages; } PopulateCommunityGroupGridData(dagdRet); TaxonomyToolBar(); //ltrItemCount.Text = cReq.RecordsAffected.ToString(); break; case "locale": taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Locale; taxonomy_request.TaxonomyType = EkEnumeration.TaxonomyType.Locale; taxonomy_request.IncludeItems = true; taxonomy_request.PageSize = _Common.RequestInformationRef.PagingSize; taxonomy_request.CurrentPage = m_intCurrentPage; taxonomy_data = _Content.ReadTaxonomy(ref taxonomy_request); if ((taxonomy_data != null)) { TaxonomyParentId = taxonomy_data.TaxonomyParentId; lbltaxonomyid.Text = taxonomy_data.TaxonomyId.ToString(); taxonomytitle.Text = taxonomy_data.TaxonomyName; _TaxonomyName = taxonomy_data.TaxonomyName; if (string.IsNullOrEmpty(taxonomy_data.TaxonomyDescription)) { taxonomydescription.Text = "[None]"; } else { taxonomydescription.Text = Server.HtmlEncode(taxonomy_data.TaxonomyDescription); } //if (string.IsNullOrEmpty(taxonomy_data.TaxonomyImage)) //{ // taxonomy_image.Text = "[None]"; //} //else //{ // taxonomy_image.Text = taxonomy_data.TaxonomyImage; //} //taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage; //if (string.IsNullOrEmpty(taxonomy_data.CategoryUrl)) //{ // catLink.Text = "[None]"; //} //else //{ // catLink.Text = taxonomy_data.CategoryUrl; //} //if (taxonomy_data.Visible == true) //{ // ltrStatus.Text = "Enabled"; //} //else //{ // ltrStatus.Text = "Disabled"; //} //if (!string.IsNullOrEmpty(taxonomy_data.TaxonomyImage.Trim())) //{ // taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0 ? taxonomy_data.TaxonomyImage : _Common.SitePath + taxonomy_data.TaxonomyImage); //} //else //{ // taxonomy_image_thumb.ImageUrl = _Common.AppImgPath + "spacer.gif"; //} //form the BreadCrumb Link. FormBreadCrumb(taxonomy_data); //if ((string.IsNullOrEmpty(taxonomy_data.TemplateName))) //{ // lblTemplate.Text = "[None]"; //} //else //{ // lblTemplate.Text = taxonomy_data.TemplateName; //} //if ((taxonomy_data.TemplateInherited)) //{ // lblTemplateInherit.Text = "Yes"; //} //else //{ // lblTemplateInherit.Text = "No"; //} m_intTotalPages = taxonomy_request.TotalPages; } Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy localeTaxonomyApi = new Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy(_Common.RequestInformationRef); //API = New Ektron.Cms.BusinessObjects.Localization.LocaleTaxonomy(_Common.RequestInformationRef) langList = localeTaxonomyApi.GetLocaleIdList(TaxonomyId, _Common.ContentLanguage, false); parenttaxonomyLanguageList = localeTaxonomyApi.GetLocaleIdList(TaxonomyParentId, _Common.ContentLanguage, true); PopulateLocaleContentGridData(langList, parenttaxonomyLanguageList); TaxonomyToolBar(); //ltrItemCount.Text = langList.Count.ToString(); break; default: // Content taxonomy_request.IncludeItems = true; taxonomy_request.PageSize = _Common.RequestInformationRef.PagingSize; taxonomy_request.CurrentPage = m_intCurrentPage; taxonomy_data = _Content.ReadTaxonomy(ref taxonomy_request); if ((taxonomy_data != null)) { TaxonomyParentId = taxonomy_data.TaxonomyParentId; lbltaxonomyid.Text = taxonomy_data.TaxonomyId.ToString(); taxonomytitle.Text = taxonomy_data.TaxonomyName; _TaxonomyName = taxonomy_data.TaxonomyName; if (string.IsNullOrEmpty(taxonomy_data.TaxonomyDescription)) { taxonomydescription.Text = "[None]"; } else { taxonomydescription.Text = Server.HtmlEncode(taxonomy_data.TaxonomyDescription); } //if (string.IsNullOrEmpty(taxonomy_data.TaxonomyImage)) //{ // taxonomy_image.Text = "[None]"; //} //else //{ // taxonomy_image.Text = taxonomy_data.TaxonomyImage; //} //taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage; //if (string.IsNullOrEmpty(taxonomy_data.CategoryUrl)) //{ // catLink.Text = "[None]"; //} //else //{ // catLink.Text = taxonomy_data.CategoryUrl; //} //if (taxonomy_data.Visible == true) //{ // ltrStatus.Text = "Enabled"; //} //else //{ // ltrStatus.Text = "Disabled"; //} //if (!string.IsNullOrEmpty(taxonomy_data.TaxonomyImage.Trim())) //{ // taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0 ? taxonomy_data.TaxonomyImage : _Common.SitePath + taxonomy_data.TaxonomyImage); //} //else //{ // taxonomy_image_thumb.ImageUrl = _Common.AppImgPath + "spacer.gif"; //} //form the BreadCrumb Link. FormBreadCrumb(taxonomy_data); //if ((string.IsNullOrEmpty(taxonomy_data.TemplateName))) //{ // lblTemplate.Text = "[None]"; //} //else //{ // lblTemplate.Text = taxonomy_data.TemplateName; //} //if ((taxonomy_data.TemplateInherited)) //{ // lblTemplateInherit.Text = "Yes"; //} //else //{ // lblTemplateInherit.Text = "No"; //} m_intTotalPages = taxonomy_request.TotalPages; //ltrItemCount.Text = taxonomy_request.RecordsAffected.ToString(); } PopulateContentGridData(); TaxonomyToolBar(); //ltrItemCount.Text = taxonomy_request.RecordsAffected.ToString(); break; } DisplayTaxonomyMetadata(); tr_catcount.Visible = false; //if (_ViewItem.ToLower() == "locale") //{ // ltrItemCount.Text = langList.Count.ToString(); //} //else //{ // ltrItemCount.Text = taxonomy_request.RecordsAffected.ToString(); //} }
private void DisplayPage() { switch (m_strViewItem.ToLower()) { case "user": DirectoryUserRequest uReq = new DirectoryUserRequest(); DirectoryAdvancedUserData uDirectory = new DirectoryAdvancedUserData(); uReq.GetItems = true; uReq.DirectoryId = TaxonomyId; uReq.DirectoryLanguage = TaxonomyLanguage; uReq.PageSize = m_refCommon.RequestInformationRef.PagingSize; uReq.CurrentPage = m_intCurrentPage; uDirectory = this.m_refContent.LoadDirectory(ref uReq); if (uDirectory != null) { TaxonomyParentId = uDirectory.DirectoryParentId; m_strTaxonomyName = uDirectory.DirectoryName; m_intTotalPages = uReq.TotalPages; } PopulateUserGridData(uDirectory); TaxonomyToolBar(); break; case "cgroup": DirectoryAdvancedGroupData dagdRet = new DirectoryAdvancedGroupData(); DirectoryGroupRequest cReq = new DirectoryGroupRequest(); cReq.CurrentPage = m_intCurrentPage; cReq.PageSize = m_refCommon.RequestInformationRef.PagingSize; cReq.DirectoryId = TaxonomyId; cReq.DirectoryLanguage = TaxonomyLanguage; cReq.GetItems = true; cReq.SortDirection = ""; dagdRet = this.m_refCommon.CommunityGroupRef.LoadDirectory(ref cReq); if (dagdRet != null) { TaxonomyParentId = dagdRet.DirectoryParentId; m_strTaxonomyName = dagdRet.DirectoryName; m_intTotalPages = cReq.TotalPages; } m_intTotalPages = cReq.TotalPages; PopulateCommunityGroupGridData(dagdRet); TaxonomyToolBar(); break; default: // Content taxonomy_request.IncludeItems = true; taxonomy_request.PageSize = m_refCommon.RequestInformationRef.PagingSize; taxonomy_request.CurrentPage = m_intCurrentPage; taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request); if (taxonomy_data != null) { TaxonomyParentId = taxonomy_data.TaxonomyParentId; m_strTaxonomyName = taxonomy_data.TaxonomyName; m_intTotalPages = taxonomy_request.TotalPages; } PopulateContentGridData(); TaxonomyToolBar(); break; } }
private void Populate_ViewFavsGrid(TaxonomyData folders, DirectoryContentData[] data) { System.Web.UI.WebControls.BoundColumn colBound; bool bOffSet = false; colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "CHECKL"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.HeaderStyle.Width = Unit.Percentage(5); colBound.ItemStyle.Width = Unit.Percentage(5); FavGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "LEFT"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.Width = Unit.Percentage(45); colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; FavGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "CHECKR"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.Width = Unit.Percentage(5); FavGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "RIGHT"; colBound.ItemStyle.Width = Unit.Percentage(45); colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.Wrap = false; FavGrid.Columns.Add(colBound); PageSettings(); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("CHECKL", typeof(string))); dt.Columns.Add(new DataColumn("LEFT", typeof(string))); dt.Columns.Add(new DataColumn("CHECKR", typeof(string))); dt.Columns.Add(new DataColumn("RIGHT", typeof(string))); int i = 0; dr = dt.NewRow(); dr["CHECKL"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "my_favorites.gif" + "\" width=\"32\" height=\"32\"/>"; dr["LEFT"] = FormatPath(this.m_FavoritesDir.TaxonomyPath); dt.Rows.Add(dr); dr = dt.NewRow(); dr["CHECKL"] = " "; dr["LEFT"] = " "; dt.Rows.Add(dr); if (((folders.Taxonomy != null) && folders.Taxonomy.Length > 0) || ((data != null) && data.Length > 0)) { // add select all row. dr = dt.NewRow(); dr["CHECKL"] = "<input type=\"checkbox\" name=\"checkall\" id=\"req_deleted_users\" onClick=\"javascript:checkAll(\'\');\">"; dr["LEFT"] = GetMessage("generic select all msg") + "<br/><br/>"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["CHECKL"] = " "; dr["LEFT"] = " "; dt.Rows.Add(dr); } if (folders.Taxonomy != null) { bOffSet = System.Convert.ToBoolean((folders.Taxonomy.Length % 2) > 0); for (i = 0; i <= (folders.Taxonomy.Length - 1); i++) { dr = dt.NewRow(); dr["CHECKL"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"f_" + folders.Taxonomy[i].TaxonomyId + "\" onClick=\"javascript:UpdateMoveStatus(\'" + folders.Taxonomy[i].TaxonomyId + "\'); checkAll(\'req_deleted_users\');\">"; dr["LEFT"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "folder.gif" + "\" width=\"32\" height=\"32\"/><a href=\"MyFavorites.aspx?id=" + folders.Taxonomy[i].TaxonomyId + "\" >" + folders.Taxonomy[i].TaxonomyName + "</a>"; dr["LEFT"] += "<br />" + folders.Taxonomy[i].TaxonomyDescription; if (i < (folders.Taxonomy.Length - 1)) { i++; dr["CHECKR"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"f_" + folders.Taxonomy[i].TaxonomyId + "\" onClick=\"javascript:UpdateMoveStatus(\'" + folders.Taxonomy[i].TaxonomyId + "\'); checkAll(\'req_deleted_users\');\">"; dr["RIGHT"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "folder.gif\"/><a href=\"MyFavorites.aspx?id=" + folders.Taxonomy[i].TaxonomyId + "\" >" + folders.Taxonomy[i].TaxonomyName + "</a>"; dr["RIGHT"] += "<br />" + folders.Taxonomy[i].TaxonomyDescription; } else if (i == (folders.Taxonomy.Length - 1) && bOffSet && (data != null) && data.Length > 0) { dr["CHECKR"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"i_" + data[0].Id + "\" onClick=\"javascript:checkAll(\'req_deleted_users\');\">"; dr["RIGHT"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "content.gif\"/>" + data[0].Title; } dt.Rows.Add(dr); } } if (!(data == null)) { int iStart = System.Convert.ToInt32(bOffSet ? 1 : 0); for (i = iStart; i <= data.Length - 1; i++) { dr = dt.NewRow(); dr["CHECKL"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"i_" + data[i].Id + "\" onClick=\"javascript:checkAll(\'req_deleted_users\');\">"; dr["LEFT"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "content.gif" + "\" width=\"32\" height=\"32\"/>" + data[i].Title; if (i < (data.Length - 1)) { i++; dr["CHECKR"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"i_" + data[i].Id + "\" onClick=\"javascript:checkAll(\'req_deleted_users\');\">"; dr["RIGHT"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "content.gif\"/>" + data[i].Title; } dt.Rows.Add(dr); } } DataView dv = new DataView(dt); FavGrid.DataSource = dv; FavGrid.DataBind(); }
private void OnGetRankedTaxonomyText(TaxonomyData taxonomyData, Dictionary <string, object> customData) { Log.Debug("ExampleAlchemyLanguage.OnGetRankedTaxonomyText()", "Alchemy Language - Get ranked taxonomy response text: {0}", customData["json"].ToString()); _getRankedTaxonomyTextTested = true; }
protected void Page_Load(object sender, System.EventArgs e) { m_refMsg = m_refApi.EkMsgRef; AppImgPath = m_refApi.AppImgPath; m_strPageAction = Request.QueryString["action"]; object refAPI = m_refApi as object; Utilities.SetLanguage(m_refApi); TaxonomyLanguage = m_refApi.ContentLanguage; if ((TaxonomyLanguage == -1)) { TaxonomyLanguage = m_refApi.DefaultContentLanguage; } if ((Request.QueryString["taxonomyid"] != null)) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); hdnTaxonomyId.Value = TaxonomyId.ToString(); } if ((Request.QueryString["parentid"] != null)) { TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]); } m_refContent = m_refApi.EkContentRef; if ((Request.QueryString["reorder"] != null)) { m_strReorderAction = Convert.ToString(Request.QueryString["reorder"]); } if ((Request.QueryString["view"] != null)) { _ViewItem = Request.QueryString["view"]; } if ((Page.IsPostBack)) { if ((m_strPageAction == "edit")) { taxonomy_data.TaxonomyLanguage = TaxonomyLanguage; taxonomy_data.TaxonomyParentId = TaxonomyParentId; taxonomy_data.TaxonomyId = TaxonomyId; taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID]; taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID]; // taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID]; // taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID]; //if (tr_enableDisable.Visible == true) //{ // if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID])) // { // taxonomy_data.Visible = true; // } // else // { // taxonomy_data.Visible = false; // } //} //else //{ // taxonomy_data.Visible = Convert.ToBoolean(Request.Form[visibility.UniqueID]); //} //if ((Request.Form[inherittemplate.UniqueID] != null)) //{ // taxonomy_data.TemplateInherited = true; //} //if ((Request.Form[taxonomytemplate.UniqueID] != null)) //{ // taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]); //} //else //{ // taxonomy_data.TemplateId = 0; //} try { m_refContent.UpdateTaxonomy(taxonomy_data); } catch (Exception ex) { Utilities.ShowError(ex.Message); } //if (((Request.Form[chkApplyDisplayAllLanguages.UniqueID] != null)) && (Request.Form[chkApplyDisplayAllLanguages.UniqueID].ToString().ToLower() == "on")) //{ // m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, taxonomy_data.Visible); //} //else //{ // m_refContent.UpdateTaxonomyVisible(TaxonomyId, TaxonomyLanguage, taxonomy_data.Visible); //} if ((TaxonomyParentId == 0)) { string strConfig = string.Empty; //if ((!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID]))) //{ // strConfig = "0"; //} //if ((!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID]))) //{ // if ((string.IsNullOrEmpty(strConfig))) // { // strConfig = "1"; // } // else // { // strConfig = strConfig + ",1"; // } //} //if ((!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID]))) //{ // if ((string.IsNullOrEmpty(strConfig))) // { // strConfig = "2"; // } // else // { // strConfig = strConfig + ",2"; // } //} //if ((!(string.IsNullOrEmpty(strConfig)))) //{ // m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig); //} } UpdateCustomProperties(); if ((Request.QueryString["iframe"] == "true")) { Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>"); } else { if ((Request.QueryString["backaction"] != null && Convert.ToString(Request.QueryString["backaction"]).ToLower() == "viewtree")) { Response.Redirect("LocaleTaxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage, true); } else if (Request.QueryString["view"] != null) { Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" +Convert.ToString(Request.QueryString["view"]) + "&taxonomyid=" + TaxonomyId + "&rf=1", true); } else { Response.Redirect("LocaleTaxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1", true); } } } else { if ((!string.IsNullOrEmpty(Request.Form[LinkOrder.UniqueID]))) { taxonomy_request = new TaxonomyRequest(); taxonomy_request.TaxonomyId = TaxonomyId; taxonomy_request.TaxonomyLanguage = TaxonomyLanguage; taxonomy_request.TaxonomyIdList = Request.Form[LinkOrder.UniqueID]; if (!string.IsNullOrEmpty(Request.Form[chkOrderAllLang.UniqueID])) { if ((m_strReorderAction == "category")) { m_refContent.ReOrderAllLanguageCategories(taxonomy_request); } } else { if ((m_strReorderAction == "category")) { m_refContent.ReOrderCategories(taxonomy_request); } else { m_refContent.ReOrderTaxonomyItems(taxonomy_request); } } } if ((Request.QueryString["iframe"] == "true")) { Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>"); } else { Response.Redirect("LocaleTaxonomy.aspx?action=view&type="+ Request.QueryString["type"]+"&taxonomyid=" + TaxonomyId + "&rf=1", true); } } } else { //ltr_sitepath.Text = m_refApi.SitePath; taxonomy_request = new TaxonomyRequest(); taxonomy_request.TaxonomyId = TaxonomyId; taxonomy_request.TaxonomyLanguage = TaxonomyLanguage; if ((m_strPageAction == "edit")) { taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request); taxonomydescription.Text = taxonomy_data.TaxonomyDescription; taxonomytitle.Text = taxonomy_data.TaxonomyName; // taxonomy_image.Text = taxonomy_data.TaxonomyImage; // taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage; // categoryLink.Text = taxonomy_data.CategoryUrl; visibility.Value = taxonomy_data.Visible.ToString(); if ((Request.QueryString["taxonomyid"] != null)) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); } if (TaxonomyParentId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage); } else if (TaxonomyId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage); } // ' why in the world would you disable the visible flag if it's not synchronized??? //If Not m_bSynchronized Then //tr_enableDisable.Visible = False //End If //if (taxonomy_data.Visible == true) //{ // chkEnableDisable.Checked = true; //} //else //{ // chkEnableDisable.Checked = false; //} //if (!string.IsNullOrEmpty(taxonomy_data.TaxonomyImage)) //{ // taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0 ? taxonomy_data.TaxonomyImage : m_refApi.SitePath + taxonomy_data.TaxonomyImage); //} //else //{ // taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif"; //} //language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage); ////if ((taxonomy_data.TaxonomyParentId == 0)) //{ // inherittemplate.Visible = false; // lblInherited.Text = "No"; // inherittemplate.Checked = taxonomy_data.TemplateInherited; //} //else //{ // inherittemplate.Visible = true; // lblInherited.Text = ""; // inherittemplate.Checked = taxonomy_data.TemplateInherited; // if ((taxonomy_data.TemplateInherited)) // { // taxonomytemplate.Enabled = false; // } //} //TemplateData[] templates = null; //templates = m_refApi.GetAllTemplates("TemplateFileName"); //taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("-select template-", "0")); //if ((templates != null && templates.Length > 0)) //{ // for (int i = 0; i <= templates.Length - 1; i++) // { // taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString())); // if ((taxonomy_data.TemplateId == templates[i].Id)) // { // taxonomytemplate.SelectedIndex = i + 1; // } // } //} if (((language_data != null) && (m_refApi.EnableMultilingual == 1))) { lblLanguage.Text = "[" + language_data.Name + "]"; } m_strCurrentBreadcrumb = taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "); if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb))) { m_strCurrentBreadcrumb = "Root"; } //admin inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)"); if ((TaxonomyParentId == 0)) { //tr_config.Visible = true; //List<Int32> config_list = m_refApi.EkContentRef.GetAllConfigIdListByTaxonomy(TaxonomyId, TaxonomyLanguage); //for (int i = 0; i <= config_list.Count - 1; i++) //{ // if ((config_list[i] == 0)) // { // chkConfigContent.Checked = true; // } // else if ((config_list[i] == 1)) // { // chkConfigUser.Checked = true; // } // else if ((config_list[i] == 2)) // { // chkConfigGroup.Checked = true; // } //} } else { // tr_config.Visible = false; } LoadCustomPropertyList(); } else { if ((m_strReorderAction == "category")) { taxonomy_request.PageSize = 99999999; // pagesize of 0 used to mean "all" taxonomy_arr = m_refContent.ReadAllSubCategories(taxonomy_request); if ((taxonomy_arr != null)) { TotalItems = taxonomy_arr.Length; } else { TotalItems = 0; } if ((TotalItems > 1)) { td_msg.Text = m_refMsg.GetMessage("generic first msg"); OrderList.DataSource = taxonomy_arr; OrderList.DataTextField = "TaxonomyName"; OrderList.DataValueField = "TaxonomyId"; OrderList.DataBind(); OrderList.SelectionMode = ListSelectionMode.Multiple; OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;"; if ((TotalItems > 20)) { OrderList.Rows = 20; } else { OrderList.Rows = TotalItems; } OrderList.Width = 300; if ((TotalItems > 0)) { loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;"; } for (int i = 0; i <= taxonomy_arr.Length - 1; i++) { if ((string.IsNullOrEmpty(LinkOrder.Value))) { LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId); } else { LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId) + ","; } } } else { LoadNoItem(); } } else { AllLangForm.Visible = false; // the all languages checkbox is only valid for categories taxonomy_request.PageSize = 99999999; taxonomy_request.IncludeItems = true; taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request); tr_ordering.Visible = true; //Not showing for items if ((taxonomy_data.TaxonomyItems != null)) { TotalItems = taxonomy_data.TaxonomyItems.Length; if ((TotalItems > 1)) { td_msg.Text = m_refMsg.GetMessage("generic first msg"); OrderList.DataSource = taxonomy_data.TaxonomyItems; OrderList.DataTextField = "TaxonomyItemTitle"; OrderList.DataValueField = "TaxonomyItemId"; OrderList.DataBind(); OrderList.SelectionMode = ListSelectionMode.Multiple; OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;"; if ((TotalItems > 20)) { OrderList.Rows = 20; } else { OrderList.Rows = TotalItems; } OrderList.Width = 300; if ((TotalItems > 0)) { loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;"; } foreach (TaxonomyItemData taxonomy_item in taxonomy_data.TaxonomyItems) { if ((string.IsNullOrEmpty(LinkOrder.Value))) { LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId); } else { LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId) + ","; } } } else { LoadNoItem(); } } } } TaxonomyToolBar(); } }
private void OnGetRankedTaxonomyText(TaxonomyData taxonomyData, string data) { Log.Debug("ExampleAlchemyLanguage", "Alchemy Language - Get ranked taxonomy response text: {0}", data); Test(taxonomyData != null); _getRankedTaxonomyTextTested = true; }
protected void Page_Load(object sender, System.EventArgs e) { try { m_refMsg = m_refApi.EkMsgRef; AppImgPath = m_refApi.AppImgPath; AppPath = m_refApi.AppPath; ltr_sitepath.Text = m_refApi.SitePath; m_strPageAction = Request.QueryString["action"]; Utilities.SetLanguage(m_refApi); TaxonomyLanguage = m_refApi.ContentLanguage; if (TaxonomyLanguage == -1) { TaxonomyLanguage = m_refApi.DefaultContentLanguage; } if (Request.QueryString["taxonomyid"] != null) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); } if (Request.QueryString["parentid"] != null) { TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]); if (TaxonomyParentId > 0) { TitleLabel = "categorytitle"; DescriptionLabel = "categorydescription"; } } if (Request.QueryString["iframe"] == "true") { styles.Visible = true; } chkConfigContent.Text = chkConfigContent.ToolTip = m_refMsg.GetMessage("content text"); chkConfigUser.Text = chkConfigUser.ToolTip = m_refMsg.GetMessage("generic user"); chkConfigGroup.Text = chkConfigGroup.ToolTip = m_refMsg.GetMessage("lbl group"); if (Page.IsPostBack) { TaxonomyData taxonomy_data = new TaxonomyData(); taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID]; taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID]; taxonomy_data.TaxonomyLanguage = TaxonomyLanguage; taxonomy_data.TaxonomyParentId = TaxonomyParentId; taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID]; taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID]; if (tr_enableDisable.Visible == true) { if (! string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID])) { taxonomy_data.Visible = true; } else { taxonomy_data.Visible = false; } } else { taxonomy_data.Visible = true; } if (Request.Form[inherittemplate.UniqueID] != null) { taxonomy_data.TemplateInherited = true; } if (Request.Form[taxonomytemplate.UniqueID] != null) { taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]); } else { taxonomy_data.TemplateId = 0; } //If (TaxonomyId <> 0) Then // taxonomy_data.TaxonomyId = TaxonomyId //End If m_refContent = m_refApi.EkContentRef; TaxonomyId = m_refContent.CreateTaxonomy(taxonomy_data); if (Request.Form[alllanguages.UniqueID] == "false") { m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, false); } m_refContent.UpdateTaxonomySynchronization(TaxonomyId, GetCheckBoxValue(chkTaxSynch)); // chkCreateLang if (TaxonomyParentId == 0) { string strConfig = string.Empty; if (! string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID])) { strConfig = "0"; } if (! string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID])) { if (string.IsNullOrEmpty(strConfig)) { strConfig = "1"; } else { strConfig = strConfig + ",1"; } } if (! string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID])) { if (string.IsNullOrEmpty(strConfig)) { strConfig = "2"; } else { strConfig = strConfig + ",2"; } } if (!(string.IsNullOrEmpty(strConfig))) { m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig); } } //++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++ Adding MetaData Information '+++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++ AddCustomProperties(); //++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++ Adding Other Langs (If Applicable) +++ //++++++++++++++++++++++++++++++++++++++++++++++++ if (!GetCheckBoxValue(chkTaxSynch) && GetCheckBoxValue(chkCreateLang)) { // Figure out which ones were created. IList<LanguageData> result_language = null; TaxonomyLanguageRequest taxonomy_language_request = new TaxonomyLanguageRequest(); taxonomy_language_request.TaxonomyId = TaxonomyId; taxonomy_language_request.IsTranslated = false; // langs that we still need result_language = m_refContent.LoadLanguageForTaxonomy(taxonomy_language_request); if (result_language != null) { foreach(LanguageData lang in result_language) { UsingLanguage(m_refContent.RequestInformation, lang.Id, delegate { taxonomy_data.TaxonomyId = TaxonomyId; taxonomy_data.LanguageId = lang.Id; m_refContent.CreateTaxonomy(taxonomy_data); }); } } } if (Request.QueryString["iframe"] == "true") { Packages.EktronCoreJS.Register(this); closeWindow = "Ektron.ready(function(){parent.CloseChildPage();});"; } else { //this should jump back to taxonomy that was added //Response.Redirect("taxonomy.aspx?rf=1", True) Response.Redirect("taxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1&reloadtrees=Tax", true); } } else { m_refContent = m_refApi.EkContentRef; TaxonomyRequest req = new TaxonomyRequest(); req.TaxonomyId = TaxonomyParentId; req.TaxonomyLanguage = TaxonomyLanguage; if (TaxonomyParentId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage); } else if (TaxonomyId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage); } chkTaxSynch.Checked = m_bSynchronized; chkTaxSynch.Attributes.Add("onclick", string.Format("ToggleTaxSynch(this, '{0}');", chkCreateLang.ClientID) ); if (m_bSynchronized) { fs_taxsynccreate.Attributes.Add("style", "display:none;"); } if (! m_bSynchronized) { tr_enableDisable.Visible = false; } TaxonomyBaseData data = m_refContent.ReadTaxonomy(ref req); if (data == null) { EkException.ThrowException(new Exception("Invalid taxonomy ID: " + TaxonomyId + " parent: " + TaxonomyParentId)); } language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage); if ((language_data != null) && (m_refApi.EnableMultilingual == 1)) { lblLanguage.Text = "[" + language_data.Name + "]"; } taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif"; m_strCurrentBreadcrumb = (string) (data.TaxonomyPath.Remove(0, 1).Replace("\\", " > ")); if (m_strCurrentBreadcrumb == "") { m_strCurrentBreadcrumb = "Root"; } if (TaxonomyParentId == 0) { inherittemplate.Visible = false; lblInherited.Text = "No"; lblInherited.ToolTip = lblInherited.Text; } else { inherittemplate.Checked = true; taxonomytemplate.Enabled = false; inherittemplate.Visible = true; lblInherited.Text = ""; } TemplateData[] templates = null; templates = m_refApi.GetAllTemplates("TemplateFileName"); taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("- " + m_refMsg.GetMessage("generic select template") + " -", "0")); if ((templates != null)&& templates.Length > 0) { for (int i = 0; i <= templates.Length - 1; i++) { taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString())); } } inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)"); inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)"); if (TaxonomyParentId == 0) { tr_config.Visible = true; } else { tr_config.Visible = false; } chkConfigContent.Checked = true; LoadCustomPropertyList(); TaxonomyToolBar(); } } catch (System.Threading.ThreadAbortException) { //Do nothing } catch (Exception ex) { Response.Redirect((string) ("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage), false); } }
protected void Page_Load(object sender, System.EventArgs e) { m_refMsg = m_refApi.EkMsgRef; AppImgPath = m_refApi.AppImgPath; m_strPageAction = Request.QueryString["action"]; object refAPI = m_refApi as object; Utilities.SetLanguage(m_refApi); TaxonomyLanguage = m_refApi.ContentLanguage; if (TaxonomyLanguage == -1) { TaxonomyLanguage = m_refApi.DefaultContentLanguage; } if (Request.QueryString["taxonomyid"] != null) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); hdnTaxonomyId.Value = TaxonomyId.ToString(); } if (Request.QueryString["parentid"] != null) { TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]); } m_refContent = m_refApi.EkContentRef; if (Request.QueryString["reorder"] != null) { m_strReorderAction = Convert.ToString(Request.QueryString["reorder"]); } chkApplyDisplayAllLanguages.Text = m_refMsg.GetMessage("lbl apply display taxonomy languages"); chkConfigContent.Text = chkConfigContent.ToolTip = m_refMsg.GetMessage("content text"); chkConfigUser.Text = chkConfigUser.ToolTip = m_refMsg.GetMessage("generic user"); chkConfigGroup.Text = chkConfigGroup.ToolTip = m_refMsg.GetMessage("lbl group"); if (Page.IsPostBack) { if (m_strPageAction == "edit") { taxonomy_data.TaxonomyLanguage = TaxonomyLanguage; taxonomy_data.TaxonomyParentId = TaxonomyParentId; taxonomy_data.TaxonomyId = TaxonomyId; taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID]; taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID]; taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID]; taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID]; if (tr_enableDisable.Visible == true) { if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID])) { taxonomy_data.Visible = true; } else { taxonomy_data.Visible = false; } } else { taxonomy_data.Visible = Convert.ToBoolean(Request.Form[visibility.UniqueID]); } if (Request.Form[inherittemplate.UniqueID] != null) { taxonomy_data.TemplateInherited = true; } if (Request.Form[taxonomytemplate.UniqueID] != null) { taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]); } else { taxonomy_data.TemplateId = 0; } try { m_refContent.UpdateTaxonomy(taxonomy_data); } catch (Exception ex) { Utilities.ShowError(ex.Message); } if ((!(Request.Form[chkApplyDisplayAllLanguages.UniqueID] == null)) && (Request.Form[chkApplyDisplayAllLanguages.UniqueID].ToString().ToLower() == "on")) { m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, taxonomy_data.Visible); } m_refContent.UpdateTaxonomySynchronization(TaxonomyId, GetCheckBoxValue(chkTaxSynch)); //else //{ // m_refContent.UpdateTaxonomyVisible(TaxonomyId, TaxonomyLanguage, taxonomy_data.Visible); //} if (TaxonomyParentId == 0) { string strConfig = string.Empty; if (!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID])) { strConfig = "0"; } if (!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID])) { if (string.IsNullOrEmpty(strConfig)) { strConfig = "1"; } else { strConfig = strConfig + ",1"; } } if (!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID])) { if (string.IsNullOrEmpty(strConfig)) { strConfig = "2"; } else { strConfig = strConfig + ",2"; } } if (!(string.IsNullOrEmpty(strConfig))) { m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig); } } UpdateCustomProperties(); if (Request.QueryString["iframe"] == "true") { Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>"); } else { if ((Request.QueryString["backaction"] != null) && Convert.ToString(Request.QueryString["backaction"]).ToLower() == "viewtree") { Response.Redirect((string)("taxonomy.aspx?action=viewtree&taxonomyid=" + TaxonomyId + "&LangType=" + TaxonomyLanguage), true); } else { Response.Redirect("taxonomy.aspx?action=view&view=item&taxonomyid=" + TaxonomyId + "&rf=1", true); } } } else { if (Request.Form[LinkOrder.UniqueID] != "") { taxonomy_request = new TaxonomyRequest(); taxonomy_request.TaxonomyId = TaxonomyId; taxonomy_request.TaxonomyLanguage = TaxonomyLanguage; taxonomy_request.TaxonomyIdList = Request.Form[LinkOrder.UniqueID]; if (!string.IsNullOrEmpty(Request.Form[chkOrderAllLang.UniqueID])) { if (m_strReorderAction == "category") { m_refContent.ReOrderAllLanguageCategories(taxonomy_request); } else if (m_strReorderAction == "users") { taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User; m_refContent.ReOrderTaxonomyItems(taxonomy_request); } } else { if (m_strReorderAction == "category") { m_refContent.ReOrderCategories(taxonomy_request); } else { if (m_strReorderAction == "users") { taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User; } m_refContent.ReOrderTaxonomyItems(taxonomy_request); } } } if (Request.QueryString["iframe"] == "true") { Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>"); } else { if(m_strReorderAction == "category") Response.Redirect("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId + "&rf=1&reloadtrees=Tax", true); else Response.Redirect("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId + "&rf=1", true); } } } else { ltr_sitepath.Text = m_refApi.SitePath; taxonomy_request = new TaxonomyRequest(); taxonomy_request.TaxonomyId = TaxonomyId; taxonomy_request.TaxonomyLanguage = TaxonomyLanguage; if (m_strPageAction == "edit") { taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request); taxonomydescription.Text = taxonomy_data.TaxonomyDescription; taxonomydescription.ToolTip = taxonomydescription.Text; taxonomytitle.Text = taxonomy_data.TaxonomyName; taxonomytitle.ToolTip = taxonomytitle.Text; taxonomy_image.Text = taxonomy_data.TaxonomyImage; taxonomy_image.ToolTip = taxonomy_image.Text; taxonomy_image_thumb.ImageUrl = taxonomy_data.TaxonomyImage; categoryLink.Text = taxonomy_data.CategoryUrl; visibility.Value = taxonomy_data.Visible.ToString(); if (Request.QueryString["taxonomyid"] != null) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); } if (TaxonomyParentId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage); if (TaxonomyId > 0) chkTaxSynch.Checked = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage); } else if (TaxonomyId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage); chkTaxSynch.Checked = m_bSynchronized; } if (taxonomy_data.Visible == true) { chkEnableDisable.Checked = true; } else { chkEnableDisable.Checked = false; } if (taxonomy_data.TaxonomyImage != "") { taxonomy_image_thumb.ImageUrl = (taxonomy_data.TaxonomyImage.IndexOf("/") == 0) ? taxonomy_data.TaxonomyImage : m_refApi.SitePath + taxonomy_data.TaxonomyImage; } else { taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif"; } language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage); if (taxonomy_data.TaxonomyParentId == 0) { inherittemplate.Visible = false; lblInherited.Text = "No"; lblInherited.ToolTip = lblInherited.Text; inherittemplate.Checked = taxonomy_data.TemplateInherited; } else { inherittemplate.Visible = true; lblInherited.Text = ""; inherittemplate.Checked = taxonomy_data.TemplateInherited; if (taxonomy_data.TemplateInherited) { taxonomytemplate.Enabled = false; } } TemplateData[] templates = null; templates = m_refApi.GetAllTemplates("TemplateFileName"); taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("- " + m_refMsg.GetMessage("generic select template") + " -", "0")); if ((templates != null) && templates.Length > 0) { for (int i = 0; i <= templates.Length - 1; i++) { taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString())); if (taxonomy_data.TemplateId == templates[i].Id) { taxonomytemplate.SelectedIndex = i + 1; } } } if ((language_data != null) && (m_refApi.EnableMultilingual == 1)) { lblLanguage.Text = "[" + language_data.Name + "]"; lblLanguage.ToolTip = lblLanguage.Text; } m_strCurrentBreadcrumb = (string)(taxonomy_data.TaxonomyPath.Remove(0, 1).Replace("\\", " > ")); if (m_strCurrentBreadcrumb == "") { m_strCurrentBreadcrumb = "Root"; } inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)"); if (TaxonomyParentId == 0) { tr_config.Visible = true; List<int> config_list = m_refApi.EkContentRef.GetAllConfigIdListByTaxonomy(TaxonomyId, TaxonomyLanguage); for (int i = 0; i <= config_list.Count - 1; i++) { if (config_list[i] == 0) { chkConfigContent.Checked = true; } else if (config_list[i] == 1) { chkConfigUser.Checked = true; } else if (config_list[i] == 2) { chkConfigGroup.Checked = true; } } } else { tr_config.Visible = false; } LoadCustomPropertyList(); } else { if (m_strReorderAction == "category") { taxonomy_request.PageSize = 99999999; // pagesize of 0 used to mean "all" taxonomy_arr = m_refContent.ReadAllSubCategories(taxonomy_request); if (taxonomy_arr != null) { TotalItems = taxonomy_arr.Length; } else { TotalItems = 0; } if (TotalItems > 1) { td_msg.Text = m_refMsg.GetMessage("generic first msg"); OrderList.DataSource = taxonomy_arr; OrderList.DataTextField = "TaxonomyName"; OrderList.DataValueField = "TaxonomyId"; OrderList.DataBind(); OrderList.SelectionMode = ListSelectionMode.Multiple; OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;"; if (TotalItems > 20) { OrderList.Rows = 20; } else { OrderList.Rows = TotalItems; } OrderList.Width = 300; if (TotalItems > 0) { loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;"; } for (int i = 0; i <= taxonomy_arr.Length - 1; i++) { if (LinkOrder.Value == "") { LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId); } else { LinkOrder.Value = Convert.ToString(taxonomy_arr[i].TaxonomyId) + ","; } } } else { LoadNoItem(); } } else if (m_strReorderAction == "users") { DirectoryUserRequest uReq = new DirectoryUserRequest(); DirectoryAdvancedUserData uDirectory = new DirectoryAdvancedUserData(); uReq.GetItems = true; uReq.DirectoryId = TaxonomyId; uReq.DirectoryLanguage = TaxonomyLanguage; uReq.PageSize = 99999; uReq.CurrentPage = 1; uDirectory = this.m_refContent.LoadDirectory(ref uReq); TotalItems = uDirectory.DirectoryItems.Count(); if (TotalItems > 1) { td_msg.Text = m_refMsg.GetMessage("generic first msg"); OrderList.DataSource = uDirectory.DirectoryItems; OrderList.DataTextField = "Username"; OrderList.DataValueField = "Id"; OrderList.DataBind(); OrderList.SelectionMode = ListSelectionMode.Multiple; OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;"; if (TotalItems > 20) { OrderList.Rows = 20; } else { OrderList.Rows = TotalItems; } OrderList.Width = 300; if (TotalItems > 0) { loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;"; } for (int i = 0; i <= TotalItems - 1; i++) { if (LinkOrder.Value == "") { LinkOrder.Value = Convert.ToString(uDirectory.DirectoryItems[i].Id); } else { LinkOrder.Value = Convert.ToString(uDirectory.DirectoryItems[i].Id) + ","; } } } else { LoadNoItem(); } } else { AllLangForm.Visible = false; // the all languages checkbox is only valid for categories taxonomy_request.PageSize = 99999999; taxonomy_request.IncludeItems = true; taxonomy_data = m_refContent.ReadTaxonomy(ref taxonomy_request); tr_ordering.Visible = true; //Not showing for items if (taxonomy_data.TaxonomyItems != null) { TotalItems = taxonomy_data.TaxonomyItems.Length; if (TotalItems > 1) { td_msg.Text = m_refMsg.GetMessage("generic first msg"); OrderList.DataSource = taxonomy_data.TaxonomyItems; OrderList.DataTextField = "TaxonomyItemTitle"; OrderList.DataValueField = "TaxonomyItemId"; OrderList.DataBind(); OrderList.SelectionMode = ListSelectionMode.Multiple; OrderList.CssClass = "width: 100%; border-style: none; border-color: White; font-family: Verdana;font-size: x-small;"; if (TotalItems > 20) { OrderList.Rows = 20; } else { OrderList.Rows = TotalItems; } OrderList.Width = 300; if (TotalItems > 0) { loadscript.Text = "document.forms[0].taxonomy_OrderList[0].selected = true;"; } foreach (TaxonomyItemData taxonomy_item in taxonomy_data.TaxonomyItems) { if (LinkOrder.Value == "") { LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId); } else { LinkOrder.Value = Convert.ToString(taxonomy_item.TaxonomyItemId) + ","; } } } else { LoadNoItem(); } } } } TaxonomyToolBar(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { m_refMsg = m_refApi.EkMsgRef; AppImgPath = m_refApi.AppImgPath; AppPath = m_refApi.AppPath; m_strPageAction = Request.QueryString["action"]; Utilities.SetLanguage(m_refApi); TaxonomyLanguage = m_refApi.ContentLanguage; if ((TaxonomyLanguage == -1)) { TaxonomyLanguage = m_refApi.DefaultContentLanguage; } if ((Request.QueryString["taxonomyid"] != null)) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); } if ((Request.QueryString["parentid"] != null)) { TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]); if ((TaxonomyParentId > 0)) { TitleLabel = "categorytitle"; DescriptionLabel = "categorydescription"; } } if ((Page.IsPostBack)) { TaxonomyData taxonomy_data = new TaxonomyData(); taxonomy_data.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Locale; taxonomy_data.TaxonomyDescription = Request.Form[taxonomydescription.UniqueID]; taxonomy_data.TaxonomyName = Request.Form[taxonomytitle.UniqueID]; taxonomy_data.TaxonomyLanguage = TaxonomyLanguage; taxonomy_data.TaxonomyParentId = TaxonomyParentId; // taxonomy_data.TaxonomyImage = Request.Form[taxonomy_image.UniqueID]; // taxonomy_data.CategoryUrl = Request.Form[categoryLink.UniqueID]; //if (tr_enableDisable.Visible == true) //{ // if (!string.IsNullOrEmpty(Request.Form[chkEnableDisable.UniqueID])) // { // taxonomy_data.Visible = true; // } // else // { // taxonomy_data.Visible = false; // } //} //else //{ // taxonomy_data.Visible = true; //} //if ((Request.Form[inherittemplate.UniqueID] != null)) //{ // taxonomy_data.TemplateInherited = true; //} //if ((Request.Form[taxonomytemplate.UniqueID] != null)) //{ // taxonomy_data.TemplateId = Convert.ToInt64(Request.Form[taxonomytemplate.UniqueID]); //} //else //{ // taxonomy_data.TemplateId = 0; //} //If (TaxonomyId <> 0) Then // taxonomy_data.TaxonomyId = TaxonomyId //End If m_refContent = m_refApi.EkContentRef; TaxonomyId = m_refContent.CreateTaxonomy(taxonomy_data); //add the default language by Default. TaxonomyRequest item_request = new TaxonomyRequest(); item_request.TaxonomyId = TaxonomyId; item_request.TaxonomyIdList =Convert.ToString(TaxonomyLanguage); item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Locale; item_request.TaxonomyLanguage = TaxonomyLanguage; m_refContent.AddTaxonomyItem(item_request); if (Request.Form[alllanguages.UniqueID] == "false") { m_refContent.UpdateTaxonomyVisible(TaxonomyId, -1, false); } if ((TaxonomyParentId == 0)) { string strConfig = string.Empty; //if ((!string.IsNullOrEmpty(Request.Form[chkConfigContent.UniqueID]))) //{ // strConfig = "0"; //} //if ((!string.IsNullOrEmpty(Request.Form[chkConfigUser.UniqueID]))) //{ // if ((string.IsNullOrEmpty(strConfig))) // { // strConfig = "1"; // } // else // { // strConfig = strConfig + ",1"; // } //} //if ((!string.IsNullOrEmpty(Request.Form[chkConfigGroup.UniqueID]))) //{ // if ((string.IsNullOrEmpty(strConfig))) // { // strConfig = "2"; // } // else // { // strConfig = strConfig + ",2"; // } //} if ((!(string.IsNullOrEmpty(strConfig)))) { m_refContent.UpdateTaxonomyConfig(TaxonomyId, strConfig); } } //++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++ Adding MetaData Information '+++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++ //Commeneted as per Doug suggestion //AddCustomProperties(); if ((Request.QueryString["iframe"] == "true")) { Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>"); } else { //this should jump back to taxonomy that was added //Response.Redirect("taxonomy.aspx?rf=1", True) Response.Redirect("LocaleTaxonomy.aspx?action=view&view=locale&taxonomyid=" + TaxonomyId + "&rf=1", true); } } else { m_refContent = m_refApi.EkContentRef; TaxonomyRequest req = new TaxonomyRequest(); req.TaxonomyId = TaxonomyParentId; req.TaxonomyLanguage = TaxonomyLanguage; if (TaxonomyParentId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyParentId, TaxonomyLanguage); } else if (TaxonomyId > 0) { m_bSynchronized = m_refContent.IsSynchronizedTaxonomy(TaxonomyId, TaxonomyLanguage); } //if (!m_bSynchronized) //{ // tr_enableDisable.Visible = false; //} TaxonomyBaseData data = m_refContent.ReadTaxonomy(ref req); if ((data == null)) { EkException.ThrowException(new Exception("Invalid taxonomy ID: " + TaxonomyId + " parent: " + TaxonomyParentId)); } language_data = (new SiteAPI()).GetLanguageById(TaxonomyLanguage); if (((language_data != null) && (m_refApi.EnableMultilingual == 1))) { lblLanguage.Text = "[" + language_data.Name + "]"; } // taxonomy_image_thumb.ImageUrl = m_refApi.AppImgPath + "spacer.gif"; m_strCurrentBreadcrumb = data.TaxonomyPath.Remove(0, 1).Replace("\\", " > "); if ((string.IsNullOrEmpty(m_strCurrentBreadcrumb))) { m_strCurrentBreadcrumb = "Root"; } //if ((TaxonomyParentId == 0)) //{ // inherittemplate.Visible = false; // lblInherited.Text = "No"; //} //else //{ // inherittemplate.Checked = true; // taxonomytemplate.Enabled = false; // inherittemplate.Visible = true; // lblInherited.Text = ""; //} // TemplateData[] templates = null; // templates = m_refApi.GetAllTemplates("TemplateFileName"); //taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem("-select template-", "0")); //if ((templates != null && templates.Length > 0)) //{ // for (int i = 0; i <= templates.Length - 1; i++) // { // taxonomytemplate.Items.Add(new System.Web.UI.WebControls.ListItem(templates[i].FileName, templates[i].Id.ToString())); // } //} // inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)"); // inherittemplate.Attributes.Add("onclick", "OnInheritTemplateClicked(this)"); //if ((TaxonomyParentId == 0)) //{ // tr_config.Visible = true; //} //else //{ // tr_config.Visible = false; //} // chkConfigContent.Checked = true; //LoadCustomPropertyList(); TaxonomyToolBar(); } } catch (System.Threading.ThreadAbortException) { //Do nothing } catch (Exception ex) { Response.Redirect(AppPath + "reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + TaxonomyLanguage, false); } }