Пример #1
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()));
        }
        private IReadOnlyCollection <FlowComponent> getNewCommentComponents(UpdateRegionSet createUpdateRegions)
        {
            if (AppTools.User == null)
            {
                return(new Paragraph(
                           new EwfHyperlink(
                               EnterpriseWebLibrary.EnterpriseWebFramework.UserManagement.Pages.LogIn.GetInfo(Home.GetInfo().GetUrl()),
                               new StandardHyperlinkStyle("Sign in")).Concat(" or ".ToComponents())
                           .Append(new EwfHyperlink(User.GetInfo(), new StandardHyperlinkStyle("sign up")))
                           .Concat(" to add comments on this article.".ToComponents())
                           .Materialize()).ToCollection());
            }

            commentMod = getCommentMod();
            return(FormState.ExecuteWithDataModificationsAndDefaultAction(
                       PostBack.CreateIntermediate(
                           createUpdateRegions.ToCollection(),
                           id: "comment",
                           modificationMethod: () => {
                commentMod.CommentId = MainSequence.GetNextValue();
                commentMod.Execute();
            })
                       .ToCollection(),
                       () => new FlowIdContainer(
                           commentMod.GetBodyTextTextControlFormItem(
                               false,
                               label: Enumerable.Empty <PhrasingComponent>().Materialize(),
                               controlSetup: TextControlSetup.Create(numberOfRows: 3, placeholder: "Write a comment..."),
                               value: "")
                           .ToComponentCollection()
                           .Append(new EwfButton(new StandardButtonStyle("Post Comment"))),
                           updateRegionSets: createUpdateRegions.ToCollection()).ToCollection()));
        }
Пример #3
0
        private IReadOnlyCollection <FlowComponent> getIdListRegionComponents()
        {
            var components = new List <FlowComponent>();

            var rs = new UpdateRegionSet();

            components.Add(
                new LineList(
                    new EwfButton(
                        new StandardButtonStyle("Add Item"),
                        behavior: new PostBackBehavior(
                            postBack: PostBack.CreateIntermediate(
                                rs.ToCollection(),
                                id: "idAdd",
                                firstModificationMethod: () =>
                                parametersModification.ItemIds = (parametersModification.ItemIds.Any() ? parametersModification.ItemIds.Min() - 1 : 0).ToCollection()
                                                                 .Concat(parametersModification.ItemIds)))).ToCollection()
                    .ToComponentListItem()
                    .ToLineListItemCollection()));

            var stack = new StackList(
                info.ItemIds.Select(getIdItem),
                setup: new ComponentListSetup(
                    itemInsertionUpdateRegions: new ItemInsertionUpdateRegion(rs.ToCollection(), () => parametersModification.ItemIds.First().ToString().ToCollection())
                    .ToCollection()));

            components.Add(new Section("Control List With ID Items", stack.ToCollection(), style: SectionStyle.Box));
            return(components);
        }
Пример #4
0
        private EwfTableItemGroup getItemGroup(int groupNumber)
        {
            var updateRegionSet = new UpdateRegionSet();

            return
                (new EwfTableItemGroup(
                     () =>
                     new EwfTableItemGroupRemainingData(
                         new PlaceHolder().AddControlsReturnThis("Group {0}".FormatWith(groupNumber).ToComponents().GetControls()),
                         groupHeadClickScript:
                         ClickScript.CreatePostBackScript(
                             PostBack.CreateIntermediate(
                                 null,
                                 id: "group{0}".FormatWith(groupNumber),
                                 firstModificationMethod: () => AddStatusMessage(StatusMessageType.Info, "You clicked group {0}.".FormatWith(groupNumber)))),
                         tailUpdateRegions: groupNumber == 1 ? new TailUpdateRegion(updateRegionSet.ToCollection(), 1).ToCollection() : null),
                     groupNumber == 1
                                                ? getItems(info.FirstGroupItemCount)
                     .Concat(
                         new Func <EwfTableItem>(
                             () =>
                             new EwfTableItem(
                                 new PostBackButton(
                                     new ButtonActionControlStyle("Add Row"),
                                     usesSubmitBehavior: false,
                                     postBack:
                                     PostBack.CreateIntermediate(
                                         updateRegionSet.ToCollection(),
                                         id: "addRow",
                                         firstModificationMethod: () => parametersModification.FirstGroupItemCount += 1)).ToCell(new TableCellSetup(fieldSpan: 2)))).ToCollection())
                                                : getItems(250)));
        }
        private IEnumerable <Control> getIdListRegionBlocks()
        {
            var rs = new UpdateRegionSet();

            yield return
                (new ControlLine(
                     new PostBackButton(
                         new ButtonActionControlStyle("Add Item"),
                         usesSubmitBehavior: false,
                         postBack:
                         PostBack.CreateIntermediate(
                             rs.ToCollection(),
                             id: "idAdd",
                             firstModificationMethod:
                             () =>
                             parametersModification.ItemIds =
                                 (parametersModification.ItemIds.Any() ? parametersModification.ItemIds.Min() - 1 : 0).ToCollection().Concat(parametersModification.ItemIds)))));

            var stack = ControlStack.Create(
                true,
                itemInsertionUpdateRegions:
                new ItemInsertionUpdateRegion(rs.ToCollection(), () => parametersModification.ItemIds.First().ToString().ToCollection()).ToCollection());

            foreach (var i in info.ItemIds)
            {
                stack.AddItem(getIdItem(i));
            }

            yield return(new Section("Control List With ID Items", stack.ToCollection(), style: SectionStyle.Box));
        }
        private IReadOnlyCollection <FlowComponent> getCommentComponents()
        {
            var components = new List <FlowComponent>();

            var createUpdateRegions = new UpdateRegionSet();

            components.AddRange(getNewCommentComponents(createUpdateRegions));

            var usersById = UsersTableRetrieval.GetRows().ToIdDictionary();

            components.Add(
                new StackList(
                    CommentsTableRetrieval.GetRows(new CommentsTableEqualityConditions.ArticleId(ArticleId))
                    .OrderByDescending(i => i.CommentId)
                    .Select(
                        i => {
                var deleteUpdateRegions = new UpdateRegionSet();
                return(new Paragraph(i.BodyText.ToComponents()).Append(getCommentFooter(i, usersById[i.AuthorId], deleteUpdateRegions))
                       .Materialize()
                       .ToComponentListItem(i.CommentId.ToString(), removalUpdateRegionSets: deleteUpdateRegions.ToCollection()));
            }),
                    setup: new ComponentListSetup(
                        classes: ElementClasses.Comment,
                        itemInsertionUpdateRegions: AppTools.User != null
                                                                                    ? new ItemInsertionUpdateRegion(
                            createUpdateRegions.ToCollection(),
                            () => commentMod.CommentId.ToString().ToCollection()).ToCollection()
                                                                                    : null)));

            return(components);
        }
