protected void Page_Load(object sender, System.EventArgs e) { try { m_refContentApi = new ContentAPI(); AppImgPath = m_refContentApi.AppImgPath; m_refMsg = m_refContentApi.EkMsgRef; Utilities.ValidateUserLogin(); RegisterResources(); if (!(Request.QueryString["folderid"] == null)) { if (Request.QueryString["folderid"] != "") { m_intFolderId = Convert.ToInt64(Request.QueryString["folderid"]); } } if (Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = int.Parse(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } m_refContentApi.ContentLanguage = ContentLanguage; SearchStyleSheet = "<link rel=\'stylesheet\' type=\'text/css\' href=\'csslib/worksearch.css\'>" + "\r\n"; StyleSheetJS = m_refStyle.GetClientScript(); if (ProductSearch1 != null) { ProductSearch1.CatalogId = m_intFolderId; ProductSearch1.LanguageID = ContentLanguage; ProductSearch1.IsInWorkArea = true; ProductSearch1.DisplayXslt = "Xslt/WA_ProductSearch.xsl"; //ProductSearch1.TemplateProduct = "ProductView.aspx" } if (Page.IsPostBack == false) { Display_ToolBar(); } } catch (Exception ex) { if (ex.Message.ToLower().IndexOf("service is not running") != -1) { Utilities.ShowError("Error: Index service is not running. You cannot search on Products. Restart the service."); } else { Utilities.ShowError(ex.Message); } } }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); m_refContApi = new ContentAPI(); Utilities.ValidateUserLogin(); RegisterResources(); if (!(Request.QueryString["LangType"] == null)) { if (Request.QueryString["LangType"] != "") { m_intContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContApi.SetCookieValue("SiteLanguage", m_intContentLanguage.ToString()); } else { if (m_refContApi.GetCookieValue("SiteLanguage") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("SiteLanguage")); } } } else { if (m_refContApi.GetCookieValue("SiteLanguage") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("SiteLanguage")); } } if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || m_intContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { m_intContentLanguage = m_refContApi.DefaultContentLanguage; } if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refContApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refContApi.ContentLanguage = m_intContentLanguage; } if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.SocialNetworking)) { Utilities.ShowError(m_refContentApi.EkMsgRef.GetMessage("feature locked error")); } SetLabels(); }
private void Page_Load(System.Object sender, System.EventArgs e) { ContentAPI m_refContApi = new ContentAPI(); string strAction = ""; string showBackButton = ""; m_refMsg = m_refContApi.EkMsgRef; AppName = m_refContApi.AppName; if (!(Request.QueryString["LangType"] == null)) { if (Request.QueryString["LangType"] != "") { m_intContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContApi.SetCookieValue("LastValidLanguageID", m_intContentLanguage.ToString()); } else { if (m_refContApi.GetCookieValue("LastValidLanguageID") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID")); } } } else { if (m_refContApi.GetCookieValue("LastValidLanguageID") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID")); } } if (Request.QueryString["action"] != null && Request.QueryString["action"] != "") { strAction = (string)("&action=" + Request.QueryString["action"]); } if (!(Request.QueryString["showbackbutton"] == null) && Request.QueryString["showbackbutton"] != "") { showBackButton = (string)("&showbackbutton=" + Request.QueryString["showBackButton"]); } //list_frame.Attributes("src") = "historylist.aspx?LangType=" & m_intContentLanguage & "&id=" & Request.QueryString("id") & strAction history_frame.Attributes["src"] = "history.aspx?LangType=" + m_intContentLanguage + "&id=" + Request.QueryString["id"] + strAction + showBackButton; }
protected void Page_Load(object sender, System.EventArgs e) { try { m_refContentApi = new ContentAPI(); AppImgPath = m_refContentApi.AppImgPath; m_refMsg = m_refContentApi.EkMsgRef; Utilities.ValidateUserLogin(); RegisterResources(); if (!(Request.QueryString["folderid"] == null)) { if (!string.IsNullOrEmpty(Request.QueryString["folderid"])) { m_intFolderId = long.Parse(Request.QueryString["folderid"].ToString()) ; } } if (!string.IsNullOrEmpty(Request.QueryString["LangType"])) { ContentLanguage = int.Parse(Request.QueryString["LangType"].ToString()) ; m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = int.Parse(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } m_refContentApi.ContentLanguage = ContentLanguage; StyleSheetJS = m_refStyle.GetClientScript(); if (Page.IsPostBack == false) { Display_ToolBar(); } } catch (Exception ex) { Utilities.ShowError(ex.Message); } }
protected void Page_Init(object sender, EventArgs e) { int langid = 0; ContentAPI m_refContApi = new ContentAPI(); if (Request.QueryString["LangType"] != null) { if (Request.QueryString["LangType"] != string.Empty) { langid = int.Parse(Request.QueryString["LangType"]); m_refContApi.SetCookieValue("SiteLanguage", langid.ToString()); } else { if (m_refContApi.GetCookieValue("SiteLanguage") != string.Empty) { langid = int.Parse(m_refContApi.GetCookieValue("SiteLanguage")); } } } else { if (m_refContApi.GetCookieValue("SiteLanguage") != string.Empty) { langid = int.Parse(m_refContApi.GetCookieValue("SiteLanguage")); } } if (langid == EkConstants.CONTENT_LANGUAGES_UNDEFINED || langid == EkConstants.ALL_CONTENT_LANGUAGES) { langid = m_refContApi.DefaultContentLanguage; } if (langid == EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refContApi.ContentLanguage = EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refContApi.ContentLanguage = langid; } }
protected void Page_Init(object sender, System.EventArgs e) { m_refContApi = new ContentAPI(); if (Request.QueryString["LangType"] == null) { if (Request.QueryString["LangType"] != "") { m_intContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContApi.SetCookieValue("SiteLanguage", m_intContentLanguage.ToString()); } else { if (m_refContApi.GetCookieValue("SiteLanguage") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("SiteLanguage")); } } } else { if (m_refContApi.GetCookieValue("SiteLanguage") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("SiteLanguage")); } } if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || m_intContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { m_intContentLanguage = m_refContApi.DefaultContentLanguage; } if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refContApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refContApi.ContentLanguage = m_intContentLanguage; } }
//public static void AddLBpaths(Collection data) //{ // ContentAPI apiCont = new ContentAPI(); // Ektron.Cms.Library.EkLibrary objLib; // int lbICount; // int lbFCount; // Collection lb; // Collection cLbs; // lbICount = 0; // lbFCount = 0; // objLib = apiCont.EkLibraryRef; // cLbs = objLib.GetAllLBPaths("images"); // if (cLbs.Count > 0) // { // foreach (Collection tempLoopVar_lb in cLbs) // { // lb = tempLoopVar_lb; // lbICount++; // data.Add(HttpContext.Current.Server.MapPath((string)(lb["LoadBalancePath"])), "LoadBalanceImagePath_" + lbICount, null, null); // } // } // data.Add(lbICount, "LoadBalanceImageCount", null, null); // cLbs = null; // lb = null; // cLbs = objLib.GetAllLBPaths("files"); // if (cLbs.Count > 0) // { // foreach (Collection tempLoopVar_lb in cLbs) // { // lb = tempLoopVar_lb; // lbFCount++; // data.Add(HttpContext.Current.Server.MapPath((string)(lb["LoadBalancePath"])), "LoadBalanceFilePath_" + lbFCount, null, null); // } // } // data.Add(lbFCount, "LoadBalanceFileCount", null, null); // cLbs = null; //} //public static void SetLanguage(object api) //{ // int ContentLanguage = -1; // if (!(System.Web.HttpContext.Current.Request.QueryString["LangType"] == null)) // { // if (System.Web.HttpContext.Current.Request.QueryString["LangType"] != "") // { // ContentLanguage = Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString["LangType"]); // Ektron.Cms.API.SetCookieValue("LastValidLanguageID", ContentLanguage); // } // else // { // if (Ektron.Cms.API.GetCookieValue("LastValidLanguageID") != "") // { // ContentLanguage = Convert.ToInt32(Ektron.Cms.API.GetCookieValue("LastValidLanguageID")); // } // } // } // else // { // if (Ektron.Cms.API.GetCookieValue("LastValidLanguageID") != "") // { // ContentLanguage = Convert.ToInt32(Ektron.Cms.API.GetCookieValue("LastValidLanguageID")); // } // } // if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) // { // Ektron.Cms.API.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; // } // else // { // Ektron.Cms.API.ContentLanguage = ContentLanguage; // } //} public static void SetLanguage(ContentAPI api) { int ContentLanguage = -1; if (!(System.Web.HttpContext.Current.Request.QueryString["LangType"] == null)) { if (System.Web.HttpContext.Current.Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString["LangType"]); api.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (api.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(api.GetCookieValue("LastValidLanguageID")); } } } else { if (api.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(api.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { api.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { api.ContentLanguage = ContentLanguage; } }
private void Page_Load(System.Object sender, System.EventArgs e) { try { m_refContentApi = new ContentAPI(); _analyticsEnabled = AnalyticsSecurity.Enabled(m_refContentApi.RequestInformationRef); RegisterResources(); if (!(Request.QueryString["LangType"] == null)) { if (Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refContentApi.ContentLanguage = ContentLanguage; } m_refMsg = m_refContentApi.EkMsgRef; if (!(Request.QueryString["id"] == null)) { if (Request.QueryString["id"] != "") { ContentId = Convert.ToInt64(Request.QueryString["id"]); } } if (!(Request.QueryString["showbackbutton"] == null)) { if (Request.QueryString["showbackbutton"] != "") { ShowBackButton = Convert.ToBoolean(Request.QueryString["showbackbutton"]); } } if (ContentId > 0) { m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId); } switch (m_contentType) { case Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry: Populate_EntryHistoryListGrid(ContentId); DisplayEntryHistoryToolBar(); Util_SetResources(); break; default: Populate_HistoryListGrid(ContentId); DisplayHistoryToolBar(); Util_SetResources(); break; } } catch (Exception ex) { Response.Redirect(m_refContentApi.ApplicationPath + "reterror.aspx?info=" + ex.Message, false); } }
private void Page_Load(System.Object sender, System.EventArgs e) { m_refContentApi = new ContentAPI(); m_refMsg = m_refContentApi.EkMsgRef; AppName = m_refContentApi.AppName; AppImgPath = m_refContentApi.AppImgPath; StyleSheetJS.Value = m_refStyle.GetClientScript(); nId = Convert.ToInt64(Request.Params["nid"]); menu = m_refContentApi.EkContentRef.GetMenuDataByID(nId); ParentMenuId = menu.ParentID; AncestorMenuId = menu.AncestorID; FolderID = menu.FolderID; EnableMultilingual = m_refContentApi.EnableMultilingual; if (!Utilities.ValidateUserLogin()) { return; } if (Convert.ToBoolean(m_refContentApi.RequestInformationRef.IsMembershipUser)) { Response.Redirect((string)("reterror.aspx?info=" + m_refMsg.GetMessage("msg login cms user")), false); return; } RegisterResources(); if (!string.IsNullOrEmpty(Request.QueryString["LangType"])) { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (!string.IsNullOrEmpty(m_refContentApi.GetCookieValue("LastValidLanguageID"))) { ContentLanguage = int.Parse(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } m_selectedFolderList = GetFolderList(nId); MenuToolBar(); }
private bool PublishContent() { ContentAPI contApi = new ContentAPI(); EkContent contObj; int ContentLanguage = EkConstants.CONTENT_LANGUAGES_UNDEFINED; if (!(Page.Request.QueryString["LangType"] == null)) { if (Page.Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Page.Request.QueryString["LangType"]); contApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (contApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(contApi.GetCookieValue("LastValidLanguageID")); } } } else { if (contApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(contApi.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == EkConstants.CONTENT_LANGUAGES_UNDEFINED) { contApi.ContentLanguage = EkConstants.ALL_CONTENT_LANGUAGES; } else { contApi.ContentLanguage = ContentLanguage; } object[] acMetaInfo = new object[4]; string MetaSelect; string MetaSeparator; string MetaTextString = ""; int ValidCounter = 0; int i = 0; bool hasMeta = false; if (Page.Request.Form["frm_validcounter"] != "") { ValidCounter = System.Convert.ToInt32(Page.Request.Form["frm_validcounter"]); hasMeta = true; } else { ValidCounter = 1; } string TaxonomyTreeIdList = ""; TaxonomyTreeIdList = Page.Request.Form[taxonomyselectedtree.UniqueID]; if ((!string.IsNullOrEmpty(TaxonomyTreeIdList)) && TaxonomyTreeIdList.Trim().EndsWith(",")) { ltrTaxonomyTreeIdList.Text = TaxonomyTreeIdList.Substring(0, TaxonomyTreeIdList.Length - 1); } contObj = contApi.EkContentRef; string[] ids; string contId = ""; ids = m_idString.Split(",".ToCharArray()); htImagesAssets = new System.Collections.Hashtable(); foreach (string tempLoopVar_contId in ids) { contId = tempLoopVar_contId; if (contId != "") { EditUrlAlias(long.Parse(contId),this.m_folderId); page_meta_data = new Collection(); if (hasMeta == true) { for (i = 1; i <= ValidCounter; i++) { acMetaInfo[1] = Page.Request.Form["frm_meta_type_id_" + i]; acMetaInfo[2] = contId; MetaSeparator = Page.Request.Form["MetaSeparator_" + i]; MetaSelect = Page.Request.Form["MetaSelect_" + i]; if (Convert.ToInt32(MetaSelect) != 0) { MetaTextString = Strings.Replace(Page.Request.Form["frm_text_" + i], ", ", MetaSeparator.ToString(), 1, -1, 0); if (MetaTextString.StartsWith(MetaSeparator)) { MetaTextString = MetaTextString.Substring(MetaTextString.Length - (MetaTextString.Length - 1), (MetaTextString.Length - 1)); } MetaTextString = CleanString(MetaTextString); acMetaInfo[3] = MetaTextString; } else { MetaTextString = Strings.Replace(Page.Request.Form["frm_text_" + i], ";", MetaSeparator.ToString(), 1, -1, 0); if (MetaTextString == null) MetaTextString = ""; MetaTextString = CleanString(MetaTextString); acMetaInfo[3] = MetaTextString; } page_meta_data.Add(acMetaInfo, i.ToString(), null, null); acMetaInfo = new object[4]; } } if (!(string.IsNullOrEmpty(TaxonomyTreeIdList))) { TaxonomyContentRequest request = new TaxonomyContentRequest(); request.ContentId = long.Parse(contId); request.TaxonomyList = TaxonomyTreeIdList; request.FolderID = m_folderId; contObj.AddTaxonomyItem(request); } if (page_meta_data.Count > 0 && hasMeta == true) { m_ContentApi.EkContentRef.UpdateMetaData(page_meta_data); } } } foreach (string tempLoopVar_contId in ids) { contId = tempLoopVar_contId; if (contId != "") { try { string Status; Status = (string)(contApi.GetContentStatusById(long.Parse(contId))); long lcontId=long.Parse(contId); if (htImagesAssets[lcontId] != null)// if item is exists in the hash table, the url alias is required. {//process url alias required, publish image assets, checkin others bool bIsPublish = (bool)htImagesAssets[lcontId]; if (Status == "O") { if (bIsPublish) contApi.PublishContentById(lcontId, m_folderId, ContentLanguage, "true", -1, ""); else contApi.EkContentRef.CheckIn(lcontId, ""); } else if (Status == "I") { if(bIsPublish) contApi.EkContentRef.SubmitForPublicationv2_0(lcontId, m_folderId, string.Empty); } } else {// normal process if (Status == "O") // this will check in and publish { contApi.PublishContentById(lcontId, m_folderId, ContentLanguage, "true", -1, ""); } else if (Status == "I") // this is just a publish { contApi.EkContentRef.SubmitForPublicationv2_0(lcontId, m_folderId, string.Empty); } } } catch (Exception) { // I wrapped it in this try block because there is a current problem on the server where the content is already being put // into published state if there are multiple pieces of content, the metadata still updates and is put in the right state. } } } return true; }
private string CaptureTaxonomy(long contentId, long folderId) { StringBuilder taxonomyOutput = new StringBuilder(); Folder myFolderApi = new Folder(); FolderData myFolderData; ContentAPI myContentApi = new ContentAPI(); TaxonomyBaseData[] myTaxonomyBaseData; List<long> myTaxonomyIds = new List<long>(); System.Text.StringBuilder Js; Js = new System.Text.StringBuilder(); long iTmpCaller = myContentApi.RequestInformationRef.CallerId; long iTmpuserID = myContentApi.RequestInformationRef.UserId; int ContentLanguage = EkConstants.CONTENT_LANGUAGES_UNDEFINED; if (!(Page.Request.QueryString["LangType"] == null)) { if (Page.Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Page.Request.QueryString["LangType"]); myContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (myContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(myContentApi.GetCookieValue("LastValidLanguageID")); } } } else { if (myContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(myContentApi.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == EkConstants.CONTENT_LANGUAGES_UNDEFINED) { myContentApi.ContentLanguage = EkConstants.ALL_CONTENT_LANGUAGES; } else { myContentApi.ContentLanguage = ContentLanguage; } myContentApi.RequestInformationRef.CallerId = Ektron.Cms.Common.EkConstants.InternalAdmin; myContentApi.RequestInformationRef.UserId = Ektron.Cms.Common.EkConstants.InternalAdmin; myFolderData = myContentApi.GetFolderById(folderId, true); myTaxonomyBaseData = myFolderData.FolderTaxonomy; myContentApi.RequestInformationRef.CallerId = iTmpCaller; myContentApi.RequestInformationRef.UserId = iTmpuserID; if (!String.IsNullOrEmpty(Request.QueryString["TaxonomyId"])) { jsTaxRedirectID.Text=taxonomyselectedtree.Value = Request.QueryString["TaxonomyId"].ToString(); } SetTaxonomy(contentId, folderId); Js.Append("function ValidateTax(){").Append(Environment.NewLine); if (myTaxonomyBaseData.Length > 0 && (myTaxonomyBaseData != null)) { if (myFolderData.CategoryRequired == true) { Js.Append(" document.getElementById(\"taxonomyselectedtree\").value=\"\";").Append(Environment.NewLine); Js.Append(" for(var i=0;i<taxonomytreearr.length;i++){").Append(Environment.NewLine); Js.Append(" if(document.getElementById(\"taxonomyselectedtree\").value==\"\"){").Append(Environment.NewLine); Js.Append(" document.getElementById(\"taxonomyselectedtree\").value=taxonomytreearr[i];").Append(Environment.NewLine); Js.Append(" }else{").Append(Environment.NewLine); Js.Append(" document.getElementById(\"taxonomyselectedtree\").value=document.getElementById(\"taxonomyselectedtree\").value+\",\"+taxonomytreearr[i];").Append(Environment.NewLine); Js.Append(" }").Append(Environment.NewLine); Js.Append(" } ").Append(Environment.NewLine); Js.Append(" if (Trim(document.getElementById(\'taxonomyselectedtree\').value) == \'\') { ").Append(Environment.NewLine); Js.Append(" alert(\'" + m_refMsg.GetMessage("js tax cat req") + "\'); ").Append(Environment.NewLine); Js.Append(" return false; ").Append(Environment.NewLine); Js.Append(" } ").Append(Environment.NewLine); Js.Append(" return true; }").Append(Environment.NewLine); } else { Js.Append(" return true;}").Append(Environment.NewLine); } ltrTaxJS.Text = Js.ToString(); ltrShowTaxonomy.Text = "<li><a id=\"taxonomyAnchor\" href=\"#\" onclick=\"dmsMetadataShowHideCategory(\'taxonomy\');return false;\" title=\"View Taxonomy\">" + m_refMsg.GetMessage("viewtaxonomytabtitle") + "</a></li>"; string addTaxonomy = "<div id=" + "\"" + "TreeOutput" + "\"" + "></div>"; return addTaxonomy; } else { Js.Append(" return true;}").Append(Environment.NewLine); ltrTaxJS.Text = Js.ToString(); string addTaxonomyEmpty = "<div id=\"EmptyTree\"></div>"; return addTaxonomyEmpty; } }
private StringBuilder CaptureMetadata(long contentId, long folderId) { StringBuilder metadataOutput = new StringBuilder(); ContentAPI myContentAPI = new ContentAPI(); ContentData myContentEditData = new ContentData(); ContentMetaData[] myContentMetadata; string myType = "update"; int myCounter = 0; Ektron.Cms.Site.EkSite myEkSite = new Ektron.Cms.Site.EkSite(); int ContentLanguage = EkConstants.CONTENT_LANGUAGES_UNDEFINED; if (Page.Request.QueryString["LangType"] != null) { if (Page.Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Page.Request.QueryString["LangType"]); myContentAPI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (myContentAPI.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(myContentAPI.GetCookieValue("LastValidLanguageID")); } } } else { if (myContentAPI.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(myContentAPI.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == EkConstants.CONTENT_LANGUAGES_UNDEFINED) { myContentAPI.ContentLanguage = EkConstants.ALL_CONTENT_LANGUAGES; } else { myContentAPI.ContentLanguage = ContentLanguage; } if (contentId != -1) { myEkSite = myContentAPI.EkSiteRef; myContentEditData = myContentAPI.GetContentById(contentId, 0); myContentMetadata = myContentEditData.MetaData; if (myContentMetadata.Length > 0) { metadataOutput = Ektron.Cms.CustomFields.WriteFilteredMetadataForEdit(myContentMetadata, false, myType, folderId, ref myCounter, myEkSite.GetPermissions(folderId, 0, "folder")); if (metadataOutput.Length > 0) { ltrShowMetadata.Text = "<li><a id=\"metadataAnchor\" href=\"#\" onclick=\"dmsMetadataShowHideCategory(\'metadata\');return false;\" title=\"View Metadata\" class=\"selected\">" + myContentAPI.EkMsgRef.GetMessage("metadata text") + "</a></li>"; } } } return metadataOutput; }
private void Page_Load(System.Object sender, System.EventArgs e) { bool bAddingNew = false; string tempStr; string referrerStr; try { //INITIALIZE THE VARIABLES if (Request.Browser.Type.IndexOf("IE") != -1) { IsBrowserIE = true; } jsIsMac.Text = "false"; if (Request.Browser.Platform.IndexOf("Win") == -1) { IsMac = true; } // Ensure that this is not a browser refresh (Mac-Safari bug causes // the editor to load after publishing, if the browser is refreshing): if (IsMac && !IsBrowserIE) { referrerStr = Request.Url.LocalPath; if (referrerStr != null) { tempStr = referrerStr.Substring(referrerStr.LastIndexOf("/")); if (tempStr == "/workarea.aspx") { tempStr = referrerStr.Replace(tempStr, "/dashboard.aspx"); Response.Redirect(tempStr, false); return; } } } if (m_SelectedEditControl != "ContentDesigner") { m_ctlContentPane.Controls.Remove(m_ctlContentDesigner); m_ctlSummaryStandard.Controls.Remove(m_ctlSummaryDesigner); m_ctlSummaryRedirect.Controls.Remove(m_ctlFormResponseRedirect); m_ctlSummaryTransfer.Controls.Remove(m_ctlFormResponseTransfer); } Response.Expires = -1; Response.AddHeader("Pragma", "no-cache"); Response.AddHeader("cache-control", "no-store"); //THE NEXT THREE LINES MUST BE REMOVED BEFORE THE RELEASE if (Request.ServerVariables["Query_String"] == "") { return; } if (IsMac) { jsIsMac.Text = "true"; } // Note: To fix a problem with the Ephox Editors on the // Mac-running-Safari (assumed if "IsMac and not IsBrowserIE") // we need to use different styles for the DIV-tags holding // the editors, etc., otherwise they frequently draw themselves // when they should remain hidden. These values cause problems // with the PC/Win/IE combination, (the summary editor fails to // provide a client area for the user to view/edit) so they cannot // cannot be used everywhere, hence our use of alternate style classes: // Pass class names to javascript: jsSelectedDivStyleClass.Text = m_sSelectedDivStyleClass; jsUnSelectedDivStyleClass.Text = m_sUnSelectedDivStyleClass; m_refContApi = new ContentAPI(); m_refSiteApi = new SiteAPI(); m_refContent = m_refContApi.EkContentRef; m_refSite = m_refContApi.EkSiteRef; m_refTask = m_refContApi.EkTaskRef; CurrentUserID = m_refContApi.UserId; AppImgPath = m_refContApi.AppImgPath; SitePath = m_refContApi.SitePath; Appname = m_refContApi.AppName; AppeWebPath = m_refContApi.ApplicationPath + m_refContApi.AppeWebPath; AppPath = m_refContApi.AppPath; EnableMultilingual = m_refContApi.EnableMultilingual; StyleSheetJS.Text = m_refStyle.GetClientScript(); EnhancedMetadataScript.Text = CustomFields.GetEnhancedMetadataScript(); EnhancedMetadataArea.Text = CustomFields.GetEnhancedMetadataArea(); lbl_GenericTitleLabel.Text = m_refMsg.GetMessage("generic title label"); if (!(Request.QueryString["id"] == null)) { m_intItemId = Convert.ToInt64(Request.QueryString["id"]); m_intTaxFolderId = m_intItemId; } if (!(Request.QueryString["LangType"] == null)) { if (Request.QueryString["LangType"] != "") { m_intContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContApi.SetCookieValue("LastValidLanguageID", m_intContentLanguage.ToString()); } else { if (m_refContApi.GetCookieValue("LastValidLanguageID") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID")); } } } else { if (m_refContApi.GetCookieValue("LastValidLanguageID") != "") { m_intContentLanguage = Convert.ToInt32(m_refContApi.GetCookieValue("LastValidLanguageID")); } } if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || m_intContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { m_intContentLanguage = m_refContApi.DefaultContentLanguage; } if (m_intContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refContApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refContApi.ContentLanguage = m_intContentLanguage; } if (!String.IsNullOrEmpty(Request.QueryString["folder_id"])) { m_intFolderId = Convert.ToInt64(Request.QueryString["folder_id"]); } if (Request.QueryString["form_type"] != null) { bNewPoll = System.Convert.ToBoolean("poll" == Convert.ToString(Request.QueryString["form_type"]).Trim().ToLower()); } if (Request.QueryString["new"] != null) { bAddingNew = System.Convert.ToBoolean("true" == Convert.ToString(Request.QueryString["new"]).Trim().ToLower()); } if (Request.QueryString["poll"] != null) { bReNewPoll = System.Convert.ToBoolean("renew" == Convert.ToString(Request.QueryString["poll"]).Trim().ToLower()); } if (Request.Form["editaction"] != null) { m_strPageAction = Convert.ToString(Request.Form["editaction"]).ToLower().Trim(); } if (Request.QueryString["translate"] != null) { translate.Value = "true"; } if (Request.QueryString["type"] != null) { m_strType = Convert.ToString(Request.QueryString["type"]).ToLower().Trim(); } else if (Request.Form["eType"] != null) { m_strType = Convert.ToString(Request.Form["eType"]).ToLower().Trim(); } if (!String.IsNullOrEmpty(Request.QueryString["ctlupdateid"])) { commparams = (string)("&ctlupdateid=" + Request.QueryString["ctlupdateid"] + "&ctlmarkup=" + Request.QueryString["ctlmarkup"] + "&cltid=" + Request.QueryString["cltid"] + "&ctltype=" + Request.QueryString["ctltype"]); updateFieldId = Request.QueryString["ctlupdateid"]; Page.ClientScript.RegisterHiddenField("ctlupdateid", updateFieldId); } if (!String.IsNullOrEmpty(Request.QueryString["cacheidentifier"])) { Page.ClientScript.RegisterHiddenField("cacheidentifier", Request.QueryString["cacheidentifier"]); } else { if ((Request.QueryString["mycollection"] != null) && (Request.QueryString["addto"] != null) && (Request.QueryString["type"] != null)) { if (Request.QueryString["type"] == "add" && Request.QueryString["addto"] == "menu") { Page.ClientScript.RegisterHiddenField("cacheidentifier", "menu_" + Request.QueryString["mycollection"] + m_intContentLanguage + "_mnu"); } } } //destination.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx"; //PostURL.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx"; //NextUsing.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "content.aspx"; if (Request.Cookies[DMSCookieName] != null && !string.IsNullOrEmpty(Request.Cookies[DMSCookieName].Value)) { if (Request.Cookies[DMSCookieName].Value == "2010") { Ektron.Cms.Controls.ExplorerDragDrop edd = new Ektron.Cms.Controls.ExplorerDragDrop(); edd.ContentLanguage = this.m_intContentLanguage; if (!string.IsNullOrEmpty(Request.QueryString["folderid"])) { destination.Value = edd.GetFolderPath(Int64.Parse(Request.QueryString["folderid"])).Replace(Page.Request.Url.GetLeftPart(UriPartial.Authority), ""); putopts.Value = "false"; } //btnMUpload.OnClientClick = "return MultipleDocumentUpload(0);"; //lbtn_toggleVersion.Attributes.Add("onclick", string.Format(_messageHelper.GetMessage("js office version toggle confirm format"), _messageHelper.GetMessage("li text office 2010 name"))); } else { destination.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx"; PostURL.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "processMultiupload.aspx"; NextUsing.Value = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + AppPath + "content.aspx"; putopts.Value = "true"; //btnMUpload.OnClientClick = "return MultipleDocumentUpload(1);"; //lbtn_toggleVersion.Attributes.Add("onclick", string.Format(_messageHelper.GetMessage("js office version toggle confirm format"), _messageHelper.GetMessage("li text other office ver name"))); } //tabMultipleDMS.Controls.Add(linebreak); } if (!String.IsNullOrEmpty(Request.QueryString["ctlmarkup"])) { Page.ClientScript.RegisterHiddenField("ctlmarkup", Request.QueryString["ctlmarkup"]); } if (!String.IsNullOrEmpty(Request.QueryString["ctltype"])) { Page.ClientScript.RegisterHiddenField("ctltype", Request.QueryString["ctltype"]); } if (!String.IsNullOrEmpty(Request.QueryString["cltid"])) { Page.ClientScript.RegisterHiddenField("cltid", Request.QueryString["cltid"]); } if (m_strType == "update") { m_refContentId = m_intItemId; } else { if (!String.IsNullOrEmpty(Request.QueryString["content_id"])) { m_refContentId = Convert.ToInt64(Request.QueryString["content_id"]); } } if (Request.QueryString["xid"] != null) { m_intXmlConfigId = Convert.ToInt64(Request.QueryString["xid"]); } else if (Request.Form["SelectedXid"] != null) { m_intXmlConfigId = Convert.ToInt64(Request.Form["SelectedXid"]); } else { if (Request.QueryString["type"] == "add") { if (Request.QueryString["AllowHTML"] != "1") { m_intXmlConfigId = Utilities.GetDefaultXmlConfig(Convert.ToInt64(Request.QueryString["id"])); if (m_intXmlConfigId == 0) { m_intXmlConfigId = -1; } } } } if (!String.IsNullOrEmpty(Request.QueryString["mycollection"])) { strMyCollection = Request.QueryString["mycollection"]; } else if (!String.IsNullOrEmpty(Request.Form["mycollection"])) { strMyCollection = Request.Form["mycollection"]; } if (!String.IsNullOrEmpty(Request.QueryString["addto"])) { strAddToCollectionType = Request.QueryString["addto"]; } else if (!String.IsNullOrEmpty(Request.Form["addto"])) { strAddToCollectionType = Request.Form["addto"]; } if (Request.QueryString["close"] == "false") { m_bClose = false; } if (Request.QueryString["back_folder_id"] != null) { back_folder_id = Convert.ToInt64(Request.QueryString["back_folder_id"]); m_intTaxFolderId = back_folder_id; } if (Request.QueryString["back_id"] != null) { back_id = Convert.ToInt64(Request.QueryString["back_id"]); } if (Request.QueryString["back_file"] != null) { back_file = Request.QueryString["back_file"]; } if (Request.QueryString["back_action"] != null) { back_action = Request.QueryString["back_action"]; if (back_action.ToLower() == "viewcontentbycategory" || back_action.ToLower() == "viewarchivecontentbycategory") { back_folder_id = back_id; } } if (Request.QueryString["control"] != null) { controlName = Request.QueryString["control"]; } if (Request.QueryString["buttonid"] != null) { buttonId.Value = Request.QueryString["buttonid"]; } if (Request.QueryString["back_form_id"] != null) { back_form_id = Convert.ToInt64(Request.QueryString["back_form_id"]); } if (Request.QueryString["back_LangType"] != null) { back_LangType = Convert.ToInt32(Request.QueryString["back_LangType"]); } else { back_LangType = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]); } if (Request.QueryString["back_callerpage"] != null) { back_callerpage = (string)("&back_callerpage=" + Request.QueryString["back_callerpage"]); } if (Request.QueryString["back_page"] != null) { back_callerpage = back_callerpage + "&back_page=" + Request.QueryString["back_page"]; } if (Request.QueryString["back_origurl"] != null) { back_origurl = (string)("&back_origurl=" + EkFunctions.UrlEncode(Request.QueryString["back_origurl"])); } if (!String.IsNullOrEmpty(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { if (Ektron.Cms.Common.EkFunctions.IsNumeric(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { g_ContentTypeSelected = System.Convert.ToInt32(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]); m_refContApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, g_ContentTypeSelected.ToString()); } } else if (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "") { if (Ektron.Cms.Common.EkFunctions.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { g_ContentTypeSelected = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]); } } if (Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes == g_ContentTypeSelected) { if (Request.QueryString["multi"] != null) { if ("" == Request.QueryString["multi"]) { lContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content; //set content type to "content" as default value } else { lContentType = Convert.ToInt32(Request.QueryString["multi"]); if (lContentType == 9876) { lContentType = 103; } } } else { lContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content; } } else { lContentType = g_ContentTypeSelected; if (lContentType == 9876) { lContentType = 103; } } language_data = m_refSiteApi.GetLanguageById(m_intContentLanguage); if (this.m_strType.ToLower() == "add" && (!String.IsNullOrEmpty(Request.QueryString["SelTaxonomyId"]))) { TaxonomySelectId = Convert.ToInt64(Request.QueryString["SelTaxonomyId"]); } SettingsData settings_data; settings_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId); int UserLocale; UserLocale = m_refSiteApi.RequestInformationRef.UserCulture; AppLocaleString = GetLocaleFileString(UserLocale.ToString()); jsMaxLengthMsg.Text = m_refMsg.GetMessage("js err encoded title exceeds max length"); jsContentLanguage.Text = Convert.ToString((short)m_intContentLanguage); jsId.Text = Convert.ToString(m_intItemId); jsDefaultContentLanguage.Text = Convert.ToString(m_refContApi.DefaultContentLanguage); jsType.Text = Convert.ToString((short)m_intContentType); phAlias.Visible = false; Page.Title = m_refContApi.AppName + " " + m_refMsg.GetMessage("edit content page title") + " \"" + Ektron.Cms.CommonApi.GetEcmCookie()["username"] + "\""; string editaction = ""; if (Request.Form["editaction"] != null) { editaction = Request.Form["editaction"]; } if ("workoffline" == editaction || "cancel" == editaction || ("" == Convert.ToString(m_intItemId) && "" == editaction)) { if (m_strType == "update") { ret = m_refContent.UndoCheckOutv2_0(Convert.ToInt64(Request.Form["content_id"])); blnUndoCheckOut_complete = true; } if (!m_bClose) { ClosePanel.Text = "<script language=javascript>" + "\r\n" + "ResizeFrame(1); // Show the navigation-tree frame." + "\r\n" + "</script>"; Response.Redirect(GetBackPage(Convert.ToInt64(Request.Form["content_id"])), false); } else { Response.Redirect("close.aspx", false); } } else if ((m_strPageAction == "save") || (m_strPageAction == "checkin") || (m_strPageAction == "publish") || (m_strPageAction == "summary_save") || (m_strPageAction == "meta_save")) { Process_FormSubmit(); if (m_bClose && m_strPageAction != "save") { if (updateFieldId != "") { string strQuery = ""; if (TaxonomySelectId > 0) { strQuery = (string)("&__taxonomyid=" + TaxonomySelectId); } else if (TaxonomyOverrideId > 0) { strQuery = (string)("&__taxonomyid=" + TaxonomyOverrideId); } Response.Redirect((string)("close.aspx?toggle=true" + strQuery), false); } } } else { Display_EditControls(); if (!(Page.IsPostBack) && bAddingNew) { if (Request.QueryString["form_type"] != null) { newformwizard ucNewFormWizard; ucNewFormWizard = (newformwizard)(LoadControl("controls/forms/newformwizard.ascx")); ucNewFormWizard.ID = "ProgressSteps"; phNewFormWizard.Controls.Add(ucNewFormWizard); if (bNewPoll) { PollHtmlScript(); } } } } PermissionData cPerms; cPerms = m_refContApi.LoadPermissions(m_intContentFolder, "folder", 0); m_ctlContentDesigner.FolderId = m_intContentFolder; if (2 == m_intContentType) { m_ctlContentDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.Designer; } else if (editorPackage.Length > 0) { m_ctlContentDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.DataEntry; } else { m_ctlContentDesigner.ToolsFile = m_refContApi.ApplicationPath + "ContentDesigner/configurations/StandardEdit.aspx?wiki=1"; } m_ctlContentDesigner.SetPermissions(cPerms); m_ctlContentDesigner.AllowFonts = true; m_ctlSummaryDesigner.FolderId = m_intContentFolder; if (2 == m_intContentType) { m_ctlSummaryDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.XsltDesigner; } else if (m_bIsBlog) { m_ctlSummaryDesigner.ToolsFile = m_refContApi.ApplicationPath + "ContentDesigner/configurations/InterfaceBlog.aspx?WMV=1"; } else { m_ctlSummaryDesigner.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.Standard; } m_ctlSummaryDesigner.SetPermissions(cPerms); m_ctlSummaryDesigner.AllowFonts = true; m_ctlFormResponseRedirect.FolderId = m_intContentFolder; m_ctlFormResponseRedirect.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.NoToolbars; m_ctlFormResponseRedirect.SetPermissions(cPerms); m_ctlFormResponseRedirect.AllowFonts = true; m_ctlFormResponseTransfer.FolderId = m_intContentFolder; m_ctlFormResponseTransfer.Toolbars = Ektron.ContentDesignerWithValidator.Configuration.NoToolbars; m_ctlFormResponseTransfer.SetPermissions(cPerms); m_ctlFormResponseTransfer.AllowFonts = true; m_ctlContentValidator.Text = m_refMsg.GetMessage("content size exceeded"); m_ctlSummaryValidator.Text = m_refMsg.GetMessage("content size exceeded"); g_ContentTypeSelected = Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes; m_refContApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, g_ContentTypeSelected.ToString()); } catch (Exception ex) { Utilities.ShowError(ex.Message); } }