Beispiel #1
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            // Update Security Protocol
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            //Create Console
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console()
            {
                Items = new List <IConsoleItem>(), Title = "Face Recognition: Person"
            };
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name           = _ADD_PERSON,
                DisplayText    = _ADD_PERSON,
                Enabled        = true,
                RaisesPostBack = true,
                ToolTip        = "Add Person and Image to Azure Face Recognizer FaceGroup"
            });

            //Set current Workspace Artifact ID
            _currentWorkspaceArtifactId = Helper.GetActiveCaseID();

            //Authenticate Azure Service
            _client = Methods.AuthenticateService(this.Helper.GetSecretStore());
            returnConsole.AddRefreshLinkToConsole().Enabled = true;

            return(returnConsole);
        }
        public async Task <Console> GetConsoleAsync(PageEvent pageEvent, IAPILog logger)
        {
            var console = new Console {
                Items = new List <IConsoleItem>(), Title = "Manage Import Job"
            };

            var validateButton = new ConsoleButton
            {
                Name           = Constant.Buttons.VALIDATE,
                DisplayText    = "Validate",
                ToolTip        = "Click here to validate this job",
                RaisesPostBack = true
            };

            var submitButton = new ConsoleButton
            {
                Name           = Constant.Buttons.SUBMIT,
                DisplayText    = "Submit",
                ToolTip        = "Click here to add this job to the queue",
                RaisesPostBack = true
            };

            var cancelButton = new ConsoleButton
            {
                Name           = Constant.Buttons.CANCEL,
                DisplayText    = "Cancel",
                ToolTip        = "Click here to cancel this job",
                RaisesPostBack = true
            };

            if (pageEvent == PageEvent.PreRender)
            {
                var recordExists = await DoesRecordExistAsync();

                if (recordExists)
                {
                    validateButton.Enabled = false;
                    submitButton.Enabled   = false;
                    cancelButton.Enabled   = true;
                }
                else
                {
                    validateButton.Enabled = true;
                    submitButton.Enabled   = true;
                    cancelButton.Enabled   = false;
                }
            }

            console.Items.Add(validateButton);
            console.Items.Add(submitButton);
            console.Items.Add(cancelButton);

            return(console);
        }
Beispiel #3
0
 private static void AssertHasButtons(kCura.EventHandler.Console console)
 {
     if (console == null)
     {
         throw new ArgumentNullException(nameof(console));
     }
     Assert.IsTrue(console.Items.Exists(b => ((ConsoleButton)b).Name == "Submit"));
     Assert.IsTrue(console.Items.Exists(b => ((ConsoleButton)b).Name == "Validate"));
     Assert.IsTrue(console.Items.Exists(b => ((ConsoleButton)b).Name == "Cancel"));
     //TODO - Complete Revert functionality
     //Assert.IsTrue(console.Items.Exists(b =>( (ConsoleButton)b).Name == "Revert" ));
 }
Beispiel #4
0
        public override Console GetConsole(ConsoleEventHandler.PageEvent pageEvent)
        {
            _console = new Console {
                Items = new List <IConsoleItem>(), Title = "Manage Set"
            };

            _submitButton = new ConsoleButton
            {
                Name           = Constant.Names.Console.SUBMIT,
                DisplayText    = "Submit",
                ToolTip        = "Click here to submit this Extractor Set to the queue.",
                RaisesPostBack = true
            };

            _cancelButton = new ConsoleButton
            {
                Name           = Constant.Names.Console.CANCEL,
                DisplayText    = "Cancel",
                ToolTip        = "Click here to cancel this Extractor Set.",
                RaisesPostBack = true
            };

            _separator = new ConsoleSeparator();

            if (pageEvent == PageEvent.PreRender)
            {
                var textExtractorStatus = ActiveArtifact.Fields[Constant.Guids.Fields.ExtractorSet.Status.ToString()].Value.Value;

                if (textExtractorStatus == null)
                {
                    _submitButton.Enabled = true;
                    _cancelButton.Enabled = false;
                }
                else if (textExtractorStatus.ToString() == Constant.ExtractorSetStatus.CANCELLED || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.COMPLETE || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.COMPLETE_WITH_ERRORS || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.ERROR)
                {
                    _submitButton.Enabled = false;
                    _cancelButton.Enabled = false;
                }
                else
                {
                    _submitButton.Enabled = false;
                    _cancelButton.Enabled = true;
                }
            }

            _console.Items.Add(_submitButton);
            _console.Items.Add(_cancelButton);
            _console.Items.Add(_separator);
            _console.AddRefreshLinkToConsole().Enabled = true;

            return(_console);
        }