Пример #7
0
        private ComponentListItem getNonIdItem(int i)
        {
            var rs = new UpdateRegionSet();

            var items = new List <ComponentListItem>();

            if (info.NonIdItemStates.ElementAt(i) == 1)
            {
                items.Add(new TextControl("Item {0}".FormatWith(i), true).ToFormItem().ToListItem());
            }
            else
            {
                items.Add("Item {0}".FormatWith(i).ToComponents().ToComponentListItem());
            }
            items.Add(
                new EwfButton(
                    new StandardButtonStyle("Toggle", buttonSize: ButtonSize.ShrinkWrap),
                    behavior: new PostBackBehavior(
                        postBack: PostBack.CreateIntermediate(
                            rs.ToCollection(),
                            id: PostBack.GetCompositeId("nonId", i.ToString()),
                            firstModificationMethod: () => parametersModification.NonIdItemStates =
                                parametersModification.NonIdItemStates.Select(
                                    (state, index) => index == i ? (state + 1) % 2 : state))))
                .ToCollection()
                .ToComponentListItem());

            return(new StackList(items).ToCollection().ToComponentListItem(updateRegionSets: rs.ToCollection()));
        }
        private IEnumerable <Control> getBasicRegionBlocks()
        {
            var rs = new UpdateRegionSet();
            var pb = PostBack.CreateIntermediate(rs.ToCollection(), id: "basic");

            yield return
                (new LegacyParagraph(new PostBackButton(new ButtonActionControlStyle("Toggle Basic Region Below"), usesSubmitBehavior: false, postBack: pb)));

            var regionControls    = new List <Control>();
            var dynamicFieldValue = new DataValue <string>();

            FormState.ExecuteWithDataModificationsAndDefaultAction(
                pb.ToCollection(),
                () => {
                if (info.Toggled)
                {
                    regionControls.Add(
                        FormItem.Create(
                            "Dynamic Field",
                            new EwfTextBox("This was just added!"),
                            validationGetter: control => new EwfValidation((pbv, validator) => dynamicFieldValue.Value = control.GetPostBackValue(pbv))).ToControl());
                }
                else
                {
                    regionControls.Add(new LegacyParagraph("Nothing here yet."));
                }
            });
            yield return
                (new NamingPlaceholder(new Section("Basic Update Region", regionControls, style: SectionStyle.Box).ToCollection(), updateRegionSets: rs.ToCollection()));

            pb.AddModificationMethod(() => parametersModification.Toggled = !parametersModification.Toggled);
            pb.AddModificationMethod(
                () =>
                AddStatusMessage(StatusMessageType.Info, info.Toggled ? "Dynamic field value was '{0}'.".FormatWith(dynamicFieldValue.Value) : "Dynamic field added."));
        }
 private FlowComponent getCommentFooter(CommentsTableRetrieval.Row comment, UsersTableRetrieval.Row author, UpdateRegionSet deleteUpdateRegions) =>
 new GenericFlowContainer(
     new GenericFlowContainer(
         new GenericPhrasingContainer(
             new EwfHyperlink(
                 Profile.GetInfo(comment.AuthorId),
                 new ImageHyperlinkStyle(
                     new ExternalResource(
                         author.ProfilePictureUrl.Any() ? author.ProfilePictureUrl : "https://static.productionready.io/images/smiley-cyrus.jpg"),
                     "")).ToCollection())
         .Append(
             new GenericPhrasingContainer(
                 new EwfHyperlink(Profile.GetInfo(comment.AuthorId), new StandardHyperlinkStyle(author.Username)).ToCollection()))
         .Append(new GenericPhrasingContainer(comment.CreationDateAndTime.ToDayMonthYearString(false).ToComponents()))
         .Materialize()).Concat <FlowComponent>(
         comment.AuthorId == AppTools.User?.UserId
                                                 ? new EwfButton(
             new StandardButtonStyle("Delete", icon: new ActionComponentIcon(new FontAwesomeIcon("fa-trash"))),
             behavior: new PostBackBehavior(
                 postBack: PostBack.CreateIntermediate(
                     deleteUpdateRegions.ToCollection(),
                     id: PostBack.GetCompositeId("delete", comment.CommentId.ToString()),
                     modificationMethod: () => CommentsModification.DeleteRows(new CommentsTableEqualityConditions.CommentId(comment.CommentId)))))
         .ToCollection()
                                                 : Enumerable.Empty <PhrasingComponent>())
     .Materialize());
Пример #10
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);
        }
