manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1601859 - in /manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main: java/org/apache/manifoldcf/agents/transformation/forcedmetadata/ resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/
Date Wed, 11 Jun 2014 11:33:27 GMT
Author: kwright
Date: Wed Jun 11 11:33:26 2014
New Revision: 1601859

URL: http://svn.apache.org/r1601859
Log:
Add post method

Modified:
    manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/java/org/apache/manifoldcf/agents/transformation/forcedmetadata/ForcedMetadataConnector.java
    manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification.js
    manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification_ForcedMetadata.html

Modified: manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/java/org/apache/manifoldcf/agents/transformation/forcedmetadata/ForcedMetadataConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/java/org/apache/manifoldcf/agents/transformation/forcedmetadata/ForcedMetadataConnector.java?rev=1601859&r1=1601858&r2=1601859&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/java/org/apache/manifoldcf/agents/transformation/forcedmetadata/ForcedMetadataConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/java/org/apache/manifoldcf/agents/transformation/forcedmetadata/ForcedMetadataConnector.java
Wed Jun 11 11:33:26 2014
@@ -163,7 +163,7 @@ public class ForcedMetadataConnector ext
   */
   public String getFormCheckJavascriptMethodName(int connectionSequenceNumber)
   {
-    return "checkSpecification_"+connectionSequenceNumber;
+    return "s"+connectionSequenceNumber+"_checkSpecification";
   }
 
   /** Obtain the name of the form presave check javascript method to call.
@@ -172,7 +172,7 @@ public class ForcedMetadataConnector ext
   */
   public String getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
   {
-    return "checkSpecificationForSave_"+connectionSequenceNumber;
+    return "s"+connectionSequenceNumber+"_checkSpecificationForSave";
   }
 
   /** Output the specification header section.
@@ -239,7 +239,46 @@ public class ForcedMetadataConnector ext
     throws ManifoldCFException
   {
     // Process specification post
-    // MHL
+    String prefix = "s"+connectionSequenceNumber+"_";
+    String forcedCount = variableContext.getParameter(prefix+"forcedmetadata_count");
+    if (forcedCount != null)
+    {
+      int count = Integer.parseInt(forcedCount);
+      // Delete old spec data
+      int i = 0;
+      while (i < os.getChildCount())
+      {
+        SpecificationNode cn = os.getChild(i);
+        if (cn.getType().equals(NODE_PAIR))
+          os.removeChild(i);
+        else
+          i++;
+      }
+      // Now, go through form data
+      for (int j = 0; j < count; j++)
+      {
+        String op = variableContext.getParameter(prefix+"forcedmetadata_"+j+"_op");
+        if (op != null && op.equals("Delete"))
+          continue;
+        String paramName = variableContext.getParameter(prefix+"forcedmetadata_"+j+"_name");
+        String paramValue = variableContext.getParameter(prefix+"forcedmetadata_"+j+"_value");
+        SpecificationNode sn = new SpecificationNode(NODE_PAIR);
+        sn.setAttribute(ATTR_PARAMETER,paramName);
+        sn.setAttribute(ATTR_VALUE,paramValue);
+        os.addChild(os.getChildCount(),sn);
+      }
+      // Look for add operation
+      String addOp = variableContext.getParameter(prefix+"forcedmetadata_op");
+      if (addOp != null && addOp.equals("Add"))
+      {
+        String paramName = variableContext.getParameter(prefix+"forcedmetadata_name");
+        String paramValue = variableContext.getParameter(prefix+"forcedmetadata_value");
+        SpecificationNode sn = new SpecificationNode(NODE_PAIR);
+        sn.setAttribute(ATTR_PARAMETER,paramName);
+        sn.setAttribute(ATTR_VALUE,paramValue);
+        os.addChild(os.getChildCount(),sn);
+      }
+    }
     return null;
   }
   

Modified: manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification.js
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification.js?rev=1601859&r1=1601858&r2=1601859&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification.js
(original)
+++ manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification.js
Wed Jun 11 11:33:26 2014
@@ -18,33 +18,33 @@
 <script type="text/javascript">
 <!--
 
-function AddForcedMetadata_$SeqNum()
+function s$SeqNum_AddForcedMetadata()
 {
-  if (editjob.forcedmetadata_$SeqNum_name.value == "")
+  if (editjob.s$SeqNum_forcedmetadata_name.value == "")
   {
     alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('ForcedMetadata.ForcedMetadataNameMustNotBeNull'))");
-    editjob.forcedmetadata_$SeqNum_name.focus();
+    editjob.s$SeqNum_forcedmetadata_name.focus();
     return;
   }
-  document.editjob.forcedmetadata_$SeqNum_op.value="Add";
-  postFormSetAnchor("forcedmetadata_$SeqNum_tag");
+  document.editjob.s$SeqNum_forcedmetadata_op.value="Add";
+  postFormSetAnchor("s$SeqNum_forcedmetadata_tag");
 }
 	
-function DeleteForcedMetadata_$SeqNum(n)
+function s$SeqNum_DeleteForcedMetadata(n)
 {
-  eval("document.editjob.forcedmetadata_$SeqNum_"+n+"_op.value = 'Delete'");
+  eval("document.editjob.s$SeqNum_forcedmetadata_"+n+"_op.value = 'Delete'");
   if (n == 0)
-    postFormSetAnchor("forcedmetadata_$SeqNum_tag");
+    postFormSetAnchor("s$SeqNum_forcedmetadata_tag");
   else
-    postFormSetAnchor("forcedmetadata_$SeqNum_"+(n-1)+"_tag");
+    postFormSetAnchor("s$SeqNum_forcedmetadata_"+(n-1)+"_tag");
 }
 
-function checkSpecificationForSave_$SeqNum()
+function s$SeqNum_checkSpecificationForSave()
 {
   return true;
 }
 
-function checkSpecification_$SeqNum()
+function s$SeqNum_checkSpecification()
 {
   return true;
 }

Modified: manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification_ForcedMetadata.html
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification_ForcedMetadata.html?rev=1601859&r1=1601858&r2=1601859&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification_ForcedMetadata.html
(original)
+++ manifoldcf/branches/CONNECTORS-961/connectors/forcedmetadata/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/forcedmetadata/editSpecification_ForcedMetadata.html
Wed Jun 11 11:33:26 2014
@@ -38,11 +38,11 @@
         <tr class="oddformrow">
     #end
           <td class="formcolumncell">
-            <a name="forcedmetadata_$SeqNum_$paramcounter_tag"/>
+            <a name="s$SeqNum_forcedmetadata_$paramcounter_tag"/>
             <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('ForcedMetadata.Delete'))"
alt="$Encoder.attributeEscape($ResourceBundle.getString('ForcedMetadata.Deleteforcedmetadatanumber'))$paramcounter"
onclick='javascript:DeleteForcedMetadata_$SeqNum("$paramcounter");'/>
-            <input type="hidden" name="forcedmetadata_$SeqNum_$paramcounter_op" value="Continue"/>
-            <input type="hidden" name="forcedmetadata_$SeqNum_$paramcounter_name" value="$Encoder.attributeEscape($paramrecord.get('parameter')"/>
-            <input type="hidden" name="forcedmetadata_$SeqNum_$paramcounter_value" value="$Encoder.attributeEscape($paramrecord.get('value')"/>
+            <input type="hidden" name="s$SeqNum_forcedmetadata_$paramcounter_op" value="Continue"/>
+            <input type="hidden" name="s$SeqNum_forcedmetadata_$paramcounter_name" value="$Encoder.attributeEscape($paramrecord.get('parameter')"/>
+            <input type="hidden" name="s$SeqNum_forcedmetadata_$paramcounter_value" value="$Encoder.attributeEscape($paramrecord.get('value')"/>
           </td>
           <td class="formcolumncell">
             <nobr>$Encoder.bodyEscape($paramrecord.get('parameter'))</nobr>
@@ -59,16 +59,16 @@
         <tr class="formrow"><td colspan="3" class="formseparator"><hr/></td></tr>
         <tr class="formrow">
           <td class="formcolumncell">
-            <a name="forcedmetadata_$SeqNum_tag"/>
-            <input type="hidden" name="forcedmetadata_$SeqNum_op" value="Continue"/>
+            <a name="s$SeqNum_forcedmetadata_tag"/>
+            <input type="hidden" name="s$SeqNum_forcedmetadata_op" value="Continue"/>
             <input type="button" value="$Encoder.attributeEscape($ResourceBundle.getString('ForcedMetadata.Add'))"
alt="$Encoder.attributeEscape($ResourceBundle.getString('ForcedMetadata.Addforcedmetadata'))"
onclick="javascript:AddForcedMetadata();"/>
-            <input type="hidden" name="forcedmetadata_$SeqNum_count" value="$paramcounter"/>
+            <input type="hidden" name="s$SeqNum_forcedmetadata_count" value="$paramcounter"/>
           </td>
           <td class="formcolumncell">
-            <input type="text" name="forcedmetadata_$SeqNum_name" size="30" value=""/>
+            <input type="text" name="s$SeqNum_forcedmetadata_name" size="30" value=""/>
           </td>
           <td class="formcolumncell">
-            <input type="text" name="forcedmetadata_$SeqNum_value" size="30" value=""/>
+            <input type="text" name="s$SeqNum_forcedmetadata_value" size="30" value=""/>
           </td>
         </tr>
       </table>
@@ -80,9 +80,9 @@
 
   #set($paramcounter = 0)
   #foreach($paramrecord in $Parameters)
-<input type="hidden" name="forcedmetadata_$SeqNum_$paramcounter_name" value="$Encoder.attributeEscape($paramrecord.get('parameter'))"
/>
-<input type="hidden" name="forcedmetadata_$SeqNum_$paramcounter_value" value="$Encoder.attributeEscape($paramrecord.get('value'))"
/>
+<input type="hidden" name="s$SeqNum_forcedmetadata_$paramcounter_name" value="$Encoder.attributeEscape($paramrecord.get('parameter'))"
/>
+<input type="hidden" name="s$SeqNum_forcedmetadata_$paramcounter_value" value="$Encoder.attributeEscape($paramrecord.get('value'))"
/>
   #end
-<input type="hidden" name="forcedmetadata_$SeqNum_count" value="$paramcounter"/>
+<input type="hidden" name="s$SeqNum_forcedmetadata_count" value="$paramcounter"/>
 
 #end



Mime
View raw message