Beispiel #5
0
        public override kCura.EventHandler.Console GetConsole(kCura.EventHandler.ConsoleEventHandler.PageEvent pageEvent)
        {
            //Construct a console object to build the console appearing in the UI.
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console
            {
                Items = new List <kCura.EventHandler.IConsoleItem>(),
                Title = CONSOLE_TITLE
            };

            //Construct the submit job button.
            kCura.EventHandler.ConsoleButton submitJobButton = new kCura.EventHandler.ConsoleButton
            {
                Name           = INSERT_JOB_BUTTON_NAME,
                DisplayText    = INSERT_JOB_DISPLAY_TEXT,
                ToolTip        = INSERT_JOB_TOOL_TIP,
                RaisesPostBack = true
            };

            //If a job is already in the queue, change the text and disable the button.
            if (pageEvent == PageEvent.PreRender)
            {
                System.Data.SqlClient.SqlParameter workspaceArtifactIDParam = new System.Data.SqlClient.SqlParameter("@WorkspaceArtifactID", System.Data.SqlDbType.Int)
                {
                    Value = this.Helper.GetActiveCaseID()
                };

                System.Data.SqlClient.SqlParameter jobArtifactIDParam = new System.Data.SqlClient.SqlParameter("@JobArtifactID", System.Data.SqlDbType.Int)
                {
                    Value = this.ActiveArtifact.ArtifactID
                };

                int jobCount = this.Helper.GetDBContext(-1).ExecuteSqlStatementAsScalar <Int32>(JOB_EXISTS_QUERY, new System.Data.SqlClient.SqlParameter[] { workspaceArtifactIDParam, jobArtifactIDParam });

                //Use the helper function to check if a job currently exists. Set Enabled to the opposite value.
                if (jobCount > 0)
                {
                    submitJobButton.Enabled = false;
                }
                else
                {
                    submitJobButton.Enabled = true;
                }
            }

            //Add the buttons to the console.
            returnConsole.Items.Add(submitJobButton);

            return(returnConsole);
        }
Beispiel #6
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console()
            {
                Items = new List <IConsoleItem>(), Title = "Azure Form Recognition"
            };
            ;

            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "Extract Info", DisplayText = "Extract Form Data", Enabled = true, ToolTip = "Submit document to Azure Form Recognizer for data extraction", RaisesPostBack = true
            });

            return(returnConsole);
        }
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console()
            {
                Items = new List <IConsoleItem>(), Title = "Azure Form Recognition"
            };
            ;

            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "Submit Documents", DisplayText = "Submit to Train", Enabled = true, RaisesPostBack = true, ToolTip = "Submit saved search to Azure Form Recognizer service for model training"
            });
            returnConsole.AddRefreshLinkToConsole().Enabled = true;
            return(returnConsole);
        }