Пример #11
0
        private EwfTableItemGroup getItemGroup(int groupNumber)
        {
            var updateRegionSet = new UpdateRegionSet();

            return(EwfTableItemGroup.Create(
                       () => new EwfTableItemGroupRemainingData(
                           "Group {0}".FormatWith(groupNumber).ToComponents(),
                           groupActions: groupNumber == 2
                                                              ? new ButtonSetup(
                               "Action 1",
                               behavior: new PostBackBehavior(
                                   postBack: PostBack.CreateIntermediate(
                                       null,
                                       id: PostBack.GetCompositeId(groupNumber.ToString(), "action1"),
                                       modificationMethod: () => AddStatusMessage(StatusMessageType.Info, "Action 1")))).Append(
                               new ButtonSetup(
                                   "Action 2",
                                   behavior: new PostBackBehavior(
                                       postBack: PostBack.CreateIntermediate(
                                           null,
                                           id: PostBack.GetCompositeId(groupNumber.ToString(), "action2"),
                                           modificationMethod: () => AddStatusMessage(StatusMessageType.Info, "Action 2")))))
                           .Materialize()
                                                              : null,
                           groupHeadActivationBehavior: ElementActivationBehavior.CreateButton(
                               new PostBackBehavior(
                                   postBack: PostBack.CreateIntermediate(
                                       null,
                                       id: "group{0}".FormatWith(groupNumber),
                                       modificationMethod: () => AddStatusMessage(StatusMessageType.Info, "You clicked group {0}.".FormatWith(groupNumber))))),
                           tailUpdateRegions: groupNumber == 1 ? new TailUpdateRegion(updateRegionSet.ToCollection(), 1).ToCollection() : null),
                       groupNumber == 1
                                        ? getItems(FirstGroupItemCount, true)
                       .Concat(
                           new Func <EwfTableItem>(
                               () => EwfTableItem.Create(
                                   new EwfButton(
                                       new StandardButtonStyle("Add Row"),
                                       behavior: new PostBackBehavior(
                                           postBack: PostBack.CreateIntermediate(
                                               updateRegionSet.ToCollection(),
                                               id: "addRow",
                                               modificationMethod: () => parametersModification.FirstGroupItemCount += 1))).ToCollection()
                                   .ToCell(),
                                   "".ToCell())).ToCollection())
                                        : getItems(250, false),
                       selectedItemActions: groupNumber == 1
                                                             ? SelectedItemAction.CreateWithIntermediatePostBackBehavior <int>(
                           "Echo group IDs",
                           null,
                           ids => AddStatusMessage(
                               StatusMessageType.Info,
                               StringTools.GetEnglishListPhrase(ids.Select(i => i.ToString()), true)))
                       .ToCollection()
                                                             : Enumerable.Empty <SelectedItemAction <int> >().Materialize()));
        }
Пример #12
0
 private IReadOnlyCollection <PhrasingComponent> getTagListComponents(DataValue <IReadOnlyCollection <int> > tagIds, UpdateRegionSet removeUpdateRegions) =>
 tagIds.Value.Select(
     tagId => new GenericPhrasingContainer(
         new EwfButton(
             new CustomButtonStyle(children: new FontAwesomeIcon("fa-times").ToCollection()),
             behavior: new PostBackBehavior(
                 postBack: PostBack.CreateIntermediate(
                     removeUpdateRegions.ToCollection(),
                     id: PostBack.GetCompositeId("removeTag", tagId.ToString()),
                     modificationMethod: () => tagIds.Value = tagIds.Value.Where(i => i != tagId).Materialize())))
         .Concat(" {0}".FormatWith(TagsTableRetrieval.GetRowMatchingId(tagId).TagName).ToComponents())
         .Materialize(),
         classes: ElementClasses.EditorTag))
 .Materialize();
        private ControlListItem getNonIdItem(int i)
        {
            var rs = new UpdateRegionSet();
            var pb = PostBack.CreateIntermediate(rs.ToCollection(), id: PostBack.GetCompositeId("nonId", i.ToString()));

            var itemStack = ControlStack.Create(true);

            if (info.NonIdItemStates.ElementAt(i) == 1)
            {
                itemStack.AddControls(new EwfTextBox("Item {0}".FormatWith(i)));
            }
            else
            {
                itemStack.AddText("Item {0}".FormatWith(i));
            }
            itemStack.AddControls(
                new PostBackButton(new ButtonActionControlStyle("Toggle", buttonSize: ButtonSize.ShrinkWrap), usesSubmitBehavior: false, postBack: pb));

            pb.AddModificationMethod(
                () => parametersModification.NonIdItemStates = parametersModification.NonIdItemStates.Select((state, index) => index == i ? (state + 1) % 2 : state));

            return(new ControlListItem(itemStack.ToCollection(), updateRegionSets: rs.ToCollection()));
        }
Пример #14
0
        private IReadOnlyCollection <PhrasingComponent> getGlobalTabComponents(DataValue <string> filter, UpdateRegionSet resultUpdateRegions)
        {
            const string label = "Global Feed";

            return(filter.Value != "user" && !filter.Value.StartsWith("tag")
                                       ? label.ToComponents()
                                       : new EwfButton(
                       new StandardButtonStyle(label),
                       behavior: new PostBackBehavior(
                           postBack: PostBack.CreateIntermediate(
                               resultUpdateRegions.ToCollection(),
                               id: "global",
                               modificationMethod: () => filter.Value = "global"))).ToCollection());
        }
Пример #15
0
        private IReadOnlyCollection <FlowComponent> getNonIdListRegionComponents()
        {
            var components = new List <FlowComponent>();

            var addRs    = new UpdateRegionSet();
            var removeRs = new UpdateRegionSet();

            components.Add(
                new LineList(
                    new EwfButton(
                        new StandardButtonStyle("Add Two Items"),
                        behavior: new PostBackBehavior(
                            postBack: PostBack.CreateIntermediate(
                                addRs.ToCollection(),
                                id: "nonIdAdd",
                                firstModificationMethod: () => parametersModification.NonIdItemStates = parametersModification.NonIdItemStates.Concat(new[] { 0, 0 }))))
                    .ToCollection()
                    .Append(
                        new EwfButton(
                            new StandardButtonStyle("Remove Two Items"),
                            behavior: new PostBackBehavior(
                                postBack: PostBack.CreateIntermediate(
                                    removeRs.ToCollection(),
                                    id: "nonIdRemove",
                                    firstModificationMethod: () =>
                                    parametersModification.NonIdItemStates =
                                        parametersModification.NonIdItemStates.Take(parametersModification.NonIdItemStates.Count() - 2)))))
                    .Select(i => (LineListItem)i.ToCollection().ToComponentListItem())));

            var stack = new StackList(
                Enumerable.Range(0, info.NonIdItemStates.Count()).Select(getNonIdItem),
                setup: new ComponentListSetup(
                    tailUpdateRegions: new[] { new TailUpdateRegion(addRs.ToCollection(), 0), new TailUpdateRegion(removeRs.ToCollection(), 2) }));

            components.Add(new Section("Control List With Non-ID Items", stack.ToCollection(), style: SectionStyle.Box));
            return(components);
        }
