Author: kwright
Date: Wed Jun 26 22:38:10 2013
New Revision: 1497147

URL: http://svn.apache.org/r1497147
Log:
Add UI support for authority prerequisites

Modified:
    
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/editauthority.jsp
    
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/execute.jsp
    
manifoldcf/branches/CONNECTORS-703/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties

Modified: 
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/editauthority.jsp
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/editauthority.jsp?rev=1497147&r1=1497146&r2=1497147&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/editauthority.jsp
 (original)
+++ 
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/editauthority.jsp
 Wed Jun 26 22:38:10 2013
@@ -32,6 +32,8 @@
        IAuthorityConnectionManager connMgr = 
AuthorityConnectionManagerFactory.make(threadContext);
        // Also get the list of available connectors
        IAuthorityConnectorManager connectorManager = 
AuthorityConnectorManagerFactory.make(threadContext);
+       // Get the mapping connection manager
+       IMappingConnectionManager mappingConnMgr = 
MappingConnectionManagerFactory.make(threadContext);
 
        // Figure out what the current tab name is.
        String tabName = variableContext.getParameter("tabname");
@@ -58,6 +60,7 @@
        String className = "";
        int maxConnections = 10;
        ConfigParams parameters = new ConfigParams();
+       Set<String> prereqs = new HashSet<String>();
 
        if (connection != null)
        {
@@ -68,6 +71,7 @@
                className = connection.getClassName();
                parameters = connection.getConfigParams();
                maxConnections = connection.getMaxConnections();
+               prereqs = connection.getPrerequisites();
        }
        else
                connectionName = null;
@@ -338,7 +342,8 @@
                    <table class="displaytable">
                        <tr><td class="separator" colspan="5"><hr/></td></tr>
                        <tr>
-                               <td 
class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.ConnectionTypeColon")%></nobr></td><td
 class="value" colspan="4">
+                               <td 
class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.ConnectionTypeColon")%></nobr></td>
+                               <td class="value" colspan="4">
 <%
            if (className.length() > 0)
            {
@@ -393,7 +398,57 @@
 <%
          }
 
-
+         // The "Prerequisites" tab
+         IMappingConnection[] mappingConnections = 
mappingConnMgr.getAllConnections();
+         if 
(tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editauthority.Prerequisites")))
+         {
+%>
+                   <table class="displaytable">
+                       <tr><td class="separator" colspan="5"><hr/></td></tr>
+                       <tr>
+                               <td 
class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.PrerequisiteUserMappingsColon")%></nobr></td>
+                               <td class="value" colspan="4">
+                                       <input type="hidden" 
name="prerequisites_present" value="true"/>
+<%
+           for (IMappingConnection mappingConnection : mappingConnections)
+           {
+               String mappingName = mappingConnection.getName();
+               String mappingDescription = mappingName;
+               if (mappingConnection.getDescription() != null && 
mappingConnection.getDescription().length() > 0)
+                       mappingDescription += " (" + 
mappingConnection.getDescription()+")";
+               if (prereqs.contains(mappingName))
+               {
+%>
+                                       <input type="checkbox" 
name="prerequisites" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(mappingName)%>' 
checked="true"/>&nbsp;<%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(mappingDescription)%><br/>
+<%
+               }
+               else
+               {
+%>
+                                       <input type="checkbox" 
name="prerequisites" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(mappingName)%>'/>&nbsp;<%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(mappingDescription)%><br/>
+<%
+               }
+           }
+%>
+                               </td>
+                       </tr>
+                   </table>
+<%
+         }
+         else
+         {
+               // Hiddens for Prerequisites tab
+%>
+                   <input type="hidden" name="prerequisites_present" 
value="true"/>
+<%
+               for (String prereq : prereqs)
+               {
+%>
+                   <input type="hidden" name="prerequisites" 
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(prereq)%>'/>
+<%
+               }
+         }
+         
          // The "Throttling" tab
          if 
(tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editauthority.Throttling")))
          {

Modified: 
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/execute.jsp
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/execute.jsp?rev=1497147&r1=1497146&r2=1497147&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/execute.jsp
 (original)
+++ 
manifoldcf/branches/CONNECTORS-703/framework/crawler-ui/src/main/webapp/execute.jsp
 Wed Jun 26 22:38:10 2013
@@ -251,7 +251,17 @@
                                        x = 
variableContext.getParameter("maxconnections");
                                        if (x != null && x.length() > 0)
                                                
connection.setMaxConnections(Integer.parseInt(x));
-
+                                       x = 
variableContext.getParameter("prerequisites_present");
+                                       if (x != null && x.equals("true"))
+                                       {
+                                               
connection.getPrerequisites().clear();
+                                               String[] y = 
variableContext.getParameterValues("prerequisites");
+                                               for (String s : y)
+                                               {
+                                                       
connection.getPrerequisites().add(s);
+                                               }
+                                       }
+                                       
                                        String error = 
AuthorityConnectorFactory.processConfigurationPost(threadContext,connection.getClassName(),variableContext,pageContext.getRequest().getLocale(),connection.getConfigParams());
                                        
                                        if (error != null)

Modified: 
manifoldcf/branches/CONNECTORS-703/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties?rev=1497147&r1=1497146&r2=1497147&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-703/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
 (original)
+++ 
manifoldcf/branches/CONNECTORS-703/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
 Wed Jun 26 22:38:10 2013
@@ -179,6 +179,8 @@ editauthority.Name=Name
 editauthority.Type=Type
 editauthority.Throttling=Throttling
 editauthority.EditAuthorityConnection=Edit Authority Connection
+editauthority.Prerequisites=Prerequisites
+editauthority.PrerequisiteUserMappingsColon=Prerequisite user mappings:
 
 editmapper.ApacheManifoldCFEditMapping=Apache ManifoldCF: Edit Mapping
 editmapper.EditAMapping=Edit A Mapping


Reply via email to