Beispiel #8
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            kCura.EventHandler.Console retVal = new kCura.EventHandler.Console();
            retVal.ButtonList = GetButtons();
            retVal.Title      = "Kramerica Video Indexer Console";

            try
            {
                if (pageEvent == PageEvent.Load)
                {
                    kCura.EventHandler.Field myStatusField = this.ActiveArtifact.Fields[ApplicationConstants.INDEX_JOB_STATUS.ToString()];
                    string myStatusValue = (string)myStatusField.Value.Value;
                    switch (myStatusValue)
                    {
                    case "Created":
                        _startButton.Enabled   = true;
                        _refreshButton.Enabled = false;
                        _videoButton.Enabled   = false;
                        break;

                    case "Complete":
                        _startButton.Enabled   = false;
                        _refreshButton.Enabled = false;
                        _videoButton.Enabled   = true;
                        string customPageUrl    = GetCustomPageUrl();
                        String playerJavaScript = String.Format("window.open('{0}', '', 'location=no,scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1920,height=1080');", customPageUrl);
                        _videoButton.OnClickEvent = playerJavaScript;
                        break;

                    default:
                        _startButton.Enabled   = false;
                        _refreshButton.Enabled = true;
                        _videoButton.Enabled   = false;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }

            return(retVal);
        }
Beispiel #9
0
        public async Task <Console> GetConsoleAsync(PageEvent pageEvent, IAPILog logger)
        {
            var console = new Console {
                Items = new List <IConsoleItem>(), Title = "Manage Export Job"
            };

            var submitButton = new ConsoleButton
            {
                Name           = Constant.Buttons.SUBMIT,
                DisplayText    = "Submit",
                ToolTip        = "Click here to add this job to the queue",
                RaisesPostBack = true
            };

            var downloadFileButton = new ConsoleButton
            {
                Name           = Constant.Buttons.DOWNLOAD_FILE,
                DisplayText    = "Download File",
                ToolTip        = "Click here to download the export file",
                RaisesPostBack = true
            };

            if (pageEvent == PageEvent.PreRender)
            {
                var recordExists = await DoesRecordExistAsync();

                if (recordExists)
                {
                    submitButton.Enabled       = false;
                    downloadFileButton.Enabled = true;
                }
                else
                {
                    submitButton.Enabled       = true;
                    downloadFileButton.Enabled = false;
                }
            }

            console.Items.Add(submitButton);
            console.Items.Add(downloadFileButton);

            return(console);
        }
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            // Construct a console object to build the console appearing in the UI.
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console();
            returnConsole.Items = new List <kCura.EventHandler.IConsoleItem>();
            returnConsole.Title = CONSOLE_TITLE;

            // Construct the reporting button.
            kCura.EventHandler.ConsoleButton button = new kCura.EventHandler.ConsoleButton();
            button.Name           = BUTTON_NAME;
            button.DisplayText    = BUTTON_DISPLAY_TEXT;
            button.ToolTip        = BUTTON_TOOL_TIP;
            button.RaisesPostBack = false;
            button.Enabled        = true;

            //Create the JavaScript for the button and set the button "OnClickEvent" property.
            button.OnClickEvent = "alert('Imagine that I am a report on the current person\\\'s enthusiasm');";

            returnConsole.Items.Add(button);

            return(returnConsole);
        }
