manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kish...@apache.org
Subject svn commit: r1792519 - in /manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main: java/org/apache/manifoldcf/crawler/connectors/webcrawler/ resource/org/ resource/org/apache/ resource/org/apache/manifoldcf/ resource/org/apache/ma...
Date Mon, 24 Apr 2017 17:13:22 GMT
Author: kishore
Date: Mon Apr 24 17:13:22 2017
New Revision: 1792519

URL: http://svn.apache.org/viewvc?rev=1792519&view=rev
Log:
Updated configuration header to use Velocity template

Added:
    manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/
    manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/
    manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/
    manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/
    manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/
    manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/
    manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration.js.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=1792519&r1=1792518&r2=1792519&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 17:13:22 2017
@@ -1563,318 +1563,8 @@ public class WebcrawlerConnector extends
     tabsArray.add(Messages.getString(locale,"WebcrawlerConnector.Certificates"));
     tabsArray.add(Messages.getString(locale,"WebcrawlerConnector.Proxy"));
 
-    out.print(
-"<script type=\"text/javascript\">\n"+
-"<!--\n"+
-"function checkConfig()\n"+
-"{\n"+
-"  if (editconnection.email.value != \"\" && editconnection.email.value.indexOf(\"@\")
== -1)\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.NeedAValidEmailAddress")+"\");\n"+
-"    editconnection.email.focus();\n"+
-"    return false;\n"+
-"  }\n"+
-"\n"+
-"  // If the Bandwidth tab is up, check to be sure we have valid numbers and regexps everywhere.\n"+
-"  var i = 0;\n"+
-"  var count = editconnection.bandwidth_count.value;\n"+
-"  while (i < count)\n"+
-"  {\n"+
-"    var connections = eval(\"editconnection.connections_bandwidth_\"+i+\".value\");\n"+
-"    if (connections != \"\" && !isInteger(connections))\n"+
-"    {\n"+
-"      alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MaximumConnectionsMustBeAnInteger")+"\");\n"+
-"      eval(\"editconnection.connections_bandwidth_\"+i+\".focus()\");\n"+
-"      return false;\n"+
-"    }\n"+
-"    var rate = eval(\"editconnection.rate_bandwidth_\"+i+\".value\");\n"+
-"    if (rate != \"\" && !isInteger(rate))\n"+
-"    {\n"+
-"      alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MaximumKbytesPerSecondMustBeAnInteger")+"\");\n"+
-"      eval(\"editconnection.rate_bandwidth_\"+i+\".focus()\");\n"+
-"      return false;\n"+
-"    }\n"+
-"    var fetches = eval(\"editconnection.fetches_bandwidth_\"+i+\".value\");\n"+
-"    if (fetches != \"\" && !isInteger(fetches))\n"+
-"    {\n"+
-"      alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MaximumFetchesPerMinuteMustBeAnInteger")+"\");\n"+
-"      eval(\"editconnection.fetches_bandwidth_\"+i+\".focus()\");\n"+
-"      return false;\n"+
-"    }\n"+
-"\n"+
-"    i = i + 1;\n"+
-"  }\n"+
-"    \n"+
-"  // Make sure access credentials are all legal\n"+
-"  i = 0;\n"+
-"  count = editconnection.acredential_count.value;\n"+
-"  while (i < count)\n"+
-"  {\n"+
-"    var username = eval(\"editconnection.username_acredential_\"+i+\".value\");\n"+
-"    if (username == \"\")\n"+
-"    {\n"+
-"      alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.CredentialMustHaveNonNullUserName")+"\");\n"+
-"      eval(\"editconnection.username_acredential_\"+i+\".focus()\");\n"+
-"      return false;\n"+
-"    }\n"+
-"    i = i + 1;\n"+
-"  }\n"+
-"\n"+
-"  // Make sure session credentials are all legal\n"+
-"  i = 0;\n"+
-"  count = editconnection.scredential_count.value;\n"+
-"  while (i < count)\n"+
-"  {\n"+
-"    var loginpagecount = eval(\"editconnection.scredential_\"+i+\"_loginpagecount.value\");\n"+
-"    var j = 0;\n"+
-"    while (j < loginpagecount)\n"+
-"    {\n"+
-"      var matchregexp = eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_matchregexp.value\");\n"+
-"      if (!isRegularExpression(matchregexp))\n"+
-"      {\n"+
-"        alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MatchExpressionMustBeAValidRegularExpression")+"\");\n"+
-"        eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_matchregexp.focus()\");\n"+
-"        return false;\n"+
-"      }\n"+
-"      if (eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_type.value\") == \"form\")\n"+
-"      {\n"+
-"        var paramcount = eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_loginparamcount.value\");\n"+
-"        var k = 0;\n"+
-"        while (k < paramcount)\n"+
-"        {\n"+
-"          var paramname = eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_\"+k+\"_param.value\");\n"+
-"          if (paramname == \"\")\n"+
-"          {\n"+
-"            alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.ParameterMustHaveNonEmptyName")+"\");\n"+
-"            eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_\"+k+\"_param.focus()\");\n"+
-"            return false;\n"+
-"          }\n"+
-"          var paramvalue = eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_\"+k+\"_value.value\");\n"+
-"          var parampassword = eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_\"+k+\"_password.value\");\n"+
-"          if (paramvalue != \"\" && parampassword != \"\")\n"+
-"          {\n"+
-"            alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.ParameterCanEitherBeHidden")+"\");\n"+
-"            eval(\"editconnection.scredential_\"+i+\"_\"+j+\"_\"+k+\"_value.focus()\");\n"+
-"            return false;\n"+
-"          }\n"+
-"          k = k + 1;\n"+
-"        }\n"+
-"      }\n"+
-"      j = j + 1;\n"+
-"    }\n"+
-"    i = i + 1;\n"+
-"  }\n"+
-"  return true;\n"+
-"}\n"+
-"\n"+
-"function checkConfigForSave()\n"+
-"{\n"+
-"  if (editconnection.email.value == \"\")\n"+
-"  {\n"+
-"    alert(\"" + Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.EmailAaddressRequired")
+ "\");\n"+
-"    SelectTab(\"" + Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.Email")
+ "\");\n"+
-"    editconnection.email.focus();\n"+
-"    return false;\n"+
-"  }\n"+
-"  return true;\n"+
-"}\n"+
-"\n"+
-"function deleteRegexp(i)\n"+
-"{\n"+
-"  // Set the operation\n"+
-"  eval(\"editconnection.op_bandwidth_\"+i+\".value=\\\"Delete\\\"\");\n"+
-"  // Submit\n"+
-"  if (editconnection.bandwidth_count.value==i)\n"+
-"    postFormSetAnchor(\"bandwidth\");\n"+
-"  else\n"+
-"    postFormSetAnchor(\"bandwidth_\"+i)\n"+
-"  // Undo, so we won't get two deletes next time\n"+
-"  eval(\"editconnection.op_bandwidth_\"+i+\".value=\\\"Continue\\\"\");\n"+
-"}\n"+
-"\n"+
-"function addRegexp()\n"+
-"{\n"+
-"  if (editconnection.connections_bandwidth.value != \"\" && !isInteger(editconnection.connections_bandwidth.value))\n"+
-"  {\n"+
-"    alert(\"" + Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MaximumConnectionsMustBeAnInteger")+"\");\n"+
-"    editconnection.connections_bandwidth.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  if (editconnection.rate_bandwidth.value != \"\" && !isInteger(editconnection.rate_bandwidth.value))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MaximumKbytesPerSecondMustBeAnInteger")+"\");\n"+
-"    editconnection.rate_bandwidth.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  if (editconnection.fetches_bandwidth.value != \"\" && !isInteger(editconnection.fetches_bandwidth.value))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MaximumFetchesPerMinuteMustBeAnInteger")+"\");\n"+
-"    editconnection.fetches_bandwidth.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  if (!isRegularExpression(editconnection.regexp_bandwidth.value))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.AValidRegularExpressionIsRequired")+"\");\n"+
-"    editconnection.regexp_bandwidth.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  editconnection.bandwidth_op.value=\"Add\";\n"+
-"  postFormSetAnchor(\"bandwidth\");\n"+
-"}\n"+
-"\n"+
-"function deleteARegexp(i)\n"+
-"{\n"+
-"  // Set the operation\n"+
-"  eval(\"editconnection.op_acredential_\"+i+\".value=\\\"Delete\\\"\");\n"+
-"  // Submit\n"+
-"  if (editconnection.acredential_count.value==i)\n"+
-"    postFormSetAnchor(\"acredential\");\n"+
-"  else\n"+
-"    postFormSetAnchor(\"acredential_\"+i)\n"+
-"  // Undo, so we won't get two deletes next time\n"+
-"  eval(\"editconnection.op_acredential_\"+i+\".value=\\\"Continue\\\"\");\n"+
-"}\n"+
-"\n"+
-"function addARegexp()\n"+
-"{\n"+
-"  if (editconnection.username_acredential.value == \"\")\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.CredentialMustIncludeANonNullUserName")+"\");\n"+
-"    editconnection.username_acredential.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  if (!isRegularExpression(editconnection.regexp_acredential.value))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.AValidRegularExpressionIsRequired")+"\");\n"+
-"    editconnection.regexp_acredential.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  editconnection.acredential_op.value=\"Add\";\n"+
-"  postFormSetAnchor(\"acredential\");\n"+
-"}\n"+
-"\n"+
-"function deleteSRegexp(i)\n"+
-"{\n"+
-"  // Set the operation\n"+
-"  eval(\"editconnection.scredential_\"+i+\"_op.value=\\\"Delete\\\"\");\n"+
-"  // Submit\n"+
-"  if (editconnection.scredential_count.value==i)\n"+
-"    postFormSetAnchor(\"scredential\");\n"+
-"  else\n"+
-"    postFormSetAnchor(\"scredential_\"+i)\n"+
-"  // Undo, so we won't get two deletes next time\n"+
-"  eval(\"editconnection.scredential_\"+i+\"_op.value=\\\"Continue\\\"\");\n"+
-"}\n"+
-"\n"+
-"function addSRegexp()\n"+
-"{\n"+
-"  if (!isRegularExpression(editconnection.scredential_regexp.value))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.AValidRegularExpressionIsRequired")+"\");\n"+
-"    editconnection.scredential_regexp.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  editconnection.scredential_op.value=\"Add\";\n"+
-"  postFormSetAnchor(\"scredential\");\n"+
-"}\n"+
-"\n"+
-"function deleteLoginPage(credential,loginpage)\n"+
-"{\n"+
-"  // Set the operation\n"+
-"  eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_op.value=\\\"Delete\\\"\");\n"+
-"  // Submit\n"+
-"  if (eval(\"editconnection.scredential_\"+credential+\"_loginpagecount.value\")==credential)\n"+
-"    postFormSetAnchor(\"scredential_loginpage\");\n"+
-"  else\n"+
-"    postFormSetAnchor(\"scredential_\"+credential+\"_\"+loginpage)\n"+
-"  // Undo, so we won't get two deletes next time\n"+
-"  eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_op.value=\\\"Continue\\\"\");\n"+
-"\n"+
-"}\n"+
-"  \n"+
-"function addLoginPage(credential)\n"+
-"{\n"+
-"  if (!isRegularExpression(eval(\"editconnection.scredential_\"+credential+\"_loginpageregexp.value\")))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.AValidRegularExpressionIsRequired")+"\");\n"+
-"    eval(\"editconnection.scredential_\"+credential+\"_loginpageregexp.focus()\");\n"+
-"    return;\n"+
-"  }\n"+
-"  if (!isRegularExpression(eval(\"editconnection.scredential_\"+credential+\"_loginpagematchregexp.value\")))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.AValidRegularExpressionIsRequired")+"\");\n"+
-"    eval(\"editconnection.scredential_\"+credential+\"_loginpagematchregexp.focus()\");\n"+
-"    return;\n"+
-"  }\n"+
-"  eval(\"editconnection.scredential_\"+credential+\"_loginpageop.value=\\\"Add\\\"\");\n"+
-"  postFormSetAnchor(\"scredential_\"+credential);\n"+
-"}\n"+
-"  \n"+
-"function deleteLoginPageParameter(credential,loginpage,parameter)\n"+
-"{\n"+
-"  // Set the operation\n"+
-"  eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_\"+parameter+\"_op.value=\\\"Delete\\\"\");\n"+
-"  // Submit\n"+
-"  if (eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_loginparamcount.value\")==credential)\n"+
-"    postFormSetAnchor(\"scredential_\"+credential+\"_loginparam\");\n"+
-"  else\n"+
-"    postFormSetAnchor(\"scredential_\"+credential+\"_\"+loginpage+\"_\"+parameter)\n"+
-"  // Undo, so we won't get two deletes next time\n"+
-"  eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_\"+parameter+\"_op.value=\\\"Continue\\\"\");\n"+
-"}\n"+
-"  \n"+
-"function addLoginPageParameter(credential,loginpage)\n"+
-"{\n"+
-"  if (!isRegularExpression(eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_loginparamname.value\")))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.ParameterNameMustBeARegularExpression")+"\");\n"+
-"    eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_loginparamname.focus()\");\n"+
-"    return;\n"+
-"  }\n"+
-"  if (eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_loginparamvalue.value\")
!= \"\" && eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_loginparampassword.value\")
!= \"\")\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.ParameterCanEitherBeHidden")+"\");\n"+
-"    eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_loginparamvalue.focus()\");\n"+
-"    return;\n"+
-"  }\n"+
-"  eval(\"editconnection.scredential_\"+credential+\"_\"+loginpage+\"_loginparamop.value=\\\"Add\\\"\");\n"+
-"  postFormSetAnchor(\"scredential_\"+credential+\"_\"+loginpage);\n"+
-"}\n"+
-"  \n"+
-"function deleteTRegexp(i)\n"+
-"{\n"+
-"  // Set the operation\n"+
-"  eval(\"editconnection.op_trust_\"+i+\".value=\\\"Delete\\\"\");\n"+
-"  // Submit\n"+
-"  if (editconnection.trust_count.value==i)\n"+
-"    postFormSetAnchor(\"trust\");\n"+
-"  else\n"+
-"    postFormSetAnchor(\"trust_\"+i);\n"+
-"  // Undo, so we won't get two deletes next time\n"+
-"  eval(\"editconnection.op_trust_\"+i+\".value=\\\"Continue\\\"\");\n"+
-"}\n"+
-"\n"+
-"function addTRegexp()\n"+
-"{\n"+
-"  if (editconnection.certificate_trust.value == \"\" && editconnection.all_trust.checked
== false)\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.SpecifyATrustCertificateFileToUploadFirst")+"\");\n"+
-"    editconnection.certificate_trust.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  if (!isRegularExpression(editconnection.regexp_trust.value))\n"+
-"  {\n"+
-"    alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.AValidRegularExpressionIsRequired")+"\");\n"+
-"    editconnection.regexp_trust.focus();\n"+
-"    return;\n"+
-"  }\n"+
-"  editconnection.trust_op.value=\"Add\";\n"+
-"  postFormSetAnchor(\"trust\");\n"+
-"}\n"+
-"  \n"+
-"//-->\n"+
-"</script>\n"
-    );
+    final Map<String,Object> velocityContext = new HashMap<String,Object>();
+    Messages.outputResourceWithVelocity(out, locale, "editConfiguration.js.vm", velocityContext);
   }
   
   /** Output the configuration body section.

Added: manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration.js.vm
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration.js.vm?rev=1792519&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration.js.vm
(added)
+++ manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration.js.vm
Mon Apr 24 17:13:22 2017
@@ -0,0 +1,323 @@
+#**
+Copyright 2017 The Apache Software Foundation.
+
+Licensed 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.
+*#
+<script type="text/javascript">
+function checkConfig()
+{
+  if (editconnection.email.value != "" && editconnection.email.value.indexOf("@")
== -1)
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.NeedAValidEmailAddress'))");
+    editconnection.email.focus();
+    return false;
+  }
+
+  // If the Bandwidth tab is up, check to be sure we have valid numbers and regexps everywhere.
+  var i = 0;
+  var count = editconnection.bandwidth_count.value;
+  while (i < count)
+  {
+    var connections = eval("editconnection.connections_bandwidth_"+i+".value");
+    if (connections != "" && !isInteger(connections))
+    {
+      alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.MaximumConnectionsMustBeAnInteger'))");
+      eval("editconnection.connections_bandwidth_"+i+".focus()");
+      return false;
+    }
+    var rate = eval("editconnection.rate_bandwidth_"+i+".value");
+    if (rate != "" && !isInteger(rate))
+    {
+      alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.MaximumKbytesPerSecondMustBeAnInteger'))");
+      eval("editconnection.rate_bandwidth_"+i+".focus()");
+      return false;
+    }
+    var fetches = eval("editconnection.fetches_bandwidth_"+i+".value");
+    if (fetches != "" && !isInteger(fetches))
+    {
+      alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.MaximumFetchesPerMinuteMustBeAnInteger'))");
+      eval("editconnection.fetches_bandwidth_"+i+".focus()");
+      return false;
+    }
+
+    i = i + 1;
+  }
+    
+  // Make sure access credentials are all legal
+  i = 0;
+  count = editconnection.acredential_count.value;
+  while (i < count)
+  {
+    var username = eval("editconnection.username_acredential_"+i+".value");
+    if (username == "")
+    {
+      alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.CredentialMustHaveNonNullUserName'))");
+      eval("editconnection.username_acredential_"+i+".focus()");
+      return false;
+    }
+    i = i + 1;
+  }
+
+  // Make sure session credentials are all legal
+  i = 0;
+  count = editconnection.scredential_count.value;
+  while (i < count)
+  {
+    var loginpagecount = eval("editconnection.scredential_"+i+"_loginpagecount.value");
+    var j = 0;
+    while (j < loginpagecount)
+    {
+      var matchregexp = eval("editconnection.scredential_"+i+"_"+j+"_matchregexp.value");
+      if (!isRegularExpression(matchregexp))
+      {
+        alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.MatchExpressionMustBeAValidRegularExpression'))");
+        eval("editconnection.scredential_"+i+"_"+j+"_matchregexp.focus()");
+        return false;
+      }
+      if (eval("editconnection.scredential_"+i+"_"+j+"_type.value") == "form")
+      {
+        var paramcount = eval("editconnection.scredential_"+i+"_"+j+"_loginparamcount.value");
+        var k = 0;
+        while (k < paramcount)
+        {
+          var paramname = eval("editconnection.scredential_"+i+"_"+j+"_"+k+"_param.value");
+          if (paramname == "")
+          {
+            alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.ParameterMustHaveNonEmptyName'))");
+            eval("editconnection.scredential_"+i+"_"+j+"_"+k+"_param.focus()");
+            return false;
+          }
+          var paramvalue = eval("editconnection.scredential_"+i+"_"+j+"_"+k+"_value.value");
+          var parampassword = eval("editconnection.scredential_"+i+"_"+j+"_"+k+"_password.value");
+          if (paramvalue != "" && parampassword != "")
+          {
+            alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.ParameterCanEitherBeHidden'))");
+            eval("editconnection.scredential_"+i+"_"+j+"_"+k+"_value.focus()");
+            return false;
+          }
+          k = k + 1;
+        }
+      }
+      j = j + 1;
+    }
+    i = i + 1;
+  }
+  return true;
+}
+
+function checkConfigForSave()
+{
+  if (editconnection.email.value == "")
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.EmailAaddressRequired'))");
+    SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.Email'))");
+    editconnection.email.focus();
+    return false;
+  }
+  return true;
+}
+
+function deleteRegexp(i)
+{
+  // Set the operation
+  eval("editconnection.op_bandwidth_"+i+".value=\"Delete\"");
+  // Submit
+  if (editconnection.bandwidth_count.value==i)
+    postFormSetAnchor("bandwidth");
+  else
+    postFormSetAnchor("bandwidth_"+i)
+  // Undo, so we won't get two deletes next time
+  eval("editconnection.op_bandwidth_"+i+".value=\"Continue\"");
+}
+
+function addRegexp()
+{
+  if (editconnection.connections_bandwidth.value != "" && !isInteger(editconnection.connections_bandwidth.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.MaximumConnectionsMustBeAnInteger'))");
+    editconnection.connections_bandwidth.focus();
+    return;
+  }
+  if (editconnection.rate_bandwidth.value != "" && !isInteger(editconnection.rate_bandwidth.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.MaximumKbytesPerSecondMustBeAnInteger'))");
+    editconnection.rate_bandwidth.focus();
+    return;
+  }
+  if (editconnection.fetches_bandwidth.value != "" && !isInteger(editconnection.fetches_bandwidth.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.MaximumFetchesPerMinuteMustBeAnInteger'))");
+    editconnection.fetches_bandwidth.focus();
+    return;
+  }
+  if (!isRegularExpression(editconnection.regexp_bandwidth.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.AValidRegularExpressionIsRequired'))");
+    editconnection.regexp_bandwidth.focus();
+    return;
+  }
+  editconnection.bandwidth_op.value="Add";
+  postFormSetAnchor("bandwidth");
+}
+
+function deleteARegexp(i)
+{
+  // Set the operation
+  eval("editconnection.op_acredential_"+i+".value=\"Delete\"");
+  // Submit
+  if (editconnection.acredential_count.value==i)
+    postFormSetAnchor("acredential");
+  else
+    postFormSetAnchor("acredential_"+i)
+  // Undo, so we won't get two deletes next time
+  eval("editconnection.op_acredential_"+i+".value=\"Continue\"");
+}
+
+function addARegexp()
+{
+  if (editconnection.username_acredential.value == "")
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.CredentialMustIncludeANonNullUserName'))");
+    editconnection.username_acredential.focus();
+    return;
+  }
+  if (!isRegularExpression(editconnection.regexp_acredential.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.AValidRegularExpressionIsRequired'))");
+    editconnection.regexp_acredential.focus();
+    return;
+  }
+  editconnection.acredential_op.value="Add";
+  postFormSetAnchor("acredential");
+}
+
+function deleteSRegexp(i)
+{
+  // Set the operation
+  eval("editconnection.scredential_"+i+"_op.value=\"Delete\"");
+  // Submit
+  if (editconnection.scredential_count.value==i)
+    postFormSetAnchor("scredential");
+  else
+    postFormSetAnchor("scredential_"+i)
+  // Undo, so we won't get two deletes next time
+  eval("editconnection.scredential_"+i+"_op.value=\"Continue\"");
+}
+
+function addSRegexp()
+{
+  if (!isRegularExpression(editconnection.scredential_regexp.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.AValidRegularExpressionIsRequired'))");
+    editconnection.scredential_regexp.focus();
+    return;
+  }
+  editconnection.scredential_op.value="Add";
+  postFormSetAnchor("scredential");
+}
+
+function deleteLoginPage(credential,loginpage)
+{
+  // Set the operation
+  eval("editconnection.scredential_"+credential+"_"+loginpage+"_op.value=\"Delete\"");
+  // Submit
+  if (eval("editconnection.scredential_"+credential+"_loginpagecount.value")==credential)
+    postFormSetAnchor("scredential_loginpage");
+  else
+    postFormSetAnchor("scredential_"+credential+"_"+loginpage)
+  // Undo, so we won't get two deletes next time
+  eval("editconnection.scredential_"+credential+"_"+loginpage+"_op.value=\"Continue\"");
+
+}
+  
+function addLoginPage(credential)
+{
+  if (!isRegularExpression(eval("editconnection.scredential_"+credential+"_loginpageregexp.value")))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.AValidRegularExpressionIsRequired'))");
+    eval("editconnection.scredential_"+credential+"_loginpageregexp.focus()");
+    return;
+  }
+  if (!isRegularExpression(eval("editconnection.scredential_"+credential+"_loginpagematchregexp.value")))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.AValidRegularExpressionIsRequired'))");
+    eval("editconnection.scredential_"+credential+"_loginpagematchregexp.focus()");
+    return;
+  }
+  eval("editconnection.scredential_"+credential+"_loginpageop.value=\"Add\"");
+  postFormSetAnchor("scredential_"+credential);
+}
+  
+function deleteLoginPageParameter(credential,loginpage,parameter)
+{
+  // Set the operation
+  eval("editconnection.scredential_"+credential+"_"+loginpage+"_"+parameter+"_op.value=\"Delete\"");
+  // Submit
+  if (eval("editconnection.scredential_"+credential+"_"+loginpage+"_loginparamcount.value")==credential)
+    postFormSetAnchor("scredential_"+credential+"_loginparam");
+  else
+    postFormSetAnchor("scredential_"+credential+"_"+loginpage+"_"+parameter)
+  // Undo, so we won't get two deletes next time
+  eval("editconnection.scredential_"+credential+"_"+loginpage+"_"+parameter+"_op.value=\"Continue\"");
+}
+  
+function addLoginPageParameter(credential,loginpage)
+{
+  if (!isRegularExpression(eval("editconnection.scredential_"+credential+"_"+loginpage+"_loginparamname.value")))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.ParameterNameMustBeARegularExpression'))");
+    eval("editconnection.scredential_"+credential+"_"+loginpage+"_loginparamname.focus()");
+    return;
+  }
+  if (eval("editconnection.scredential_"+credential+"_"+loginpage+"_loginparamvalue.value")
!= "" && eval("editconnection.scredential_"+credential+"_"+loginpage+"_loginparampassword.value")
!= "")
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.ParameterCanEitherBeHidden'))");
+    eval("editconnection.scredential_"+credential+"_"+loginpage+"_loginparamvalue.focus()");
+    return;
+  }
+  eval("editconnection.scredential_"+credential+"_"+loginpage+"_loginparamop.value=\"Add\"");
+  postFormSetAnchor("scredential_"+credential+"_"+loginpage);
+}
+  
+function deleteTRegexp(i)
+{
+  // Set the operation
+  eval("editconnection.op_trust_"+i+".value=\"Delete\"");
+  // Submit
+  if (editconnection.trust_count.value==i)
+    postFormSetAnchor("trust");
+  else
+    postFormSetAnchor("trust_"+i);
+  // Undo, so we won't get two deletes next time
+  eval("editconnection.op_trust_"+i+".value=\"Continue\"");
+}
+
+function addTRegexp()
+{
+  if (editconnection.certificate_trust.value == "" && editconnection.all_trust.checked
== false)
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.SpecifyATrustCertificateFileToUploadFirst'))");
+    editconnection.certificate_trust.focus();
+    return;
+  }
+  if (!isRegularExpression(editconnection.regexp_trust.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('WebcrawlerConnector.AValidRegularExpressionIsRequired'))");
+    editconnection.regexp_trust.focus();
+    return;
+  }
+  editconnection.trust_op.value="Add";
+  postFormSetAnchor("trust");
+}
+</script>
+

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



Mime
View raw message