Ejemplo n.º 1
0
        protected override PageContent getContent()
        {
            var content = new UiPageContent(isAutoDataUpdater: true);

            var omni = FormItemList.CreateGrid(numberOfColumns: 7);

            var boxId = new ModalBoxId();

            omni.AddFormItems(
                new TextControl("", true).ToFormItem(
                    setup: new FormItemSetup(columnSpan: 2),
                    label: "Model number ".ToComponents()
                    .Append(
                        new EwfButton(
                            new StandardButtonStyle("(popup)", buttonSize: ButtonSize.ShrinkWrap),
                            behavior: new OpenModalBehavior(boxId, etherealChildren: new ModalBox(boxId, true, "More information...".ToComponents()).ToCollection())))
                    .Materialize()),
                "".ToComponents().ToFormItem(label: "Normal price".ToComponents()),
                new TextControl("", true).ToFormItem(label: "Actual price".ToComponents()),
                new TextControl("", true).ToFormItem(label: "Quantity".ToComponents()),
                "".ToComponents().ToFormItem(label: "Inventory".ToComponents()),
                "".ToComponents().ToFormItem(label: "Bill Number".ToComponents()));
            content.Add(omni);

            return(content);
        }
Ejemplo n.º 2
0
        protected override void loadData()
        {
            var omni = FormItemList.CreateGrid(numberOfColumns: 7);

            var boxId = new ModalBoxId();

            new ModalBox(boxId, true, "More information...".ToComponents()).ToCollection().AddEtherealControls(this);

            omni.AddFormItems(
                new TextControl("", true).ToFormItem(
                    setup: new FormItemSetup(columnSpan: 2),
                    label: "Model number ".ToComponents()
                    .Append(new EwfButton(new StandardButtonStyle("(popup)", buttonSize: ButtonSize.ShrinkWrap), behavior: new OpenModalBehavior(boxId)))
                    .Materialize()),
                "".ToComponents().ToFormItem(label: "Normal price".ToComponents()),
                new TextControl("", true).ToFormItem(label: "Actual price".ToComponents()),
                new TextControl("", true).ToFormItem(label: "Quantity".ToComponents()),
                "".ToComponents().ToFormItem(label: "Inventory".ToComponents()),
                "".ToComponents().ToFormItem(label: "Bill Number".ToComponents()));
            ph.AddControlsReturnThis(omni.ToCollection().GetControls());
        }
