protected void Page_Init(object sender, EventArgs e) { var m_refMsg = new ContentAPI().EkMsgRef; BackLabel.Text = m_refMsg.GetMessage("btn back"); DeleteLabel.Text = m_refMsg.GetMessage("btn delete"); //Register CSS Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaIeCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronFixedPositionToolbarCss); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronJFunctJS); ltrlStyleSheetJS.Text = _styleHelper.GetClientScript(); _msgHelper = new EkMessageHelper(_contentApi.RequestInformationRef); Utilities.ValidateUserLogin(); if (_contentApi.RequestInformationRef.IsMembershipUser == 1 || !_contentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminPersonalize)) { Response.Redirect(_contentApi.ApplicationPath + "reterror.aspx?info=" + _contentApi.EkMsgRef.GetMessage("msg login cms user"), true); return; } BindToolbars(); this.image_link_100.Attributes.Add("onclick", string.Format("return validateList('{0}');", _msgHelper.GetMessage("select target content"))); }
protected void Page_Init(object sender, EventArgs e) { var m_refMsg = new ContentAPI().EkMsgRef; CancelLabel.Text = m_refMsg.GetMessage("generic Cancel"); SaveLabel.Text = m_refMsg.GetMessage("btn Save"); //If initial load, reset pagebuilder page to clean slate. if (!IsPostBack && Request.UrlReferrer != null && Request.UrlReferrer.ToString().ToLower().Contains("targetcontentlist.aspx")) { Session["EkWidgetDirty"] = null; Session["EkWidgetBag"] = null; (Page as PageBuilder).Pagedata = null; (Page as PageBuilder).ClearView(); } _msgHelper = new EkMessageHelper(_contentApi.RequestInformationRef); Utilities.ValidateUserLogin(); if (_contentApi.RequestInformationRef.IsMembershipUser == 1 || (_contentApi.RequestInformationRef.UserId != 999999999 && !_contentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminPersonalize))) { Response.Redirect(_contentApi.ApplicationPath + "reterror.aspx?info=" + _contentApi.EkMsgRef.GetMessage("msg login cms user"), true); return; } txtName.Attributes.Add("onkeypress", "return CheckKeyValue(event, '34,13, 60, 62');"); //Register CSS Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaIeCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronFixedPositionToolbarCss); string cssFilePath = ResolveUrl(String.Format("{0}/{1}", new SiteAPI().SitePath, "Workarea/csslib/ektron.workarea.personalization.ie.7.css")); Ektron.Cms.API.Css.RegisterCss(this, cssFilePath, "ie-targetcontent", Css.BrowserTarget.IE8); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronJFunctJS); ltrlStyleSheetJS.Text = _styleHelper.GetClientScript(); //ViewAllToolbar txtTitleBar.InnerHtml = _styleHelper.GetTitleBar(_msgHelper.GetMessage("lbl targeted content")); lblName.Text = _msgHelper.GetMessage("generic title"); ltrTitleEmpty.Text = _msgHelper.GetMessage("js: alert title required"); image_link_100.Attributes.Add("onclick", "verifyTitle(event);"); PageBuilder pb = this as PageBuilder; if (Request["targetcontentid"] != null) { long.TryParse(Request["targetcontentid"], out _targetContentId); } //Add the Target Content Widget to Page if (pb.Pagedata.Widgets == null || pb.Pagedata.Widgets.Count == 0) { if (_targetContentId == 0) { _columnGuid = Guid.NewGuid(); _targetContentWidgetXml = string.Format(@"<ArrayOfDataStore xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><dataStore><Property>RulesetNames</Property><TypeName>System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</TypeName><AssemblyAndType>System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore><dataStore><Property>Rulesets</Property><TypeName>System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</TypeName><AssemblyAndType>System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore><dataStore><Property>SelectedZone</Property><Value xsi:type=""xsd:int"">0</Value><TypeName>System.Int32</TypeName><AssemblyAndType>System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore><dataStore><Property>TargetConfigurationId</Property><Value xsi:type=""xsd:long"">{0}</Value><TypeName>System.Int64</TypeName><AssemblyAndType>System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore><dataStore><Property>TargetedContent</Property><Value xsi:type=""TargetedContentData""><Id>0</Id><IsGlobal>false</IsGlobal><Segments><SegmentData><Id>0</Id><Name>Default</Name><Rules /><IsGlobal>false</IsGlobal></SegmentData></Segments><PageData><IsMasterLayout xmlns=""PB"">false</IsMasterLayout><masterID xmlns=""PB"">0</masterID><pageID xmlns=""PB"">0</pageID><languageID xmlns=""PB"">0</languageID><Zones xmlns=""PB""><DropZoneData><isMasterZone>false</isMasterZone><Columns><ColumnDataSerialize><Guid>{1}</Guid><Display>false</Display><columnID>-1</columnID><width>100</width><unit>percent</unit></ColumnDataSerialize></Columns></DropZoneData></Zones><Widgets xmlns=""PB"" /></PageData></Value><TypeName>Ektron.Cms.Content.Targeting.TargetedContentData</TypeName><AssemblyAndType>Ektron.Cms.Content.Targeting.TargetedContentData, Ektron.Cms.ObjectFactory, Version=8.5.0.297, Culture=neutral, PublicKeyToken=559a2c4fa21e63be</AssemblyAndType></dataStore></ArrayOfDataStore>", "{0}", _columnGuid); } pb.ClearView(layoutVersion.Staged, false); pb.Status = Mode.Editing; pb.viewType = layoutVersion.Staged; WidgetData targetContentWidget = new WidgetData() { ID = 999, ControlURL = "TargetedContent.ascx", ColumnID = 0, DropID = "targetContentZone", Settings = string.Format(_targetContentWidgetXml, _targetContentId) }; pb.Pagedata.Widgets = new List<WidgetData>(); pb.Pagedata.Widgets.Add(targetContentWidget); //(Page as PageBuilder).View(pb.Pagedata); LoadTargetContentConfiguration(targetContentWidget); pb.View(pb.Pagedata); } if (!IsPostBack) { Bind(); } }