Author: kishore
Date: Mon Apr 24 19:27:26 2017
New Revision: 1792535

URL: http://svn.apache.org/viewvc?rev=1792535&view=rev
Log:
Updated Bandwidth tab with Velocity template

Added:
    
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Bandwidth.html.vm
   (with props)
Modified:
    
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java

Modified: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java?rev=1792535&r1=1792534&r2=1792535&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
 Mon Apr 24 19:27:26 2017
@@ -1566,6 +1566,84 @@ public class WebcrawlerConnector extends
     final Map<String,Object> velocityContext = new HashMap<String,Object>();
     Messages.outputResourceWithVelocity(out, locale, 
"editConfiguration.js.vm", velocityContext);
   }
+
+  private void fillInEmailTab(Map<String,Object> velocityContext, IHTTPOutput 
out, ConfigParams parameters)
+  {
+    String email = parameters.getParameter(WebcrawlerConfig.PARAMETER_EMAIL);
+    if (email == null)
+      email = "";
+
+    velocityContext.put("EMAIL",email);
+  }
+
+  private void fillInRobotsTab(Map<String,Object> velocityContext, IHTTPOutput 
out, ConfigParams parameters)
+  {
+    String robotsUsage = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_ROBOTSUSAGE);
+    if (robotsUsage == null)
+      robotsUsage = "all";
+    String metaRobotsTagsUsage = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_META_ROBOTS_TAGS_USAGE);
+    if (metaRobotsTagsUsage == null)
+      metaRobotsTagsUsage = "all";
+
+    velocityContext.put("ROBOTSUSAGE",robotsUsage);
+    velocityContext.put("METAROBOTSTAGSUSAGE",metaRobotsTagsUsage);
+  }
+
+  private void fillInBandwidthTab(Map<String,Object> velocityContext, 
IHTTPOutput out, ConfigParams parameters)
+  {
+    int i = 0;
+    int binCounter = 0;
+    List<Map<String,String>> throttlesMapList = new ArrayList<>();
+    while (i < parameters.getChildCount())
+    {
+      ConfigNode cn = parameters.getChild(i++);
+      if (cn.getType().equals(WebcrawlerConfig.NODE_BINDESC))
+      {
+        Map<String,String> throttleMap = new HashMap<>();
+        // A bin description node!  Look for all its parameters.
+        String regexp = cn.getAttributeValue(WebcrawlerConfig.ATTR_BINREGEXP);
+        String isCaseInsensitive = 
cn.getAttributeValue(WebcrawlerConfig.ATTR_INSENSITIVE);
+        String maxConnections = null;
+        String maxKBPerSecond = null;
+        String maxFetchesPerMinute = null;
+        int j = 0;
+        while (j < cn.getChildCount())
+        {
+          ConfigNode childNode = cn.getChild(j++);
+          if (childNode.getType().equals(WebcrawlerConfig.NODE_MAXCONNECTIONS))
+            maxConnections = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
+          else if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXKBPERSECOND))
+            maxKBPerSecond = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
+          else if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXFETCHESPERMINUTE))
+            maxFetchesPerMinute = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
+        }
+        if (maxConnections == null)
+          maxConnections = "";
+        if (maxKBPerSecond == null)
+          maxKBPerSecond = "";
+        if (maxFetchesPerMinute == null)
+          maxFetchesPerMinute = "";
+        if(regexp == null)
+          regexp = "";
+
+        if (isCaseInsensitive == null || isCaseInsensitive.length() == 0)
+          isCaseInsensitive = "false";
+
+        throttleMap.put("regexp",regexp);
+        throttleMap.put("isCaseInsensitive",isCaseInsensitive);
+        throttleMap.put("maxConnections",maxConnections);
+        throttleMap.put("maxKBPerSecond",maxKBPerSecond);
+        throttleMap.put("maxFetchesPerMinute",maxFetchesPerMinute);
+        throttlesMapList.add(throttleMap);
+        binCounter++;
+      }
+    }
+    if (parameters.getChildCount() == 0)
+    {
+      velocityContext.put("BRANDNEW",true);
+    }
+    velocityContext.put("THROTTLESMAPLIST",throttlesMapList);
+  }
   
   /** Output the configuration body section.
   * This method is called in the body section of the connector's configuration 
page.  Its purpose is to present the required form elements for editing.
@@ -1587,11 +1665,14 @@ public class WebcrawlerConnector extends
 
     fillInEmailTab(velocityContext,out,parameters);
     fillInRobotsTab(velocityContext,out,parameters);
+    fillInBandwidthTab(velocityContext,out,parameters);
 
     // Email tab
     
Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Email.html.vm",velocityContext);
     // Robots tab
     
Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Robots.html.vm",velocityContext);
+    //Bandwidth tab
+    
Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Bandwidth.html.vm",velocityContext);
 
     String proxyHost = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYHOST);
     if (proxyHost == null)
@@ -1651,234 +1732,6 @@ public class WebcrawlerConnector extends
       );
     }
 
-    // Bandwidth tab
-    if 
(tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Bandwidth")))
-    {
-      out.print(
-"<table class=\"displaytable\">\n"+
-"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
-"  <tr>\n"+
-"    <td class=\"description\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.Throttles") + 
"</nobr></td>\n"+
-"    <td class=\"boxcell\">\n"+
-"      <table class=\"formtable\">\n"+
-"        <tr class=\"formheaderrow\">\n"+
-"          <td class=\"formcolumnheader\"></td>\n"+
-"          <td class=\"formcolumnheader\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.BinRegularExpression") + 
"</nobr></td>\n"+
-"          <td class=\"formcolumnheader\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.CaseInsensitive") + 
"</nobr></td>\n"+
-"          <td class=\"formcolumnheader\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.MaxConnections") + 
"</nobr></td>\n"+
-"          <td class=\"formcolumnheader\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.MaxKbytesSec") + 
"</nobr></td>\n"+
-"          <td class=\"formcolumnheader\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.MaxFetchesMin") + 
"</nobr></td>\n"+
-"        </tr>\n"
-      );
-      int i = 0;
-      int binCounter = 0;
-      while (i < parameters.getChildCount())
-      {
-        ConfigNode cn = parameters.getChild(i++);
-        if (cn.getType().equals(WebcrawlerConfig.NODE_BINDESC))
-        {
-          // A bin description node!  Look for all its parameters.
-          String regexp = 
cn.getAttributeValue(WebcrawlerConfig.ATTR_BINREGEXP);
-          String isCaseInsensitive = 
cn.getAttributeValue(WebcrawlerConfig.ATTR_INSENSITIVE);
-          String maxConnections = null;
-          String maxKBPerSecond = null;
-          String maxFetchesPerMinute = null;
-          int j = 0;
-          while (j < cn.getChildCount())
-          {
-            ConfigNode childNode = cn.getChild(j++);
-            if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXCONNECTIONS))
-              maxConnections = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
-            else if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXKBPERSECOND))
-              maxKBPerSecond = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
-            else if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXFETCHESPERMINUTE))
-              maxFetchesPerMinute = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
-          }
-          if (maxConnections == null)
-            maxConnections = "";
-          if (maxKBPerSecond == null)
-            maxKBPerSecond = "";
-          if (maxFetchesPerMinute == null)
-            maxFetchesPerMinute = "";
-            
-          if (isCaseInsensitive == null || isCaseInsensitive.length() == 0)
-            isCaseInsensitive = "false";
-
-          // It's prefix will be...
-          String prefix = "bandwidth_" + Integer.toString(binCounter);
-          out.print(
-"        <tr class=\""+(((binCounter % 
2)==0)?"evenformrow":"oddformrow")+"\">\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <a name=\""+prefix+"\">\n"+
-"              <input type=\"button\" value=\"" + 
Messages.getAttributeString(locale,"WebcrawlerConnector.Delete") + "\" 
alt=\""+Messages.getAttributeString(locale,"WebcrawlerConnector.DeleteBinRegularExpression")+Integer.toString(binCounter+1)+"\"
 onclick='javascript:deleteRegexp("+Integer.toString(binCounter)+");'/>\n"+
-"              <input type=\"hidden\" name=\""+"op_"+prefix+"\" 
value=\"Continue\"/>\n"+
-"              <input type=\"hidden\" name=\""+"regexp_"+prefix+"\" 
value=\""+Encoder.attributeEscape(regexp)+"\"/>\n"+
-"            </a>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr>"+Encoder.bodyEscape(regexp)+"</nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"checkbox\" name=\"insensitive_"+prefix+"\" 
value=\"true\" "+(isCaseInsensitive.equals("true")?"checked=\"\"":"")+" 
/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" 
name=\"connections_"+prefix+"\" value=\""+maxConnections+"\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" name=\"rate_"+prefix+"\" 
value=\""+maxKBPerSecond+"\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" name=\"fetches_"+prefix+"\" 
value=\""+maxFetchesPerMinute+"\"/></nobr>\n"+
-"          </td>\n"+
-"        </tr>\n"
-          );
-          binCounter++;
-        }
-      }
-
-      // If it looks like this is a brand-new configuration, add in a default 
throttle.
-      // This only works because other nodes must get created on the first 
post, and cannot then be deleted.
-      if (parameters.getChildCount() == 0)
-      {
-        // It's prefix will be...
-        String prefix = "bandwidth_" + Integer.toString(binCounter);
-        out.print(
-"        <tr class=\""+(((binCounter % 
2)==0)?"evenformrow":"oddformrow")+"\">\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <a name=\""+prefix+"\">\n"+
-"              <input type=\"button\" value=\"" + 
Messages.getAttributeString(locale,"WebcrawlerConnector.Delete") + "\" alt=\""+ 
Messages.getAttributeString(locale,"WebcrawlerConnector.DeleteBinRegularExpression")
 +Integer.toString(binCounter+1)+"\" 
onclick='javascript:deleteRegexp("+Integer.toString(binCounter)+");'/>\n"+
-"              <input type=\"hidden\" name=\""+"op_"+prefix+"\" 
value=\"Continue\"/>\n"+
-"              <input type=\"hidden\" name=\""+"regexp_"+prefix+"\" 
value=\"\"/>\n"+
-"            </a>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"checkbox\" name=\"insensitive_"+prefix+"\" 
value=\"false\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" 
name=\"connections_"+prefix+"\" value=\"2\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" name=\"rate_"+prefix+"\" 
value=\"64\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" name=\"fetches_"+prefix+"\" 
value=\"12\"/></nobr>\n"+
-"          </td>\n"+
-"        </tr>\n"
-        );
-        binCounter++;
-      }
-
-      if (binCounter == 0)
-      {
-        out.print(
-"        <tr class=\"formrow\"><td class=\"formmessage\" 
colspan=\"6\">"+Messages.getBodyString(locale,"WebcrawlerConnector.NoBandwidthOrConnectionThrottlingSpecified")+"</td></tr>\n"
-        );
-      }
-      out.print(
-"        <tr class=\"formrow\"><td class=\"formseparator\" 
colspan=\"6\"><hr/></td></tr>\n"+
-"        <tr class=\"formrow\">\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <a name=\"bandwidth\">\n"+
-"              <input type=\"button\" value=\"" + 
Messages.getAttributeString(locale,"WebcrawlerConnector.Add") + "\" alt=\"" + 
Messages.getAttributeString(locale,"WebcrawlerConnector.AddBinRegularExpression")
 + "\" onclick=\"javascript:addRegexp();\"/>\n"+
-"            </a>\n"+
-"            <input type=\"hidden\" name=\"bandwidth_count\" 
value=\""+binCounter+"\"/>\n"+
-"            <input type=\"hidden\" name=\"bandwidth_op\" 
value=\"Continue\"/>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"30\" name=\"regexp_bandwidth\" 
value=\"\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"checkbox\" name=\"insensitive_bandwidth\" 
value=\"true\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" 
name=\"connections_bandwidth\" value=\"\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" name=\"rate_bandwidth\" 
value=\"\"/></nobr>\n"+
-"          </td>\n"+
-"          <td class=\"formcolumncell\">\n"+
-"            <nobr><input type=\"text\" size=\"5\" name=\"fetches_bandwidth\" 
value=\"\"/></nobr>\n"+
-"          </td>\n"+
-"        </tr>\n"+
-"      </table>\n"+
-"    </td>\n"+
-"  </tr>\n"+
-"</table>\n"
-      );
-    }
-    else
-    {
-      // Hiddens for bandwidth tab.
-      int i = 0;
-      int binCounter = 0;
-      while (i < parameters.getChildCount())
-      {
-        ConfigNode cn = parameters.getChild(i++);
-        if (cn.getType().equals(WebcrawlerConfig.NODE_BINDESC))
-        {
-          // A bin description node!  Look for all its parameters.
-          String regexp = 
cn.getAttributeValue(WebcrawlerConfig.ATTR_BINREGEXP);
-          String isCaseInsensitive = 
cn.getAttributeValue(WebcrawlerConfig.ATTR_INSENSITIVE);
-          String maxConnections = null;
-          String maxKBPerSecond = null;
-          String maxFetchesPerMinute = null;
-          int j = 0;
-          while (j < cn.getChildCount())
-          {
-            ConfigNode childNode = cn.getChild(j++);
-            if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXCONNECTIONS))
-              maxConnections = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
-            else if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXKBPERSECOND))
-              maxKBPerSecond = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
-            else if 
(childNode.getType().equals(WebcrawlerConfig.NODE_MAXFETCHESPERMINUTE))
-              maxFetchesPerMinute = 
childNode.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
-          }
-          if (maxConnections == null)
-            maxConnections = "";
-          if (maxKBPerSecond == null)
-            maxKBPerSecond = "";
-          if (maxFetchesPerMinute == null)
-            maxFetchesPerMinute = "";
-          if (isCaseInsensitive == null || isCaseInsensitive.length() == 0)
-            isCaseInsensitive = "false";
-
-          // It's prefix will be...
-          String prefix = "bandwidth_" + Integer.toString(binCounter);
-          out.print(
-"<input type=\"hidden\" name=\""+"regexp_"+prefix+"\" 
value=\""+Encoder.attributeEscape(regexp)+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"insensitive_"+prefix+"\" 
value=\""+isCaseInsensitive+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"connections_"+prefix+"\" 
value=\""+maxConnections+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"rate_"+prefix+"\" 
value=\""+maxKBPerSecond+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"fetches_"+prefix+"\" 
value=\""+maxFetchesPerMinute+"\"/>\n"
-          );
-          binCounter++;
-        }
-      }
-
-      // If it looks like this is a brand-new configuration, add in a default 
throttle.
-      // This only works because other nodes must get created on the first 
post, and cannot then be deleted.
-      if (parameters.getChildCount() == 0)
-      {
-        // It's prefix will be...
-        String prefix = "bandwidth_" + Integer.toString(binCounter);
-        out.print(
-"<input type=\"hidden\" name=\""+"regexp_"+prefix+"\" value=\"\"/>\n"+
-"<input type=\"hidden\" name=\""+"insensitive_"+prefix+"\" 
value=\"false\"/>\n"+
-"<input type=\"hidden\" name=\""+"connections_"+prefix+"\" value=\"2\"/>\n"+
-"<input type=\"hidden\" name=\""+"rate_"+prefix+"\" value=\"64\"/>\n"+
-"<input type=\"hidden\" name=\""+"fetches_"+prefix+"\" value=\"12\"/>\n"
-        );
-        binCounter++;
-      }
-
-      out.print(
-"<input type=\"hidden\" name=\"bandwidth_count\" value=\""+binCounter+"\"/>\n"
-      );
-    }
-
     // Access Credentials tab
     if 
(tabName.equals(Messages.getString(locale,"WebcrawlerConnector.AccessCredentials")))
     {

Added: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Bandwidth.html.vm
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Bandwidth.html.vm?rev=1792535&view=auto
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Bandwidth.html.vm
 (added)
+++ 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Bandwidth.html.vm
 Mon Apr 24 19:27:26 2017
@@ -0,0 +1,149 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+#set( $BINCOUNTER = 0)
+#if($TABNAME == $ResourceBundle.getString('WebcrawlerConnector.Bandwidth'))
+<table class="displaytable">
+  <tr><td class="separator" colspan="2"><hr/></td></tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.Throttles'))</nobr></td>
+    <td class="boxcell">
+      <table class="formtable">
+        <tr class="formheaderrow">
+          <td class="formcolumnheader"></td>
+          <td 
class="formcolumnheader"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.BinRegularExpression'))</nobr></td>
+          <td 
class="formcolumnheader"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.CaseInsensitive'))</nobr></td>
+          <td 
class="formcolumnheader"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.MaxConnections'))</nobr></td>
+          <td 
class="formcolumnheader"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.MaxKbytesSec'))</nobr></td>
+          <td 
class="formcolumnheader"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.MaxFetchesMin'))</nobr></td>
+        </tr>
+        #foreach($throttleMap in $THROTTLESMAPLIST)
+          #set( $THROTTLEPREFIX = "bandwidth_" + $BINCOUNTER )
+        <tr>
+          <td class="formcolumncell">
+            <a name="$THROTTLEPREFIX">
+              <input type="button" 
value="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.Delete'))"
 
alt="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.DeleteBinRegularExpression'))$foreach.count"
 onclick='javascript:deleteRegexp($BINCOUNTER);'/>
+              <input type="hidden" name="op_$THROTTLEPREFIX" value="Continue"/>
+              <input type="hidden" name="regexp_$THROTTLEPREFIX" 
value="$throttleMap.get("regexp")"/>
+            </a>
+          </td>
+          <td class="formcolumncell">
+            <nobr>$Encoder.bodyEscape($throttleMap.get("regexp"))</nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="checkbox" name="insensitive_$THROTTLEPREFIX" 
value="true" #if($throttleMap.get("isCaseInsensitive") == 'true') checked 
#{else} "" #end /></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" 
name="connections_$THROTTLEPREFIX" 
value="$throttleMap.get("maxConnections")"/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" name="rate_$THROTTLEPREFIX" 
value="$throttleMap.get("maxKBPerSecond")"/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" name="fetches_$THROTTLEPREFIX" 
value="$throttleMap.get("maxFetchesPerMinute")"/></nobr>
+          </td>
+        </tr>
+          #set( $BINCOUNTER = $BINCOUNTER + 1)
+        #end
+
+        ## If it looks like this is a brand-new configuration, add in a 
default throttle.
+        ## This only works because other nodes must get created on the first 
post, and cannot then be deleted.
+        #if($BRANDNEW)
+          #set( $THROTTLEPREFIX = "bandwidth_" + $BINCOUNTER )
+        <tr>
+          <td class="formcolumncell">
+            <a name="$THROTTLEPREFIX">
+              <input type="button" 
value="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.Delete'))"
 
alt="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.DeleteBinRegularExpression'))($foreach.count
 + 1)" onclick='javascript:deleteRegexp($BINCOUNTER);'/>
+              <input type="hidden" name="op_$THROTTLEPREFIX" value="Continue"/>
+              <input type="hidden" name="regexp_$THROTTLEPREFIX" value=""/>
+            </a>
+          </td>
+          <td class="formcolumncell">
+            <nobr></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="checkbox" name="insensitive_$THROTTLEPREFIX" 
value="false"/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" 
name="connections_$THROTTLEPREFIX" value="2"/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" name="rate_$THROTTLEPREFIX" 
value="64"/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" name="fetches_$THROTTLEPREFIX" 
value="12"/></nobr>
+          </td>
+        </tr>
+          #set( $BINCOUNTER = $BINCOUNTER + 1)
+        #end
+
+        #if($BINCOUNTER == "0")
+        <tr class="formrow">
+            <td class="formmessage" 
colspan="6">$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.NoBandwidthOrConnectionThrottlingSpecified'))</td>
+        </tr>
+        #end
+
+        <tr class="formrow"><td class="formseparator" 
colspan="6"><hr/></td></tr>
+        <tr class="formrow">
+          <td class="formcolumncell">
+            <a name="bandwidth">
+              <input type="button" 
value="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.Add'))"
 
alt="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.AddBinRegularExpression'))"
 onclick="javascript:addRegexp();"/>
+            </a>
+            <input type="hidden" name="bandwidth_count" value="$BINCOUNTER"/>
+            <input type="hidden" name="bandwidth_op" value="Continue"/>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="30" name="regexp_bandwidth" 
value=""/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="checkbox" name="insensitive_bandwidth" 
value="true"/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" name="connections_bandwidth" 
value=""/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" name="rate_bandwidth" 
value=""/></nobr>
+          </td>
+          <td class="formcolumncell">
+            <nobr><input type="text" size="5" name="fetches_bandwidth" 
value=""/></nobr>
+          </td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+</table>
+#else
+  #foreach($throttleMap in $THROTTLESMAPLIST)
+    #set( $THROTTLEPREFIX = "bandwidth_" + $BINCOUNTER )
+<input type="hidden" name="regexp_$THROTTLEPREFIX" 
value="$Encoder.attributeEscape($throttleMap.get("regexp"))"/>
+<input type="hidden" name="insensitive_$THROTTLEPREFIX" 
value="$Encoder.attributeEscape($throttleMap.get("isCaseInsensitive"))"/>
+<input type="hidden" name="connections_$THROTTLEPREFIX" 
value="$Encoder.attributeEscape($throttleMap.get("maxConnections"))"/>
+<input type="hidden" name="rate_$THROTTLEPREFIX" 
value="$Encoder.attributeEscape($throttleMap.get("maxKBPerSecond"))"/>
+<input type="hidden" name="fetches_$THROTTLEPREFIX" 
value="$Encoder.attributeEscape($throttleMap.get("maxFetchesPerMinute"))"/>
+    #set( $BINCOUNTER = $BINCOUNTER + 1)
+  #end
+  #if($BRANDNEW)
+    #set( $THROTTLEPREFIX = "bandwidth_" + $BINCOUNTER )
+<input type="hidden" name="regexp_$THROTTLEPREFIX" value=""/>
+<input type="hidden" name="insensitive_$THROTTLEPREFIX" value="false"/>
+<input type="hidden" name="connections_$THROTTLEPREFIX" value="2"/>
+<input type="hidden" name="rate_$THROTTLEPREFIX" value="64"/>
+<input type="hidden" name="fetches_$THROTTLEPREFIX" value="12"/>
+    #set( $BINCOUNTER = $BINCOUNTER + 1)
+  #end
+<input type="hidden" name="bandwidth_count" value="$BINCOUNTER"/>
+#end
+

Propchange: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Bandwidth.html.vm
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to