Пример #16
0
        private static PhrasingComponent getFavoriteActionComponent(
            ArticlesRetrieval.Row article, ILookup <int, FavoritesTableRetrieval.Row> favoritesByArticleId)
        {
            var count = favoritesByArticleId[article.ArticleId].Count().ToString();

            if (AppTools.User == null)
            {
                return(new EwfHyperlink(User.GetInfo(), new StandardHyperlinkStyle(count, icon: new ActionComponentIcon(new FontAwesomeIcon("fa-heart-o")))));
            }

            var       rs = new UpdateRegionSet();
            EwfButton button;

            if (FavoritesTableRetrieval.GetRowMatchingPk(AppTools.User.UserId, article.ArticleId, returnNullIfNoMatch: true) == null)
            {
                button = new EwfButton(
                    new StandardButtonStyle(count, icon: new ActionComponentIcon(new FontAwesomeIcon("fa-heart-o"))),
                    behavior: new PostBackBehavior(
                        postBack: PostBack.CreateIntermediate(
                            rs.ToCollection(),
                            id: PostBack.GetCompositeId("favorite", article.ArticleId.ToString()),
                            modificationMethod: () => FavoritesModification.InsertRow(AppTools.User.UserId, article.ArticleId))));
            }
            else
            {
                button = new EwfButton(
                    new StandardButtonStyle(count, icon: new ActionComponentIcon(new FontAwesomeIcon("fa-heart"))),
                    behavior: new PostBackBehavior(
                        postBack: PostBack.CreateIntermediate(
                            rs.ToCollection(),
                            id: PostBack.GetCompositeId("unfavorite", article.ArticleId.ToString()),
                            modificationMethod: () => FavoritesModification.DeleteRows(
                                new FavoritesTableEqualityConditions.UserId(AppTools.User.UserId),
                                new FavoritesTableEqualityConditions.ArticleId(article.ArticleId)))));
            }
            return(new PhrasingIdContainer(button.ToCollection(), updateRegionSets: rs.ToCollection()));
        }
Пример #17
0
        private IReadOnlyCollection <PhrasingComponent> getUserTabComponents(DataValue <string> filter, UpdateRegionSet resultUpdateRegions)
        {
            const string label = "Your Feed";

            return(AppTools.User != null
                                       ? filter.Value == "user" ? label.ToComponents() :
                   new EwfButton(
                       new StandardButtonStyle(label),
                       behavior: new PostBackBehavior(
                           postBack: PostBack.CreateIntermediate(
                               resultUpdateRegions.ToCollection(),
                               id: "user",
                               modificationMethod: () => filter.Value = "user"))).ToCollection()
                                       : Enumerable.Empty <PhrasingComponent>().Materialize());
        }
Пример #18
0
        private IEnumerable <FlowComponent> getBasicRegionComponents()
        {
            var rs = new UpdateRegionSet();
            var pb = PostBack.CreateIntermediate(rs.ToCollection(), id: "basic");

            yield return(new Paragraph(
                             new EwfButton(new StandardButtonStyle("Toggle Basic Region Below"), behavior: new PostBackBehavior(postBack: pb)).ToCollection()));

            var regionComponents  = new List <FlowComponent>();
            var dynamicFieldValue = new DataValue <string>();

            FormState.ExecuteWithDataModificationsAndDefaultAction(
                pb.ToCollection(),
                () => {
                if (info.Toggled)
                {
                    regionComponents.AddRange(
                        dynamicFieldValue.ToTextControl(true, value: "This was just added!")
                        .ToFormItem(label: "Dynamic Field".ToComponents())
                        .ToComponentCollection());
                }
                else
                {
                    regionComponents.Add(new Paragraph("Nothing here yet.".ToComponents()));
                }
            });
            yield return(new FlowIdContainer(
                             new Section("Basic Update Region", regionComponents, style: SectionStyle.Box).ToCollection(),
                             updateRegionSets: rs.ToCollection()));

            pb.AddModificationMethod(() => parametersModification.Toggled = !parametersModification.Toggled);
            pb.AddModificationMethod(
                () => AddStatusMessage(
                    StatusMessageType.Info,
                    info.Toggled ? "Dynamic field value was '{0}'.".FormatWith(dynamicFieldValue.Value) : "Dynamic field added."));
        }
        private ControlListItem getIdItem(int id)
        {
            var rs = new UpdateRegionSet();
            var pb = PostBack.CreateIntermediate(rs.ToCollection(), id: PostBack.GetCompositeId("id", id.ToString()));

            var itemStack = ControlStack.Create(true);

            itemStack.AddControls(new EwfTextBox("ID {0}".FormatWith(id)));
            itemStack.AddControls(
                new PostBackButton(new ButtonActionControlStyle("Remove", buttonSize: ButtonSize.ShrinkWrap), usesSubmitBehavior: false, postBack: pb));

            pb.AddModificationMethod(() => parametersModification.ItemIds = parametersModification.ItemIds.Where(i => i != id).ToArray());

            return(new ControlListItem(itemStack.ToCollection(), id.ToString(), removalUpdateRegionSets: rs.ToCollection()));
        }
        private IEnumerable <Control> getNonIdListRegionBlocks()
        {
            var addRs    = new UpdateRegionSet();
            var removeRs = new UpdateRegionSet();

            yield return
                (new ControlLine(
                     new PostBackButton(
                         new ButtonActionControlStyle("Add Two Items"),
                         usesSubmitBehavior: false,
                         postBack:
                         PostBack.CreateIntermediate(
                             addRs.ToCollection(),
                             id: "nonIdAdd",
                             firstModificationMethod: () => parametersModification.NonIdItemStates = parametersModification.NonIdItemStates.Concat(new[] { 0, 0 }))),
                     new PostBackButton(
                         new ButtonActionControlStyle("Remove Two Items"),
                         usesSubmitBehavior: false,
                         postBack:
                         PostBack.CreateIntermediate(
                             removeRs.ToCollection(),
                             id: "nonIdRemove",
                             firstModificationMethod:
                             () => parametersModification.NonIdItemStates = parametersModification.NonIdItemStates.Take(parametersModification.NonIdItemStates.Count() - 2)))));

            var stack = ControlStack.Create(
                true,
                tailUpdateRegions: new[] { new TailUpdateRegion(addRs.ToCollection(), 0), new TailUpdateRegion(removeRs.ToCollection(), 2) });

            for (var i = 0; i < info.NonIdItemStates.Count(); i += 1)
            {
                stack.AddItem(getNonIdItem(i));
            }

            yield return(new Section("Control List With Non-ID Items", stack.ToCollection(), style: SectionStyle.Box));
        }
