protected void Page_Init(object sender, EventArgs e) { m_refMsg = common.EkMsgRef; Ektron.Cms.PageBuilder.PageBuilder pb = this.Page as Ektron.Cms.PageBuilder.PageBuilder; if (pb == null) { TargetedContentViewSet.SetActiveView(NonPageBuilderView); return; } Ektron.Cms.CommonApi api = new Ektron.Cms.CommonApi(); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronUICoreJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronUIDialogJS); Ektron.Cms.API.JS.RegisterJSInclude(this, api.ApplicationPath + "controls/paging/clientpaging/ektron.controls.clientpaging.js", "EktronWorkareaClientPagingJs"); _host = (Ektron.Cms.PageBuilder.WidgetHost)Ektron.Cms.Widget.WidgetHost.GetHost(this); _host.ExpandOptions = Expandable.DontExpand; // Expandable.ExpandOnEdit; //string myPath = string.Empty; //if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ek_helpDomainPrefix"])) //{ // string helpDomain = ConfigurationManager.AppSettings["ek_helpDomainPrefix"]; // if ((helpDomain.IndexOf("[ek_cmsversion]") > 1)) // { // myPath = helpDomain.Replace("[ek_cmsversion]", new CommonApi().RequestInformationRef.Version.Replace(".", "0").Substring(0, 3)); // } // else // { // myPath = ConfigurationManager.AppSettings["ek_helpDomainPrefix"]; // } //} //else //{ // myPath = api.AppPath + "/help"; //} //_host.HelpFile = myPath + "/Widget Chapter/Targeted Content/Creating Conditions with the Targeted Content Widget.htm"; _host.Edit += new EditDelegate(host_edit); SaveButton.OnClientClick = "if(Ektron.RuleEditor.save('" + ruleEditor.UniqueID + "') == false){ return false;}"; ruleEditor.Save += new EventHandler<SaveEventArgs>(ruleEditor_Save); pb.PageUpdated += new EventHandler(pb_PageUpdated); ConditionalZones.DeleteColumn += new EventHandler<ColumnDisplay.DeleteColumnEventArgs>(DeleteConditionalZone); ConditionalZones.WidgetHost = _host; ActiveColumn.WidgetHost = _host; // Localization _host.Title = m_refMsg.GetMessage("lbl targeted content"); btnAddConditionalZone.Text = "<span class=\"ui-icon ui-icon-plus\"></span>" + m_refMsg.GetMessage("lbl new condition"); btnEditConditionalZone.Text = m_refMsg.GetMessage("lbl edit condition"); _conditionNameLabel = m_refMsg.GetMessage("foldername label"); _defaultConditionName = "{0}"; CancelButton.Text = CancelButton.ToolTip = m_refMsg.GetMessage("generic cancel"); SaveButton.Text = SaveButton.ToolTip = m_refMsg.GetMessage("btn save"); AddAllRuleTemplates(); //Forced TargetedContent to be loaded. if (TargetConfigurationId > 0 && !IsWorkarea) { TargetedContent = null; _host.Edit -= new EditDelegate(host_edit); } _currentColumns = _host.GetColumns(); if (Rulesets != null && _targetedContent == null) { //this is an upgraded version of the widget. LoadLegacyWidget(); } LoadTargetConfigurationData(); if (_host.GetColumns().Count == 0) { AddConditionalZone(); } //if IsMasterlayoutLocked - show normal page view if ((Page as Ektron.Cms.PageBuilder.PageBuilder).Status == Ektron.Cms.PageBuilder.Mode.Editing && !IsMasterLayoutWidgetLocked()) { if (TargetConfigurationId == 0 || IsWorkarea) { TargetedContentViewSet.SetActiveView(PageEditing); } else { SetGlobalTargetedContentView(); } this.aSelectGlobalConfig.Attributes.Add("onclick", "Ektron.Widget.TargetedContentList.showDialog('" + ClientID + "');return false;"); RefreshColumns(); } else { TargetedContentViewSet.SetActiveView(View); //Get all available Widget child columns //these are the possible columns to show based upon evaluated conditions List<Ektron.Cms.PageBuilder.ColumnData> hostColumns = _host.GetColumns(); if (hostColumns.Count > 0) { ActiveColumn.IsEditable = !IsMasterLayoutWidgetLocked(); ActiveColumn.Columns = SelectConditionalZone(); } } }
/// <summary> /// Called when the pagebuilder page is saved. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void pb_PageUpdated(object sender, EventArgs e) { _host = (Ektron.Cms.PageBuilder.WidgetHost)Ektron.Cms.Widget.WidgetHost.GetHost(this); //TargetedContentData targetContent = LoadTargetConfigurationData(); SynchTargetConfiguration(); //SaveConfiguration(targetContent); }
protected void Page_Init(object sender, EventArgs e) { _host = Ektron.Cms.Widget.WidgetHost.GetHost(this) as Ektron.Cms.PageBuilder.WidgetHost; _host.Title = "Content Block Widget"; _host.Edit += new EditDelegate(EditEvent); _host.Maximize += new MaximizeDelegate(delegate() { Visible = true; }); _host.Minimize += new MinimizeDelegate(delegate() { Visible = false; }); _host.Create += new CreateDelegate(delegate() { EditEvent(""); }); _host.ExpandOptions = Expandable.ExpandOnEdit; this.EnableViewState = false; if ((Page as PageBuilder)!= null && (Page as PageBuilder).Status != Mode.Editing && ShowTestingTab) { litGoogleHeader.Text = String.Format("<script>utmx_section(\"{0}\")</script>", GoogleSectionName); litGoogleFooter.Text = "</noscript>"; } else { litGoogleHeader.Text = ""; litGoogleFooter.Text = ""; } Page.ClientScript.GetPostBackEventReference(SaveButton, ""); _api = new Ektron.Cms.CommonApi(); appPath = _api.AppPath; langType = _api.RequestInformationRef.ContentLanguage; MainView(); ViewSet.SetActiveView(View); }