You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/09/18 18:57:00 UTC
svn commit: r1626026 [11/11] - in /manifoldcf/branches/dev_1x: ./
connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/
connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/a...
Modified: manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java?rev=1626026&r1=1626025&r2=1626026&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java (original)
+++ manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java Thu Sep 18 16:56:59 2014
@@ -3630,15 +3630,42 @@ public class WebcrawlerConnector extends
);
}
+ /** Obtain the name of the form check javascript method to call.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@return the name of the form check javascript method.
+ */
+ @Override
+ public String getFormCheckJavascriptMethodName(int connectionSequenceNumber)
+ {
+ return "s"+connectionSequenceNumber+"_checkSpecification";
+ //return "checkSpecification";
+ }
+
+ /** Obtain the name of the form presave check javascript method to call.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@return the name of the form presave check javascript method.
+ */
+ @Override
+ public String getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
+ {
+ return "s"+connectionSequenceNumber+"_checkSpecificationForSave";
+ //return "checkSpecificationForSave";
+ }
+
/** Output the specification header section.
- * This method is called in the head section of a job page which has selected a repository connection of the current type. Its purpose is to add the required tabs
- * to the list, and to output any javascript methods that might be needed by the job editing HTML.
+ * This method is called in the head section of a job page which has selected a repository connection of the
+ * current type. Its purpose is to add the required tabs to the list, and to output any javascript methods
+ * that might be needed by the job editing HTML.
+ * The connector will be connected before this method can be called.
*@param out is the output to which any HTML should be sent.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
*@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector.
*/
@Override
- public void outputSpecificationHeader(IHTTPOutput out, Locale locale, DocumentSpecification ds, List<String> tabsArray)
+ public void outputSpecificationHeader(IHTTPOutput out, Locale locale, Specification ds,
+ int connectionSequenceNumber, List<String> tabsArray)
throws ManifoldCFException, IOException
{
tabsArray.add(Messages.getString(locale,"WebcrawlerConnector.Seeds"));
@@ -3648,66 +3675,68 @@ public class WebcrawlerConnector extends
tabsArray.add(Messages.getString(locale,"WebcrawlerConnector.Exclusions"));
tabsArray.add(Messages.getString(locale,"WebcrawlerConnector.Security"));
tabsArray.add(Messages.getString(locale,"WebcrawlerConnector.Metadata"));
+ String seqPrefix = "s"+connectionSequenceNumber+"_";
+
out.print(
"<script type=\"text/javascript\">\n"+
"<!--\n"+
"\n"+
-"function SpecOp(n, opValue, anchorvalue)\n"+
+"function "+seqPrefix+"SpecOp(n, opValue, anchorvalue)\n"+
"{\n"+
" eval(\"editjob.\"+n+\".value = \\\"\"+opValue+\"\\\"\");\n"+
" postFormSetAnchor(anchorvalue);\n"+
"}\n"+
"\n"+
-"function AddRegexp(anchorvalue)\n"+
+"function "+seqPrefix+"AddRegexp(anchorvalue)\n"+
"{\n"+
-" if (editjob.rssmatch.value == \"\")\n"+
+" if (editjob."+seqPrefix+"rssmatch.value == \"\")\n"+
" {\n"+
" alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.MatchMustHaveARegexpValue")+"\");\n"+
-" editjob.rssmatch.focus();\n"+
+" editjob."+seqPrefix+"rssmatch.focus();\n"+
" return;\n"+
" }\n"+
"\n"+
-" SpecOp(\"rssop\",\"Add\",anchorvalue);\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"rssop\",\"Add\",anchorvalue);\n"+
"}\n"+
"\n"+
-"function RemoveRegexp(index, anchorvalue)\n"+
+"function "+seqPrefix+"RemoveRegexp(index, anchorvalue)\n"+
"{\n"+
-" editjob.rssindex.value = index;\n"+
-" SpecOp(\"rssop\",\"Delete\",anchorvalue);\n"+
+" editjob."+seqPrefix+"rssindex.value = index;\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"rssop\",\"Delete\",anchorvalue);\n"+
"}\n"+
"\n"+
-"function URLRegexpDelete(index, anchorvalue)\n"+
+"function "+seqPrefix+"URLRegexpDelete(index, anchorvalue)\n"+
"{\n"+
-" editjob.urlregexpnumber.value = index;\n"+
-" SpecOp(\"urlregexpop\",\"Delete\",anchorvalue);\n"+
+" editjob."+seqPrefix+"urlregexpnumber.value = index;\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"urlregexpop\",\"Delete\",anchorvalue);\n"+
"}\n"+
"\n"+
-"function URLRegexpAdd(anchorvalue)\n"+
+"function "+seqPrefix+"URLRegexpAdd(anchorvalue)\n"+
"{\n"+
-" SpecOp(\"urlregexpop\",\"Add\",anchorvalue);\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"urlregexpop\",\"Add\",anchorvalue);\n"+
"}\n"+
"\n"+
-"function checkSpecification()\n"+
+"function "+seqPrefix+"checkSpecification()\n"+
"{\n"+
-" if (check_expressions(\"inclusions\",editjob.inclusions.value) == false)\n"+
+" if ("+seqPrefix+"check_expressions(\"inclusions\",editjob."+seqPrefix+"inclusions.value) == false)\n"+
" {\n"+
-" editjob.inclusions.focus();\n"+
+" editjob."+seqPrefix+"inclusions.focus();\n"+
" return false;\n"+
" } \n"+
-" if (check_expressions(\"exclusions\",editjob.exclusions.value) == false)\n"+
+" if ("+seqPrefix+"check_expressions(\"exclusions\",editjob."+seqPrefix+"exclusions.value) == false)\n"+
" {\n"+
-" editjob.exclusions.focus();\n"+
+" editjob."+seqPrefix+"exclusions.focus();\n"+
" return false;\n"+
" }\n"+
-" if (check_seedsList() == false)\n"+
+" if ("+seqPrefix+"check_seedsList() == false)\n"+
" {\n"+
-" editjob.seeds.focus();\n"+
+" editjob."+seqPrefix+"seeds.focus();\n"+
" return false;\n"+
" }\n"+
" return true;\n"+
"}\n"+
"\n"+
-"function check_expressions(thecontext,theexpressionlist)\n"+
+"function "+seqPrefix+"check_expressions(thecontext,theexpressionlist)\n"+
"{\n"+
" var rval = true;\n"+
" var theArray = theexpressionlist.split(\"\\n\");\n"+
@@ -3734,10 +3763,10 @@ public class WebcrawlerConnector extends
" return rval;\n"+
"}\n"+
"\n"+
-"function check_seedsList()\n"+
+"function "+seqPrefix+"check_seedsList()\n"+
"{\n"+
" var regexp = /http(s)?:\\/\\/([a-z0-9+!*(),;?&=\\$_.-]+(\\:[a-z0-9+!*(),;?&=\\$_.-]+)?@)?[a-z0-9+\\$_-]+(\\.[a-z0-9+\\$_-]+)*(\\:[0-9]{2,5})?(\\/([a-z0-9+\\$_-]\\.?)+)*\\/?(\\?[a-z+&\\$_.-][a-z0-9;:@\\/&%=+\\$_.-]*)?(#[a-z_.-][a-z0-9+\\$_.-]*)?/;\n"+
-" var lines = editjob.seeds.value.split(\"\\n\");\n"+
+" var lines = editjob."+seqPrefix+"seeds.value.split(\"\\n\");\n"+
" var trimmedUrlList = \"\";\n"+
" var invalidUrlList = \"\";\n"+
" var i = 0;\n"+
@@ -3752,7 +3781,7 @@ public class WebcrawlerConnector extends
" }\n"+
" i = i + 1;\n"+
" }\n"+
-" editjob.seeds.value = trimmedUrlList;\n"+
+" editjob."+seqPrefix+"seeds.value = trimmedUrlList;\n"+
" if (invalidUrlList.length > 0)\n"+
" {\n"+
" alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.InvalidUrlsInSeedsList")+"\\n\" + invalidUrlList);\n"+
@@ -3761,15 +3790,15 @@ public class WebcrawlerConnector extends
" return true;\n"+
"}\n"+
"\n"+
-"function SpecAddToken(anchorvalue)\n"+
+"function "+seqPrefix+"SpecAddToken(anchorvalue)\n"+
"{\n"+
-" if (editjob.spectoken.value == \"\")\n"+
+" if (editjob."+seqPrefix+"spectoken.value == \"\")\n"+
" {\n"+
" alert(\""+Messages.getBodyJavascriptString(locale,"WebcrawlerConnector.TypeInAnAccessToken")+"\");\n"+
-" editjob.spectoken.focus();\n"+
+" editjob."+seqPrefix+"spectoken.focus();\n"+
" return;\n"+
" }\n"+
-" SpecOp(\"accessop\",\"Add\",anchorvalue);\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"accessop\",\"Add\",anchorvalue);\n"+
"}\n"+
"\n"+
"function SpecAddMetadata(anchorvalue)\n"+
@@ -3795,17 +3824,26 @@ public class WebcrawlerConnector extends
}
/** Output the specification body section.
- * This method is called in the body section of a job page which has selected a repository connection of the current type. Its purpose is to present the required form elements for editing.
- * The coder can presume that the HTML that is output from this configuration will be within appropriate <html>, <body>, and <form> tags. The name of the
- * form is "editjob".
+ * This method is called in the body section of a job page which has selected a repository connection of the
+ * current type. Its purpose is to present the required form elements for editing.
+ * The coder can presume that the HTML that is output from this configuration will be within appropriate
+ * <html>, <body>, and <form> tags. The name of the form is always "editjob".
+ * The connector will be connected before this method can be called.
*@param out is the output to which any HTML should be sent.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
- *@param tabName is the current tab name.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@param actualSequenceNumber is the connection within the job that has currently been selected.
+ *@param tabName is the current tab name. (actualSequenceNumber, tabName) form a unique tuple within
+ * the job.
*/
@Override
- public void outputSpecificationBody(IHTTPOutput out, Locale locale, DocumentSpecification ds, String tabName)
+ public void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds,
+ int connectionSequenceNumber, int actualSequenceNumber, String tabName)
throws ManifoldCFException, IOException
{
+ String seqPrefix = "s"+connectionSequenceNumber+"_";
+
int i;
int k;
@@ -3886,14 +3924,14 @@ public class WebcrawlerConnector extends
// Seeds tab
- if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Seeds")))
+ if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Seeds")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"value\" colspan=\"2\">\n"+
-" <textarea rows=\"25\" cols=\"80\" name=\"seeds\">"+Encoder.bodyEscape(seeds)+"</textarea>\n"+
+" <textarea rows=\"25\" cols=\"80\" name=\""+seqPrefix+"seeds\">"+Encoder.bodyEscape(seeds)+"</textarea>\n"+
" </td>\n"+
" </tr>\n"+
"</table>\n"
@@ -3902,21 +3940,21 @@ public class WebcrawlerConnector extends
else
{
out.print(
-"<input type=\"hidden\" name=\"seeds\" value=\""+Encoder.attributeEscape(seeds)+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"seeds\" value=\""+Encoder.attributeEscape(seeds)+"\"/>\n"
);
}
// Canonicalization tab
- if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Canonicalization")))
+ if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Canonicalization")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"boxcell\" colspan=\"2\">\n"+
-" <input type=\"hidden\" name=\"urlregexpop\" value=\"Continue\"/>\n"+
-" <input type=\"hidden\" name=\"urlregexpnumber\" value=\"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpop\" value=\"Continue\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpnumber\" value=\"\"/>\n"+
" <table class=\"formtable\">\n"+
" <tr class=\"formheaderrow\">\n"+
" <td class=\"formcolumnheader\"></td>\n"+
@@ -3989,18 +4027,18 @@ public class WebcrawlerConnector extends
out.print(
" <tr class=\""+(((l % 2)==0)?"evenformrow":"oddformrow")+"\">\n"+
" <td class=\"formcolumncell\">\n"+
-" <a name=\""+"urlregexp_"+Integer.toString(l)+"\">\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Delete") + "\" alt=\""+Messages.getAttributeString(locale,"WebcrawlerConnector.DeleteUrlRegexp")+Encoder.attributeEscape(regexpString)+"\" onclick='javascript:URLRegexpDelete("+Integer.toString(l)+",\"urlregexp_"+Integer.toString(l)+"\");'/>\n"+
+" <a name=\""+seqPrefix+"urlregexp_"+Integer.toString(l)+"\">\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Delete") + "\" alt=\""+Messages.getAttributeString(locale,"WebcrawlerConnector.DeleteUrlRegexp")+Encoder.attributeEscape(regexpString)+"\" onclick='javascript:"+seqPrefix+"URLRegexpDelete("+Integer.toString(l)+",\""+seqPrefix+"urlregexp_"+Integer.toString(l)+"\");'/>\n"+
" </a>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
-" <input type=\"hidden\" name=\""+"urlregexp_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(regexpString)+"\"/>\n"+
-" <input type=\"hidden\" name=\""+"urlregexpdesc_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(description)+"\"/>\n"+
-" <input type=\"hidden\" name=\""+"urlregexpreorder_"+Integer.toString(l)+"\" value=\""+allowReorder+"\"/>\n"+
-" <input type=\"hidden\" name=\""+"urlregexpjava_"+Integer.toString(l)+"\" value=\""+allowJavaSessionRemoval+"\"/>\n"+
-" <input type=\"hidden\" name=\""+"urlregexpasp_"+Integer.toString(l)+"\" value=\""+allowASPSessionRemoval+"\"/>\n"+
-" <input type=\"hidden\" name=\""+"urlregexpphp_"+Integer.toString(l)+"\" value=\""+allowPHPSessionRemoval+"\"/>\n"+
-" <input type=\"hidden\" name=\""+"urlregexpbv_"+Integer.toString(l)+"\" value=\""+allowBVSessionRemoval+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexp_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(regexpString)+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpdesc_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(description)+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpreorder_"+Integer.toString(l)+"\" value=\""+allowReorder+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpjava_"+Integer.toString(l)+"\" value=\""+allowJavaSessionRemoval+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpasp_"+Integer.toString(l)+"\" value=\""+allowASPSessionRemoval+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpphp_"+Integer.toString(l)+"\" value=\""+allowPHPSessionRemoval+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpbv_"+Integer.toString(l)+"\" value=\""+allowBVSessionRemoval+"\"/>\n"+
" <nobr>"+Encoder.bodyEscape(regexpString)+"</nobr>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">"+Encoder.bodyEscape(description)+"</td>\n"+
@@ -4025,18 +4063,18 @@ public class WebcrawlerConnector extends
" <tr class=\"formrow\"><td colspan=\"8\" class=\"formseparator\"><hr/></td></tr>\n"+
" <tr class=\"formrow\">\n"+
" <td class=\"formcolumncell\">\n"+
-" <a name=\""+"urlregexp_"+Integer.toString(l)+"\">\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Add") + "\" alt=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.AddUrlRegexp") + "\" onclick='javascript:URLRegexpAdd(\"urlregexp_"+Integer.toString(l+1)+"\");'/>\n"+
-" <input type=\"hidden\" name=\"urlregexpcount\" value=\""+Integer.toString(l)+"\"/>\n"+
+" <a name=\""+seqPrefix+"urlregexp_"+Integer.toString(l)+"\">\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Add") + "\" alt=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.AddUrlRegexp") + "\" onclick='javascript:"+seqPrefix+"URLRegexpAdd(\""+seqPrefix+"urlregexp_"+Integer.toString(l+1)+"\");'/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"urlregexpcount\" value=\""+Integer.toString(l)+"\"/>\n"+
" </a>\n"+
" </td>\n"+
-" <td class=\"formcolumncell\"><input type=\"text\" name=\"urlregexp\" size=\"30\" value=\"\"/></td>\n"+
-" <td class=\"formcolumncell\"><input type=\"text\" name=\"urlregexpdesc\" size=\"30\" value=\"\"/></td>\n"+
-" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\"urlregexpreorder\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\"/></td>\n"+
-" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\"urlregexpjava\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
-" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\"urlregexpasp\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
-" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\"urlregexpphp\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
-" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\"urlregexpbv\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
+" <td class=\"formcolumncell\"><input type=\"text\" name=\""+seqPrefix+"urlregexp\" size=\"30\" value=\"\"/></td>\n"+
+" <td class=\"formcolumncell\"><input type=\"text\" name=\""+seqPrefix+"urlregexpdesc\" size=\"30\" value=\"\"/></td>\n"+
+" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\""+seqPrefix+"urlregexpreorder\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\"/></td>\n"+
+" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\""+seqPrefix+"urlregexpjava\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
+" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\""+seqPrefix+"urlregexpasp\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
+" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\""+seqPrefix+"urlregexpphp\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
+" <td class=\"formcolumncell\"><input type=\"checkbox\" name=\""+seqPrefix+"urlregexpbv\" value=\""+WebcrawlerConfig.ATTRVALUE_YES+"\" checked=\"true\"/></td>\n"+
" </tr>\n"+
" </table>\n"+
" </td>\n"+
@@ -4075,19 +4113,19 @@ public class WebcrawlerConnector extends
if (allowBVSessionRemoval == null || allowBVSessionRemoval.length() == 0)
allowBVSessionRemoval = WebcrawlerConfig.ATTRVALUE_NO;
out.print(
-"<input type=\"hidden\" name=\""+"urlregexp_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(regexpString)+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"urlregexpdesc_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(description)+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"urlregexpreorder_"+Integer.toString(l)+"\" value=\""+allowReorder+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"urlregexpjava_"+Integer.toString(l)+"\" value=\""+allowJavaSessionRemoval+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"urlregexpasp_"+Integer.toString(l)+"\" value=\""+allowASPSessionRemoval+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"urlregexpphp_"+Integer.toString(l)+"\" value=\""+allowPHPSessionRemoval+"\"/>\n"+
-"<input type=\"hidden\" name=\""+"urlregexpbv_"+Integer.toString(l)+"\" value=\""+allowBVSessionRemoval+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexp_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(regexpString)+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexpdesc_"+Integer.toString(l)+"\" value=\""+Encoder.attributeEscape(description)+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexpreorder_"+Integer.toString(l)+"\" value=\""+allowReorder+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexpjava_"+Integer.toString(l)+"\" value=\""+allowJavaSessionRemoval+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexpasp_"+Integer.toString(l)+"\" value=\""+allowASPSessionRemoval+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexpphp_"+Integer.toString(l)+"\" value=\""+allowPHPSessionRemoval+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexpbv_"+Integer.toString(l)+"\" value=\""+allowBVSessionRemoval+"\"/>\n"
);
l++;
}
}
out.print(
-"<input type=\"hidden\" name=\"urlregexpcount\" value=\""+Integer.toString(l)+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"urlregexpcount\" value=\""+Integer.toString(l)+"\"/>\n"
);
}
@@ -4169,7 +4207,7 @@ public class WebcrawlerConnector extends
}
// Inclusions tab
- if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Inclusions")))
+ if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Inclusions")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
@@ -4177,20 +4215,20 @@ public class WebcrawlerConnector extends
" <tr>\n"+
" <td class=\"description\" colspan=\"1\"><nobr>" + Messages.getBodyString(locale,"WebcrawlerConnector.IncludeInCrawl") + "</nobr></td>\n"+
" <td class=\"value\" colspan=\"1\">\n"+
-" <textarea rows=\"25\" cols=\"60\" name=\"inclusions\">"+Encoder.bodyEscape(inclusions)+"</textarea>\n"+
+" <textarea rows=\"25\" cols=\"60\" name=\""+seqPrefix+"inclusions\">"+Encoder.bodyEscape(inclusions)+"</textarea>\n"+
" </td>\n"+
" </tr>\n"+
" <tr>\n"+
" <td class=\"description\" colspan=\"1\"><nobr>" + Messages.getBodyString(locale,"WebcrawlerConnector.IncludeInIndex") + "</nobr></td>\n"+
" <td class=\"value\" colspan=\"1\">\n"+
-" <textarea rows=\"10\" cols=\"60\" name=\"inclusionsindex\">"+Encoder.bodyEscape(inclusionsIndex)+"</textarea>\n"+
+" <textarea rows=\"10\" cols=\"60\" name=\""+seqPrefix+"inclusionsindex\">"+Encoder.bodyEscape(inclusionsIndex)+"</textarea>\n"+
" </td>\n"+
" </tr>\n"+
" <tr>\n"+
" <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"WebcrawlerConnector.IncludeOnlyHostsMatchingSeeds") + "</nobr></td>\n"+
" <td class=\"value\">\n"+
-" <input type=\"checkbox\" name=\"matchinghosts\" value=\"true\""+(includeMatching?" checked=\"yes\"":"")+"/>\n"+
-" <input type=\"hidden\" name=\"matchinghosts_present\" value=\"true\"/>\n"+
+" <input type=\"checkbox\" name=\""+seqPrefix+"matchinghosts\" value=\"true\""+(includeMatching?" checked=\"yes\"":"")+"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"matchinghosts_present\" value=\"true\"/>\n"+
" </td>\n"+
" </tr>\n"+
"</table>\n"
@@ -4199,16 +4237,16 @@ public class WebcrawlerConnector extends
else
{
out.print(
-"<input type=\"hidden\" name=\"inclusions\" value=\""+Encoder.attributeEscape(inclusions)+"\"/>\n"+
-"<input type=\"hidden\" name=\"inclusionsindex\" value=\""+Encoder.attributeEscape(inclusionsIndex)+"\"/>\n"+
-"<input type=\"hidden\" name=\"matchinghosts\" value=\""+(includeMatching?"true":"false")+"\"/>\n"+
-"<input type=\"hidden\" name=\"matchinghosts_present\" value=\"true\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"inclusions\" value=\""+Encoder.attributeEscape(inclusions)+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"inclusionsindex\" value=\""+Encoder.attributeEscape(inclusionsIndex)+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"matchinghosts\" value=\""+(includeMatching?"true":"false")+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"matchinghosts_present\" value=\"true\"/>\n"
);
}
// Exclusions tab
- if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Exclusions")))
+ if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Exclusions")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
@@ -4216,13 +4254,13 @@ public class WebcrawlerConnector extends
" <tr>\n"+
" <td class=\"description\" colspan=\"1\"><nobr>" + Messages.getBodyString(locale,"WebcrawlerConnector.ExcludeFromCrawl") + "</nobr></td>\n"+
" <td class=\"value\" colspan=\"1\">\n"+
-" <textarea rows=\"25\" cols=\"60\" name=\"exclusions\">"+Encoder.bodyEscape(exclusions)+"</textarea>\n"+
+" <textarea rows=\"25\" cols=\"60\" name=\""+seqPrefix+"exclusions\">"+Encoder.bodyEscape(exclusions)+"</textarea>\n"+
" </td>\n"+
" </tr>\n"+
" <tr>\n"+
" <td class=\"description\" colspan=\"1\"><nobr>" + Messages.getBodyString(locale,"WebcrawlerConnector.ExcludeFromIndex") + "</nobr></td>\n"+
" <td class=\"value\" colspan=\"1\">\n"+
-" <textarea rows=\"10\" cols=\"60\" name=\"exclusionsindex\">"+Encoder.bodyEscape(exclusionsIndex)+"</textarea>\n"+
+" <textarea rows=\"10\" cols=\"60\" name=\""+seqPrefix+"exclusionsindex\">"+Encoder.bodyEscape(exclusionsIndex)+"</textarea>\n"+
" </td>\n"+
" </tr>\n"+
"</table>\n"
@@ -4231,8 +4269,8 @@ public class WebcrawlerConnector extends
else
{
out.print(
-"<input type=\"hidden\" name=\"exclusions\" value=\""+Encoder.attributeEscape(exclusions)+"\"/>\n"+
-"<input type=\"hidden\" name=\"exclusionsindex\" value=\""+Encoder.attributeEscape(exclusionsIndex)+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"exclusions\" value=\""+Encoder.attributeEscape(exclusions)+"\"/>\n"+
+"<input type=\"hidden\" name=\""+seqPrefix+"exclusionsindex\" value=\""+Encoder.attributeEscape(exclusionsIndex)+"\"/>\n"
);
}
@@ -4240,7 +4278,7 @@ public class WebcrawlerConnector extends
// There is no native security, so all we care about are the tokens.
i = 0;
- if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Security")))
+ if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Security")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
@@ -4255,15 +4293,15 @@ public class WebcrawlerConnector extends
if (sn.getType().equals(WebcrawlerConfig.NODE_ACCESS))
{
String accessDescription = "_"+Integer.toString(k);
- String accessOpName = "accessop"+accessDescription;
+ String accessOpName = seqPrefix+"accessop"+accessDescription;
String token = sn.getAttributeValue(WebcrawlerConfig.ATTR_TOKEN);
out.print(
" <tr>\n"+
" <td class=\"description\">\n"+
" <input type=\"hidden\" name=\""+accessOpName+"\" value=\"\"/>\n"+
-" <input type=\"hidden\" name=\""+"spectoken"+accessDescription+"\" value=\""+Encoder.attributeEscape(token)+"\"/>\n"+
-" <a name=\""+"token_"+Integer.toString(k)+"\">\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Delete") + "\" onClick='Javascript:SpecOp(\""+accessOpName+"\",\"Delete\",\"token_"+Integer.toString(k)+"\")' alt=\""+Messages.getAttributeString(locale,"WebcrawlerConnector.DeleteToken")+Integer.toString(k)+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"spectoken"+accessDescription+"\" value=\""+Encoder.attributeEscape(token)+"\"/>\n"+
+" <a name=\""+seqPrefix+"token_"+Integer.toString(k)+"\">\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Delete") + "\" onClick='Javascript:"+seqPrefix+"SpecOp(\""+accessOpName+"\",\"Delete\",\""+seqPrefix+"token_"+Integer.toString(k)+"\")' alt=\""+Messages.getAttributeString(locale,"WebcrawlerConnector.DeleteToken")+Integer.toString(k)+"\"/>\n"+
" </a> \n"+
" </td>\n"+
" <td class=\"value\">\n"+
@@ -4286,14 +4324,14 @@ public class WebcrawlerConnector extends
" <tr><td class=\"lightseparator\" colspan=\"2\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"description\">\n"+
-" <input type=\"hidden\" name=\"tokencount\" value=\""+Integer.toString(k)+"\"/>\n"+
-" <input type=\"hidden\" name=\"accessop\" value=\"\"/>\n"+
-" <a name=\""+"token_"+Integer.toString(k)+"\">\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Add") + "\" onClick='Javascript:SpecAddToken(\"token_"+Integer.toString(k+1)+"\")' alt=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.AddAccessToken") + "\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"tokencount\" value=\""+Integer.toString(k)+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"accessop\" value=\"\"/>\n"+
+" <a name=\""+seqPrefix+"token_"+Integer.toString(k)+"\">\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.Add") + "\" onClick='Javascript:"+seqPrefix+"SpecAddToken(\""+seqPrefix+"token_"+Integer.toString(k+1)+"\")' alt=\"" + Messages.getAttributeString(locale,"WebcrawlerConnector.AddAccessToken") + "\"/>\n"+
" </a> \n"+
" </td>\n"+
" <td class=\"value\">\n"+
-" <input type=\"text\" size=\"30\" name=\"spectoken\" value=\"\"/>\n"+
+" <input type=\"text\" size=\"30\" name=\""+seqPrefix+"spectoken\" value=\"\"/>\n"+
" </td>\n"+
" </tr>\n"+
"</table>\n"
@@ -4312,18 +4350,18 @@ public class WebcrawlerConnector extends
String accessDescription = "_"+Integer.toString(k);
String token = sn.getAttributeValue(WebcrawlerConfig.ATTR_TOKEN);
out.print(
-"<input type=\"hidden\" name=\""+"spectoken"+accessDescription+"\" value=\""+Encoder.attributeEscape(token)+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"spectoken"+accessDescription+"\" value=\""+Encoder.attributeEscape(token)+"\"/>\n"
);
k++;
}
}
out.print(
-"<input type=\"hidden\" name=\"tokencount\" value=\""+Integer.toString(k)+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"tokencount\" value=\""+Integer.toString(k)+"\"/>\n"
);
}
// "Metadata" tab
- if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Metadata")))
+ if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Metadata")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
@@ -4331,13 +4369,13 @@ public class WebcrawlerConnector extends
" <tr>\n"+
" <td class=\"description\"><nobr>"+Messages.getBodyString(locale, "WebcrawlerConnector.ExcludedHeadersColon")+"</nobr></td>\n"+
" <td class=\"value\" colspan=\"3\">\n"+
-" <input type=\"hidden\" name=\"excludedheaders_present\" value=\"true\"/>\n"
+" <input type=\"hidden\" name=\""+seqPrefix+"excludedheaders_present\" value=\"true\"/>\n"
);
for (String potentiallyExcludedHeader : potentiallyExcludedHeaders)
{
out.print(
-" <input type=\"checkbox\" name=\"excludedheaders\" value=\""+Encoder.attributeEscape(potentiallyExcludedHeader)+"\""+(excludedHeaders.contains(potentiallyExcludedHeader)?" checked=\"true\"":"")+">"+Encoder.bodyEscape(potentiallyExcludedHeader)+"</input><br/>\n"
+" <input type=\"checkbox\" name=\""+seqPrefix+"excludedheaders\" value=\""+Encoder.attributeEscape(potentiallyExcludedHeader)+"\""+(excludedHeaders.contains(potentiallyExcludedHeader)?" checked=\"true\"":"")+">"+Encoder.bodyEscape(potentiallyExcludedHeader)+"</input><br/>\n"
);
}
out.print(
@@ -4413,12 +4451,12 @@ public class WebcrawlerConnector extends
else
{
out.print(
-"<input type=\"hidden\" name=\"excludedheaders_present\" value=\"true\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"excludedheaders_present\" value=\"true\"/>\n"
);
for (String excludedHeader : excludedHeaders)
{
out.print(
-"<input type=\"hidden\" name=\"excludedheaders\" value=\""+Encoder.attributeEscape(excludedHeader)+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"excludedheaders\" value=\""+Encoder.attributeEscape(excludedHeader)+"\"/>\n"
);
}
// Finally, go through metadata
@@ -4447,19 +4485,26 @@ public class WebcrawlerConnector extends
}
/** Process a specification post.
- * This method is called at the start of job's edit or view page, whenever there is a possibility that form data for a connection has been
- * posted. Its purpose is to gather form information and modify the document specification accordingly.
- * The name of the posted form is "editjob".
+ * This method is called at the start of job's edit or view page, whenever there is a possibility that form
+ * data for a connection has been posted. Its purpose is to gather form information and modify the
+ * document specification accordingly. The name of the posted form is always "editjob".
+ * The connector will be connected before this method can be called.
*@param variableContext contains the post data, including binary file-upload information.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
- *@return null if all is well, or a string error message if there is an error that should prevent saving of the job (and cause a redirection to an error page).
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@return null if all is well, or a string error message if there is an error that should prevent saving of
+ * the job (and cause a redirection to an error page).
*/
@Override
- public String processSpecificationPost(IPostParameters variableContext, Locale locale, DocumentSpecification ds)
+ public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds,
+ int connectionSequenceNumber)
throws ManifoldCFException
{
+ String seqPrefix = "s"+connectionSequenceNumber+"_";
+
// Get the map
- String value = variableContext.getParameter("rssmapcount");
+ String value = variableContext.getParameter(seqPrefix+"rssmapcount");
if (value != null)
{
int mapsize = Integer.parseInt(value);
@@ -4479,7 +4524,7 @@ public class WebcrawlerConnector extends
j = 0;
while (j < mapsize)
{
- String prefix = "rssregexp_"+Integer.toString(j)+"_";
+ String prefix = seqPrefix+"rssregexp_"+Integer.toString(j)+"_";
String match = variableContext.getParameter(prefix+"match");
String map = variableContext.getParameter(prefix+"map");
if (map == null)
@@ -4494,12 +4539,12 @@ public class WebcrawlerConnector extends
}
}
// Now, do whatever action we were told to do.
- String rssop = variableContext.getParameter("rssop");
+ String rssop = variableContext.getParameter(seqPrefix+"rssop");
if (rssop != null && rssop.equals("Add"))
{
// Add a match to the end
- String match = variableContext.getParameter("rssmatch");
- String map = variableContext.getParameter("rssmap");
+ String match = variableContext.getParameter(seqPrefix+"rssmatch");
+ String map = variableContext.getParameter(seqPrefix+"rssmap");
SpecificationNode node = new SpecificationNode(WebcrawlerConfig.NODE_MAP);
node.setAttribute(WebcrawlerConfig.ATTR_MATCH,match);
node.setAttribute(WebcrawlerConfig.ATTR_MAP,map);
@@ -4507,7 +4552,7 @@ public class WebcrawlerConnector extends
}
else if (rssop != null && rssop.equals("Delete"))
{
- int index = Integer.parseInt(variableContext.getParameter("rssindex"));
+ int index = Integer.parseInt(variableContext.getParameter(seqPrefix+"rssindex"));
int j = 0;
while (j < ds.getChildCount())
{
@@ -4526,7 +4571,7 @@ public class WebcrawlerConnector extends
}
// Get excluded headers
- String excludedHeadersPresent = variableContext.getParameter("excludedheaders_present");
+ String excludedHeadersPresent = variableContext.getParameter(seqPrefix+"excludedheaders_present");
if (excludedHeadersPresent != null)
{
// Delete existing excludedheader record first
@@ -4539,7 +4584,7 @@ public class WebcrawlerConnector extends
else
i++;
}
- String[] excludedHeaders = variableContext.getParameterValues("excludedheaders");
+ String[] excludedHeaders = variableContext.getParameterValues(seqPrefix+"excludedheaders");
if (excludedHeaders != null)
{
for (String excludedHeader : excludedHeaders)
@@ -4552,7 +4597,7 @@ public class WebcrawlerConnector extends
}
// Get the seeds
- String seeds = variableContext.getParameter("seeds");
+ String seeds = variableContext.getParameter(seqPrefix+"seeds");
if (seeds != null)
{
// Delete existing seeds record first
@@ -4572,7 +4617,7 @@ public class WebcrawlerConnector extends
}
// Get the inclusions
- String inclusions = variableContext.getParameter("inclusions");
+ String inclusions = variableContext.getParameter(seqPrefix+"inclusions");
if (inclusions != null)
{
// Delete existing inclusions record first
@@ -4592,7 +4637,7 @@ public class WebcrawlerConnector extends
}
// Get the index inclusions
- String inclusionsIndex = variableContext.getParameter("inclusionsindex");
+ String inclusionsIndex = variableContext.getParameter(seqPrefix+"inclusionsindex");
if (inclusionsIndex != null)
{
// Delete existing index inclusions record first
@@ -4612,7 +4657,7 @@ public class WebcrawlerConnector extends
}
// Handle the seeds-only switch
- String matchingHostsPresent = variableContext.getParameter("matchinghosts_present");
+ String matchingHostsPresent = variableContext.getParameter(seqPrefix+"matchinghosts_present");
if (matchingHostsPresent != null)
{
// Delete existing switch record first
@@ -4626,14 +4671,14 @@ public class WebcrawlerConnector extends
i++;
}
- String matchingHosts = variableContext.getParameter("matchinghosts");
+ String matchingHosts = variableContext.getParameter(seqPrefix+"matchinghosts");
SpecificationNode cn = new SpecificationNode(WebcrawlerConfig.NODE_LIMITTOSEEDS);
cn.setAttribute(WebcrawlerConfig.ATTR_VALUE,(matchingHosts==null||matchingHosts.equals("false"))?"false":"true");
ds.addChild(ds.getChildCount(),cn);
}
// Get the exclusions
- String exclusions = variableContext.getParameter("exclusions");
+ String exclusions = variableContext.getParameter(seqPrefix+"exclusions");
if (exclusions != null)
{
// Delete existing exclusions record first
@@ -4653,7 +4698,7 @@ public class WebcrawlerConnector extends
}
// Get the index exclusions
- String exclusionsIndex = variableContext.getParameter("exclusionsindex");
+ String exclusionsIndex = variableContext.getParameter(seqPrefix+"exclusionsindex");
if (exclusionsIndex != null)
{
// Delete existing exclusions record first
@@ -4673,7 +4718,7 @@ public class WebcrawlerConnector extends
}
// Read the url specs
- String urlRegexpCount = variableContext.getParameter("urlregexpcount");
+ String urlRegexpCount = variableContext.getParameter(seqPrefix+"urlregexpcount");
if (urlRegexpCount != null && urlRegexpCount.length() > 0)
{
int regexpCount = Integer.parseInt(urlRegexpCount);
@@ -4688,12 +4733,12 @@ public class WebcrawlerConnector extends
}
// Grab the operation and the index (if any)
- String operation = variableContext.getParameter("urlregexpop");
+ String operation = variableContext.getParameter(seqPrefix+"urlregexpop");
if (operation == null)
operation = "Continue";
int opIndex = -1;
if (operation.equals("Delete"))
- opIndex = Integer.parseInt(variableContext.getParameter("urlregexpnumber"));
+ opIndex = Integer.parseInt(variableContext.getParameter(seqPrefix+"urlregexpnumber"));
// Reconstruct urlspec nodes
j = 0;
@@ -4703,13 +4748,13 @@ public class WebcrawlerConnector extends
if (!operation.equals("Delete") || j != opIndex)
{
// Add the jth node
- String regexp = variableContext.getParameter("urlregexp_"+Integer.toString(j));
- String regexpDescription = variableContext.getParameter("urlregexpdesc_"+Integer.toString(j));
- String reorder = variableContext.getParameter("urlregexpreorder_"+Integer.toString(j));
- String javaSession = variableContext.getParameter("urlregexpjava_"+Integer.toString(j));
- String aspSession = variableContext.getParameter("urlregexpasp_"+Integer.toString(j));
- String phpSession = variableContext.getParameter("urlregexpphp_"+Integer.toString(j));
- String bvSession = variableContext.getParameter("urlregexpbv_"+Integer.toString(j));
+ String regexp = variableContext.getParameter(seqPrefix+"urlregexp_"+Integer.toString(j));
+ String regexpDescription = variableContext.getParameter(seqPrefix+"urlregexpdesc_"+Integer.toString(j));
+ String reorder = variableContext.getParameter(seqPrefix+"urlregexpreorder_"+Integer.toString(j));
+ String javaSession = variableContext.getParameter(seqPrefix+"urlregexpjava_"+Integer.toString(j));
+ String aspSession = variableContext.getParameter(seqPrefix+"urlregexpasp_"+Integer.toString(j));
+ String phpSession = variableContext.getParameter(seqPrefix+"urlregexpphp_"+Integer.toString(j));
+ String bvSession = variableContext.getParameter(seqPrefix+"urlregexpbv_"+Integer.toString(j));
SpecificationNode newSn = new SpecificationNode(WebcrawlerConfig.NODE_URLSPEC);
newSn.setAttribute(WebcrawlerConfig.ATTR_REGEXP,regexp);
if (regexpDescription != null && regexpDescription.length() > 0)
@@ -4730,13 +4775,13 @@ public class WebcrawlerConnector extends
}
if (operation.equals("Add"))
{
- String regexp = variableContext.getParameter("urlregexp");
- String regexpDescription = variableContext.getParameter("urlregexpdesc");
- String reorder = variableContext.getParameter("urlregexpreorder");
- String javaSession = variableContext.getParameter("urlregexpjava");
- String aspSession = variableContext.getParameter("urlregexpasp");
- String phpSession = variableContext.getParameter("urlregexpphp");
- String bvSession = variableContext.getParameter("urlregexpbv");
+ String regexp = variableContext.getParameter(seqPrefix+"urlregexp");
+ String regexpDescription = variableContext.getParameter(seqPrefix+"urlregexpdesc");
+ String reorder = variableContext.getParameter(seqPrefix+"urlregexpreorder");
+ String javaSession = variableContext.getParameter(seqPrefix+"urlregexpjava");
+ String aspSession = variableContext.getParameter(seqPrefix+"urlregexpasp");
+ String phpSession = variableContext.getParameter(seqPrefix+"urlregexpphp");
+ String bvSession = variableContext.getParameter(seqPrefix+"urlregexpbv");
// Add a new node at the end
SpecificationNode newSn = new SpecificationNode(WebcrawlerConfig.NODE_URLSPEC);
@@ -4757,7 +4802,7 @@ public class WebcrawlerConnector extends
}
}
- String xc = variableContext.getParameter("tokencount");
+ String xc = variableContext.getParameter(seqPrefix+"tokencount");
if (xc != null)
{
// Delete all tokens first
@@ -4776,7 +4821,7 @@ public class WebcrawlerConnector extends
while (i < accessCount)
{
String accessDescription = "_"+Integer.toString(i);
- String accessOpName = "accessop"+accessDescription;
+ String accessOpName = seqPrefix+"accessop"+accessDescription;
xc = variableContext.getParameter(accessOpName);
if (xc != null && xc.equals("Delete"))
{
@@ -4785,24 +4830,24 @@ public class WebcrawlerConnector extends
continue;
}
// Get the stuff we need
- String accessSpec = variableContext.getParameter("spectoken"+accessDescription);
+ String accessSpec = variableContext.getParameter(seqPrefix+"spectoken"+accessDescription);
SpecificationNode node = new SpecificationNode(WebcrawlerConfig.NODE_ACCESS);
node.setAttribute(WebcrawlerConfig.ATTR_TOKEN,accessSpec);
ds.addChild(ds.getChildCount(),node);
i++;
}
- String op = variableContext.getParameter("accessop");
+ String op = variableContext.getParameter(seqPrefix+"accessop");
if (op != null && op.equals("Add"))
{
- String accessspec = variableContext.getParameter("spectoken");
+ String accessspec = variableContext.getParameter(seqPrefix+"spectoken");
SpecificationNode node = new SpecificationNode(WebcrawlerConfig.NODE_ACCESS);
node.setAttribute(WebcrawlerConfig.ATTR_TOKEN,accessspec);
ds.addChild(ds.getChildCount(),node);
}
}
- xc = variableContext.getParameter("metadatacount");
+ xc = variableContext.getParameter(seqPrefix+"metadatacount");
if (xc != null)
{
// Delete all tokens first
@@ -4821,7 +4866,7 @@ public class WebcrawlerConnector extends
while (i < metadataCount)
{
String metadataDescription = "_"+Integer.toString(i);
- String metadataOpName = "metadataop"+metadataDescription;
+ String metadataOpName = seqPrefix+"metadataop"+metadataDescription;
xc = variableContext.getParameter(metadataOpName);
if (xc != null && xc.equals("Delete"))
{
@@ -4830,8 +4875,8 @@ public class WebcrawlerConnector extends
continue;
}
// Get the stuff we need
- String metaNameSpec = variableContext.getParameter("specmetaname"+metadataDescription);
- String metaValueSpec = variableContext.getParameter("specmetavalue"+metadataDescription);
+ String metaNameSpec = variableContext.getParameter(seqPrefix+"specmetaname"+metadataDescription);
+ String metaValueSpec = variableContext.getParameter(seqPrefix+"specmetavalue"+metadataDescription);
SpecificationNode node = new SpecificationNode(WebcrawlerConfig.NODE_METADATA);
node.setAttribute(WebcrawlerConfig.ATTR_NAME,metaNameSpec);
node.setAttribute(WebcrawlerConfig.ATTR_VALUE,metaValueSpec);
@@ -4839,11 +4884,11 @@ public class WebcrawlerConnector extends
i++;
}
- String op = variableContext.getParameter("metadataop");
+ String op = variableContext.getParameter(seqPrefix+"metadataop");
if (op != null && op.equals("Add"))
{
- String metaNameSpec = variableContext.getParameter("specmetaname");
- String metaValueSpec = variableContext.getParameter("specmetavalue");
+ String metaNameSpec = variableContext.getParameter(seqPrefix+"specmetaname");
+ String metaValueSpec = variableContext.getParameter(seqPrefix+"specmetavalue");
SpecificationNode node = new SpecificationNode(WebcrawlerConfig.NODE_METADATA);
node.setAttribute(WebcrawlerConfig.ATTR_NAME,metaNameSpec);
@@ -4856,13 +4901,18 @@ public class WebcrawlerConnector extends
}
/** View specification.
- * This method is called in the body section of a job's view page. Its purpose is to present the document specification information to the user.
- * The coder can presume that the HTML that is output from this configuration will be within appropriate <html> and <body> tags.
+ * This method is called in the body section of a job's view page. Its purpose is to present the document
+ * specification information to the user. The coder can presume that the HTML that is output from
+ * this configuration will be within appropriate <html> and <body> tags.
+ * The connector will be connected before this method can be called.
*@param out is the output to which any HTML should be sent.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
*/
@Override
- public void viewSpecification(IHTTPOutput out, Locale locale, DocumentSpecification ds)
+ public void viewSpecification(IHTTPOutput out, Locale locale, Specification ds,
+ int connectionSequenceNumber)
throws ManifoldCFException, IOException
{
int j;
Modified: manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/webcrawler/tests/NavigationDerbyUI.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/webcrawler/tests/NavigationDerbyUI.java?rev=1626026&r1=1626025&r2=1626026&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/webcrawler/tests/NavigationDerbyUI.java (original)
+++ manifoldcf/branches/dev_1x/connectors/webcrawler/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/webcrawler/tests/NavigationDerbyUI.java Thu Sep 18 16:56:59 2014
@@ -223,7 +223,7 @@ public class NavigationDerbyUI extends B
link.click();
window = testerInstance.findWindow(null);
form = window.findForm(testerInstance.createStringDescription("editjob"));
- textarea = form.findTextarea(testerInstance.createStringDescription("seeds"));
+ textarea = form.findTextarea(testerInstance.createStringDescription("s0_seeds"));
textarea.setValue(testerInstance.createStringDescription("http://www.cnn.com"));
// Canonicalization tab
link = window.findLink(testerInstance.createStringDescription("Canonicalization tab"));
@@ -248,7 +248,7 @@ public class NavigationDerbyUI extends B
link.click();
window = testerInstance.findWindow(null);
form = window.findForm(testerInstance.createStringDescription("editjob"));
- checkbox = form.findCheckbox(testerInstance.createStringDescription("matchinghosts"),
+ checkbox = form.findCheckbox(testerInstance.createStringDescription("s0_matchinghosts"),
testerInstance.createStringDescription("true"));
checkbox.select();
// Exclusions tab
Propchange: manifoldcf/branches/dev_1x/connectors/wiki/
------------------------------------------------------------------------------
Merged /manifoldcf/trunk/connectors/wiki:r1621855,1622740
Modified: manifoldcf/branches/dev_1x/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java?rev=1626026&r1=1626025&r2=1626026&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java (original)
+++ manifoldcf/branches/dev_1x/connectors/wiki/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/wiki/WikiConnector.java Thu Sep 18 16:56:59 2014
@@ -1465,51 +1465,73 @@ public class WikiConnector extends org.a
}
+ /** Obtain the name of the form check javascript method to call.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@return the name of the form check javascript method.
+ */
+ @Override
+ public String getFormCheckJavascriptMethodName(int connectionSequenceNumber)
+ {
+ return "s"+connectionSequenceNumber+"_checkSpecification";
+ //return "checkSpecification";
+ }
+
+ /** Obtain the name of the form presave check javascript method to call.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@return the name of the form presave check javascript method.
+ */
+ @Override
+ public String getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
+ {
+ return "s"+connectionSequenceNumber+"_checkSpecificationForSave";
+ //return "checkSpecificationForSave";
+ }
+
/** Output the specification header section.
- * This method is called in the head section of a job page which has selected a repository connection of the current type. Its purpose is to add the required tabs
- * to the list, and to output any javascript methods that might be needed by the job editing HTML.
+ * This method is called in the head section of a job page which has selected a repository connection of the
+ * current type. Its purpose is to add the required tabs to the list, and to output any javascript methods
+ * that might be needed by the job editing HTML.
+ * The connector will be connected before this method can be called.
*@param out is the output to which any HTML should be sent.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
*@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector.
*/
@Override
- public void outputSpecificationHeader(IHTTPOutput out, Locale locale, DocumentSpecification ds, List<String> tabsArray)
+ public void outputSpecificationHeader(IHTTPOutput out, Locale locale, Specification ds,
+ int connectionSequenceNumber, List<String> tabsArray)
throws ManifoldCFException, IOException
{
tabsArray.add(Messages.getString(locale,"WikiConnector.NamespaceAndTitles"));
tabsArray.add(Messages.getString(locale, "WikiConnector.Security"));
-
+ String seqPrefix = "s"+connectionSequenceNumber+"_";
+
out.print(
"<script type=\"text/javascript\">\n"+
"<!--\n"+
-"function checkSpecification()\n"+
+"function "+seqPrefix+"NsDelete(k)\n"+
"{\n"+
-" // Does nothing right now.\n"+
-" return true;\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"nsop_\"+k, \"Delete\", \""+seqPrefix+"ns_\"+k);\n"+
"}\n"+
"\n"+
-"function NsDelete(k)\n"+
+"function "+seqPrefix+"NsAdd(k)\n"+
"{\n"+
-" SpecOp(\"nsop_\"+k, \"Delete\", \"ns_\"+k);\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"nsop\", \"Add\", \""+seqPrefix+"ns_\"+k);\n"+
"}\n"+
"\n"+
-"function NsAdd(k)\n"+
+"function "+seqPrefix+"SpecAddToken(anchorvalue)\n"+
"{\n"+
-" SpecOp(\"nsop\", \"Add\", \"ns_\"+k);\n"+
-"}\n"+
-"\n"+
-"function SpecAddToken(anchorvalue)\n"+
-"{\n"+
-" if (editjob.spectoken.value == \"\")\n"+
+" if (editjob."+seqPrefix+"spectoken.value == \"\")\n"+
" {\n"+
" alert(\"" + Messages.getBodyJavascriptString(locale, "WikiConnector.TypeInAnAccessToken") + "\");\n"+
-" editjob.spectoken.focus();\n"+
+" editjob."+seqPrefix+"spectoken.focus();\n"+
" return;\n"+
" }\n"+
-" SpecOp(\"accessop\",\"Add\",anchorvalue);\n"+
+" "+seqPrefix+"SpecOp(\""+seqPrefix+"accessop\",\"Add\",anchorvalue);\n"+
"}\n"+
"\n"+
-"function SpecOp(n, opValue, anchorvalue)\n"+
+"function "+seqPrefix+"SpecOp(n, opValue, anchorvalue)\n"+
"{\n"+
" eval(\"editjob.\"+n+\".value = \\\"\"+opValue+\"\\\"\");\n"+
" postFormSetAnchor(anchorvalue);\n"+
@@ -1521,19 +1543,27 @@ public class WikiConnector extends org.a
}
/** Output the specification body section.
- * This method is called in the body section of a job page which has selected a repository connection of the current type. Its purpose is to present the required form elements for editing.
- * The coder can presume that the HTML that is output from this configuration will be within appropriate <html>, <body>, and <form> tags. The name of the
- * form is "editjob".
+ * This method is called in the body section of a job page which has selected a repository connection of the
+ * current type. Its purpose is to present the required form elements for editing.
+ * The coder can presume that the HTML that is output from this configuration will be within appropriate
+ * <html>, <body>, and <form> tags. The name of the form is always "editjob".
+ * The connector will be connected before this method can be called.
*@param out is the output to which any HTML should be sent.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
- *@param tabName is the current tab name.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@param actualSequenceNumber is the connection within the job that has currently been selected.
+ *@param tabName is the current tab name. (actualSequenceNumber, tabName) form a unique tuple within
+ * the job.
*/
@Override
-
- public void outputSpecificationBody(IHTTPOutput out, Locale locale, DocumentSpecification ds, String tabName)
+ public void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds,
+ int connectionSequenceNumber, int actualSequenceNumber, String tabName)
throws ManifoldCFException, IOException
{
- if (tabName.equals(Messages.getString(locale,"WikiConnector.NamespaceAndTitles")))
+ String seqPrefix = "s"+connectionSequenceNumber+"_";
+
+ if (tabName.equals(Messages.getString(locale,"WikiConnector.NamespaceAndTitles")) && connectionSequenceNumber == actualSequenceNumber)
{
boolean seenAny = false;
// Output table column headers
@@ -1560,18 +1590,18 @@ public class WikiConnector extends org.a
String namespace = sn.getAttributeValue(WikiConfig.ATTR_NAMESPACE);
String titlePrefix = sn.getAttributeValue(WikiConfig.ATTR_TITLEPREFIX);
- String nsOpName = "nsop_"+k;
- String nsNsName = "nsnsname_"+k;
- String nsTitlePrefix = "nstitleprefix_"+k;
+ String nsOpName = seqPrefix+"nsop_"+k;
+ String nsNsName = seqPrefix+"nsnsname_"+k;
+ String nsTitlePrefix = seqPrefix+"nstitleprefix_"+k;
out.print(
" <tr class=\""+(((k % 2)==0)?"evenformrow":"oddformrow")+"\">\n"+
" <td class=\"formcolumncell\">\n"+
" <nobr>\n"+
-" <a name=\""+"ns_"+Integer.toString(k)+"\"/>\n"+
+" <a name=\""+seqPrefix+"ns_"+Integer.toString(k)+"\"/>\n"+
" <input type=\"hidden\" name=\""+nsOpName+"\" value=\"\"/>\n"+
" <input type=\"hidden\" name=\""+nsNsName+"\" value=\""+((namespace==null)?"":org.apache.manifoldcf.ui.util.Encoder.attributeEscape(namespace))+"\"/>\n"+
" <input type=\"hidden\" name=\""+nsTitlePrefix+"\" value=\""+((titlePrefix==null)?"":org.apache.manifoldcf.ui.util.Encoder.attributeEscape(titlePrefix))+"\"/>\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WikiConnector.Delete") + "\" onClick='Javascript:NsDelete("+Integer.toString(k)+")' alt=\""+Messages.getAttributeString(locale,"WikiConnector.DeleteNamespaceTitle")+Integer.toString(k)+"\"/>\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WikiConnector.Delete") + "\" onClick='Javascript:"+seqPrefix+"NsDelete("+Integer.toString(k)+")' alt=\""+Messages.getAttributeString(locale,"WikiConnector.DeleteNamespaceTitle")+Integer.toString(k)+"\"/>\n"+
" </nobr>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
@@ -1621,15 +1651,15 @@ public class WikiConnector extends org.a
" <tr class=\"formrow\">\n"+
" <td class=\"formcolumncell\">\n"+
" <nobr>\n"+
-" <a name=\""+"ns_"+Integer.toString(k)+"\"/>\n"+
-" <input type=\"hidden\" name=\"nsop\" value=\"\"/>\n"+
-" <input type=\"hidden\" name=\"nscount\" value=\""+Integer.toString(k)+"\"/>\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WikiConnector.Add") + "\" onClick='Javascript:NsAdd("+Integer.toString(k)+")' alt=\"" + Messages.getAttributeString(locale,"WikiConnector.AddNamespacePrefix") + "\"/>\n"+
+" <a name=\""+seqPrefix+"ns_"+Integer.toString(k)+"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"nsop\" value=\"\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"nscount\" value=\""+Integer.toString(k)+"\"/>\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"WikiConnector.Add") + "\" onClick='Javascript:"+seqPrefix+"NsAdd("+Integer.toString(k)+")' alt=\"" + Messages.getAttributeString(locale,"WikiConnector.AddNamespacePrefix") + "\"/>\n"+
" </nobr>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" <nobr>\n"+
-" <select name=\"nsnsname\">\n"+
+" <select name=\""+seqPrefix+"nsnsname\">\n"+
" <option value=\"\" selected=\"true\">-- " + Messages.getBodyString(locale,"WikiConnector.UseDefault") + " --</option>\n"
);
for (int l = 0 ; l < nameSpaceNames.length ; l++)
@@ -1647,7 +1677,7 @@ public class WikiConnector extends org.a
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" <nobr>\n"+
-" <input type=\"text\" name=\"nstitleprefix\" size=\"16\" value=\"\"/>\n"+
+" <input type=\"text\" name=\""+seqPrefix+"nstitleprefix\" size=\"16\" value=\"\"/>\n"+
" </nobr>\n"+
" </td>\n"+
" </tr>\n"
@@ -1680,8 +1710,8 @@ public class WikiConnector extends org.a
String namespace = sn.getAttributeValue(WikiConfig.ATTR_NAMESPACE);
String titlePrefix = sn.getAttributeValue(WikiConfig.ATTR_TITLEPREFIX);
- String nsNsName = "nsnsname_"+k;
- String nsTitlePrefix = "nstitleprefix_"+k;
+ String nsNsName = seqPrefix+"nsnsname_"+k;
+ String nsTitlePrefix = seqPrefix+"nstitleprefix_"+k;
out.print(
"<input type=\"hidden\" name=\""+nsNsName+"\" value=\""+((namespace == null)?"":org.apache.manifoldcf.ui.util.Encoder.attributeEscape(namespace))+"\"/>\n"+
@@ -1691,11 +1721,11 @@ public class WikiConnector extends org.a
}
}
out.print(
-"<input type=\"hidden\" name=\"nscount\" value=\""+new Integer(k)+"\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"nscount\" value=\""+new Integer(k)+"\"/>\n"
);
}
- if (tabName.equals(Messages.getString(locale, "WikiConnector.Security")))
+ if (tabName.equals(Messages.getString(locale, "WikiConnector.Security")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
@@ -1708,15 +1738,15 @@ public class WikiConnector extends org.a
SpecificationNode sn = ds.getChild(i++);
if (sn.getType().equals("access")) {
String accessDescription = "_" + Integer.toString(k);
- String accessOpName = "accessop" + accessDescription;
+ String accessOpName = seqPrefix + "accessop" + accessDescription;
String token = sn.getAttributeValue("token");
out.print(
" <tr>\n"+
" <td class=\"description\">\n"+
" <input type=\"hidden\" name=\"" + accessOpName + "\" value=\"\"/>\n"+
-" <input type=\"hidden\" name=\"" + "spectoken" + accessDescription + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(token) + "\"/>\n"+
-" <a name=\"" + "token_" + Integer.toString(k) + "\">\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale, "WikiConnector.Delete") + "\" onClick='Javascript:SpecOp(\"" + accessOpName + "\",\"Delete\",\"token_" + Integer.toString(k) + "\")' alt=\"" + Messages.getAttributeString(locale, "WikiConnector.Delete") + Integer.toString(k) + "\"/>\n"+
+" <input type=\"hidden\" name=\"" + seqPrefix + "spectoken" + accessDescription + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(token) + "\"/>\n"+
+" <a name=\"" + seqPrefix + "token_" + Integer.toString(k) + "\">\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale, "WikiConnector.Delete") + "\" onClick='Javascript:"+seqPrefix+"SpecOp(\"" + accessOpName + "\",\"Delete\",\""+seqPrefix+"token_" + Integer.toString(k) + "\")' alt=\"" + Messages.getAttributeString(locale, "WikiConnector.Delete") + Integer.toString(k) + "\"/>\n"+
" </a> \n"+
" </td>\n"+
" <td class=\"value\">\n"+
@@ -1738,14 +1768,14 @@ public class WikiConnector extends org.a
" <tr><td class=\"lightseparator\" colspan=\"2\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"description\">\n"+
-" <input type=\"hidden\" name=\"tokencount\" value=\"" + Integer.toString(k) + "\"/>\n"+
-" <input type=\"hidden\" name=\"accessop\" value=\"\"/>\n"+
-" <a name=\"" + "token_" + Integer.toString(k) + "\">\n"+
-" <input type=\"button\" value=\"" + Messages.getAttributeString(locale, "WikiConnector.Add") + "\" onClick='Javascript:SpecAddToken(\"token_" + Integer.toString(k + 1) + "\")' alt=\"" + Messages.getAttributeString(locale, "WikiConnector.Add") + "\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"tokencount\" value=\"" + Integer.toString(k) + "\"/>\n"+
+" <input type=\"hidden\" name=\""+seqPrefix+"accessop\" value=\"\"/>\n"+
+" <a name=\"" + seqPrefix + "token_" + Integer.toString(k) + "\">\n"+
+" <input type=\"button\" value=\"" + Messages.getAttributeString(locale, "WikiConnector.Add") + "\" onClick='Javascript:"+seqPrefix+"SpecAddToken(\""+seqPrefix+"token_" + Integer.toString(k + 1) + "\")' alt=\"" + Messages.getAttributeString(locale, "WikiConnector.Add") + "\"/>\n"+
" </a> \n"+
" </td>\n"+
" <td class=\"value\">\n"+
-" <input type=\"text\" size=\"30\" name=\"spectoken\" value=\"\"/>\n"+
+" <input type=\"text\" size=\"30\" name=\""+seqPrefix+"spectoken\" value=\"\"/>\n"+
" </td>\n"+
" </tr>\n"+
"</table>\n"
@@ -1762,30 +1792,37 @@ public class WikiConnector extends org.a
String accessDescription = "_" + Integer.toString(k);
String token = sn.getAttributeValue("token");
out.print(
-"<input type=\"hidden\" name=\"" + "spectoken" + accessDescription + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(token) + "\"/>\n"
+"<input type=\"hidden\" name=\"" + seqPrefix + "spectoken" + accessDescription + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(token) + "\"/>\n"
);
k++;
}
}
out.print(
-"<input type=\"hidden\" name=\"tokencount\" value=\"" + Integer.toString(k) + "\"/>\n"
+"<input type=\"hidden\" name=\""+seqPrefix+"tokencount\" value=\"" + Integer.toString(k) + "\"/>\n"
);
}
}
/** Process a specification post.
- * This method is called at the start of job's edit or view page, whenever there is a possibility that form data for a connection has been
- * posted. Its purpose is to gather form information and modify the document specification accordingly.
- * The name of the posted form is "editjob".
+ * This method is called at the start of job's edit or view page, whenever there is a possibility that form
+ * data for a connection has been posted. Its purpose is to gather form information and modify the
+ * document specification accordingly. The name of the posted form is always "editjob".
+ * The connector will be connected before this method can be called.
*@param variableContext contains the post data, including binary file-upload information.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
- *@return null if all is well, or a string error message if there is an error that should prevent saving of the job (and cause a redirection to an error page).
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
+ *@return null if all is well, or a string error message if there is an error that should prevent saving of
+ * the job (and cause a redirection to an error page).
*/
@Override
- public String processSpecificationPost(IPostParameters variableContext, Locale locale, DocumentSpecification ds)
+ public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds,
+ int connectionSequenceNumber)
throws ManifoldCFException
{
- String countString = variableContext.getParameter("nscount");
+ String seqPrefix = "s"+connectionSequenceNumber+"_";
+
+ String countString = variableContext.getParameter(seqPrefix+"nscount");
if (countString != null)
{
for (int i = 0 ; i < ds.getChildCount() ; i++)
@@ -1800,9 +1837,9 @@ public class WikiConnector extends org.a
int nsCount = Integer.parseInt(countString);
for (int i = 0 ; i < nsCount ; i++)
{
- String nsOpName = "nsop_"+i;
- String nsNsName = "nsnsname_"+i;
- String nsTitlePrefix = "nstitleprefix_"+i;
+ String nsOpName = seqPrefix+"nsop_"+i;
+ String nsNsName = seqPrefix+"nsnsname_"+i;
+ String nsTitlePrefix = seqPrefix+"nstitleprefix_"+i;
String nsOp = variableContext.getParameter(nsOpName);
if (nsOp == null || !nsOp.equals("Delete"))
@@ -1822,13 +1859,13 @@ public class WikiConnector extends org.a
}
}
- String newOp = variableContext.getParameter("nsop");
+ String newOp = variableContext.getParameter(seqPrefix+"nsop");
if (newOp != null && newOp.equals("Add"))
{
- String namespaceName = variableContext.getParameter("nsnsname");
+ String namespaceName = variableContext.getParameter(seqPrefix+"nsnsname");
if (namespaceName != null && namespaceName.length() == 0)
namespaceName = null;
- String titlePrefix = variableContext.getParameter("nstitleprefix");
+ String titlePrefix = variableContext.getParameter(seqPrefix+"nstitleprefix");
if (titlePrefix != null && titlePrefix.length() == 0)
titlePrefix = null;
SpecificationNode sn = new SpecificationNode(WikiConfig.NODE_NAMESPACE_TITLE_PREFIX);
@@ -1840,7 +1877,7 @@ public class WikiConnector extends org.a
}
}
- String xc = variableContext.getParameter("tokencount");
+ String xc = variableContext.getParameter(seqPrefix+"tokencount");
if (xc != null) {
// Delete all tokens first
int i = 0;
@@ -1857,7 +1894,7 @@ public class WikiConnector extends org.a
i = 0;
while (i < accessCount) {
String accessDescription = "_" + Integer.toString(i);
- String accessOpName = "accessop" + accessDescription;
+ String accessOpName = seqPrefix +"accessop" + accessDescription;
xc = variableContext.getParameter(accessOpName);
if (xc != null && xc.equals("Delete")) {
// Next row
@@ -1865,16 +1902,16 @@ public class WikiConnector extends org.a
continue;
}
// Get the stuff we need
- String accessSpec = variableContext.getParameter("spectoken" + accessDescription);
+ String accessSpec = variableContext.getParameter(seqPrefix + "spectoken" + accessDescription);
SpecificationNode node = new SpecificationNode("access");
node.setAttribute("token", accessSpec);
ds.addChild(ds.getChildCount(), node);
i++;
}
- String op = variableContext.getParameter("accessop");
+ String op = variableContext.getParameter(seqPrefix+"accessop");
if (op != null && op.equals("Add")) {
- String accessspec = variableContext.getParameter("spectoken");
+ String accessspec = variableContext.getParameter(seqPrefix+"spectoken");
SpecificationNode node = new SpecificationNode("access");
node.setAttribute("token", accessspec);
ds.addChild(ds.getChildCount(), node);
@@ -1885,13 +1922,18 @@ public class WikiConnector extends org.a
}
/** View specification.
- * This method is called in the body section of a job's view page. Its purpose is to present the document specification information to the user.
- * The coder can presume that the HTML that is output from this configuration will be within appropriate <html> and <body> tags.
+ * This method is called in the body section of a job's view page. Its purpose is to present the document
+ * specification information to the user. The coder can presume that the HTML that is output from
+ * this configuration will be within appropriate <html> and <body> tags.
+ * The connector will be connected before this method can be called.
*@param out is the output to which any HTML should be sent.
+ *@param locale is the locale the output is preferred to be in.
*@param ds is the current document specification for this job.
+ *@param connectionSequenceNumber is the unique number of this connection within the job.
*/
@Override
- public void viewSpecification(IHTTPOutput out, Locale locale, DocumentSpecification ds)
+ public void viewSpecification(IHTTPOutput out, Locale locale, Specification ds,
+ int connectionSequenceNumber)
throws ManifoldCFException, IOException
{
out.print(