示例#1
0
        protected override void loadData()
        {
            ph.AddControlsReturnThis(
                getBox(
                    new PostBackButton(
                        PostBack.CreateFull(id: "tiny"),
                        new ButtonActionControlStyle("Tiny Post Back Button", buttonSize: ButtonActionControlStyle.ButtonSize.ShrinkWrap),
                        false)));
            ph.AddControlsReturnThis(
                getBox(
                    EwfLink.Create(SubFolder.General.GetInfo(), new ButtonActionControlStyle("Tiny EWF Link", buttonSize: ButtonActionControlStyle.ButtonSize.ShrinkWrap))));
            ph.AddControlsReturnThis(
                getBox(
                    new ToggleButton(new WebControl[0], new ButtonActionControlStyle("Tiny Toggle Button", buttonSize: ButtonActionControlStyle.ButtonSize.ShrinkWrap))));

            ph.AddControlsReturnThis(
                getBox(
                    new PostBackButton(PostBack.CreateFull(id: "normal"), new ButtonActionControlStyle("Post Back Button"), usesSubmitBehavior: false)
            {
                Width = Unit.Pixel(200)
            }));
            ph.AddControlsReturnThis(getBox(EwfLink.Create(EwfTableDemo.GetInfo(), new ButtonActionControlStyle("EWF Link"))));
            ph.AddControlsReturnThis(getBox(new ToggleButton(new WebControl[0], new ButtonActionControlStyle("Toggle button"))));

            ph.AddControlsReturnThis(
                getBox(
                    new PostBackButton(
                        PostBack.CreateFull(id: "large"),
                        new ButtonActionControlStyle("Large Post Back Button", buttonSize: ButtonActionControlStyle.ButtonSize.Large),
                        usesSubmitBehavior: false)));
            ph.AddControlsReturnThis(
                getBox(EwfLink.Create(EwfTableDemo.GetInfo(), new ButtonActionControlStyle("Large EWF Link", ButtonActionControlStyle.ButtonSize.Large))));
            ph.AddControlsReturnThis(
                getBox(new ToggleButton(new WebControl[0], new ButtonActionControlStyle("Large Toggle Button", ButtonActionControlStyle.ButtonSize.Large))));
        }
示例#2
0
        protected override void loadData()
        {
            accessDenied.InnerText = Translation.AccessIsDenied;

            if (info.ShowHomeLink)
            {
                ph.AddControlsReturnThis(
                    new LegacyParagraph(EwfLink.Create(new ExternalResourceInfo(NetTools.HomeUrl), new TextActionControlStyle(Translation.ClickHereToGoToHomePage))));
            }

            Response.StatusCode             = 403;
            Response.TrySkipIisCustomErrors = true;
        }
        private IEnumerable <Control> getTabControlsForResources(ResourceGroup resourceGroup)
        {
            var tabs = new List <Control>();

            foreach (var resource in resourceGroup.Resources.Where(p => p.UserCanAccessResource))
            {
                // NOTE: Should we use CustomActionControlStyle for the link so it doesn't have any built-in styling?
                var tab = EwfLink.Create(resource.IsIdenticalToCurrent() ? null : resource, new TextActionControlStyle(resource.ResourceName));

                tab.CssClass = resource.IsIdenticalToCurrent()
                                                       ? CssElementCreator.CurrentTabCssClass
                                                       : resource.AlternativeMode is DisabledResourceMode ? CssElementCreator.DisabledTabCssClass : "";
                tabs.Add(tab);
            }
            return(tabs);
        }
示例#4
0
        private IEnumerable <Control> getTabControlsForResources(ResourceGroup resourceGroup, bool includeIcons)
        {
            var tabs = new List <Control>();

            foreach (var resource in resourceGroup.Resources.Where(p => p.UserCanAccessResource))
            {
                var tab = EwfLink.Create(
                    resource.IsIdenticalToCurrent() ? null : resource,
                    new TextActionControlStyle(
                        resource.ResourceName,
                        icon: includeIcons ? new ActionComponentIcon(new FontAwesomeIcon(resource.IsIdenticalToCurrent() ? "fa-circle" : "fa-circle-thin")) : null));

                tab.CssClass = resource.IsIdenticalToCurrent()
                                                       ? CssElementCreator.CurrentTabCssClass
                                                       : resource.AlternativeMode is DisabledResourceMode ? CssElementCreator.DisabledTabCssClass : "";
                tabs.Add(tab);
            }
            return(tabs);
        }
示例#5
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()");
        }