Exemple #1
0
        protected override void loadData()
        {
            var staticFil = FormItemList.CreateStack(generalSetup: new FormItemListSetup(buttonSetup: new ButtonSetup("Submit")));

            staticFil.AddFormItems(
                new TextControl("Values here will be retained across post-backs", true).ToFormItem(label: "Static Field".ToComponents()),
                new TextControl("", true).ToFormItem(label: "Static Field".ToComponents()),
                new TextControl(
                    "Edit this one to get a validation error",
                    true,
                    setup: TextControlSetup.Create(validationPredicate: valueChangedOnPostBack => valueChangedOnPostBack),
                    validationMethod: (postBackValue, validator) => validator.NoteErrorAndAddMessage("You can't change the value in this box!")).ToFormItem(
                    label: "Static Field".ToComponents()));
            ph.AddControlsReturnThis(staticFil.ToCollection().GetControls());

            ph.AddControlsReturnThis(getBasicRegionComponents().GetControls());

            var listTable = EwfTable.Create(
                style: EwfTableStyle.StandardLayoutOnly,
                fields: new[] { 10, 1, 10 }.Select(i => new EwfTableField(size: i.ToPercentage())).Materialize());

            listTable.AddItem(
                EwfTableItem.Create(
                    EwfTableItemSetup.Create(verticalAlignment: TableCellVerticalAlignment.Top),
                    getNonIdListRegionComponents().ToCell(),
                    "".ToCell(),
                    getIdListRegionComponents().ToCell()));
            ph.AddControlsReturnThis(listTable.ToCollection().GetControls());
        }
        public override List <ActionButtonSetup> GetGlobalNavActionControls()
        {
            var navButtonSetups = new List <ActionButtonSetup>();

            if (CreateSystem.GetInfo().IsIdenticalToCurrent())
            {
                return(navButtonSetups);
            }

            // This will hide itself because Contact Us requires a logged-in user, and the standard library test web site has no users.
            var contactPage = EnterpriseWebFramework.EnterpriseWebLibrary.WebSite.ContactSupport.GetInfo(EwfPage.Instance.InfoAsBaseType.GetUrl());

            navButtonSetups.Add(new ActionButtonSetup(contactPage.ResourceName, new EwfLink(contactPage)));

            var menu = EwfTable.Create();

            menu.AddItem(
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(
                        clickScript:
                        ClickScript.CreatePostBackScript(
                            PostBack.CreateFull(id: "testMethod", firstModificationMethod: () => EwfPage.AddStatusMessage(StatusMessageType.Info, "Successful method execution.")))),
                    "Test method"));
            navButtonSetups.Add(new ActionButtonSetup("Test", new ToolTipButton(menu)));

            return(navButtonSetups);
        }
        private WebControl getTableForFormItemTable()
        {
            var columnWidthSpecified = firstColumnWidth != null || secondColumnWidth != null;
            var table = EwfTable.Create(
                caption: heading,
                fields:
                new[]
            {
                new EwfTableField(size: columnWidthSpecified?firstColumnWidth: Unit.Percentage(1)),
                new EwfTableField(size: columnWidthSpecified ? secondColumnWidth : Unit.Percentage(2))
            });

            table.AddData(
                formItems,
                i => {
                var stack = ControlStack.Create(true);
                if (i.Validation != null)
                {
                    stack.AddModificationErrorItem(i.Validation, errors => ErrorMessageControlListBlockStatics.CreateErrorMessageListBlock(errors).ToSingleElementArray());
                }
                stack.AddControls(i.Control);
                return(new EwfTableItem(i.Label, stack.ToCell(new TableCellSetup(textAlignment: i.TextAlignment))));
            });
            return(table);
        }
