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); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, System.EventArgs e) { m_refMsg = this.m_refContentApi.EkMsgRef; AppImgPath = this.m_refContentApi.AppImgPath; AppPath = this.m_refContentApi.AppPath; m_strPageAction = Request.QueryString["action"]; object refApi = m_refContentApi as object; Utilities.SetLanguage(m_refContentApi); TaxonomyLanguage = this.m_refContentApi.ContentLanguage; if ((TaxonomyLanguage == -1)) { TaxonomyLanguage = m_refContentApi.DefaultContentLanguage; } if ((Request.QueryString["view"] != null)) { _ViewItem = Request.QueryString["view"]; } if ((Request.QueryString["taxonomyid"] != null)) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); } if ((Request.QueryString["parentid"] != null)) { this.TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]); } if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "author") { this.m_ObjectType = EkEnumeration.CMSObjectTypes.User; this.m_UserType = EkEnumeration.UserTypes.AuthorType; } else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "member") { this.m_ObjectType = EkEnumeration.CMSObjectTypes.User; this.m_UserType = EkEnumeration.UserTypes.MemberShipType; } else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "cgroup") { this.m_ObjectType = EkEnumeration.CMSObjectTypes.CommunityGroup; } else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "locales") { this.m_LocaleObjectType = EkEnumeration.TaxonomyItemType.Locale; } else if ((m_strPageAction == "addfolder")) { localization_folder_chkRecursive_div.Visible = true; this.m_ObjectType = EkEnumeration.CMSObjectTypes.Folder; } if ((Request.QueryString["contFetchType"] != null) && !string.IsNullOrEmpty(Request.QueryString["contFetchType"].ToLower())) { contentFetchType = Request.QueryString["contFetchType"]; } this.m_refContent = this.m_refContentApi.EkContentRef; FormsIcon = "<img src=\"" + this.m_refContentApi.AppPath + "images/UI/Icons/contentForm.png\" alt=\"Form\">"; ContentIcon = "<img src=\"" + this.m_refContentApi.AppPath + "images/UI/Icons/contentHtml.png\" alt=\"Content\">"; pageIcon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/layout.png\" alt=\"Page\">"; if (this.m_UserType == EkEnumeration.UserTypes.AuthorType) { UserIcon = "<img src=\"" + this.m_refContentApi.AppPath + "Images/ui/icons/user.png\" alt=\"Content\">"; } else { UserIcon = "<img src=\"" + this.m_refContentApi.AppPath + "Images/ui/icons/userMembership.png\" alt=\"Content\">"; } if ((Page.IsPostBack && (!string.IsNullOrEmpty(Request.Form[isPostData.UniqueID])) && (m_ObjectType == EkEnumeration.CMSObjectTypes.Content | (m_ObjectType == EkEnumeration.CMSObjectTypes.User & !string.IsNullOrEmpty(Request.Form["itemlist"])) | (m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup & !string.IsNullOrEmpty(Request.Form["itemlist"]) | (m_ObjectType == EkEnumeration.CMSObjectTypes.Folder & !string.IsNullOrEmpty(Request.Form["itemlist"])) | (m_ObjectType == EkEnumeration.CMSObjectTypes.TaxonomyNode & !string.IsNullOrEmpty(Request.Form["itemlist"])))))) { if ((this.m_strPageAction == "additem")) { TaxonomyRequest item_request = new TaxonomyRequest(); item_request.TaxonomyId = TaxonomyId; item_request.TaxonomyIdList = Validate(Request.Form["itemlist"]); if (m_ObjectType == EkEnumeration.CMSObjectTypes.User) { item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User; } else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup) { item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Group; } else if (this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale) { item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Locale; } item_request.TaxonomyLanguage = TaxonomyLanguage; m_refContent.AddTaxonomyItem(item_request); } else if (this.m_strPageAction == "addfolder") { TaxonomyRequest item_request = new TaxonomyRequest(); item_request.TaxonomyId = this.TaxonomyId; item_request.TaxonomyLanguage = this.TaxonomyLanguage; item_request.TaxonomyIdList = this.Validate(Request.Form["newFolderDescendantsCSV"]); if (!String.IsNullOrEmpty(item_request.TaxonomyIdList)) { item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.FolderDescendants; this.m_refContent.AddTaxonomyItem(item_request); } item_request.TaxonomyIdList = this.Validate(Request.Form["newFolderChildrenCSV"]); if (!String.IsNullOrEmpty(item_request.TaxonomyIdList)) { item_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.FolderChildren; this.m_refContent.AddTaxonomyItem(item_request); } } if ((Request.QueryString["iframe"] == "true")) { Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>"); } else { if ((Request.QueryString["type"] != null)) { if (this.m_LocaleObjectType == EkEnumeration.TaxonomyItemType.Locale) { Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" + this.m_LocaleObjectType + "&taxonomyid=" + this.TaxonomyId); } else { if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup) { Response.Redirect("LocaleTaxonomy.aspx?action=view&view=cGroup&taxonomyid=" + TaxonomyId); } else { Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" + Convert.ToString(this.m_ObjectType).ToLower() + "&taxonomyid=" + TaxonomyId); } } } else if (this.m_ObjectType == EkEnumeration.CMSObjectTypes.Folder) { Response.Redirect("LocaleTaxonomy.aspx?action=view&view=" + Convert.ToString(this.m_ObjectType).ToLower() + "&taxonomyid=" + TaxonomyId); } else { Response.Redirect("LocaleTaxonomy.aspx?action=view&taxonomyid=" + TaxonomyId); } } } else { this.FolderId = Convert.ToInt64(Request.QueryString["folderid"]); folder_data_col = this.m_refContent.GetFolderInfoWithPath(FolderId); FolderName = this.folder_data_col["FolderName"].ToString(); FolderParentId = Convert.ToInt64(this.folder_data_col["ParentID"].ToString()); FolderPath = this.folder_data_col["Path"].ToString(); folder_request_col = new Collection(); folder_request_col.Add(this.FolderId, "ParentID", null, null); folder_request_col.Add("name", "OrderBy", null, null); folder_data_col = this.m_refContent.GetAllViewableChildFoldersv2_0(folder_request_col); if ((m_strPageAction != "additem")) { if (!string.IsNullOrEmpty(Request.QueryString[EkConstants.ContentTypeUrlParam])) { if (Information.IsNumeric(Request.QueryString[EkConstants.ContentTypeUrlParam])) { this.SelectedContentType = Convert.ToInt32(Request.QueryString[EkConstants.ContentTypeUrlParam]); this.m_refContentApi.SetCookieValue(EkConstants.ContentTypeUrlParam.ToString(), SelectedContentType.ToString()); } } else if (!string.IsNullOrEmpty(Ektron.Cms.CommonApi.GetEcmCookie()[(EkConstants.ContentTypeUrlParam)])) { if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[(EkConstants.ContentTypeUrlParam)])) { this.SelectedContentType = Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()[(EkConstants.ContentTypeUrlParam)]); } } asset_data = this.m_refContent.GetAssetSuperTypes(); } this.RegisterResources(); this.TaxonomyToolBar(); if ((!Page.IsPostBack || m_ObjectType == EkEnumeration.CMSObjectTypes.User || this.m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup)) { //// avoid redisplay when clicking next/prev buttons this.DisplayPage(); } } }
protected void Page_Load(object sender, System.EventArgs e) { m_refMsg = m_refContentApi.EkMsgRef; AppImgPath = m_refContentApi.AppImgPath; AppPath = m_refContentApi.AppPath; m_strPageAction = Request.QueryString["action"]; object refApi = m_refContentApi as object; Utilities.SetLanguage(m_refContentApi); //Utilities.SetLanguage(m_refContentApi); TaxonomyLanguage = m_refContentApi.ContentLanguage; if (TaxonomyLanguage == -1) { TaxonomyLanguage = m_refContentApi.DefaultContentLanguage; } if (Request.QueryString["taxonomyid"] != null) { TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]); } if (Request.QueryString["parentid"] != null) { TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]); } if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "author") { m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User; m_UserType = Ektron.Cms.Common.EkEnumeration.UserTypes.AuthorType; } else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "member") { m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User; m_UserType = Ektron.Cms.Common.EkEnumeration.UserTypes.MemberShipType; } else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "cgroup") { m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup; } if ((Request.QueryString["contFetchType"] != null) && Request.QueryString["contFetchType"].ToLower() != "") { contentFetchType = Request.QueryString["contFetchType"]; } m_refContent = m_refContentApi.EkContentRef; CalendarIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/calendar.png\" alt=\"Calendar Event\">"; FormsIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/contentForm.png\" alt=\"Form\">"; ContentIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/contentHtml.png\" alt=\"Content\">"; pageIcon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/layout.png\" alt=\"Page\">"; //-HC- if (this.m_UserType == Ektron.Cms.Common.EkEnumeration.UserTypes.AuthorType) { UserIcon = "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/user.png\" alt=\"Content\">"; } else { UserIcon = "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/userMembership.png\" alt=\"Content\">"; } if ((Page.IsPostBack && (!string.IsNullOrEmpty(Request.Form[isPostData.UniqueID])) && (m_ObjectType == EkEnumeration.CMSObjectTypes.Content | (m_ObjectType == EkEnumeration.CMSObjectTypes.User & !string.IsNullOrEmpty(Request.Form["itemlist"])) | (m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup & !string.IsNullOrEmpty(Request.Form["itemlist"]) | (m_ObjectType == EkEnumeration.CMSObjectTypes.Folder & !string.IsNullOrEmpty(Request.Form["itemlist"])))))) //if (Page.IsPostBack && (Request.Form[isPostData.UniqueID] != "") && (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content || (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User && Request.Form["itemlist"] != "") || (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup && Request.Form["itemlist"] != ""))) { if (m_strPageAction == "additem") { TaxonomyRequest item_request = new TaxonomyRequest(); item_request.TaxonomyId = TaxonomyId; item_request.TaxonomyIdList = Validate(Request.Form["itemlist"]); if (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User) { item_request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.User; } else if (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup) { item_request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group; } item_request.TaxonomyLanguage = TaxonomyLanguage; m_refContent.AddTaxonomyItem(item_request); } else if (m_strPageAction == "addfolder") { TaxonomySyncRequest sync_request = new TaxonomySyncRequest(); sync_request.TaxonomyId = TaxonomyId; sync_request.SyncIdList = Validate(Request.Form["selectedfolder"]); //Validate(Request.Form("itemlist")) //sync_request.SyncRecursiveIdList = Validate(Request.Form("recursiveidlist")) sync_request.TaxonomyLanguage = TaxonomyLanguage; m_refContent.AddTaxonomySyncFolder(sync_request); } if (Request.QueryString["iframe"] == "true") { Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>"); } else { Response.Redirect((string) ("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId)); } } else { FolderId = Convert.ToInt64(Request.QueryString["folderid"]); folder_data_col = m_refContent.GetFolderInfoWithPath(FolderId); FolderName = folder_data_col["FolderName"].ToString(); FolderParentId = Convert.ToInt64(folder_data_col["ParentID"].ToString()); FolderPath = folder_data_col["Path"].ToString(); folder_request_col = new Collection(); folder_request_col.Add(FolderId, "ParentID", null, null); folder_request_col.Add("name", "OrderBy", null, null); folder_data_col = m_refContent.GetAllViewableChildFoldersv2_0(folder_request_col); if (m_strPageAction != "additem") { if (Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "") { if (Information.IsNumeric(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { SelectedContentType = System.Convert.ToInt32(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]); m_refContentApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, SelectedContentType.ToString()); } } else if (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "") { if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { SelectedContentType = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]); } } asset_data = m_refContent.GetAssetSuperTypes(); } RegisterResources(); TaxonomyToolBar(); if (! Page.IsPostBack || m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User || m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup) { // avoid redisplay when clicking next/prev buttons DisplayPage(); } } }