コード例 #1
0
 public ErrorPageContent(IReadOnlyCollection <FlowComponent> content)
 {
     basicContent = new BasicPageContent(bodyClasses: elementClass).Add(content);
 }
コード例 #2
0
        protected override PageContent getContent()
        {
            if (User.Any())
            {
                return(new BasicPageContent(
                           bodyClasses: elementClass,
                           pageLoadPostBack: PostBack.CreateFull(
                               modificationMethod: () => UserImpersonationStatics.BeginImpersonation(UserObject),
                               actionGetter: () => new PostBackAction(new ExternalResource(ReturnUrl)))).Add(new Paragraph("Please wait.".ToComponents())));
            }

            var content = new BasicPageContent(bodyClasses: elementClass);

            content.Add(new PageName());

            if (ConfigurationStatics.IsLiveInstallation)
            {
                content.Add(
                    new Paragraph(
                        new ImportantContent("Warning:".ToComponents()).ToCollection()
                        .Concat(
                            " Do not impersonate a user without permission. Your actions will be attributed to the user you are impersonating, not to you.".ToComponents())
                        .Materialize()));
            }

            var user = new DataValue <User>();
            var pb   = PostBack.CreateFull(
                modificationMethod: () => UserImpersonationStatics.BeginImpersonation(user.Value),
                actionGetter: () => new PostBackAction(
                    new ExternalResource(
                        ReturnUrl.Any()
                                                        ? ReturnUrl
                                                        : EwfConfigurationStatics.AppConfiguration.DefaultBaseUrl.GetUrlString(EwfConfigurationStatics.AppSupportsSecureConnections))));

            FormState.ExecuteWithDataModificationsAndDefaultAction(
                pb.ToCollection(),
                () => {
                content.Add(
                    new EmailAddressControl(
                        "",
                        true,
                        validationMethod: (postBackValue, validator) => {
                    if (!postBackValue.Any())
                    {
                        user.Value = null;
                        return;
                    }
                    user.Value = UserManagementStatics.SystemProvider.GetUser(postBackValue);
                    if (user.Value == null)
                    {
                        validator.NoteErrorAndAddMessage("The email address you entered does not match a user.");
                    }
                }).ToFormItem(label: "User's email address (leave blank for anonymous)".ToComponents())
                    .ToComponentCollection()
                    .Append(
                        new Paragraph(
                            new EwfButton(
                                new StandardButtonStyle(
                                    AppRequestState.Instance.ImpersonatorExists ? "Change User" : "Begin Impersonation",
                                    buttonSize: ButtonSize.Large))
                            .ToCollection()))
                    .Materialize());
            });

            return(content);
        }