Exemple #4
0
        public override List <ActionButtonSetup> GetGlobalNavActionControls()
        {
            var navButtonSetups = new List <ActionButtonSetup>();

            // This will hide itself because Contact Us requires a logged-in user, and the standard library test web site has no users.
            navButtonSetups.Add(
                new ActionButtonSetup(
                    "Contact us",
                    new EwfLink(
                        RedStapler.StandardLibrary.EnterpriseWebFramework.EnterpriseWebLibrary.WebSite.ContactUs.Page.GetInfo(EwfPage.Instance.InfoAsBaseType.GetUrl()))));

            var menu = EwfTable.Create();

            menu.AddItem(
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(
                        clickScript:
                        ClickScript.CreatePostBackScript(
                            PostBack.CreateFull(id: "testMethod", firstModificationMethod: () => EwfPage.AddStatusMessage(StatusMessageType.Info, "Successful method execution.")))),
                    "Test method"));
            navButtonSetups.Add(new ActionButtonSetup("Test", new ToolTipButton(menu)));

            navButtonSetups.Add(
                new ActionButtonSetup(
                    "Calendar",
                    new EwfLink(
                        CalendarDemo.GetInfo(
                            new EntitySetup.OptionalParameterPackage(),
                            new CalendarDemo.OptionalParameterPackage {
                ReturnUrl = EwfPage.Instance.InfoAsBaseType.GetUrl(), Date = DateTime.Now
            }))));
            return(navButtonSetups);
        }
        protected override void loadData()
        {
            var staticTable = FormItemBlock.CreateFormItemTable();

            staticTable.AddFormItems(
                FormItem.Create("Static Field", new EwfTextBox("Values here will be retained across post-backs")),
                FormItem.Create("Static Field", new EwfTextBox("")),
                FormItem.Create(
                    "Static Field",
                    new EwfTextBox("Edit this one to get a validation error"),
                    validationGetter: control => new EwfValidation(
                        (pbv, validator) => {
                if (control.ValueChangedOnPostBack(pbv))
                {
                    validator.NoteErrorAndAddMessage("You can't change the value in this box!");
                }
            },
                        DataUpdate)));
            staticTable.IncludeButtonWithThisText = "Submit";
            ph.AddControlsReturnThis(staticTable);

            ph.AddControlsReturnThis(getBasicRegionBlocks());

            var listTable = EwfTable.Create(
                style: EwfTableStyle.StandardLayoutOnly,
                fields: from i in new[] { 10, 1, 10 } select new EwfTableField(size: Unit.Percentage(i)));

            listTable.AddItem(
                new EwfTableItem(
                    new EwfTableItemSetup(verticalAlignment: TableCellVerticalAlignment.Top),
                    getNonIdListRegionBlocks().ToCell(),
                    "",
                    getIdListRegionBlocks().ToCell()));
            ph.AddControlsReturnThis(listTable);
        }
        private WebControl getTableForFormItemList()
        {
            var actualNumberOfColumns = numberOfColumns ?? formItems.Sum(fi => getCellSpan(fi));

            if (actualNumberOfColumns < 1)
            {
                throw new ApplicationException("There must be at least one column.");
            }

            var table = EwfTable.Create(caption: heading, disableEmptyFieldDetection: true);

            if (formItems.Any(fi => getCellSpan(fi) > actualNumberOfColumns))
            {
                throw new ApplicationException("Form fields cannot have a column span greater than the number of columns.");
            }

            // NOTE: Make control list use an implementation more like this?
            foreach (var row in getFormItemRows(formItems, actualNumberOfColumns))
            {
                var items = row.ToList();
                (actualNumberOfColumns - row.Sum(r => getCellSpan(r))).Times(() => items.Add(getPlaceholderFormItem()));

                table.AddItem(
                    new EwfTableItem(
                        new EwfTableItemSetup(verticalAlignment: verticalAlignment),
                        items.Select(i => i.ToControl().ToCell(new TableCellSetup(fieldSpan: getCellSpan(i), textAlignment: i.TextAlignment))).ToArray()));
            }
            return(table);
        }
        private Control getAppLogoAndUserInfoBlock()
        {
            var table = EwfTable.Create(style: EwfTableStyle.StandardLayoutOnly, classes: CssElementCreator.AppLogoAndUserInfoBlockCssClass.ToSingleElementArray());

            var appLogoBlock = EwfUiStatics.AppProvider.GetLogoControl() ??
                               new Panel().AddControlsReturnThis(
                (EwfApp.Instance.AppDisplayName.Length > 0 ? EwfApp.Instance.AppDisplayName : AppTools.SystemName).GetLiteralControl());

            appLogoBlock.CssClass = CssElementCreator.AppLogoBlockCssClass;

            ControlStack userInfoList = null;

            if (AppRequestState.Instance.UserAccessible)
            {
                var changePasswordPage = UserManagement.ChangePassword.Page.GetInfo(EwfPage.Instance.InfoAsBaseType.GetUrl());
                if (changePasswordPage.UserCanAccessResource && AppTools.User != null)
                {
                    var userInfo = new UserInfo();
                    userInfo.LoadData(changePasswordPage);
                    userInfoList          = ControlStack.CreateWithControls(true, userInfo);
                    userInfoList.CssClass = CssElementCreator.UserInfoListCssClass;
                }
            }

            table.AddItem(() => new EwfTableItem(appLogoBlock, userInfoList));
            return(table);
        }
