Modified: manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxRepositoryConnector.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxRepositoryConnector.java?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxRepositoryConnector.java (original) +++ manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxRepositoryConnector.java Thu Sep 18 16:56:59 2014 @@ -46,6 +46,7 @@ import org.apache.manifoldcf.core.interf import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity; import org.apache.manifoldcf.core.interfaces.IPostParameters; import org.apache.manifoldcf.core.interfaces.IThreadContext; +import org.apache.manifoldcf.core.interfaces.Specification; import org.apache.manifoldcf.core.interfaces.SpecificationNode; import org.apache.manifoldcf.crawler.interfaces.DocumentSpecification; import org.apache.manifoldcf.crawler.interfaces.IProcessActivity; @@ -512,7 +513,7 @@ public class DropboxRepositoryConnector /** * Fill in specification Velocity parameter map for DROPBOXPath tab. */ - private static void fillInDropboxPathSpecificationMap(Map<String, Object> newMap, DocumentSpecification ds) { + private static void fillInDropboxPathSpecificationMap(Map<String, Object> newMap, Specification ds) { int i = 0; String DropboxPath = DropboxConfig.DROPBOX_PATH_PARAM_DEFAULT_VALUE; while (i < ds.getChildCount()) { @@ -528,7 +529,7 @@ public class DropboxRepositoryConnector /** * Fill in specification Velocity parameter map for Dropbox Security tab. */ - private static void fillInDropboxSecuritySpecificationMap(Map<String, Object> newMap, DocumentSpecification ds) { + private static void fillInDropboxSecuritySpecificationMap(Map<String, Object> newMap, Specification ds) { List<Map<String,String>> accessTokenList = new ArrayList<Map<String,String>>(); for (int i = 0; i < ds.getChildCount(); i++) { SpecificationNode sn = ds.getChild(i); @@ -542,21 +543,23 @@ public class DropboxRepositoryConnector newMap.put("ACCESSTOKENS", accessTokenList); } - /** - * 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. - * - * @param out is the output to which any HTML should be sent. - * @param ds is the current document specification for this job. - */ + /** 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. + * 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 { Map<String, Object> paramMap = new HashMap<String, Object>(); + paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); // Fill in the map with data from all tabs fillInDropboxPathSpecificationMap(paramMap, ds); @@ -565,24 +568,25 @@ public class DropboxRepositoryConnector Messages.outputResourceWithVelocity(out,locale,VIEW_SPEC_FORWARD,paramMap); } - /** - * 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". - * - * @param variableContext contains the post data, including binary - * file-upload information. - * @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). - */ + /** 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 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. + *@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, - DocumentSpecification ds) throws ManifoldCFException { - String dropboxPath = variableContext.getParameter("dropboxpath"); + public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds, + int connectionSequenceNumber) + throws ManifoldCFException { + String seqPrefix = "s"+connectionSequenceNumber+"_"; + + String dropboxPath = variableContext.getParameter(seqPrefix+"dropboxpath"); if (dropboxPath != null) { int i = 0; while (i < ds.getChildCount()) { @@ -597,7 +601,7 @@ public class DropboxRepositoryConnector node.setAttribute(JOB_PATH_ATTRIBUTE, dropboxPath); ds.addChild(ds.getChildCount(), node); } - String xc = variableContext.getParameter("tokencount"); + String xc = variableContext.getParameter(seqPrefix+"tokencount"); if (xc != null) { // Delete all tokens first int i = 0; @@ -613,7 +617,7 @@ public class DropboxRepositoryConnector 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 @@ -621,17 +625,17 @@ public class DropboxRepositoryConnector continue; } // Get the stuff we need - String accessSpec = variableContext.getParameter("spectoken"+accessDescription); + String accessSpec = variableContext.getParameter(seqPrefix+"spectoken"+accessDescription); SpecificationNode node = new SpecificationNode(JOB_ACCESS_NODE_TYPE); node.setAttribute(JOB_TOKEN_ATTRIBUTE,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(JOB_ACCESS_NODE_TYPE); node.setAttribute(JOB_TOKEN_ATTRIBUTE,accessspec); ds.addChild(ds.getChildCount(),node); @@ -641,26 +645,53 @@ public class DropboxRepositoryConnector return null; } - /** - * 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". - * - * @param out is the output to which any HTML should be sent. - * @param ds is the current document specification for this job. - * @param tabName is the current tab name. - */ + /** 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 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 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 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) throws ManifoldCFException, - IOException { + public void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds, + int connectionSequenceNumber, int actualSequenceNumber, String tabName) + throws ManifoldCFException, IOException { // Output DROPBOXPath tab Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("TabName", tabName); + paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); + paramMap.put("SelectedNum", Integer.toString(actualSequenceNumber)); + fillInDropboxPathSpecificationMap(paramMap, ds); fillInDropboxSecuritySpecificationMap(paramMap, ds); @@ -668,26 +699,26 @@ public class DropboxRepositoryConnector Messages.outputResourceWithVelocity(out,locale,EDIT_SPEC_FORWARD_SECURITY,paramMap); } - /** - * 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. - * - * @param out is the output to which any HTML should be sent. - * @param ds is the current document specification for this job. - * @param tabsArray is an array of tab names. Add to this array any tab - * names that are specific to the connector. - */ + /** 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. + * 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, DROPBOX_PATH_TAB_PROPERTY)); tabsArray.add(Messages.getString(locale, DROPBOX_SECURITY_TAB_PROPERTY)); Map<String, Object> paramMap = new HashMap<String, Object>(); + paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); // Fill in the specification header map, using data from all tabs. fillInDropboxPathSpecificationMap(paramMap, ds);
Modified: manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification.js URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification.js?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification.js (original) +++ manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification.js Thu Sep 18 16:56:59 2014 @@ -17,42 +17,37 @@ <script type="text/javascript"> <!-- -function checkSpecification() +function s${SeqNum}_checkSpecificationForSave() { - return true; -} - -function checkSpecificationForSave() -{ - if(editjob.dropboxpath.value == "") { + if(editjob.s${SeqNum}_dropboxpath.value == "") { alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('DropboxRepositoryConnector.PathMustNotBeNull'))"); - SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('DropboxRepositoryConnector.Server'))"); - editjob.dropboxpath.focus(); + SelectSequencedTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('DropboxRepositoryConnector.Server'))",${SEQNUM}); + editjob.s${SeqNum}_dropboxpath.focus(); return false; } return true; } -function SpecOp(n, opValue, anchorvalue) +function s${SeqNum}_SpecOp(n, opValue, anchorvalue) { eval("editjob."+n+".value = \""+opValue+"\""); postFormSetAnchor(anchorvalue); } -function SpecDeleteToken(i) +function s${SeqNum}_SpecDeleteToken(i) { - SpecOp("accessop_"+i,"Delete","token_"+i); + s${SeqNum}_SpecOp("s${SeqNum}_accessop_"+i,"Delete","s${SeqNum}_token_"+i); } -function SpecAddToken(i) +function s${SeqNum}_SpecAddToken(i) { - if (editjob.spectoken.value == "") + if (editjob.s${SeqNum}_spectoken.value == "") { alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('DropboxRepositoryConnector.TypeInAnAccessToken'))"); - editjob.spectoken.focus(); + editjob.s${SeqNum}_spectoken.focus(); return; } - SpecOp("accessop","Add","token_"+i); + s${SeqNum}_SpecOp("s${SeqNum}_accessop","Add","s${SeqNum}_token_"+i); } //--> Modified: manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_DropboxPath.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_DropboxPath.html?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_DropboxPath.html (original) +++ manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_DropboxPath.html Thu Sep 18 16:56:59 2014 @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -#if($TabName == $ResourceBundle.getString('DropboxRepositoryConnector.DropboxPath')) +#if($TabName == $ResourceBundle.getString('DropboxRepositoryConnector.DropboxPath') && ${SeqNum} == ${SelectedNum}) <table class="displaytable"> <tr><td class="separator" colspan="2"><hr/></td></tr> @@ -23,14 +23,14 @@ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('DropboxRepositoryConnector.DropboxPathColon'))</nobr> </td> <td class="value"> - <nobr><input type="text" size="80" name="dropboxpath" value="$Encoder.attributeEscape($DROPBOXPATH)" /></nobr> + <nobr><input type="text" size="80" name="s${SeqNum}_dropboxpath" value="$Encoder.attributeEscape($DROPBOXPATH)" /></nobr> </td> </tr> </table> #else -<input type="hidden" name="dropboxpath" value="$Encoder.attributeEscape($DROPBOXPATH)" /> +<input type="hidden" name="s${SeqNum}_dropboxpath" value="$Encoder.attributeEscape($DROPBOXPATH)" /> #end Modified: manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_Security.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_Security.html?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_Security.html (original) +++ manifoldcf/branches/dev_1x/connectors/dropbox/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/dropbox/editSpecification_Security.html Thu Sep 18 16:56:59 2014 @@ -15,7 +15,7 @@ limitations under the License. --> -#if($TabName == $ResourceBundle.getString('DropboxRepositoryConnector.Security')) +#if($TabName == $ResourceBundle.getString('DropboxRepositoryConnector.Security') && ${SeqNum} == ${SelectedNum}) <table class="displaytable"> <tr><td class="separator" colspan="2"><hr/></td></tr> @@ -25,10 +25,10 @@ <tr> <td class="description"> - <input type="hidden" name="accessop_$atcounter" value=""/> - <input type="hidden" name="spectoken_$atcounter" value="$Encoder.attributeEscape($atoken.get('TOKEN'))"/> - <a name="token_$atcounter"> - <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.Delete'))" onClick='Javascript:SpecDeleteToken($atcounter)' alt="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.DeleteToken'))$atcounter"/> + <input type="hidden" name="s${SeqNum}_accessop_$atcounter" value=""/> + <input type="hidden" name="s${SeqNum}_spectoken_$atcounter" value="$Encoder.attributeEscape($atoken.get('TOKEN'))"/> + <a name="s${SeqNum}_token_$atcounter"> + <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.Delete'))" onClick='Javascript:s${SeqNum}_SpecDeleteToken($atcounter)' alt="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.DeleteToken'))$atcounter"/> </a> </td> <td class="value">$Encoder.bodyEscape($atoken.get('TOKEN'))</td> @@ -49,14 +49,14 @@ <tr> <td class="description"> - <input type="hidden" name="tokencount" value="$atcounter"/> - <input type="hidden" name="accessop" value=""/> - <a name="token_$atcounter"> - <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.Add'))" onClick='Javascript:SpecAddToken($nexttoken)' alt="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.AddAccessToken'))"/> + <input type="hidden" name="s${SeqNum}_tokencount" value="$atcounter"/> + <input type="hidden" name="s${SeqNum}_accessop" value=""/> + <a name="s${SeqNum}_token_$atcounter"> + <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.Add'))" onClick='Javascript:s${SeqNum}_SpecAddToken($nexttoken)' alt="$Encoder.attributeEscape($ResourceBundle.getString('DropboxRepositoryConnector.AddAccessToken'))"/> </a> </td> <td class="value"> - <input type="text" size="30" name="spectoken" value=""/> + <input type="text" size="30" name="s${SeqNum}_spectoken" value=""/> </td> </tr> </table> @@ -65,9 +65,9 @@ #set($atcounter = 0) #foreach($atoken in $ACCESSTOKENS) -<input type="hidden" name="spectoken_$atcounter" value="$Encoder.attributeEscape($atoken.get('TOKEN'))"/> +<input type="hidden" name="s${SeqNum}_spectoken_$atcounter" value="$Encoder.attributeEscape($atoken.get('TOKEN'))"/> #set($atcounter = $atcounter + 1) #end -<input type="hidden" name="tokencount" value="$atcounter"/> +<input type="hidden" name="s${SeqNum}_tokencount" value="$atcounter"/> #end Modified: manifoldcf/branches/dev_1x/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java (original) +++ manifoldcf/branches/dev_1x/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java Thu Sep 18 16:56:59 2014 @@ -851,57 +851,83 @@ public class EmailConnector extends org. /////////////////////////////////Start of Specification UI////////////////////////////////////////////////// - /** - * Output the specification header section. + /** 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 + * 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 desired locale. - * @param ds is the current document specification for this job. - * @param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector. + *@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 { + Map<String, Object> paramMap = new HashMap<String, Object>(); + paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); // Add the tabs tabsArray.add(Messages.getString(locale, "EmailConnector.Metadata")); tabsArray.add(Messages.getString(locale, "EmailConnector.Filter")); - Messages.outputResourceWithVelocity(out, locale, "SpecificationHeader.js", null); + Messages.outputResourceWithVelocity(out, locale, "SpecificationHeader.js", paramMap); } - /** - * Output the specification body section. + /** 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. + * 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". + * <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 desired locale. - * @param ds is the current document specification for this job. - * @param tabName is the current tab name. + *@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 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 { - outputFilterTab(out, locale, ds, tabName); - outputMetadataTab(out, locale, ds, tabName); + outputFilterTab(out, locale, ds, tabName, connectionSequenceNumber, actualSequenceNumber); + outputMetadataTab(out, locale, ds, tabName, connectionSequenceNumber, actualSequenceNumber); } /** * Take care of "Metadata" tab. */ protected void outputMetadataTab(IHTTPOutput out, Locale locale, - DocumentSpecification ds, String tabName) - throws ManifoldCFException, IOException { + Specification ds, String tabName, int connectionSequenceNumber, int actualSequenceNumber) + throws ManifoldCFException, IOException { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("TabName", tabName); + paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); + paramMap.put("SelectedNum", Integer.toString(actualSequenceNumber)); fillInMetadataTab(paramMap, ds); fillInMetadataAttributes(paramMap); Messages.outputResourceWithVelocity(out, locale, "Specification_Metadata.html", paramMap); @@ -911,7 +937,7 @@ public class EmailConnector extends org. * Fill in Velocity context for Metadata tab. */ protected static void fillInMetadataTab(Map<String, Object> paramMap, - DocumentSpecification ds) { + Specification ds) { Set<String> metadataSelections = new HashSet<String>(); int i = 0; while (i < ds.getChildCount()) { @@ -933,10 +959,12 @@ public class EmailConnector extends org. } protected void outputFilterTab(IHTTPOutput out, Locale locale, - DocumentSpecification ds, String tabName) + Specification ds, String tabName, int connectionSequenceNumber, int actualSequenceNumber) throws ManifoldCFException, IOException { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("TabName", tabName); + paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); + paramMap.put("SelectedNum", Integer.toString(actualSequenceNumber)); fillInFilterTab(paramMap, ds); if (tabName.equals(Messages.getString(locale, "EmailConnector.Filter"))) fillInSearchableAttributes(paramMap); @@ -964,7 +992,7 @@ public class EmailConnector extends org. } protected static void fillInFilterTab(Map<String, Object> paramMap, - DocumentSpecification ds) { + Specification ds) { List<Map<String, String>> filterList = new ArrayList<Map<String, String>>(); Set<String> folders = new HashSet<String>(); int i = 0; @@ -988,34 +1016,38 @@ public class EmailConnector extends org. paramMap.put("FOLDERS", folders); } - /** - * Process a specification post. + /** 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 always "editjob". + * 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 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 + *@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. + *@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, DocumentSpecification ds) - throws ManifoldCFException { + public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds, + int connectionSequenceNumber) + throws ManifoldCFException { - String result = processFilterTab(variableContext, ds); + String result = processFilterTab(variableContext, ds, connectionSequenceNumber); if (result != null) return result; - result = processMetadataTab(variableContext, ds); + result = processMetadataTab(variableContext, ds, connectionSequenceNumber); return result; } - protected String processFilterTab(IPostParameters variableContext, DocumentSpecification ds) - throws ManifoldCFException { + protected String processFilterTab(IPostParameters variableContext, Specification ds, + int connectionSequenceNumber) + throws ManifoldCFException { - String findCountString = variableContext.getParameter("findcount"); + String seqPrefix = "s"+connectionSequenceNumber+"_"; + + String findCountString = variableContext.getParameter(seqPrefix + "findcount"); if (findCountString != null) { int findCount = Integer.parseInt(findCountString); @@ -1026,23 +1058,23 @@ public class EmailConnector extends org. while (i < findCount) { String suffix = "_" + Integer.toString(i++); // Only add the name/value if the item was not deleted. - String findParameterOp = variableContext.getParameter("findop" + suffix); + String findParameterOp = variableContext.getParameter(seqPrefix + "findop" + suffix); if (findParameterOp == null || !findParameterOp.equals("Delete")) { - String findParameterName = variableContext.getParameter("findname" + suffix); - String findParameterValue = variableContext.getParameter("findvalue" + suffix); + String findParameterName = variableContext.getParameter(seqPrefix + "findname" + suffix); + String findParameterValue = variableContext.getParameter(seqPrefix + "findvalue" + suffix); addFindParameterNode(ds, findParameterName, findParameterValue); } } - String operation = variableContext.getParameter("findop"); + String operation = variableContext.getParameter(seqPrefix + "findop"); if (operation != null && operation.equals("Add")) { - String findParameterName = variableContext.getParameter("findname"); - String findParameterValue = variableContext.getParameter("findvalue"); + String findParameterName = variableContext.getParameter(seqPrefix + "findname"); + String findParameterValue = variableContext.getParameter(seqPrefix + "findvalue"); addFindParameterNode(ds, findParameterName, findParameterValue); } } - String[] folders = variableContext.getParameterValues("folders"); + String[] folders = variableContext.getParameterValues(seqPrefix + "folders"); if (folders != null) { removeNodes(ds, EmailConfig.NODE_FOLDER); @@ -1055,13 +1087,17 @@ public class EmailConnector extends org. } - protected String processMetadataTab(IPostParameters variableContext, DocumentSpecification ds) - throws ManifoldCFException { + protected String processMetadataTab(IPostParameters variableContext, Specification ds, + int connectionSequenceNumber) + throws ManifoldCFException { + + String seqPrefix = "s"+connectionSequenceNumber+"_"; + // Remove old included metadata nodes removeNodes(ds, EmailConfig.NODE_METADATA); // Get the posted metadata values - String[] metadataNames = variableContext.getParameterValues("metadata"); + String[] metadataNames = variableContext.getParameterValues(seqPrefix + "metadata"); if (metadataNames != null) { // Add each metadata name as a node to the document specification int i = 0; @@ -1074,21 +1110,22 @@ public class EmailConnector extends org. return null; } - /** - * 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 + /** 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. * 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 desired locale. - * @param ds is the current document specification for this job. -*/ + *@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) - throws ManifoldCFException, IOException { + public void viewSpecification(IHTTPOutput out, Locale locale, Specification ds, + int connectionSequenceNumber) + throws ManifoldCFException, IOException { Map<String, Object> paramMap = new HashMap<String, Object>(); + paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); fillInFilterTab(paramMap, ds); fillInMetadataTab(paramMap, ds); Messages.outputResourceWithVelocity(out, locale, "SpecificationView.html", paramMap); @@ -1181,7 +1218,7 @@ public class EmailConnector extends org. } } - protected static void removeNodes(DocumentSpecification ds, + protected static void removeNodes(Specification ds, String nodeTypeName) { int i = 0; while (i < ds.getChildCount()) { @@ -1193,7 +1230,7 @@ public class EmailConnector extends org. } } - protected static void addIncludedMetadataNode(DocumentSpecification ds, + protected static void addIncludedMetadataNode(Specification ds, String metadataName) { // Build the proper node SpecificationNode sn = new SpecificationNode(EmailConfig.NODE_METADATA); @@ -1202,7 +1239,7 @@ public class EmailConnector extends org. ds.addChild(ds.getChildCount(), sn); } - protected static void addFindParameterNode(DocumentSpecification ds, String findParameterName, String findParameterValue) { + protected static void addFindParameterNode(Specification ds, String findParameterName, String findParameterValue) { SpecificationNode sn = new SpecificationNode(EmailConfig.NODE_FILTER); sn.setAttribute(EmailConfig.ATTRIBUTE_NAME, findParameterName); sn.setAttribute(EmailConfig.ATTRIBUTE_VALUE, findParameterValue); @@ -1210,7 +1247,7 @@ public class EmailConnector extends org. ds.addChild(ds.getChildCount(), sn); } - protected static void addFolderNode(DocumentSpecification ds, String folderName) + protected static void addFolderNode(Specification ds, String folderName) { SpecificationNode sn = new SpecificationNode(EmailConfig.NODE_FOLDER); sn.setAttribute(EmailConfig.ATTRIBUTE_NAME, folderName); Modified: manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/SpecificationHeader.js URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/SpecificationHeader.js?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/SpecificationHeader.js (original) +++ manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/SpecificationHeader.js Thu Sep 18 16:56:59 2014 @@ -18,51 +18,51 @@ <script type="text/javascript"> <!-- -function checkSpecification() +function s${SeqNum}_checkSpecification() { - if (checkDocumentsTab() == false) + if (s${SeqNum}_checkDocumentsTab() == false) return false; - if (checkMetadataTab() == false) + if (s${SeqNum}_checkMetadataTab() == false) return false; return true; } -function SpecOp(n, opValue, anchorvalue) +function s${SeqNum}_SpecOp(n, opValue, anchorvalue) { eval("editjob."+n+".value = \""+opValue+"\""); postFormSetAnchor(anchorvalue); } -function checkDocumentsTab() +function s${SeqNum}_checkDocumentsTab() { return true; } -function checkMetadataTab() +function s${SeqNum}_checkMetadataTab() { return true; } -function FindDelete(n) +function s${SeqNum}_FindDelete(n) { - SpecOp("findop_"+n, "Delete", "find_"+n); + s${SeqNum}_SpecOp("s${SeqNum}_findop_"+n, "Delete", "s${SeqNum}_find_"+n); } -function FindAdd(n) +function s${SeqNum}_FindAdd(n) { - if (editjob.findname.value == "") + if (editjob.s${SeqNum}_findname.value == "") { alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('EmailConnector.PleaseSelectAMetadataName'))"); - editjob.findname.focus(); + editjob.s${SeqNum}_findname.focus(); return; } - if (editjob.findvalue.value == "") + if (editjob.s${SeqNum}_findvalue.value == "") { alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('EmailConnector.ValueCannotBeBlank'))"); - editjob.findvalue.focus(); + editjob.s${SeqNum}_findvalue.focus(); return; } - SpecOp("findop", "Add", "find_"+n); + s${SeqNum}_SpecOp("s${SeqNum}_findop", "Add", "s${SeqNum}_find_"+n); } //--> Modified: manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Filter.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Filter.html?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Filter.html (original) +++ manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Filter.html Thu Sep 18 16:56:59 2014 @@ -15,7 +15,7 @@ See the License for the specific languag limitations under the License. --> -#if($TabName == $ResourceBundle.getString('EmailConnector.Filter')) +#if($TabName == $ResourceBundle.getString('EmailConnector.Filter') && ${SeqNum} == ${SelectedNum}) <table class="displaytable"> <tr><td class="separator" colspan="2"><hr/></td></tr> @@ -25,7 +25,7 @@ limitations under the License. <nobr>$Encoder.bodyEscape($ResourceBundle.getString('EmailConnector.FoldersColon'))</nobr> </td> <td class="value"> - <select name="folders" multiple="true" size="4"> + <select name="s${SeqNum}_folders" multiple="true" size="4"> #foreach($name in $FOLDERNAMES) #if($FOLDERS.contains($name)) <option value="$Encoder.attributeEscape($name)" selected="true">$Encoder.bodyEscape($name)</option> @@ -38,7 +38,7 @@ limitations under the License. #else <td class="message" colspan="2"> #foreach($name in $FOLDERS) - <input type="hidden" name="folders" value="$Encoder.attributeEscape($name)"/> + <input type="hidden" name="s${SeqNum}_folders" value="$Encoder.attributeEscape($name)"/> #end $Encoder.bodyEscape($EXCEPTION) </td> @@ -70,11 +70,11 @@ limitations under the License. <tr class="oddformrow"> #end <td class="formcolumncell"> - <input type="hidden" name="findop_$k" value=""/> - <input type="hidden" name="findname_$k" value="$Encoder.attributeEscape($match.get('name'))"/> - <input type="hidden" name="findvalue_$k" value="$Encoder.attributeEscape($match.get('value'))"/> - <a name="find_$k"> - <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.Delete'))" onClick='Javascript:FindDelete("$k")' alt="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.DeleteMatchNumber'))$k"/> + <input type="hidden" name="s${SeqNum}_findop_$k" value=""/> + <input type="hidden" name="s${SeqNum}_findname_$k" value="$Encoder.attributeEscape($match.get('name'))"/> + <input type="hidden" name="s${SeqNum}_findvalue_$k" value="$Encoder.attributeEscape($match.get('value'))"/> + <a name="s${SeqNum}_find_$k"> + <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.Delete'))" onClick='Javascript:s${SeqNum}_FindDelete("$k")' alt="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.DeleteMatchNumber'))$k"/> </a> </td> <td class="formcolumncell"> @@ -100,15 +100,15 @@ limitations under the License. <tr class="formrow"> <td class="formcolumncell"> <nobr> - <a name="find_$k"> - <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.Add'))" onClick='Javascript:FindAdd("$nextk")' alt="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.AddNewMatch'))"/> - <input type="hidden" name="findcount" value="$k"/> - <input type="hidden" name="findop" value=""/> + <a name="s${SeqNum}_find_$k"> + <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.Add'))" onClick='Javascript:s${SeqNum}_FindAdd("$nextk")' alt="$Encoder.attributeEscape($ResourceBundle.getString('EmailConnector.AddNewMatch'))"/> + <input type="hidden" name="s${SeqNum}_findcount" value="$k"/> + <input type="hidden" name="s${SeqNum}_findop" value=""/> </a> </nobr> </td> <td class="formcolumncell"> - <select name="findname"> + <select name="s${SeqNum}_findname"> <option value="" selected="true">$Encoder.bodyEscape($ResourceBundle.getString('EmailConnector.SelectMetadataName'))</option> #foreach($name in $SEARCHABLEATTRIBUTES) <option value="$Encoder.attributeEscape($name)">$Encoder.bodyEscape($name)</option> @@ -116,7 +116,7 @@ limitations under the License. </select> </td> <td class="formcolumncell"> - <nobr><input type="text" size="32" name="findvalue" value=""/></nobr> + <nobr><input type="text" size="32" name="s${SeqNum}_findvalue" value=""/></nobr> </td> </tr> @@ -128,18 +128,18 @@ limitations under the License. #else #foreach($name in $FOLDERS) -<input type="hidden" name="folders" value="$Encoder.attributeEscape($name)"/> +<input type="hidden" name="s${SeqNum}_folders" value="$Encoder.attributeEscape($name)"/> #end #set($k = 0) #foreach($match in $MATCHES) -<input type="hidden" name="findname_$k" value="$Encoder.attributeEscape($match.get('name'))"/> -<input type="hidden" name="findvalue_$k" value="$Encoder.attributeEscape($match.get('value'))"/> +<input type="hidden" name="s${SeqNum}_findname_$k" value="$Encoder.attributeEscape($match.get('name'))"/> +<input type="hidden" name="s${SeqNum}_findvalue_$k" value="$Encoder.attributeEscape($match.get('value'))"/> #set($k = $k + 1) #end -<input type="hidden" name="findcount" value="$k"/> +<input type="hidden" name="s${SeqNum}_findcount" value="$k"/> #end Modified: manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Metadata.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Metadata.html?rev=1626026&r1=1626025&r2=1626026&view=diff ============================================================================== --- manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Metadata.html (original) +++ manifoldcf/branches/dev_1x/connectors/email/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/email/Specification_Metadata.html Thu Sep 18 16:56:59 2014 @@ -15,7 +15,7 @@ See the License for the specific languag limitations under the License. --> -#if($TabName == $ResourceBundle.getString('EmailConnector.Metadata')) +#if($TabName == $ResourceBundle.getString('EmailConnector.Metadata') && ${SeqNum} == ${SelectedNum}) <table class="displaytable"> <tr><td class="separator" colspan="2"><hr/></td></tr> @@ -24,9 +24,9 @@ limitations under the License. <td class="value"> #foreach($metadataattribute in $METADATAATTRIBUTES) #if($METADATASELECTIONS.contains($metadataattribute)) - <input type="checkbox" name="metadata" value="$Encoder.attributeEscape($metadataattribute)" checked="true"/> + <input type="checkbox" name="s${SeqNum}_metadata" value="$Encoder.attributeEscape($metadataattribute)" checked="true"/> #else - <input type="checkbox" name="metadata" value="$Encoder.attributeEscape($metadataattribute)"/> + <input type="checkbox" name="s${SeqNum}_metadata" value="$Encoder.attributeEscape($metadataattribute)"/> #end <nobr>$Encoder.bodyEscape($metadataattribute)</nobr><br/> #end @@ -38,7 +38,7 @@ limitations under the License. #else #foreach($metadataselection in $METADATASELECTIONS) -<input type="hidden" name="metadata" value="$Encoder.attributeEscape($metadataselection)"/> +<input type="hidden" name="s${SeqNum}_metadata" value="$Encoder.attributeEscape($metadataselection)"/> #end #end