Пример #21
0
        private FormItem getTagFormItem(DataValue <IReadOnlyCollection <int> > tagIds)
        {
            var addUpdateRegions    = new UpdateRegionSet();
            var tagName             = new DataValue <string>();
            var removeUpdateRegions = new UpdateRegionSet();

            return(new FlowIdContainer(
                       FormState.ExecuteWithDataModificationsAndDefaultAction(
                           PostBack.CreateIntermediate(addUpdateRegions.ToCollection(), id: "addTag", modificationMethod: () => addTag(tagIds, tagName)).ToCollection(),
                           () => new TextControl(
                               "",
                               false,
                               maxLength: TagsTable.TagNameColumn.Size,
                               validationMethod: (postBackValue, validator) => tagName.Value = postBackValue))
                       .ToFormItem()
                       .ToComponentCollection(),
                       updateRegionSets: addUpdateRegions.ToCollection()).Append <FlowComponent>(new LineBreak())
                   .Append(
                       new PhrasingIdContainer(
                           getTagListComponents(tagIds, removeUpdateRegions),
                           updateRegionSets: addUpdateRegions.ToCollection().Append(removeUpdateRegions)))
                   .Materialize()
                   .ToFormItem(label: "Enter tags".ToComponents()));
        }
        private ComponentListItem getIdItem(int id)
        {
            var rs = new UpdateRegionSet();

            var items = new List <ComponentListItem>();

            items.Add(new TextControl("ID {0}".FormatWith(id), true).ToFormItem().ToListItem());
            items.Add(
                new EwfButton(
                    new StandardButtonStyle("Remove", buttonSize: ButtonSize.ShrinkWrap),
                    behavior: new PostBackBehavior(
                        postBack: PostBack.CreateIntermediate(
                            rs.ToCollection(),
                            id: PostBack.GetCompositeId("id", id.ToString()),
                            modificationMethod: () => parametersModification.ItemIds = parametersModification.ItemIds.Where(i => i != id).ToArray()))).ToCollection()
                .ToComponentListItem());

            return(new StackList(items).ToCollection().ToComponentListItem(id.ToString(), removalUpdateRegionSets: rs.ToCollection()));
        }
Пример #23
0
        private ComponentListItem getItemLimitButtonItem(DataRowLimit itemLimit, UpdateRegionSet updateRegionSet)
        {
            var text = itemLimit == DataRowLimit.Unlimited ? "All" : ((int)itemLimit).ToString();

            if (itemLimit == (DataRowLimit)CurrentItemLimit)
            {
                return(text.ToComponents().ToComponentListItem());
            }
            return
                (new EwfButton(
                     new StandardButtonStyle(text, buttonSize: ButtonSize.ShrinkWrap),
                     behavior:
                     new PostBackBehavior(
                         postBack:
                         PostBack.CreateIntermediate(
                             updateRegionSet.ToCollection(),
                             id: PostBack.GetCompositeId(postBackIdBase, itemLimit.ToString()),
                             firstModificationMethod: () => EwfPage.Instance.PageState.SetValue(this, itemLimitPageStateKey, (int)itemLimit)))).ToCollection()
                 .ToComponentListItem());
        }
Пример #24
0
        private FlowComponent getTagSection(DataValue <string> filter, UpdateRegionSet resultUpdateRegions)
        {
            var tags = ArticleTagsTableRetrieval.GetRows()
                       .Select(i => i.TagId)
                       .GroupBy(i => i)
                       .OrderByDescending(i => i.Count())
                       .Take(20)
                       .Select(i => TagsTableRetrieval.GetRowMatchingId(i.Key));

            return(new Section(
                       "Popular Tags",
                       new WrappingList(
                           tags.Select(
                               i => (WrappingListItem) new EwfButton(
                                   new StandardButtonStyle(i.TagName, buttonSize: ButtonSize.ShrinkWrap),
                                   behavior: new PostBackBehavior(
                                       postBack: PostBack.CreateIntermediate(
                                           resultUpdateRegions.ToCollection(),
                                           id: PostBack.GetCompositeId("tag", i.TagId.ToString()),
                                           modificationMethod: () => filter.Value = "tag{0}".FormatWith(i.TagId)))).ToComponentListItem()),
                           generalSetup: new ComponentListSetup(classes: ElementClasses.Tag)).ToCollection(),
                       style: SectionStyle.Box));
        }
Пример #25
0
 private FlowComponent getArticleSection(DataValue <string> filter, UpdateRegionSet resultUpdateRegions) =>
 new Section(
     new LineList(
         new[]
 {
     getUserTabComponents(filter, resultUpdateRegions), getGlobalTabComponents(filter, resultUpdateRegions),
     getTagTabComponents(filter.Value)
 }.Where(i => i.Any())
         .Select(i => (LineListItem)i.ToComponentListItem()),
         verticalAlignment: FlexboxVerticalAlignment.Center).Append <FlowComponent>(
         new FlowIdContainer(getResultTable(filter.Value).ToCollection(), updateRegionSets: resultUpdateRegions.ToCollection()))
     .Materialize());
