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);
        }
Example #2
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);
        }
 protected override void loadData()
 {
     ph.AddControlsReturnThis(
         ControlStack.CreateWithControls(
             true,
             new EwfCheckBox(false, label: "Inline Check Box"),
             new BlockCheckBox(false, (postBackValue, validator) => { }, label: "Block Check Box")));
 }
 /// <summary>
 /// Standard Library use only.
 /// </summary>
 public static Block CreateErrorMessageListBlock(IEnumerable <string> errors)
 {
     // Client code that uses NetTools.BuildBasicLink depends on us not HTML encoding error messages here. If raw or stored user input is ever used in error
     // messages, we are exposed to injection attacks.
     return(new Block(ControlStack.CreateWithControls(true, errors.Select(i => new Literal {
         Text = i
     }).ToArray()))
     {
         CssClass = CssElementCreator.CssClass
     });
 }
Example #5
0
 protected override void loadData()
 {
     ph.AddControlsReturnThis(
         ControlStack.CreateWithControls(
             true,
             new PostBackButton(
                 PostBack.CreateFull(id: "sendHealthCheck", firstModificationMethod: () => EwfApp.Instance.SendHealthCheck()),
                 new ButtonActionControlStyle("Send Health Check"),
                 usesSubmitBehavior: false),
             new PostBackButton(
                 PostBack.CreateFull(id: "throwException", firstModificationMethod: throwException),
                 new ButtonActionControlStyle("Throw Unhandled Exception"),
                 usesSubmitBehavior: false)));
 }
 private IEnumerable <Control> getStatusMessageControlList()
 {
     return
         (ControlStack.CreateWithControls(
              true,
              EwfPage.Instance.StatusMessages.Select(
                  i =>
                  new Block(
                      new FontAwesomeIcon(i.Item1 == StatusMessageType.Info ? "fa-info-circle" : "fa-exclamation-triangle", "fa-lg", "fa-fw").ToCollection <PhrasingComponent>
                          ().Concat(new GenericPhrasingContainer(i.Item2.ToComponents(), classes: statusMessageTextClass)).GetControls().ToArray())
     {
         CssClass = i.Item1 == StatusMessageType.Info ? infoMessageContainerClass : warningMessageContainerClass
     } as Control).ToArray()).ToCollection());
 }
Example #7
0
 private IEnumerable <Control> getStatusMessageControlList()
 {
     return
         (ControlStack.CreateWithControls(
              true,
              EwfPage.Instance.StatusMessages.Select(
                  i =>
                  new Block(
                      new FontAwesomeIcon(i.Item1 == StatusMessageType.Info ? "fa-info-circle" : "fa-exclamation-triangle", "fa-lg", "fa-fw"),
                      new EwfLabel {
         CssClass = statusMessageTextClass, Text = i.Item2
     })
     {
         CssClass = i.Item1 == StatusMessageType.Info ? infoMessageContainerClass : warningMessageContainerClass
     } as Control).ToArray())
          .ToSingleElementArray());
 }
Example #8
0
 internal static Control GetErrorMessageListBlock(IEnumerable <string> additionalClasses, IEnumerable <string> errors)
 {
     // Client code that uses NetTools.BuildBasicLink depends on us not HTML encoding error messages here. If raw or stored user input is ever used in error
     // messages, we are exposed to injection attacks.
     return
         (new Block(
              ControlStack.CreateWithControls(
                  true,
                  errors.Select(
                      i =>
                      (Control) new PlaceHolder().AddControlsReturnThis(new FontAwesomeIcon("fa-times-circle", "fa-lg"), " ".GetLiteralControl(), new Literal {
         Text = i
     }))
                  .ToArray()))
     {
         CssClass = StringTools.ConcatenateWithDelimiter(" ", CssElementCreator.CssClass.ToSingleElementArray().Concat(additionalClasses).ToArray())
     });
 }