Exemple #8
0
        private Control getAppLogoAndUserInfoBlock()
        {
            var table = EwfTable.Create(style: EwfTableStyle.StandardLayoutOnly, classes: CssElementCreator.AppLogoAndUserInfoBlockCssClass.ToCollection());

            var appLogo =
                new GenericFlowContainer(
                    (!ConfigurationStatics.IsIntermediateInstallation || AppRequestState.Instance.IntermediateUserExists ? EwfUiStatics.AppProvider.GetLogoComponent() : null) ??
                    (EwfApp.Instance.AppDisplayName.Length > 0 ? EwfApp.Instance.AppDisplayName : ConfigurationStatics.SystemName).ToComponents(),
                    classes: CssElementCreator.AppLogoClass);

            ControlStack userInfoList = null;

            if (AppRequestState.Instance.UserAccessible)
            {
                var changePasswordPage = UserManagement.ChangePassword.Page.GetInfo(EwfPage.Instance.InfoAsBaseType.GetUrl());
                if (changePasswordPage.UserCanAccessResource && AppTools.User != null)
                {
                    var userInfo = new UserInfo();
                    userInfo.LoadData(changePasswordPage);
                    userInfoList          = ControlStack.CreateWithControls(true, userInfo);
                    userInfoList.CssClass = CssElementCreator.UserInfoListCssClass;
                }
            }

            table.AddItem(() => new EwfTableItem(new PlaceHolder().AddControlsReturnThis(appLogo.ToCollection().GetControls()), userInfoList));
            return(table);
        }
Exemple #9
0
        protected override void loadData()
        {
            var updateRegionSet = new UpdateRegionSet();

            EwfUiStatics.SetPageActions(
                new ActionButtonSetup(
                    "Remove Last Group",
                    new PostBackButton(
                        PostBack.CreateIntermediate(
                            updateRegionSet.ToCollection(),
                            id: "removeLastGroup",
                            firstModificationMethod: () => {
                if (info.GroupCount <= 0)
                {
                    throw new DataModificationException("No groups to remove.");
                }
                parametersModification.GroupCount -= 1;
            }))));

            place.Controls.Add(
                EwfTable.CreateWithItemGroups(
                    Enumerable.Range(1, info.GroupCount).Select(getItemGroup),
                    defaultItemLimit: DataRowLimit.Fifty,
                    caption: "Caption",
                    subCaption: "Sub caption",
                    fields:
                    new[]
                    { new EwfTableField(size: Unit.Percentage(1), toolTip: "First column!"), new EwfTableField(size: Unit.Percentage(2), toolTip: "Second column!") },
                    headItems: new EwfTableItem("First Column", "Second Column").ToCollection(),
                    tailUpdateRegions: new TailUpdateRegion(updateRegionSet.ToCollection(), 1).ToCollection()));
        }
Exemple #10
0
 protected override PageContent getContent() =>
 new UiPageContent().Add(
     EwfTable.Create()
     .AddData(
         getStatusTests(),
         tests => EwfTableItem.Create(
             tests.Item1.ToCell(),
             new EwfButton(new StandardButtonStyle("Test"), behavior: new PostBackBehavior(postBack: tests.Item2)).ToCell())));
 protected override void loadData()
 {
     ph.AddControlsReturnThis(
         EwfTable.CreateWithItems(
             items:
             getStatusTests()
             .Select(tests => new EwfTableItem(tests.Item1, new PostBackButton(tests.Item2, new ButtonActionControlStyle("Test"), usesSubmitBehavior: false)))
             .ToFunctions()));
 }
 private void testUrl( EwfTable table, string url )
 {
     var validator = new Validator();
     validator.GetUrl( new ValidationErrorHandler( "" ), url, false );
     table.AddItem(
         new EwfTableItem(
             url,
             ( !validator.ErrorsOccurred ).BooleanToYesNo( false )
                 .ToCell( new TableCellSetup( classes: ( validator.ErrorsOccurred ? CssClasses.Red : CssClasses.Green ).ToSingleElementArray() ) ) ) );
 }