Пример #26
0
        void ControlTreeDataLoader.LoadData()
        {
            using (MiniProfiler.Current.Step("EWF - Load table data")) {
                FormState.ExecuteWithDataModificationsAndDefaultAction(
                    dataModifications,
                    () => {
                    if (hideIfEmpty && itemGroups.All(itemGroup => !itemGroup.Items.Any()))
                    {
                        Visible = false;
                        return;
                    }

                    SetUpTableAndCaption(this, style, classes, caption, subCaption);

                    var visibleItemGroupsAndItems = new List <Tuple <EwfTableItemGroup, IReadOnlyCollection <EwfTableItem> > >();
                    foreach (var itemGroup in itemGroups)
                    {
                        var visibleItems = itemGroup.Items.Take(CurrentItemLimit - visibleItemGroupsAndItems.Sum(i => i.Item2.Count)).Select(i => i());
                        visibleItemGroupsAndItems.Add(Tuple.Create <EwfTableItemGroup, IReadOnlyCollection <EwfTableItem> >(itemGroup, visibleItems.ToImmutableArray()));
                        if (visibleItemGroupsAndItems.Sum(i => i.Item2.Count) == CurrentItemLimit)
                        {
                            break;
                        }
                    }

                    var fields = GetFields(specifiedFields, headItems.AsReadOnly(), visibleItemGroupsAndItems.SelectMany(i => i.Item2));
                    if (!fields.Any())
                    {
                        fields = new EwfTableField().ToCollection();
                    }

                    addColumnSpecifications(fields);

                    var allVisibleItems = new List <EwfTableItem>();

                    var itemLimitingUpdateRegionSet = new UpdateRegionSet();
                    var headRows =
                        buildRows(
                            getItemLimitingAndGeneralActionsItem(fields.Count, itemLimitingUpdateRegionSet).Concat(getItemActionsItem(fields.Count)).ToList(),
                            Enumerable.Repeat(new EwfTableField(), fields.Count).ToArray(),
                            null,
                            false,
                            null,
                            null,
                            allVisibleItems).Concat(buildRows(headItems, fields, null, true, null, null, allVisibleItems)).ToArray();
                    if (headRows.Any())
                    {
                        Controls.Add(new WebControl(HtmlTextWriterTag.Thead).AddControlsReturnThis(headRows));
                    }

                    var bodyRowGroupsAndRows = new List <Tuple <WebControl, ImmutableArray <Control> > >();
                    var updateRegionSetListsAndStaticRowGroupCounts = new List <Tuple <IReadOnlyCollection <UpdateRegionSet>, int> >();
                    for (var visibleGroupIndex = 0; visibleGroupIndex < visibleItemGroupsAndItems.Count; visibleGroupIndex += 1)
                    {
                        var groupAndItems          = visibleItemGroupsAndItems[visibleGroupIndex];
                        var useContrastForFirstRow = visibleItemGroupsAndItems.Where((group, i) => i < visibleGroupIndex).Sum(i => i.Item2.Count) % 2 == 1;
                        var groupBodyRows          = buildRows(groupAndItems.Item2, fields, useContrastForFirstRow, false, null, null, allVisibleItems).ToImmutableArray();
                        var rowGroup =
                            new WebControl(HtmlTextWriterTag.Tbody).AddControlsReturnThis(
                                buildRows(
                                    groupAndItems.Item1.GetHeadItems(fields.Count),
                                    Enumerable.Repeat(new EwfTableField(), fields.Count).ToArray(),
                                    null,
                                    true,
                                    null,
                                    null,
                                    allVisibleItems).Concat(new NamingPlaceholder(groupBodyRows).ToCollection()));
                        bodyRowGroupsAndRows.Add(Tuple.Create(rowGroup, groupBodyRows));

                        var cachedVisibleGroupIndex = visibleGroupIndex;
                        EwfPage.Instance.AddUpdateRegionLinker(
                            new LegacyUpdateRegionLinker(
                                rowGroup,
                                "tail",
                                from region in groupAndItems.Item1.RemainingData.Value.TailUpdateRegions
                                let staticRowCount = itemGroups[cachedVisibleGroupIndex].Items.Count - region.UpdatingItemCount
                                                     select new LegacyPreModificationUpdateRegion(region.Sets, () => groupBodyRows.Skip(staticRowCount), staticRowCount.ToString),
                                arg => groupBodyRows.Skip(int.Parse(arg))));

                        // If item limiting is enabled, include all subsequent item groups in tail update regions since any number of items could be appended.
                        if (defaultItemLimit != DataRowLimit.Unlimited)
                        {
                            updateRegionSetListsAndStaticRowGroupCounts.Add(
                                Tuple.Create <IReadOnlyCollection <UpdateRegionSet>, int>(
                                    groupAndItems.Item1.RemainingData.Value.TailUpdateRegions.SelectMany(i => i.Sets).ToImmutableArray(),
                                    visibleGroupIndex + 1));
                        }
                    }
                    Controls.Add(new NamingPlaceholder(bodyRowGroupsAndRows.Select(i => i.Item1)));

                    if (defaultItemLimit != DataRowLimit.Unlimited)
                    {
                        var oldItemLimit   = CurrentItemLimit;
                        var lowerItemLimit = new Lazy <int>(() => Math.Min(oldItemLimit, CurrentItemLimit));

                        var itemLimitingTailUpdateRegionControlGetter = new Func <int, IEnumerable <Control> >(
                            staticItemCount => {
                            var rowCount = 0;
                            for (var groupIndex = 0; groupIndex < bodyRowGroupsAndRows.Count; groupIndex += 1)
                            {
                                var rows  = bodyRowGroupsAndRows[groupIndex].Item2;
                                rowCount += rows.Length;
                                if (rowCount < staticItemCount)
                                {
                                    continue;
                                }
                                return(rows.Skip(rows.Length - (rowCount - staticItemCount)).Concat(bodyRowGroupsAndRows.Skip(groupIndex + 1).Select(i => i.Item1)));
                            }
                            return(ImmutableArray <Control> .Empty);
                        });

                        EwfPage.Instance.AddUpdateRegionLinker(
                            new LegacyUpdateRegionLinker(
                                this,
                                "itemLimitingTail",
                                new LegacyPreModificationUpdateRegion(
                                    itemLimitingUpdateRegionSet.ToCollection(),
                                    () => itemLimitingTailUpdateRegionControlGetter(lowerItemLimit.Value),
                                    () => lowerItemLimit.Value.ToString()).ToCollection(),
                                arg => itemLimitingTailUpdateRegionControlGetter(int.Parse(arg))));
                    }

                    EwfPage.Instance.AddUpdateRegionLinker(
                        new LegacyUpdateRegionLinker(
                            this,
                            "tail",
                            from region in
                            tailUpdateRegions.Select(i => new { sets = i.Sets, staticRowGroupCount = itemGroups.Count - i.UpdatingItemCount })
                            .Concat(updateRegionSetListsAndStaticRowGroupCounts.Select(i => new { sets = i.Item1, staticRowGroupCount = i.Item2 }))
                            select
                            new LegacyPreModificationUpdateRegion(
                                region.sets,
                                () => bodyRowGroupsAndRows.Skip(region.staticRowGroupCount).Select(i => i.Item1),
                                region.staticRowGroupCount.ToString),
                            arg => bodyRowGroupsAndRows.Skip(int.Parse(arg)).Select(i => i.Item1)));

                    var itemCount            = itemGroups.Sum(i => i.Items.Count);
                    var itemLimitingRowGroup = new List <Control>();
                    if (CurrentItemLimit < itemCount)
                    {
                        var nextLimit          = EnumTools.GetValues <DataRowLimit>().First(i => i > (DataRowLimit)CurrentItemLimit);
                        var itemIncrementCount = Math.Min((int)nextLimit, itemCount) - CurrentItemLimit;
                        var button             = new PostBackButton(
                            new TextActionControlStyle("Show " + itemIncrementCount + " more item" + (itemIncrementCount != 1 ? "s" : "")),
                            usesSubmitBehavior: false,
                            postBack:
                            PostBack.CreateIntermediate(
                                itemLimitingUpdateRegionSet.ToCollection(),
                                id: PostBack.GetCompositeId(postBackIdBase, "showMore"),
                                firstModificationMethod: () => EwfPage.Instance.PageState.SetValue(this, itemLimitPageStateKey, (int)nextLimit)));
                        var item        = new EwfTableItem(button.ToCell(new TableCellSetup(fieldSpan: fields.Count)));
                        var useContrast = visibleItemGroupsAndItems.Sum(i => i.Item2.Count) % 2 == 1;
                        itemLimitingRowGroup.Add(
                            new WebControl(HtmlTextWriterTag.Tbody).AddControlsReturnThis(
                                buildRows(
                                    item.ToCollection().ToList(),
                                    Enumerable.Repeat(new EwfTableField(), fields.Count).ToArray(),
                                    useContrast,
                                    false,
                                    null,
                                    null,
                                    allVisibleItems)));
                    }
                    Controls.Add(
                        new NamingPlaceholder(
                            itemLimitingRowGroup,
                            updateRegionSets:
                            itemLimitingUpdateRegionSet.ToCollection()
                            .Concat(
                                itemGroups.SelectMany(i => i.RemainingData.Value.TailUpdateRegions).ToImmutableArray().Concat(tailUpdateRegions).SelectMany(i => i.Sets))));

                    // Assert that every visible item in the table has the same number of cells and store a data structure for below.
                    var cellPlaceholderListsForItems = TableOps.BuildCellPlaceholderListsForItems(allVisibleItems, fields.Count);

                    if (!disableEmptyFieldDetection)
                    {
                        AssertAtLeastOneCellPerField(fields, cellPlaceholderListsForItems);
                    }
                });
            }
        }