Beispiel #11
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console()
            {
                Items = new List <IConsoleItem>(), Title = "Bing Search"
            };
            string address = null;

            if (!ActiveArtifact.Fields[0].Value.IsNull)
            {
                address = ActiveArtifact.Fields[0].Value.Value.ToString();                  //TODO: You will need to update this with the field ID for your own workspace

                string noBreakingSpacesRemoved = address.Replace('\u00A0', ' ').Replace(" ", "%2b");
                returnConsole.Items.Add(new ConsoleButton()
                {
                    Name = "Map", DisplayText = "Plot Location and Search", Enabled = true, OnClickEvent = "window.location.href = 'https://kcura-current-sandbox.relativity.one/Relativity/External.aspx?AppID=1463683&ArtifactID=1463683&DirectTo=%25applicationPath%25%2fCustomPages%2f0a9cd0ab-2924-4034-868d-9c97eb5cd85b%2fBingSearch.aspx?Address=" + noBreakingSpacesRemoved + "&SelectedTab=1067106'"
                });
            }

            Int32 currentWorkspaceArtifactID = Helper.GetActiveCaseID();


            return(returnConsole);
        }
        public override Console GetConsole(PageEvent pageEvent)
        {
            // Update Security Protocol
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            Console returnConsole = new Console()
            {
                Items = new List <IConsoleItem>(), Title = "Face Recognition: Image"
            };

            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = _BUTTON_NAME, DisplayText = _BUTTON_NAME, Enabled = true, RaisesPostBack = true, ToolTip = "Identify Faces in Image"
            });
            returnConsole.AddRefreshLinkToConsole().Enabled = true;

            //Set current Workspace Artifact ID
            _currentWorkspaceArtifactId = Helper.GetActiveCaseID();

            //Authenticate Azure Service
            _client = Methods.AuthenticateService(this.Helper.GetSecretStore());

            return(returnConsole);
        }
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            int activeWorkspaceId = this.Helper.GetActiveCaseID();

            //Construct a console object to build the console appearing in the UI.
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console();
            returnConsole.Items = new List <IConsoleItem>();
            returnConsole.Title = CONSOLE_TITLE;
            string select = "<h3 style='color:#11599E'>Comments Tree</h3>";

            List <string> elements = new List <string>();

            elements.Add(select);
            using (kCura.Relativity.Client.IRSAPIClient client =
                       this.Helper.GetServicesManager().CreateProxy <kCura.Relativity.Client.IRSAPIClient>(Relativity.API.ExecutionIdentity.System))
            {
                client.APIOptions.WorkspaceID = this.Helper.GetActiveCaseID();
                Service.SqlService.CommentSqlService     commentService      = new Service.SqlService.CommentSqlService(this.Helper.GetDBContext(this.Helper.GetActiveCaseID()));
                Service.RSAPIService.CommentRSAPIService commentRSAPIService = new Service.RSAPIService.CommentRSAPIService(client);
                Data.Entities.Comment comment = commentRSAPIService.Get(this.ActiveArtifact.ArtifactID);
                comment.CommentChilds = commentService.GetCommentsChild(comment.ArtifactId);
                drawCommentTree2(ref elements, (comment.CommentChilds).ToList());
                returnConsole.HTMLBlocks = elements;
            }

            ConsoleHeader header = new ConsoleHeader("Console Application");

            //Construct the submit job button.
            ConsoleButton submitJobButton = new ConsoleButton();

            submitJobButton.Name           = INSERT_JOB_BUTTON_NAME;
            submitJobButton.DisplayText    = INSERT_JOB_DISPLAY_TEXT;
            submitJobButton.ToolTip        = INSERT_JOB_TOOL_TIP;
            submitJobButton.RaisesPostBack = true;
            submitJobButton.Enabled        = true;

            //Construct the delete job button
            ConsoleButton deleteJobButton = new ConsoleButton()
            {
                Name           = DELETE_JOB_BUTTON_NAME,
                DisplayText    = DELETE_JOB_DISPLAY_TEXT,
                ToolTip        = DELETE_JOB_TOOL_TIP,
                RaisesPostBack = true,
                Enabled        = true
            };

            //Button to see the comment data
            ConsoleButton seeCommentButton = new ConsoleButton()
            {
                Name           = "See Comment Data",
                DisplayText    = "Commen Data",
                ToolTip        = "Comment Data",
                RaisesPostBack = true,
                Enabled        = true
            };


            ConsoleSeparator separador = new ConsoleSeparator();


            //If a job is already in the queue, change the text and disable the button.
            if (pageEvent == PageEvent.PreRender)
            {
                SqlParameter commentArtifactId = new SqlParameter("@commentArtifacId", System.Data.SqlDbType.Int);
                commentArtifactId.Value = ActiveArtifact.ArtifactID;

                int jobCount = this.Helper.GetDBContext(activeWorkspaceId).ExecuteSqlStatementAsScalar <Int32>(JOB_EXISTS_QUERY, new SqlParameter[] { commentArtifactId });

                //Use the helper function to check if a job currently exists. Set Enabled to the opposite value.
                if (jobCount > 0)
                {
                    submitJobButton.Enabled = false;
                    deleteJobButton.Enabled = true;
                }
                else
                {
                    submitJobButton.Enabled = true;
                    deleteJobButton.Enabled = false;
                }

                //Get the base path to the application.
                String basePath = this.Application.ApplicationUrl.Substring(0, this.Application.ApplicationUrl.IndexOf("/Case/Mask/"));

                //Construct the path to the custom page with the current patient artifact id and current workspace.
                String patientProfilePageUrl = String.Format("{0}/CustomPages/{1}/Home/Index/?artifacId={2}", basePath, COMMENT_HISTORY_APPLICATION_GUID, ActiveArtifact.ArtifactID);

                //Create the JavaScript for the button and set the button property.
                String windowOpenJavaScript = String.Format("window.open('{0}', '', 'location=no,scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=300,height=400');", patientProfilePageUrl);
                seeCommentButton.OnClickEvent = windowOpenJavaScript;
            }


            //Add the buttons to the console.
            returnConsole.Items.Add(header);
            returnConsole.Items.Add(submitJobButton);
            returnConsole.Items.Add(deleteJobButton);
            returnConsole.Items.Add(seeCommentButton);
            returnConsole.Items.Add(separador);
            return(returnConsole);
        }
        public async Task <kCura.EventHandler.Console> LoadConsoleAsync(PageEvent pageEvent)
        {
            _console = new kCura.EventHandler.Console {
                Items = new List <IConsoleItem>(), Title = "Manage Import Job"
            };

            _validateButton = new ConsoleButton
            {
                Name           = Constant.Buttons.VALIDATE,
                DisplayText    = "Validate",
                ToolTip        = "Click here to validate this job",
                RaisesPostBack = true
            };

            _submitButton = new ConsoleButton
            {
                Name           = Constant.Buttons.SUBMIT,
                DisplayText    = "Submit",
                ToolTip        = "Click here to add this job to the queue",
                RaisesPostBack = true
            };

            _cancelButton = new ConsoleButton
            {
                Name           = Constant.Buttons.CANCEL,
                DisplayText    = "Cancel",
                ToolTip        = "Click here to cancel this job",
                RaisesPostBack = true
            };

            if (Utility.UserIsAdmin(Helper, Helper.GetAuthenticationManager().UserInfo.ArtifactID, ArtifactQueries))
            {
                var jobStatus = await ImportUtilityJob.RetrieveJobStatusAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, CurrentArtifactId);

                var recordExists = await ImportUtilityJob.DoesRecordExistAsync();

                var submittedForMigration = ((Boolean?)(ActiveArtifact.Fields[Constant.Guids.Field.ImportUtilityJob.SubmittedForMigration.ToString()].Value).Value).GetValueOrDefault();

                if (pageEvent == PageEvent.PreRender)
                {
                    if (recordExists)
                    {
                        switch (jobStatus)
                        {
                        case Constant.Status.Job.NEW:
                            _validateButton.Enabled = true;
                            _submitButton.Enabled   = true;
                            _cancelButton.Enabled   = false;
                            break;

                        case Constant.Status.Job.SUBMITTED:
                        case Constant.Status.Job.IN_PROGRESS_MANAGER:
                        case Constant.Status.Job.COMPLETED_MANAGER:
                        case Constant.Status.Job.IN_PROGRESS_WORKER:
                        case Constant.Status.Job.RETRY:
                            _validateButton.Enabled = false;
                            _submitButton.Enabled   = false;
                            _cancelButton.Enabled   = true;
                            break;

                        case Constant.Status.Job.COMPLETED:
                        case Constant.Status.Job.COMPLETED_WITH_ERRORS:
                        case Constant.Status.Job.ERROR:
                        case Constant.Status.Job.CANCELLED:
                        case Constant.Status.Job.CANCELREQUESTED:
                            _validateButton.Enabled = false;
                            _submitButton.Enabled   = false;
                            _cancelButton.Enabled   = false;
                            break;

                        default:
                            _validateButton.Enabled = false;
                            _submitButton.Enabled   = false;
                            _cancelButton.Enabled   = false;
                            break;
                        }
                    }
                    else
                    {
                        if (submittedForMigration && (jobStatus == Constant.Status.Job.COMPLETED || jobStatus == Constant.Status.Job.COMPLETED_WITH_ERRORS || jobStatus == Constant.Status.Job.ERROR))
                        {
                            _validateButton.Enabled = false;
                            _submitButton.Enabled   = false;
                            _cancelButton.Enabled   = false;
                        }
                        else
                        {
                            _validateButton.Enabled = true;
                            _submitButton.Enabled   = true;
                            _cancelButton.Enabled   = false;
                        }
                    }
                }
            }
            else
            {
                _console.ScriptBlocks.Add(new ScriptBlock()
                {
                    Key = "DisableButtonsForNonAdmins", Script = "<script type='text/javascript'>alert('Buttons Disabled. Only system administrators are allowed to submit jobs.')</script>"
                });
                _validateButton.Enabled = false;
                _submitButton.Enabled   = false;
                _cancelButton.Enabled   = false;
            }

            _console.Items.Add(_validateButton);
            _console.Items.Add(_submitButton);
            _console.Items.Add(_cancelButton);
            _console.AddRefreshLinkToConsole().Enabled = true;

            return(_console);
        }