Exemple #13
0
        private void testUrl(EwfTable <int> table, string url)
        {
            var validator = new Validator();

            validator.GetUrl(new ValidationErrorHandler(""), url, false);
            table.AddItem(
                EwfTableItem.Create(
                    url.ToCell(),
                    (!validator.ErrorsOccurred).ToYesOrEmpty()
                    .ToCell(new TableCellSetup(classes: validator.ErrorsOccurred ? ElementClasses.Red : ElementClasses.Green))));
        }
        private void testUrl(EwfTable table, string url)
        {
            var validator = new Validator();

            validator.GetUrl(new ValidationErrorHandler(""), url, false);
            table.AddItem(
                new EwfTableItem(
                    url,
                    (!validator.ErrorsOccurred).BooleanToYesNo(false)
                    .ToCell(new TableCellSetup(classes: (validator.ErrorsOccurred ? CssClasses.Red : CssClasses.Green).ToSingleElementArray()))));
        }
        protected override PageContent getContent()
        {
            var content = new UiPageContent(omitContentBox: true);

            if (UserManagementStatics.IdentityProviders.OfType <SamlIdentityProvider>().Any())
            {
                var certificate = UserManagementStatics.GetCertificate();
                content.Add(
                    new Section(
                        "Identity providers",
                        FormItemList.CreateStack(
                            items:
                            (certificate.Any()
                                                                          ? "Certificate valid until {0}.".FormatWith(
                                 new X509Certificate2(Convert.FromBase64String(certificate), UserManagementStatics.CertificatePassword).NotAfter
                                 .ToDayMonthYearString(
                                     false))
                             .ToComponents()
                                                                          : "No certificate.".ToComponents()).Concat(" ".ToComponents())
                            .Append(
                                new EwfButton(
                                    new StandardButtonStyle("Regenerate", buttonSize: ButtonSize.ShrinkWrap),
                                    behavior: new ConfirmationButtonBehavior(
                                        "Are you sure?".ToComponents(),
                                        postBack: PostBack.CreateFull(
                                            "certificate",
                                            modificationMethod: () => UserManagementStatics.UpdateCertificate(generateCertificate(DateTimeOffset.UtcNow))))))
                            .Materialize()
                            .ToFormItem(label: "System self-signed certificate".ToComponents())
                            .Concat(
                                AuthenticationStatics.SamlIdentityProviders.Any()
                                                                                ? new EwfHyperlink(EnterpriseWebFramework.UserManagement.SamlResources.Metadata.GetInfo(), new StandardHyperlinkStyle(""))
                                .ToFormItem(label: "Application SAML metadata".ToComponents())
                                .ToCollection()
                                                                                : Enumerable.Empty <FormItem>())
                            .Materialize())
                        .ToCollection(),
                        style: SectionStyle.Box));
            }
            content.Add(
                new Section(
                    "System users",
                    EwfTable.Create(
                        tableActions: new HyperlinkSetup(new SystemUser(Es, null), "Create User").ToCollection(),
                        headItems: EwfTableItem.Create("Email".ToCell().Append("Role".ToCell()).Materialize()).ToCollection())
                    .AddData(
                        UserManagementStatics.SystemProvider.GetUsers(),
                        user => EwfTableItem.Create(
                            user.Email.ToCell().Append(user.Role.Name.ToCell()).Materialize(),
                            setup: EwfTableItemSetup.Create(activationBehavior: ElementActivationBehavior.CreateHyperlink(new SystemUser(Es, user.UserId)))))
                    .ToCollection(),
                    style: SectionStyle.Box));
            return(content);
        }
        private void testUrl(EwfTable table, string url)
        {
            var validator = new Validator();

            validator.GetUrl(new ValidationErrorHandler(""), url, false);
            table.AddItem(
                new EwfTableItem(
                    url,
                    (!validator.ErrorsOccurred).ToYesOrEmpty()
                    .ToCell(new TableCellSetup(classes: (validator.ErrorsOccurred ? CssClasses.Red : CssClasses.Green).ToCollection()))));
        }
Exemple #17
0
 protected override void loadData()
 {
     ph.AddControlsReturnThis(
         EwfTable.Create()
         .AddData(
             getStatusTests(),
             tests => EwfTableItem.Create(
                 tests.Item1.ToCell(),
                 new EwfButton(new StandardButtonStyle("Test"), behavior: new PostBackBehavior(postBack: tests.Item2)).ToCell()))
         .ToCollection()
         .GetControls());
 }
