Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CED9410ECC for ; Sun, 21 Dec 2014 16:26:19 +0000 (UTC) Received: (qmail 11891 invoked by uid 500); 21 Dec 2014 16:26:18 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 11843 invoked by uid 500); 21 Dec 2014 16:26:18 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 11833 invoked by uid 99); 21 Dec 2014 16:26:18 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Dec 2014 16:26:17 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 42C20AC0939; Sun, 21 Dec 2014 16:26:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1647163 - /manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/editjob.jsp Date: Sun, 21 Dec 2014 16:26:16 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141221162617.42C20AC0939@hades.apache.org> Author: kwright Date: Sun Dec 21 16:26:16 2014 New Revision: 1647163 URL: http://svn.apache.org/r1647163 Log: Add notification support on connections tab Modified: manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/editjob.jsp Modified: manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/editjob.jsp URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/editjob.jsp?rev=1647163&r1=1647162&r2=1647163&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/editjob.jsp (original) +++ manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/editjob.jsp Sun Dec 21 16:26:16 2014 @@ -33,6 +33,8 @@ IJobManager manager = JobManagerFactory.make(threadContext); IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(threadContext); IRepositoryConnection[] connList = connMgr.getAllConnections(); + INotificationConnectionManager notificationMgr = NotificationConnectionManagerFactory.make(threadContext); + INotificationConnection[] notificationList = notificationMgr.getAllConnections(); IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(threadContext); IOutputConnection[] outputList = outputMgr.getAllConnections(); ITransformationConnectionManager transformationMgr = TransformationConnectionManagerFactory.make(threadContext); @@ -40,6 +42,7 @@ IOutputConnectorPool outputConnectorPool = OutputConnectorPoolFactory.make(threadContext); IRepositoryConnectorPool repositoryConnectorPool = RepositoryConnectorPoolFactory.make(threadContext); + INotificationConnectorPool notificationConnectorPool = NotificationConnectorPoolFactory.make(threadContext); ITransformationConnectorPool transformationConnectorPool = TransformationConnectorPoolFactory.make(threadContext); // Figure out tab name and sequence number @@ -89,6 +92,10 @@ int[] pipelinePrerequisites = new int[0]; Specification[] pipelineSpecifications = new Specification[0]; + String[] notificationConnectionNames = new String[0]; + String[] notificationDescriptions = new String[0]; + Specification[] notificationSpecifications = new Specification[0]; + ArrayList scheduleRecords = new ArrayList(); EnumeratedValues dayOfWeek = null; @@ -139,6 +146,16 @@ pipelinePrerequisites[j] = job.getPipelineStagePrerequisite(j); pipelineSpecifications[j] = job.getPipelineStageSpecification(j); } + notificationConnectionNames = new String[job.countNotifications()]; + notificationDescriptions = new String[job.countNotifications()]; + notificationSpecifications = new Specification[job.countNotifications()]; + for (int j = 0; j < job.countNotifications(); j++) + { + notificationConnectionNames[j] = job.getNotificationConnectionName(j); + notificationDescriptions[j] = job.getNotificationDescription(j); + notificationSpecifications[j] = job.getNotificationSpecification(j); + } + type = job.getType(); startMethod = job.getStartMethod(); hopcountMode = job.getHopcountMode(); @@ -204,11 +221,19 @@ String saveCheckMethod = "checkSpecificationForSave"; String[] pipelineCheckMethods = new String[pipelineConnectionNames.length]; String[] pipelineCheckForSaveMethods = new String[pipelineConnectionNames.length]; + String[] notificationCheckMethods = new String[notificationConnectionNames.length]; + String[] notificationCheckForSaveMethods = new String[notificationConnectionNames.length]; + for (int j = 0; j < pipelineConnectionNames.length; j++) { pipelineCheckMethods[j] = "unknown"; pipelineCheckForSaveMethods[j] = "unknown"; } + for (int j = 0; j < notificationConnectionNames.length; j++) + { + notificationCheckMethods[j] = "unknown"; + notificationCheckForSaveMethods[j] = "unknown"; + } if (connection != null) { @@ -250,6 +275,20 @@ } } + for (int j = 0; j < notificationConnectionNames.length; j++) + { + INotificationConnection notificationConnection = notificationMgr.load(notificationConnectionNames[j]); + if (notificationConnection != null) + { + INotificationConnector notificationConnector = NotificationConnectorFactory.getConnectorNoCheck(notificationConnection.getClassName()); + if (notificationConnector != null) + { + notificationCheckMethods[j] = notificationConnector.getFormCheckJavascriptMethodName(1+pipelineConnectionNames.length+j); + notificationCheckForSaveMethods[j] = notificationConnector.getFormPresaveCheckJavascriptMethodName(1+pipelineConnectionNames.length+j); + } + + } + } %> @@ -413,7 +452,28 @@ else postFormSetAnchor("pipeline_"+(n-1)+"_tag"); } + + function AppendNotification() + { + if (editjob.notification_connectionname.value == "") + { + alert("<%=Messages.getBodyJavascriptString(pageContext.getRequest().getLocale(),"editjob.SelectANotificationConnectionName")%>"); + editjob.notification_connectionname.focus(); + return; + } + document.editjob.notification_op.value="Add"; + postFormSetAnchor("notification_tag"); + } + function DeleteNotification(n) + { + eval("document.editjob.notification_"+n+"_op.value = 'Delete'"); + if (n == 0) + postFormSetAnchor("notification_tag"); + else + postFormSetAnchor("notification_"+(n-1)+"_tag"); + } + function AddScheduledTime() { if (editjob.duration.value != "" && !isInteger(editjob.duration.value)) @@ -1081,7 +1141,94 @@ - + +<% + alreadyPresent = new HashSet(); + for (int j = 0; j < notificationConnectionNames.length; j++) + { + alreadyPresent.add(notificationConnectionNames[j]); + } + if (notificationList.length > 0) + { +%> + + <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.NotificationsColon")%> + + + + + + + + +<% + rowCounter = 0; + for (int j = 0; j < notificationConnectionNames.length; j++) + { + String notificationConnectionName = notificationConnectionNames[j]; + String notificationDescription = notificationDescriptions[j]; + if (notificationDescription == null) + notificationDescription = ""; +%> + "> + + + + + +<% + } + if (notificationList.length != alreadyPresent.size()) + { +%> + + + + + + + +<% + } +%> +
+ + <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.NotificationNumber")%><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.NotificationDescription")%><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.NotificationConnectionName")%>
+ + + " alt='<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.Deletenotification")%>' onclick="javascript:DeleteNotification(<%=j%>);"/> + <%=(j+pipelineConnectionNames.length+2)%>. + + + <%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(notificationConnectionName)%> + +

+ + + + + + + +
+ + +<% + } +%>
@@ -1117,6 +1264,7 @@ %> + <% for (int j = 0; j < pipelineConnectionNames.length; j++) { @@ -1131,6 +1279,18 @@ <% } + for (int j = 0; j < notificationConnectionNames.length; j++) + { + String notificationConnectionName = notificationConnectionNames[j]; + String notificationDescription = notificationDescriptions[j]; + if (notificationDescription == null) + notificationDescription = ""; +%> + + +<% + } + %>