Пример #27
0
        protected override PageContent getContent()
        {
            AuthenticationStatics.CodeLoginModificationMethod codeLoginMethod = null;
            string destinationUrl = null;

            if (User.Any())
            {
                var postBack = PostBack.CreateFull(
                    modificationMethod: () => destinationUrl = codeLoginMethod(
                        User,
                        Code,
                        errorMessage:
                        "The login link you just used has expired. Please return to the page you were trying to access and send yourself another login email.")
                                                               .destinationUrl,
                    actionGetter: () => new PostBackAction(new ExternalResource(destinationUrl)));
                return(FormState.ExecuteWithDataModificationsAndDefaultAction(
                           postBack.ToCollection(),
                           () => {
                    var logInHiddenFieldsAndMethods = AuthenticationStatics.GetLogInHiddenFieldsAndMethods();
                    codeLoginMethod = logInHiddenFieldsAndMethods.modificationMethods.codeLoginMethod;
                    return new UiPageContent(pageLoadPostBack: postBack).Add(new Paragraph("Please wait.".ToComponents()))
                    .Add(logInHiddenFieldsAndMethods.hiddenFields);
                }));
            }

            var content = new UiPageContent(omitContentBox: true);

            var codeEntryIsForPasswordReset = ComponentStateItem.Create <bool?>("codeEntryIsForPasswordReset", null, value => true, false);

            var emailAddress = new DataValue <string>();
            var password     = new DataValue <string>();
            var loginCode    = new DataValue <string>();

            AuthenticationStatics.PasswordLoginModificationMethod passwordLoginMethod = null;
            AuthenticationStatics.LoginCodeSenderMethod           loginCodeSender     = null;

            var logInPb = PostBack.CreateFull(
                modificationMethod: () => {
                if (codeEntryIsForPasswordReset.Value.Value.HasValue)
                {
                    destinationUrl = codeLoginMethod(emailAddress.Value, loginCode.Value).destinationUrl;
                }
                else
                {
                    passwordLoginMethod(emailAddress, password);
                }
            },
                actionGetter: () => new PostBackAction(new ExternalResource(codeEntryIsForPasswordReset.Value.Value.HasValue ? destinationUrl : ReturnUrl)));

            var          authenticationModeUpdateRegion = new UpdateRegionSet();
            const string passwordOrCodeFocusKey         = "code";
            var          sendCodePb = codeEntryIsForPasswordReset.Value.Value != true
                                                 ? PostBack.CreateIntermediate(
                authenticationModeUpdateRegion.ToCollection(),
                id : "sendCode",
                modificationMethod : () => {
                loginCodeSender(emailAddress, false, ReturnUrl);
                codeEntryIsForPasswordReset.Value.Value = false;
            },
                reloadBehaviorGetter : () => new PageReloadBehavior(focusKey: passwordOrCodeFocusKey))
                                                 : null;

            var newPasswordPb = codeEntryIsForPasswordReset.Value.Value != false
                                                    ? PostBack.CreateIntermediate(
                authenticationModeUpdateRegion.ToCollection(),
                id : "newPw",
                modificationMethod : () => {
                loginCodeSender(emailAddress, true, ReturnUrl);
                codeEntryIsForPasswordReset.Value.Value = true;
            },
                reloadBehaviorGetter : () => new PageReloadBehavior(focusKey: passwordOrCodeFocusKey))
                                                    : null;

            FormState.ExecuteWithDataModificationsAndDefaultAction(
                logInPb.ToCollection(),
                () => {
                var registeredComponents = new List <FlowComponent>();
                registeredComponents.Add(
                    new Paragraph(
                        "You may log in to this system if you have registered your email address with {0}."
                        .FormatWith(UserManagementStatics.LocalIdentityProvider.AdministratingOrganizationName)
                        .ToComponents()));

                registeredComponents.Add(
                    FormItemList.CreateStack(
                        generalSetup: new FormItemListSetup(buttonSetup: new ButtonSetup("Log In"), enableSubmitButton: true),
                        items: FormState
                        .ExecuteWithDataModificationsAndDefaultAction(
                            new[] { logInPb, sendCodePb, newPasswordPb }.Where(i => i != null),
                            () => emailAddress.GetEmailAddressFormItem("Email address".ToComponents()))
                        .Append(
                            codeEntryIsForPasswordReset.Value.Value.HasValue
                                                                                ? getLoginCodeFormItem(authenticationModeUpdateRegion.ToCollection(), AutofocusCondition.PostBack(passwordOrCodeFocusKey), loginCode)
                                                                                : getPasswordFormItem(
                                authenticationModeUpdateRegion.ToCollection(),
                                AutofocusCondition.PostBack(passwordOrCodeFocusKey),
                                password,
                                new PostBackBehavior(postBack: sendCodePb)))
                        .Materialize()));

                registeredComponents.Add(
                    new Paragraph(
                        new PhrasingIdContainer(
                            codeEntryIsForPasswordReset.Value.Value.HasValue
                                                                        ? new ImportantContent("Having trouble?".ToComponents()).ToCollection()
                            .Concat(" ".ToComponents())
                            .Append(
                                new EwfButton(
                                    new StandardButtonStyle("Send me another code", buttonSize: ButtonSize.ShrinkWrap),
                                    behavior: new PostBackBehavior(postBack: codeEntryIsForPasswordReset.Value.Value.Value ? newPasswordPb : sendCodePb)))
                            .Concat(" ".ToComponents())
                            .Append(
                                new EwfButton(
                                    new StandardButtonStyle(
                                        codeEntryIsForPasswordReset.Value.Value.Value ? "Try password again" : "Log in with password",
                                        buttonSize: ButtonSize.ShrinkWrap),
                                    behavior: new PostBackBehavior(
                                        postBack: PostBack.CreateIntermediate(
                                            authenticationModeUpdateRegion.ToCollection(),
                                            id: "revertToPasswordEntry",
                                            modificationMethod: () => codeEntryIsForPasswordReset.Value.Value = null,
                                            reloadBehaviorGetter: () => new PageReloadBehavior(focusKey: passwordOrCodeFocusKey)))))
                                                                        : new ImportantContent("Forgot password?".ToComponents()).ToCollection()
                            .Concat(" ".ToComponents())
                            .Append(
                                new EwfButton(
                                    new StandardButtonStyle("Set a new password", buttonSize: ButtonSize.ShrinkWrap),
                                    behavior: new ConfirmationButtonBehavior(
                                        new Paragraph("Are you sure you want to set a new password?".ToComponents()).Append(
                                            new Paragraph(
                                                StringTools.ConcatenateWithDelimiter(
                                                    " ",
                                                    "Click \"Continue\" to email yourself a login code.",
                                                    "After logging in, you will be prompted to change your password to something you will remember, which you may use to log in from that point forward.")
                                                .ToComponents()))
                                        .Materialize(),
                                        postBack: newPasswordPb))),
                            updateRegionSets: authenticationModeUpdateRegion.ToCollection()).ToCollection()));

                var logInHiddenFieldsAndMethods = FormState.ExecuteWithDataModificationsAndDefaultAction(
                    new[] { logInPb, sendCodePb, newPasswordPb }.Where(i => i != null),
                    AuthenticationStatics.GetLogInHiddenFieldsAndMethods);

                content.Add(
                    new FlowAutofocusRegion(
                        AutofocusCondition.InitialRequest(),
                        new Section(
                            "Registered users",
                            registeredComponents,
                            style: SectionStyle.Box,
                            etherealContent: logInHiddenFieldsAndMethods.hiddenFields.Append(codeEntryIsForPasswordReset).Materialize()).ToCollection()));

                passwordLoginMethod = logInHiddenFieldsAndMethods.modificationMethods.passwordLoginMethod;
                loginCodeSender     = logInHiddenFieldsAndMethods.modificationMethods.loginCodeSender;
                codeLoginMethod     = logInHiddenFieldsAndMethods.modificationMethods.codeLoginMethod;
            });

            var specialInstructions = EwfUiStatics.AppProvider.GetSpecialInstructionsForLogInPage();

            if (specialInstructions.Any())
            {
                content.Add(specialInstructions);
            }
            else
            {
                var unregisteredComponents = new List <FlowComponent>();
                unregisteredComponents.Add(
                    new Paragraph(
                        "If you have difficulty logging in, please {0}".FormatWith(UserManagementStatics.LocalIdentityProvider.LogInHelpInstructions).ToComponents()));
                content.Add(new Section("Unregistered users", unregisteredComponents, style: SectionStyle.Box));
            }

            return(content);
        }