Author: kishore
Date: Mon Apr 24 18:45:13 2017
New Revision: 1792530

URL: http://svn.apache.org/viewvc?rev=1792530&view=rev
Log:
Updated Email and Robots tab with Velocity template

Added:
    
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Email.html.vm
   (with props)
    
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Robots.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=1792530&r1=1792529&r2=1792530&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 18:45:13 2017
@@ -1581,16 +1581,18 @@ public class WebcrawlerConnector extends
     Locale locale, ConfigParams parameters, String tabName)
     throws ManifoldCFException, IOException
   {
-    
-    String email = parameters.getParameter(WebcrawlerConfig.PARAMETER_EMAIL);
-    if (email == null)
-      email = "";
-    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";
+
+    final Map<String,Object> velocityContext = new HashMap<String,Object>();
+    velocityContext.put("TABNAME",tabName);
+
+    fillInEmailTab(velocityContext,out,parameters);
+    fillInRobotsTab(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);
+
     String proxyHost = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYHOST);
     if (proxyHost == null)
       proxyHost = "";
@@ -1649,64 +1651,6 @@ public class WebcrawlerConnector extends
       );
     }
 
-    // Email tab
-    if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Email")))
-    {
-      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.EmailAddressToContact") + 
"</nobr></td>\n"+
-"    <td class=\"value\">\n"+
-"      <input type=\"text\" size=\"32\" name=\"email\" 
value=\""+Encoder.attributeEscape(email)+"\"/>\n"+
-"    </td>\n"+
-"  </tr>\n"+
-"</table>\n"
-      );
-    }
-    else
-    {
-      out.print(
-"<input type=\"hidden\" name=\"email\" 
value=\""+Encoder.attributeEscape(email)+"\"/>\n"
-      );
-    }
-
-    // Robots tab
-    if 
(tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Robots")))
-    {
-      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.RobotsTxtUsage") + 
"</nobr></td>\n"+
-"    <td class=\"value\">\n"+
-"      <select name=\"robotsusage\" size=\"3\">\n"+
-"        <option value=\"none\" 
"+(robotsUsage.equals("none")?"selected=\"selected\"":"")+">" + 
Messages.getBodyString(locale,"WebcrawlerConnector.DontLookAtRobotsTxt") + 
"</option>\n"+
-"        <option value=\"data\" 
"+(robotsUsage.equals("data")?"selected=\"selected\"":"")+">" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ObeyRobotsTxtForDataFetchesOnly")
 + "</option>\n"+
-"        <option value=\"all\" 
"+(robotsUsage.equals("all")?"selected=\"selected\"":"")+">" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ObeyRobotsTxtForAllFetches") 
+ "</option>\n"+
-"      </select>\n"+
-"    </td>\n"+
-"  </tr>\n"+
-"  <tr>\n"+
-"    <td class=\"description\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.MetaRobotsTagsUsage") + 
"</nobr></td>\n"+
-"    <td class=\"value\">\n"+
-"      <select name=\"metarobotstagsusage\" size=\"3\">\n"+
-"        <option value=\"none\" 
"+(metaRobotsTagsUsage.equals("none")?"selected=\"selected\"":"")+">" + 
Messages.getBodyString(locale,"WebcrawlerConnector.DontLookAtMetaRobotsTags") + 
"</option>\n"+
-"        <option value=\"all\" 
"+(metaRobotsTagsUsage.equals("all")?"selected=\"selected\"":"")+">" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ObeyMetaRobotsTags") + 
"</option>\n"+
-"      </select>\n"+
-"    </td>\n"+
-"  </tr>\n"+
-"</table>\n"
-      );
-    }
-    else
-    {
-      out.print(
-"<input type=\"hidden\" name=\"robotsusage\" value=\""+robotsUsage+"\"/>\n"+
-"<input type=\"hidden\" name=\"metarobotstagsusage\" 
value=\""+metaRobotsTagsUsage+"\"/>\n"
-      );
-    }
-
     // Bandwidth tab
     if 
(tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Bandwidth")))
     {

Added: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Email.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_Email.html.vm?rev=1792530&view=auto
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Email.html.vm
 (added)
+++ 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Email.html.vm
 Mon Apr 24 18:45:13 2017
@@ -0,0 +1,31 @@
+<!--
+ 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.
+-->
+
+#if($TABNAME == $ResourceBundle.getString('WebcrawlerConnector.Email'))
+<table class="displaytable">
+  <tr><td class="separator" colspan="2"><hr/></td></tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.EmailAddressToContact'))</nobr></td>
+    <td class="value">
+      <input type="text" size="32" name="email" 
value="$Encoder.attributeEscape($EMAIL)"/>
+    </td>
+  </tr>
+</table>
+#else
+<input type="hidden" name="email" value="$Encoder.attributeEscape($EMAIL)"/>
+#end
+

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

Added: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Robots.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_Robots.html.vm?rev=1792530&view=auto
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Robots.html.vm
 (added)
+++ 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Robots.html.vm
 Mon Apr 24 18:45:13 2017
@@ -0,0 +1,45 @@
+<!--
+ 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.
+-->
+
+#if($TABNAME == $ResourceBundle.getString('WebcrawlerConnector.Robots'))
+<table class="displaytable">
+  <tr><td class="separator" colspan="2"><hr/></td></tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.RobotsTxtUsage'))</nobr></td>
+    <td class="value">
+      <select name="robotsusage" size="3">
+        <option value="none" #if($ROBOTSUSAGE == 'none') selected="selected" 
#{else} "" #end 
>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.DontLookAtRobotsTxt'))</option>
+        <option value="data" #if($ROBOTSUSAGE == 'data') selected="selected" 
#{else} "" #end 
>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ObeyRobotsTxtForDataFetchesOnly'))</option>
+        <option value="all"  #if($ROBOTSUSAGE == 'all')  selected="selected" 
#{else} "" #end 
>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ObeyRobotsTxtForAllFetches'))</option>
+      </select>
+    </td>
+  </tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.MetaRobotsTagsUsage'))</nobr></td>
+    <td class="value">
+      <select name="metarobotstagsusage" size="3">
+        <option value="none" #if($METAROBOTSTAGSUSAGE == 'none') 
selected="selected" #{else} "" #end 
>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.DontLookAtMetaRobotsTags'))</option>
+        <option value="all"  #if($METAROBOTSTAGSUSAGE == 'all')  
selected="selected" #{else} "" 
#end>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ObeyMetaRobotsTags'))</option>
+      </select>
+    </td>
+  </tr>
+</table>
+#else
+<input type="hidden" name="robotsusage" 
value="$Encoder.attributeEscape($ROBOTSUSAGE)"/>
+<input type="hidden" name="metarobotstagsusage" 
value="$Encoder.attributeEscape($METAROBOTSTAGSUSAGE)"/>
+#end
+

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


Reply via email to