Ejemplo n.º 3
0
        private FlowComponent getFormItemStack(UsersModification mod, DataValue <string> password)
        {
            var stack = FormItemList.CreateStack();

            if (AppTools.User != null)
            {
                stack.AddItem(mod.GetProfilePictureUrlUrlControlFormItem(true, label: "URL of profile picture".ToComponents()));
            }
            stack.AddItem(mod.GetUsernameTextControlFormItem(false, label: "Username".ToComponents(), value: AppTools.User == null ? "" : null));
            if (AppTools.User != null)
            {
                stack.AddItem(
                    mod.GetShortBioTextControlFormItem(true, label: "Short bio about you".ToComponents(), controlSetup: TextControlSetup.Create(numberOfRows: 8)));
            }
            stack.AddItem(mod.GetEmailAddressEmailAddressControlFormItem(false, label: "Email".ToComponents(), value: AppTools.User == null ? "" : null));

            if (AppTools.User == null)
            {
                stack.AddItems(password.GetPasswordModificationFormItems());
            }
            else
            {
                var changePasswordChecked = new DataValue <bool>();
                stack.AddItem(
                    changePasswordChecked.ToFlowCheckbox(
                        "Change password".ToComponents(),
                        setup: FlowCheckboxSetup.Create(
                            nestedContentGetter: () => FormState.ExecuteWithValidationPredicate(
                                () => changePasswordChecked.Value,
                                () => FormItemList.CreateGrid(1, items: password.GetPasswordModificationFormItems()).ToCollection())),
                        value: false)
                    .ToFormItem());
            }

            return(stack);
        }
        void ControlTreeDataLoader.LoadData()
        {
            basicBody.Attributes.Add("onpagehide", "deactivateProcessingDialog();");
            form.Action = EwfPage.Instance.InfoAsBaseType.GetUrl();

            ph.AddControlsReturnThis(
                new NamingPlaceholder(
                    EwfPage.Instance.StatusMessages.Any() && statusMessagesDisplayAsNotification()
                                                ? new Block {
                CssClass = notificationSpacerClass
            }.ToCollection()
                                                : Enumerable.Empty <Control>()));

            var warningLines = new List <IReadOnlyCollection <PhrasingComponent> >();

            if (!ConfigurationStatics.IsLiveInstallation)
            {
                var components = new List <PhrasingComponent>();
                components.Add(new FontAwesomeIcon("fa-exclamation-triangle", "fa-lg"));
                components.AddRange(" This is not the live system. Changes made here will be lost and are not recoverable. ".ToComponents());
                if (ConfigurationStatics.IsIntermediateInstallation && AppRequestState.Instance.IntermediateUserExists)
                {
                    components.AddRange(
                        new EwfButton(
                            new StandardButtonStyle("Log out", buttonSize: ButtonSize.ShrinkWrap),
                            behavior: new PostBackBehavior(
                                postBack: PostBack.CreateFull(
                                    id: "ewfIntermediateLogOut",
                                    firstModificationMethod: NonLiveInstallationStatics.ClearIntermediateAuthenticationCookie,
                                    actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))))).Concat(" ".ToComponents()));
                }
                components.Add(
                    new EwfButton(
                        new StandardButtonStyle(
                            "Hide this warning",
                            buttonSize: ButtonSize.ShrinkWrap,
                            icon: new ActionComponentIcon(new FontAwesomeIcon("fa-eye-slash"))),
                        behavior: new PostBackBehavior(
                            postBack: PostBack.CreateIntermediate(
                                null,
                                id: "ewfHideNonLiveWarnings",
                                firstModificationMethod: NonLiveInstallationStatics.SetWarningsHiddenCookie))));
                if (ConfigurationStatics.IsIntermediateInstallation && AppRequestState.Instance.IntermediateUserExists)
                {
                    var boxId = new ModalBoxId();
                    components.AddRange(
                        " ".ToComponents()
                        .Append(
                            new EwfButton(
                                new StandardButtonStyle("Get link", buttonSize: ButtonSize.ShrinkWrap, icon: new ActionComponentIcon(new FontAwesomeIcon("fa-link"))),
                                behavior: new OpenModalBehavior(
                                    boxId,
                                    etherealChildren: new ModalBox(
                                        boxId,
                                        true,
                                        FormItemList.CreateGrid(
                                            1,
                                            items: new[] { false, true }.Select(
                                                i => {
                        var url = AppRequestState.Instance.Url;
                        if (AppRequestState.Instance.UserAccessible && AppRequestState.Instance.ImpersonatorExists)
                        {
                            url = SelectUser.GetInfo(
                                url,
                                optionalParameterPackage: new SelectUser.OptionalParameterPackage {
                                User = AppTools.User.Email
                            })
                                  .GetUrl();
                        }
                        url = IntermediateLogIn.GetInfo(
                            url,
                            new IntermediateLogIn.OptionalParameterPackage
                        {
                            Password = ConfigurationStatics.SystemGeneralProvider.IntermediateLogInPassword, HideWarnings = i
                        })
                              .GetUrl();
                        return(new GenericPhrasingContainer(
                                   url.ToComponents(),
                                   classes: new ElementClass("ewfIntermediateUrl" /* This is used by EWF CSS files. */)).ToFormItem(
                                   label: i ? "Non-live warnings hidden:".ToComponents() : "Standard:".ToComponents()));
                    })
                                            .Materialize())
                                        .ToCollection()).ToCollection()))));
                }
                warningLines.Add(components);
            }

            if (AppRequestState.Instance.UserAccessible && AppRequestState.Instance.ImpersonatorExists &&
                (!ConfigurationStatics.IsIntermediateInstallation || AppRequestState.Instance.IntermediateUserExists))
            {
                warningLines.Add(
                    "User impersonation is in effect. ".ToComponents()
                    .Append(
                        new EwfHyperlink(
                            SelectUser.GetInfo(AppRequestState.Instance.Url),
                            new ButtonHyperlinkStyle("Change user", buttonSize: ButtonSize.ShrinkWrap)))
                    .Concat(" ".ToComponents())
                    .Append(
                        new EwfButton(
                            new StandardButtonStyle("End impersonation", buttonSize: ButtonSize.ShrinkWrap),
                            behavior: new PostBackBehavior(
                                postBack: PostBack.CreateFull(
                                    id: "ewfEndImpersonation",
                                    firstModificationMethod: UserImpersonationStatics.EndImpersonation,
                                    actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))))))
                    .Materialize());
            }

            if (warningLines.Any())
            {
                ph.AddControlsReturnThis(
                    new GenericFlowContainer(
                        warningLines.Aggregate((components, line) => components.Append(new LineBreak()).Concat(line).Materialize()),
                        displaySetup: new DisplaySetup(ConfigurationStatics.IsLiveInstallation || !NonLiveInstallationStatics.WarningsHiddenCookieExists()),
                        classes: topWarningContainerClass).ToCollection()
                    .GetControls());
            }

            // This is used by the EWF JavaScript file.
            const string clickBlockerId = "ewfClickBlocker";

            ph2.AddControlsReturnThis(
                new Block {
                ClientIDMode = ClientIDMode.Static, ID = clickBlockerId, CssClass = clickBlockerInactiveClass
            },
                new PlaceHolder().AddControlsReturnThis(getProcessingDialog().GetControls()),
                new NamingPlaceholder(getStatusMessageControl()));
        }