internal void SetUpClickableControl(WebControl clickableControl) { if (resource == null && postBack == null && script == "") { return; } clickableControl.CssClass = clickableControl.CssClass.ConcatenateWithSpace("ewfClickable"); if (resource != null && EwfPage.Instance.IsAutoDataUpdater) { postBack = EwfLink.GetLinkPostBack(resource); resource = null; } Func <string> scriptGetter; if (resource != null) { scriptGetter = () => "location.href = '" + EwfPage.Instance.GetClientUrl(resource.GetUrl()) + "'; return false"; } else if (postBack != null) { EwfPage.Instance.AddPostBack(postBack); scriptGetter = () => PostBackButton.GetPostBackScript(postBack); } else { scriptGetter = () => script; } // Defer script generation until after all controls have IDs. EwfPage.Instance.PreRender += delegate { clickableControl.AddJavaScriptEventScript(JsWritingMethods.onclick, scriptGetter()); }; }
void ControlTreeDataLoader.LoadData() { CssClass = CssClass.ConcatenateWithSpace(CssElementCreator.CssClass); var pagePath = EwfPage.Instance.InfoAsBaseType.ResourcePath; foreach (var resource in pagePath.Take(pagePath.Count - 1)) { Controls.Add(EwfLink.Create(resource, new ButtonActionControlStyle(resource.ResourceFullName, buttonSize: ButtonSize.ShrinkWrap))); Controls.Add(new PlaceHolder().AddControlsReturnThis(ResourceInfo.ResourcePathSeparator.ToComponents().GetControls())); } if (pageName != null) { Controls.Add(pageName); } else if (Controls.Count > 0) { Controls.RemoveAt(Controls.Count - 1); } }
/// <summary> /// EWL use only. Do not call if there is no authenticated user. /// </summary> public void LoadData(PageInfo changePasswordPage) { this.AddControlsReturnThis(("Logged in as " + AppTools.User.Email).ToComponents().GetControls()); if (!FormsAuthStatics.FormsAuthEnabled) { return; } this.AddControlsReturnThis( new LiteralControl(" "), EwfLink.Create(changePasswordPage, new TextActionControlStyle("Change password")), new LiteralControl(" • "), new PostBackButton( new TextActionControlStyle("Log out"), usesSubmitBehavior: false, postBack: PostBack.CreateFull( id: "ewfLogOut", firstModificationMethod: FormsAuthStatics.LogOutUser, actionGetter: () => { // NOTE: Is this the correct behavior if we are already on a public page? return(new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))); }))); }