Exemple #18
0
        private FlowComponent getResultTable()
        {
            var results              = ShowFavorites ? ArticlesRetrieval.GetRowsLinkedToUser(UserId) : ArticlesRetrieval.GetRowsLinkedToAuthor(UserId);
            var usersById            = UsersTableRetrieval.GetRows().ToIdDictionary();
            var tagsByArticleId      = ArticleTagsTableRetrieval.GetRows().ToArticleIdLookup();
            var favoritesByArticleId = FavoritesTableRetrieval.GetRows().ToArticleIdLookup();

            var table = EwfTable.Create(defaultItemLimit: DataRowLimit.Fifty);

            table.AddData(results, i => EwfTableItem.Create(AppStatics.GetArticleDisplay(i, usersById, tagsByArticleId, favoritesByArticleId).ToCell()));
            return(table);
        }
        private Control getEntityNavAndActionBlock()
        {
            var cells = new[] { getEntityNavCell(), getEntityActionCell() }.Where(i => i != null);

            if (!cells.Any())
            {
                return(null);
            }
            var table = EwfTable.Create(style: EwfTableStyle.Raw, classes: CssElementCreator.EntityNavAndActionBlockCssClass.ToSingleElementArray());

            table.AddItem(new EwfTableItem(cells));
            return(table);
        }
        private FlowComponent getResultTable(string filter)
        {
            var results = filter == "user" && AppTools.User != null?ArticlesRetrieval.GetRowsLinkedToFollower(AppTools.User.UserId) :
                              filter.StartsWith("tag") ? ArticlesRetrieval.GetRowsLinkedToTag(int.Parse(filter.Substring(3))) :
                              ArticlesRetrieval.GetRowsOrderedByCreation();

            var usersById            = UsersTableRetrieval.GetRows().ToIdDictionary();
            var tagsByArticleId      = ArticleTagsTableRetrieval.GetRows().ToArticleIdLookup();
            var favoritesByArticleId = FavoritesTableRetrieval.GetRows().ToArticleIdLookup();

            var table = EwfTable.Create(defaultItemLimit: DataRowLimit.Fifty);

            table.AddData(results, i => EwfTableItem.Create(AppStatics.GetArticleDisplay(i, usersById, tagsByArticleId, favoritesByArticleId).ToCell()));
            return(table);
        }
 protected override void loadData()
 {
     ph.AddControlsReturnThis(
         EwfTable
         .Create(
             tableActions: new HyperlinkSetup(new EditUser.Info(es.info, null), "Create User").ToCollection(),
             headItems: EwfTableItem.Create("Email".ToCell().Append("Role".ToCell()).Materialize()).ToCollection())
         .AddData(
             UserManagementStatics.GetUsers(),
             user => EwfTableItem.Create(
                 user.Email.ToCell().Append(user.Role.Name.ToCell()).Materialize(),
                 setup: EwfTableItemSetup.Create(
                     activationBehavior: ElementActivationBehavior.CreateRedirectScript(new EditUser.Info(es.info, user.UserId)))))
         .ToCollection()
         .GetControls());
 }
Exemple #22
0
        private Control getContentFootBlock()
        {
            var controls = new List <Control>();

            if (contentFootActions != null)
            {
                if (contentFootActions.Any())
                {
                    var first = from i in contentFootActions.Take(1)
                                select i.BuildButton((text, icon) => new ButtonActionControlStyle( text, ButtonActionControlStyle.ButtonSize.Large, icon : icon ), true);

                    var remaining = from i in contentFootActions.Skip(1)
                                    select
                                    i.BuildButton((text, icon) => new ButtonActionControlStyle( text, ButtonActionControlStyle.ButtonSize.Large, icon : icon ), false);

                    controls.Add(new ControlLine(first.Concat(remaining).ToArray())
                    {
                        CssClass = CssElementCreator.ContentFootActionListCssClass
                    });
                }
                else if (EwfPage.Instance.IsAutoDataUpdater)
                {
                    controls.Add(new PostBackButton(EwfPage.Instance.DataUpdatePostBack, new ButtonActionControlStyle("Update Now")));
                }
            }
            else
            {
                if (EwfPage.Instance.IsAutoDataUpdater)
                {
                    throw new ApplicationException("AutoDataUpdater is not currently compatible with custom content foot controls.");
                }
                controls.AddRange(contentFootControls.ToList());
            }

            if (!controls.Any())
            {
                return(null);
            }

            var table = EwfTable.Create(style: EwfTableStyle.StandardLayoutOnly, classes: CssElementCreator.ContentFootBlockCssClass.ToSingleElementArray());

            table.AddItem(
                new EwfTableItem(
                    controls.ToCell(new TableCellSetup(textAlignment: contentFootActions != null && contentFootActions.Any() ? TextAlignment.Right : TextAlignment.Center))));
            return(table);
        }