Beispiel #15
0
        public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent)
        {
            kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console()
            {
                Items = new List <IConsoleItem>(), Title = "Shiba Processor"
            };;

            //TODO: strings should be variables
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "GetImage", DisplayText = "Get Image", Enabled = true, RaisesPostBack = true
            });
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "Correct", DisplayText = "Mark as Correct", Enabled = true, RaisesPostBack = true
            });
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "FalseNegative", DisplayText = "Mark as False Negative", Enabled = true, RaisesPostBack = true
            });
            returnConsole.Items.Add(new ConsoleButton()
            {
                Name = "FalsePositive", DisplayText = "Mark as False Positive", Enabled = true, RaisesPostBack = true
            });

            var viewImageButton = new ConsoleButton
            {
                Name           = "ViewImage",
                DisplayText    = "View Image",
                ToolTip        = "View Image",
                RaisesPostBack = false,
                Enabled        = true
            };

            var imageLocation = String.Empty;

            DTOs.FieldValue field;

            using (IRSAPIClient proxy = Helper.GetServicesManager().CreateProxy <IRSAPIClient>(ExecutionIdentity.System))
            {
                //Set the proxy to use the current workspace
                proxy.APIOptions.WorkspaceID = Helper.GetActiveCaseID();

                var imageArtifactId = ActiveArtifact.ArtifactID;
                var rdoToRead       = proxy.Repositories.RDO.ReadSingle(imageArtifactId);
                rdoToRead.ArtifactTypeGuids.Add(Helpers.Constants.IMAGE_OBJECT_GUID);
                field = rdoToRead.Fields.Get(Shibativity.Helpers.Constants.IMAGE_URL_FIELD_GUID);
            }

            if (field.Value == null)
            {
                return(returnConsole);
            }
            imageLocation = field.Value.ToString();

            var openImageWindowJavaScript = $"window.open('{imageLocation}', '', 'location=no,scrollbars=no,menubar=no,toolbar=no,status=no,resizable=yes,width=800,height=800');";

            viewImageButton.OnClickEvent = openImageWindowJavaScript;
            returnConsole.Items.Add(viewImageButton);

            return(returnConsole);
        }
 public override kCura.EventHandler.Console GetConsole(kCura.EventHandler.ConsoleEventHandler.PageEvent pageEvent)
 {
     kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console();
     return(returnConsole);
 }
        public async Task <Console> GetConsoleAsync(PageEvent pageEvent)
        {
            SvcManager            = Helper.GetServicesManager();
            WorkspaceArtifactId   = Application.ArtifactID;
            Identity              = ExecutionIdentity.CurrentUser;
            CurrentArtifactId     = ActiveArtifact.ArtifactID;
            CurrentUserArtifactId = Helper.GetAuthenticationManager().UserInfo.ArtifactID;
            DbContextWorkspace    = Helper.GetDBContext(WorkspaceArtifactId);
            DbContextEdds         = Helper.GetDBContext(-1);

            var console = new Console {
                Items = new List <IConsoleItem>(), Title = "Manage Redaction Export Job"
            };

            var submitButton = new ConsoleButton
            {
                Name           = Constant.Buttons.SUBMIT,
                DisplayText    = "Submit",
                ToolTip        = "Click here to add this Import job to the queue.",
                RaisesPostBack = true
            };

            var cancelButton = new ConsoleButton
            {
                Name           = Constant.Buttons.CANCEL,
                DisplayText    = "Cancel",
                ToolTip        = "Click here to remove this Import job from the queue.",
                RaisesPostBack = true
            };

            if (pageEvent == PageEvent.PreRender)
            {
                var jobStatus = await RetrieveJobStatusAsync(SvcManager, WorkspaceArtifactId, Identity, CurrentArtifactId);

                switch (jobStatus)
                {
                case Constant.Status.Job.COMPLETED:
                case Constant.Status.Job.COMPLETED_MANAGER:
                case Constant.Status.Job.COMPLETED_WORKER:
                case Constant.Status.Job.COMPLETED_WITH_ERRORS:
                case Constant.Status.Job.ERROR:
                case Constant.Status.Job.VALIDATING:
                case Constant.Status.Job.CANCELLED:
                case Constant.Status.Job.CANCELREQUESTED:
                    submitButton.Enabled = false;
                    cancelButton.Enabled = false;
                    break;

                case Constant.Status.Job.NEW:
                case Constant.Status.Job.VALIDATED:
                    submitButton.Enabled = true;
                    cancelButton.Enabled = false;
                    break;

                case Constant.Status.Job.SUBMITTED:
                case Constant.Status.Job.IN_PROGRESS_MANAGER:
                case Constant.Status.Job.IN_PROGRESS_WORKER:
                    submitButton.Enabled = false;
                    cancelButton.Enabled = true;
                    break;

                default:
                    submitButton.Enabled = false;
                    cancelButton.Enabled = false;
                    break;
                }
            }

            console.Items.Add(submitButton);
            console.Items.Add(cancelButton);
            console.AddRefreshLinkToConsole().Enabled = true;

            return(console);
        }
        public override Console GetConsole(PageEvent pageEvent)
        {
            SvcManager            = Helper.GetServicesManager();
            WorkspaceArtifactId   = Application.ArtifactID;
            Identity              = ExecutionIdentity.CurrentUser;
            CurrentArtifactId     = ActiveArtifact.ArtifactID;
            CurrentUserArtifactId = Helper.GetAuthenticationManager().UserInfo.ArtifactID;
            DbContextWorkspace    = Helper.GetDBContext(WorkspaceArtifactId);
            DbContextEdds         = Helper.GetDBContext(-1);

            var console = new Console {
                Items = new List <IConsoleItem>(), Title = "Manage Redaction Import Job"
            };

            var validateButton = new ConsoleButton
            {
                Name           = Constant.Buttons.VALIDATE,
                DisplayText    = "Validate",
                ToolTip        = "Click here to validate that redactions and documents exist before importing.",
                RaisesPostBack = true
            };

            var submitButton = new ConsoleButton
            {
                Name           = Constant.Buttons.SUBMIT,
                DisplayText    = "Submit",
                ToolTip        = "Click here to add this Import job to the queue.",
                RaisesPostBack = true
            };

            var cancelButton = new ConsoleButton
            {
                Name           = Constant.Buttons.CANCEL,
                DisplayText    = "Cancel",
                ToolTip        = "Click here to remove this Import job from the queue.",
                RaisesPostBack = true
            };

            // *******************************************************************************************************
            //
            //       *********
            //       *       *
            //  *********    *
            //  *    *  *    *
            //  *    *********
            //  *       *
            //  *********
            //
            //  This functionality currently needs to be completed.
            //
            //  If you are interested in building this functionality, please make sure to write associated unit tests.
            //  The basic concept is that the Import Worker Agent will retrieve all the redactrions that were imported
            //  for the selected job and delete them from the Redaction table.
            // *******************************************************************************************************
            //var revertButton = new ConsoleButton
            //{
            //	Name = Constant.Buttons.REVERT,
            //	DisplayText = "Revert",
            //	ToolTip = "Click here to remove redactions created by this job.",
            //	RaisesPostBack = true
            //};

            if (pageEvent == PageEvent.PreRender)
            {
                var jobStatus = ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.MarkupUtilityImportJob.Status)].Value.Value.ToString();
                SetButtonState(jobStatus, validateButton, submitButton, cancelButton);
            }

            console.Items.Add(validateButton);
            console.Items.Add(submitButton);
            console.Items.Add(cancelButton);
            //TODO - Complete Revert functionality
            //console.Items.Add(revertButton);
            console.AddRefreshLinkToConsole().Enabled = true;

            return(console);
        }