Mohana Ramaratnam avatar Mohana Ramaratnam committed da41e0b

added capability to handle checkboxes

Comments (0)

Files changed (2)

plugin-resources/webapp/xnat-templates/screens/PipelineScreen_default_launcher.vm

 	<TR>
 	  <TD><input type="hidden"  id=${dblQts}param[$c].name$dblQts name=${dblQts}param[$c].name$dblQts value="$param.getName()"/><font size="-1">$param.getName()</font></TD> 
 	   #if ($param.getValues().isSetUnique())	
-	   <TD><input type="text" id=${dblQts}param[$c].value$dblQts  name=${dblQts}param[$c].value$dblQts value="$param.getValues().getUnique()"/></TD>
+	   <TD><input type="text" id=${dblQts}param[$c][0].value$dblQts  name=${dblQts}param[$c][0].value$dblQts value="$param.getValues().getUnique()"/></TD>
+	     <input type="hidden"  id=${dblQts}param[$c].name.rowcount$dblQts name=${dblQts}param[$c].name.rowcount$dblQts value="1"/>
 	  #else
-	   <td> 
+	   <td>
+	     #set ($x = 0)
 	     #foreach ($val in $param.getValues().getListArray())	
-	  	<input type="checkbox" id=${dblQts}param[$c].value$dblQts name=${dblQts}param[$c].value$dblQts value="$val"/>$val
+	  	<input type="checkbox" id=${dblQts}param[$c][$x].value$dblQts name=${dblQts}param[$c][$x].value$dblQts value="$val"/>$val
+	  	#set ($x = $x +1)
 	     #end
+	     <input type="hidden"  id=${dblQts}param[$c].name.rowcount$dblQts name=${dblQts}param[$c].name.rowcount$dblQts value="$x"/>
 	  </TD>
 	  #end
 	</tr>
 	#set ($c = $c + 1)
 	#end
+
 </TABLE>
 
 

plugin-resources/webapp/xnat/java/org/nrg/xnat/turbine/modules/actions/ManagePipeline.java

 
 import java.io.File;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Hashtable;
 
 		int totalParams = data.getParameters().getInt("param_cnt");
 		for (int i =0; i < totalParams; i++) {
 			String name = data.getParameters().get("param[" + i + "].name");
-			String value = data.getParameters().get("param[" + i + "].value");
-			ParameterData param = parameters.addNewParameter();
-			param.setName(name);
-			Values values = param.addNewValues();
-			values.setUnique(value);
+			int rowcount = new Integer(data.getParameters().get("param[" + i + "].name.rowcount")).intValue();
+			ArrayList<String> formvalues = new ArrayList<String>();
+			if (rowcount == 1) {
+				String value = data.getParameters().get("param[" + i + "][0].value");
+				formvalues.add(value);
+			}else if (rowcount>1) {
+				for (int j=0; j < rowcount; j++) {
+					String formfieldname = "param[" + i + "][" + j + "].value";
+					if (TurbineUtils.HasPassedParameter(formfieldname,data))
+					   formvalues.add(data.getParameters().get(formfieldname));
+				}
+			}
+			if (formvalues.size()>0) {
+				ParameterData param = parameters.addNewParameter();
+				param.setName(name);
+				if (formvalues.size()==1) {
+					Values values = param.addNewValues();
+					values.setUnique(formvalues.get(0));
+				}else {
+					Values values = param.addNewValues();
+					for (int k=0; k<rowcount; k++) {
+						values.addList(formvalues.get(k));
+					}
+				}
+			}
 		}
 		return parameters;
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.