Exemple #23
0
        protected override PageContent getContent()
        {
            var content = new UiPageContent();

            var updateRegionSet = new UpdateRegionSet();

            content.Add(
                EwfTable.Create(
                    caption: "Caption",
                    subCaption: "Sub caption",
                    allowExportToExcel: true,
                    tableActions: new ButtonSetup(
                        "Remove Last Group",
                        behavior: new PostBackBehavior(
                            postBack: PostBack.CreateIntermediate(
                                updateRegionSet.ToCollection(),
                                id: "removeLastGroup",
                                modificationMethod: () => {
                if (GroupCount <= 0)
                {
                    throw new DataModificationException("No groups to remove.");
                }
                parametersModification.GroupCount -= 1;
            }))).ToCollection(),
                    selectedItemActions: SelectedItemAction
                    .CreateWithIntermediatePostBackBehavior <int>(
                        "Echo IDs",
                        null,
                        ids => AddStatusMessage(StatusMessageType.Info, StringTools.GetEnglishListPhrase(ids.Select(i => i.ToString()), true)))
                    .Append(
                        SelectedItemAction.CreateWithIntermediatePostBackBehavior <int>(
                            "With confirmation",
                            null,
                            ids => AddStatusMessage(StatusMessageType.Info, StringTools.GetEnglishListPhrase(ids.Select(i => i.ToString()), true)),
                            confirmationDialogContent: "Are you sure?".ToComponents()))
                    .Materialize(),
                    fields: new[] { new EwfTableField(size: 1.ToPercentage()), new EwfTableField(size: 2.ToPercentage()) },
                    headItems: EwfTableItem.Create("First Column".ToCell(), "Second Column".ToCell()).ToCollection(),
                    defaultItemLimit: DataRowLimit.Fifty,
                    tailUpdateRegions: new TailUpdateRegion(updateRegionSet.ToCollection(), 1).ToCollection())
                .AddItemGroups(Enumerable.Range(1, GroupCount).Select(getItemGroup).Materialize()));

            return(content);
        }
Exemple #24
0
        public List <ActionButtonSetup> CreateNavButtonSetups()
        {
            var navButtonSetups = new List <ActionButtonSetup>();

            navButtonSetups.Add(new ActionButtonSetup("Calendar", new EwfLink(new CalendarDemo.Info(info))));
            navButtonSetups.Add(new ActionButtonSetup("Go to Microsoft", new EwfLink(new ExternalResourceInfo("http://www.microsoft.com"))));
            navButtonSetups.Add(new ActionButtonSetup("Custom script", new CustomButton(() => "alert('test')")));
            navButtonSetups.Add(
                new ActionButtonSetup(
                    "Menu",
                    new ToolTipButton(
                        EwfTable.CreateWithItems(
                            items:
                            new Func <EwfTableItem>[]
            {
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(new ExternalResourceInfo("http://www.apple.com"))),
                    "Apple"),
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(new ExternalResourceInfo("http://www.microsoft.com"))),
                    "Microsoft"),
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(new ExternalResourceInfo("http://www.google.com"))),
                    "Google"),
                () => new EwfTableItem(new EwfTableItemSetup(clickScript: ClickScript.CreateCustomScript("alert('test!')")), "Custom script"),
                () =>
                new EwfTableItem(new LaunchWindowLink(new ModalWindow(new Paragraph("Test!")))
                {
                    ActionControlStyle = new TextActionControlStyle("Modal")
                })
            }))));

            navButtonSetups.Add(
                new ActionButtonSetup(
                    "Modal Window",
                    new LaunchWindowLink(new ModalWindow(new EwfImage("http://i3.microsoft.com/en/shared/templates/components/cspMscomHeader/m_head_blend.png")))));
            return(navButtonSetups);
        }
        protected override void loadData()
        {
            var dataRows = Enumerable.Range(0, 550);

            var table = EwfTable.Create(
                defaultItemLimit: DataRowLimit.Fifty,
                caption: "Caption",
                subCaption: "Sub caption",
                fields:
                new[]
                { new EwfTableField(size: Unit.Percentage(1), toolTip: "First column!"), new EwfTableField(size: Unit.Percentage(2), toolTip: "Second column!") },
                headItems: new EwfTableItem("First Column", "Second Column").ToSingleElementArray());

            table.AddData(
                dataRows,
                i =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(ActionControls.GetInfo())),
                    i.ToString(),
                    (i * 2) + Environment.NewLine + "extra stuff"));
            place.Controls.Add(table);
        }
        public List <ActionButtonSetup> CreateNavButtonSetups()
        {
            var navButtonSetups = new List <ActionButtonSetup>();

            navButtonSetups.Add(new ActionButtonSetup("Go to Microsoft", new EwfLink(new ExternalResourceInfo("http://www.microsoft.com"))));
            navButtonSetups.Add(new ActionButtonSetup("Custom script", new CustomButton(() => "alert('test')")));
            navButtonSetups.Add(
                new ActionButtonSetup(
                    "Menu",
                    new ToolTipButton(
                        EwfTable.CreateWithItems(
                            items:
                            new Func <EwfTableItem>[]
            {
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(new ExternalResourceInfo("http://www.apple.com"))),
                    "Apple"),
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(new ExternalResourceInfo("http://www.microsoft.com"))),
                    "Microsoft"),
                () =>
                new EwfTableItem(
                    new EwfTableItemSetup(clickScript: ClickScript.CreateRedirectScript(new ExternalResourceInfo("http://www.google.com"))),
                    "Google"),
                () => new EwfTableItem(new EwfTableItemSetup(clickScript: ClickScript.CreateCustomScript("alert('test!')")), "Custom script"),
                () => new EwfTableItem(new LaunchWindowLink(one)
                {
                    ActionControlStyle = new TextActionControlStyle("Modal")
                })
            }))));

            navButtonSetups.Add(new ActionButtonSetup("Modal Window", new LaunchWindowLink(two)));
            return(navButtonSetups);
        }