Example #9
0
        void ControlTreeDataLoader.LoadData()
        {
            basicBody.Attributes.Add("onpagehide", "hideProcessingDialog();");
            form.Action = EwfPage.Instance.InfoAsBaseType.GetUrl();

            var warningControls = new List <Control>();

            if (!AppTools.IsLiveInstallation)
            {
                var children = new List <Control>();
                children.Add("This is not the live system. Changes made here will be lost and are not recoverable. ".GetLiteralControl());
                if (AppTools.IsIntermediateInstallation && AppRequestState.Instance.IntermediateUserExists)
                {
                    children.Add(
                        new PostBackButton(
                            PostBack.CreateFull(
                                id: "ewfIntermediateLogOut",
                                firstModificationMethod: IntermediateAuthenticationMethods.ClearCookie,
                                actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))),
                            new ButtonActionControlStyle("Log Out", ButtonActionControlStyle.ButtonSize.ShrinkWrap),
                            false));
                }
                warningControls.Add(new PlaceHolder().AddControlsReturnThis(children.ToArray()));
            }
            else if (ConfigurationStatics.MachineIsStandbyServer)
            {
                warningControls.Add(
                    "This is a standby system. It operates with a read-only database, and any attempt to make a modification will result in an error.".GetLiteralControl());
            }

            if (AppRequestState.Instance.UserAccessible && AppRequestState.Instance.ImpersonatorExists &&
                (!AppTools.IsIntermediateInstallation || AppRequestState.Instance.IntermediateUserExists))
            {
                warningControls.Add(
                    new PlaceHolder().AddControlsReturnThis(
                        "User impersonation is in effect. ".GetLiteralControl(),
                        EwfLink.Create(
                            SelectUser.GetInfo(EwfPage.Instance.InfoAsBaseType.GetUrl()),
                            new ButtonActionControlStyle("Change User", ButtonActionControlStyle.ButtonSize.ShrinkWrap)),
                        " ".GetLiteralControl(),
                        new PostBackButton(
                            PostBack.CreateFull(
                                id: "ewfEndImpersonation",
                                firstModificationMethod: UserImpersonationStatics.EndImpersonation,
                                actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))),
                            new ButtonActionControlStyle("End Impersonation", ButtonActionControlStyle.ButtonSize.ShrinkWrap),
                            usesSubmitBehavior: false)));
            }

            if (warningControls.Any())
            {
                var warningControl = warningControls.Count() > 1 ? ControlStack.CreateWithControls(true, warningControls.ToArray()) : warningControls.Single();
                ph.AddControlsReturnThis(new Block(warningControl)
                {
                    CssClass = CssElementCreator.TopWarningBlockCssClass
                });
            }

            ph2.AddControlsReturnThis(new Block {
                CssClass = CssElementCreator.ClickBlockingBlockCssClass
            }, getProcessingDialog());
            ph2.AddControlsReturnThis(new NamingPlaceholder(getStatusMessageDialog()));

            var ajaxLoadingImage = new EwfImage("Images/ajax-loader.gif")
            {
                CssClass = "ajaxloaderImage"
            };

            ajaxLoadingImage.Style.Add("display", "none");
            ph2.AddControlsReturnThis(ajaxLoadingImage);

            EwfPage.Instance.ClientScript.RegisterOnSubmitStatement(GetType(), "formSubmitEventHandler", "postBackRequestStarted()");
        }
        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
            }.ToSingleElementArray()
                                                : new Control[0]));

            var warningControls = new List <Control>();

            if (!ConfigurationStatics.IsLiveInstallation)
            {
                var children = new List <Control>();
                children.Add(new FontAwesomeIcon("fa-exclamation-triangle", "fa-lg"));
                children.Add(" This is not the live system. Changes made here will be lost and are not recoverable. ".GetLiteralControl());
                if (ConfigurationStatics.IsIntermediateInstallation && AppRequestState.Instance.IntermediateUserExists)
                {
                    children.Add(
                        new PostBackButton(
                            PostBack.CreateFull(
                                id: "ewfIntermediateLogOut",
                                firstModificationMethod: IntermediateAuthenticationMethods.ClearCookie,
                                actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))),
                            new ButtonActionControlStyle("Log Out", ButtonActionControlStyle.ButtonSize.ShrinkWrap),
                            false));
                }
                warningControls.Add(new PlaceHolder().AddControlsReturnThis(children.ToArray()));
            }
            else if (ConfigurationStatics.MachineIsStandbyServer)
            {
                warningControls.Add(
                    new PlaceHolder().AddControlsReturnThis(
                        new FontAwesomeIcon("fa-exclamation-triangle", "fa-lg"),
                        " This is a standby system. It operates with a read-only database, and any attempt to make a modification will result in an error.".GetLiteralControl()));
            }

            if (AppRequestState.Instance.UserAccessible && AppRequestState.Instance.ImpersonatorExists &&
                (!ConfigurationStatics.IsIntermediateInstallation || AppRequestState.Instance.IntermediateUserExists))
            {
                warningControls.Add(
                    new PlaceHolder().AddControlsReturnThis(
                        "User impersonation is in effect. ".GetLiteralControl(),
                        EwfLink.Create(
                            SelectUser.GetInfo(AppRequestState.Instance.Url),
                            new ButtonActionControlStyle("Change User", ButtonActionControlStyle.ButtonSize.ShrinkWrap)),
                        " ".GetLiteralControl(),
                        new PostBackButton(
                            PostBack.CreateFull(
                                id: "ewfEndImpersonation",
                                firstModificationMethod: UserImpersonationStatics.EndImpersonation,
                                actionGetter: () => new PostBackAction(new ExternalResourceInfo(NetTools.HomeUrl))),
                            new ButtonActionControlStyle("End Impersonation", ButtonActionControlStyle.ButtonSize.ShrinkWrap),
                            usesSubmitBehavior: false)));
            }

            if (warningControls.Any())
            {
                var warningControl = warningControls.Count() > 1 ? ControlStack.CreateWithControls(true, warningControls.ToArray()) : warningControls.Single();
                ph.AddControlsReturnThis(new Block(warningControl)
                {
                    CssClass = topWarningBlockCssClass
                });
            }

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

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

            EwfPage.Instance.ClientScript.RegisterOnSubmitStatement(GetType(), "formSubmitEventHandler", "postBackRequestStarted()");
        }