Exemple #27
0
        protected override PageContent getContent()
        {
            var content = new UiPageContent(isAutoDataUpdater: true);

            var fil = FormItemList.CreateStack();

            fil.AddFormItems(parametersModification.GetField1TextControlFormItem(true), parametersModification.GetField2TextControlFormItem(true));
            content.Add(fil);

            content.Add(
                new EwfButton(
                    new StandardButtonStyle("Navigate and change Field 2"),
                    behavior: new PostBackBehavior(
                        postBack: PostBack.CreateFull(
                            actionGetter: () => new PostBackAction(
                                new OptionalParametersDemo(Es, optionalParameterSetter: (specifier, entitySetup, parameters) => { specifier.Field2 = "bob"; }))))));

            var table = EwfTable.Create(headItems: new[] { EwfTableItem.Create("Url".ToCell(), "Valid?".ToCell()) });

            content.Add(table);

            foreach (var scheme in new[] { "http://", "ftp://", "file://" })
            {
                foreach (var userinfo in new[] { "", "user:pass@" })
                {
                    foreach (var subdomain in new[] { "", "subdomain." })
                    {
                        foreach (var domain in new[] { "domain", "localhost" })
                        {
                            foreach (var tld in new[] { "", ".com" })
                            {
                                foreach (var port in new[] { "", ":80" })
                                {
                                    foreach (var folder in new[] { "", "/", "/folder/" })
                                    {
                                        foreach (var file in new[] { "", "file.asp" })
                                        {
                                            foreach (var query in new[] { "", "?here=go&there=yup" })
                                            {
                                                foreach (var frag in new[] { "", "#fragment" })
                                                {
                                                    testUrl(table, scheme + userinfo + subdomain + domain + tld + port + folder + file + query + frag);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                foreach (var additionalUrl in new[]
                {
                    "//example.org/scheme-relative/URI/with/absolute/path/to/resource.txt", "/relative/URI/with/absolute/path/to/resource.txt",
                    "relative/path/to/resource.txt", "../../../resource.txt", "./resource.txt#frag01", "resource.txt", "#frag01", "www.world.com"
                })
                {
                    testUrl(table, additionalUrl);
                }
            }

            return(content);
        }
        protected override void loadData()
        {
            var fib = FormItemBlock.CreateFormItemTable();

            fib.AddFormItems(parametersModification.GetField1TextFormItem(true), parametersModification.GetField2TextFormItem(true));
            ph.AddControlsReturnThis(fib);

            ph.AddControlsReturnThis(
                new PostBackButton(
                    new ButtonActionControlStyle("Navigate and change Field 2"),
                    usesSubmitBehavior: false,
                    postBack: PostBack.CreateFull(actionGetter: () => new PostBackAction(new Info(es.info, new OptionalParameterPackage {
                Field2 = "bob"
            })))));

            var table = EwfTable.Create(headItems: new[] { new EwfTableItem("Url", "Valid?") });

            ph.AddControlsReturnThis(table);

            foreach (var scheme in new[] { "http://", "ftp://", "file://" })
            {
                foreach (var userinfo in new[] { "", "user:pass@" })
                {
                    foreach (var subdomain in new[] { "", "subdomain." })
                    {
                        foreach (var domain in new[] { "domain", "localhost" })
                        {
                            foreach (var tld in new[] { "", ".com" })
                            {
                                foreach (var port in new[] { "", ":80" })
                                {
                                    foreach (var folder in new[] { "", "/", "/folder/" })
                                    {
                                        foreach (var file in new[] { "", "file.asp" })
                                        {
                                            foreach (var query in new[] { "", "?here=go&there=yup" })
                                            {
                                                foreach (var frag in new[] { "", "#fragment" })
                                                {
                                                    testUrl(table, scheme + userinfo + subdomain + domain + tld + port + folder + file + query + frag);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                foreach (var additionalUrl in
                         new[]
                {
                    "//example.org/scheme-relative/URI/with/absolute/path/to/resource.txt", "/relative/URI/with/absolute/path/to/resource.txt",
                    "relative/path/to/resource.txt", "../../../resource.txt", "./resource.txt#frag01", "resource.txt", "#frag01", "www.world.com"
                })
                {
                    testUrl(table, additionalUrl);
                }
            }
        }
        protected override void loadData()
        {
            var logInPb =
                PostBack.CreateFull(
                    actionGetter:
                    () =>
                    new PostBackAction(user.MustChangePassword ? ChangePassword.Page.GetInfo(info.ReturnUrl) as ResourceInfo : new ExternalResourceInfo(info.ReturnUrl)));
            var newPasswordPb = PostBack.CreateFull(id: "newPw", actionGetter: getSendNewPasswordAction);

            var registeredTable = EwfTable.Create(caption: "Registered users");

            registeredTable.AddItem(
                new EwfTableItem(
                    ("You may log in to this system if you have registered your email address with " + FormsAuthStatics.SystemProvider.AdministratingCompanyName).ToCell(
                        new TableCellSetup(fieldSpan: 2))));

            emailAddress = new DataValue <string>();
            var emailVl = new BasicValidationList();

            registeredTable.AddItem(
                new EwfTableItem("Email address", emailAddress.GetEmailAddressFormItem("", "Please enter a valid email address.", emailVl).ToControl()));
            logInPb.AddValidations(emailVl);
            newPasswordPb.AddValidations(emailVl);

            var password = new DataValue <string>();

            registeredTable.AddItem(
                new EwfTableItem(
                    "Password",
                    FormItem.Create(
                        "",
                        new EwfTextBox("", masksCharacters: true),
                        validationGetter: control => new EwfValidation((pbv, v) => password.Value = control.GetPostBackValue(pbv), logInPb)).ToControl()));

            if (FormsAuthStatics.PasswordResetEnabled)
            {
                registeredTable.AddItem(
                    new EwfTableItem(
                        new PlaceHolder().AddControlsReturnThis(
                            "If you are a first-time user and do not know your password, or if you have forgotten your password, ".GetLiteralControl(),
                            new PostBackButton(newPasswordPb, new TextActionControlStyle("click here to immediately send yourself a new password."), usesSubmitBehavior: false))
                        .ToCell(new TableCellSetup(fieldSpan: 2))));
            }

            ph.AddControlsReturnThis(registeredTable);

            var specialInstructions = EwfUiStatics.AppProvider.GetSpecialInstructionsForLogInPage();

            if (specialInstructions != null)
            {
                ph.AddControlsReturnThis(specialInstructions);
            }
            else
            {
                var unregisteredTable = EwfTable.Create(caption: "Unregistered users");
                unregisteredTable.AddItem(new EwfTableItem("If you have difficulty logging in, please " + FormsAuthStatics.SystemProvider.LogInHelpInstructions));
                ph.AddControlsReturnThis(unregisteredTable);
            }

            EwfUiStatics.SetContentFootActions(new ActionButtonSetup("Log In", new PostBackButton(logInPb)));

            var logInMethod = FormsAuthStatics.GetLogInMethod(
                this,
                emailAddress,
                password,
                getUnregisteredEmailMessage(),
                "Incorrect password. If you do not know your password, enter your email address and send yourself a new password using the link below.",
                logInPb);

            logInPb.AddModificationMethod(() => user = logInMethod());
        }