Commits

Anonymous committed 7fb5752 Merge

Download DicomDIR user interface

Comments (0)

Files changed (56)

plugin-resources/project-skeletons/xnat/src/schemas/xnat/display/xnat_projectData_display.xml

 	</DisplayField>
 	<DisplayField id="NAME_CSV" header="Title" visible="true" searchable="true">
 		<DisplayFieldElement name="Field1" schema-element="xnat:projectData/name"/>
+		<HTML-Link>
+			<Property name="HREF" value="@WEBAPPapp/action/DisplayItemAction/search_value/@Field1/search_element/xnat:projectData/search_field/xnat:projectData.ID">
+				<InsertValue id="Field1" field="ID"/>
+			</Property>
+			<Property name="ONCLICK" value="return rpt('@Field1','xnat:projectData','xnat:projectData.ID');">
+				<InsertValue id="Field1" field="ID"/>
+			</Property>
+		</HTML-Link>
 	</DisplayField>
 	<DisplayField id="DESCRIPTION" header="Description" visible="true" searchable="true">
 		<DisplayFieldElement name="Field1" schema-element="xnat:projectData/description"/>

plugin-resources/project-skeletons/xnat/src/schemas/xnat/xnat.xsd

 					</xs:element>
 					<xs:element name="educationDesc" type="xs:string" minOccurs="0"/>
 					<xs:element name="race" type="xs:string" minOccurs="0"/>
+					<xs:element name="race2" type="xs:string" minOccurs="0"/>
+					<xs:element name="race3" type="xs:string" minOccurs="0"/>
+					<xs:element name="race4" type="xs:string" minOccurs="0"/>
+					<xs:element name="race5" type="xs:string" minOccurs="0"/>
+					<xs:element name="race6" type="xs:string" minOccurs="0"/>
 					<xs:element name="ethnicity" type="xs:string" minOccurs="0"/>
 					<xs:element name="weight" minOccurs="0">
 						<xs:complexType>
 					<xs:element name="start_time_injection" type="xs:dateTime" minOccurs="0"/>
 					<xs:element name="blood_glucose" type="xs:float" minOccurs="0"/>
 					<xs:element name="blood_glucose_units" type="xs:string" minOccurs="0"/>
+					<xs:element name="blood_glucose_collection_time" type="xs:dateTime" minOccurs="0"/>
 				</xs:sequence>
 			</xs:extension>
 		</xs:complexContent>

plugin-resources/repository/dcm/jars/DicomUtils-1.0.jar

Binary file modified.

plugin-resources/repository/xdat/jars/xdat-1.jar

Binary file modified.

plugin-resources/webapp/xdat-templates/macros/TurbineMacros.vm

     #end
 #end
 
-
 #macro (xdatPKDisplay $name $item)
 	<input id="$name" type="hidden" name="$name" value="$item.getStringProperty($name)"/>
 	$item.getProperty($name)
 	#end
 #end
 
+#macro (xdatBooleanCheckbox $name $item $vr)
+#if ($vr)
+	#if($vr.getField($name))
+		<font color="red">&#8658</font>
+	#end
+#end
+	#set($value = $!item.getBooleanProperty($name))
+
+	## The hidden box is necessary to submit a "false" value if the checkbox is unchecked
+	## If the checkbox is checked, its true value will override the hidden's "false" value
+	<input type="checkbox" name="$name" value="1" #if($value) CHECKED #end />
+	<input type="hidden" name="$name" value="0" />`
+#end
+
 #macro (xdatBooleanRadio $name $item $defaultValue $vr)
 #if ($vr)
 	#if($vr.getField($name))
 	#end
 #end
 
+#macro (xdatBooleanRadioYesNoWithoutDefault $name $item $vr)
+#if ($vr)
+	#if($vr.getField($name))
+		<font color="red">&#8658</font>
+	#end
+#end
+	#set($value = "$!item.getBooleanProperty($name)")
+
+	#if ($value == "true")
+	<input type="radio" name="$name" value="1" CHECKED/>&nbsp;yes
+	<input type="radio" name="$name" value="0"/>&nbsp;no
+	#elseif ($value == "false")
+	<input type="radio" name="$name" value="1"/>&nbsp;yes
+	<input type="radio" name="$name" value="0" CHECKED/>&nbsp;no
+	#else
+	<input type="radio" name="$name" value="1"/>&nbsp;yes
+	<input type="radio" name="$name" value="0"/>&nbsp;no
+	#end
+#end
+
+#macro (xdatRadioButtonGroup $name $item $possibleValues $vr)
+#if ($vr)
+	#if($vr.getField($name))
+		<font color="red">&#8658</font>
+	#end
+#end
+	#if($item.isPKField($name) && (!$vr.getField($name)))
+		<input ID="$name" type="hidden" name="$name" value="$item.getProperty($name)"/>
+		$item.getProperty($name)
+	#else
+		#if ($possibleValues.size()==0)
+			<input ID="$name" type="text" name="$name" value="$item.getProperty($name)"/>
+		#else
+			#foreach ($pValue in $possibleValues)
+			<input type="radio" name="$name" VALUE="$pValue" #if($pValue.equals($item.getProperty($name))) CHECKED #end />&nbsp;$pValue
+			#end
+		#end
+	#end
+#end
 
 #macro (xdatComboBox $name $item $settings_alias $vr)
  #if ($vr)
 	#end
 #end
 
+#macro (xdatSimpleSelectBox $name $item $possibleValues $vr)
+#if ($vr)
+	#if($vr.getField($name))
+		<font color="red">&#8658</font>
+	#end
+#end
+	#if($item.isPKField($name) && (!$vr.getField($name)))
+		<input ID="$name" type="hidden" name="$name" value="$item.getProperty($name)"/>
+		$item.getProperty($name)
+	#else
+		#if ($possibleValues.size()==0)
+			<input ID="$name" type="text" name="$name" value="$item.getProperty($name)"/>
+		#else
+			<SELECT ID="$name" name="$name">
+				<OPTION VALUE="">(SELECT)</OPTION>
+				#foreach ($pValue in $possibleValues)
+				<OPTION VALUE="$pValue" #if($pValue.equals($item.getProperty($name))) SELECTED #end>$pValue</OPTION>
+				#end
+			</SELECT>
+		#end
+	#end
+#end
+
 #macro (xdatDateBox $name $item $vr $years)
  #if ($vr)
 	  #if($vr.getField($name))
  <!-- no object found -->
  #end
 #end
+
+#macro(escapeHTML $s)
+$!turbineUtils.escapeHTML($s)
+#end
+ 
+#macro(escapeJS $s)
+$!turbineUtils.escapeJS($s)
+#end

plugin-resources/webapp/xdat-templates/screens/Login.vm

         <font face="$ui.sansSerifFonts">
         #foreach($key in $data.getParameters().getKeys())
         	#if ($key!="action" && $key!="template" &&$key!="password" &&$key!="username" &&$key!="exception")
-        	<input type="hidden" name="$key" value="$turbineUtils.escapeHTML($data.getParameters().getString($key))">	
+        	<input type="hidden" name="$key" value="$!turbineUtils.escapeHTML($!data.getParameters().getString($key))">		
         	#end
         #end
           <input type="submit" value="Login">

plugin-resources/webapp/xdat-templates/screens/Register.vm

 <form name="form2" id="registerForm" method="post" action="$link.setAction("XDATRegisterUser")" onSubmit="return XNAT.app.register.validateForm();">
 		#foreach($key in $data.getParameters().getKeys())
         	#if ($key!="action" && $key!="template" &&$key!="password" &&$key!="phone" &&$key!="comments" &&!$key.startsWith("xdat:user") &&$key!="username" &&$key!="exception")
-   		<input type="hidden" name="$key" value="$turbineUtils.escapeHTML($data.getParameters().getString($key))">	
+   		<input type="hidden" name="$key" value="$!turbineUtils.escapeHTML($!data.getParameters().getString($key))">	
         	#end
         #end
   <table valign="top" align="center">

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

   </table>
         #foreach($key in $data.getParameters().getKeys())
         	#if ($key!="action" && $key!="template" &&$key!="password" &&!$key.startsWith("xdat:user") &&$key!="username" &&$key!="exception")
-        		<input type="hidden" name="$key" value="$turbineUtils.escapeHTML($data.getParameters().getString($key))">	
+        		<input type="hidden" name="$key" value="$!turbineUtils.escapeHTML($!data.getParameters().getString($key))">	
         	#end
         #end
 </form>

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

+<script type="text/javascript" src="$content.getURI("scripts/java/deployJava.js")"></script>
+<script type="text/javascript">
+// The upload applet requires at least Java 1.5 (because of the wizard library).
+// We use Java's deployJava.js (http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html)
+// to ensure that a supported version of the JRE exists on the client.
+// Use an anonymous function to prevent global scope
+(function() {
+    SUPPORTED_JRE_VERSIONS = ["1.5", "1.6", "1.7"];
+    
+    function hasSupport(versions) {
+        for (var i=0; i < versions.length; i++) {
+            if (deployJava.versionCheck(versions[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    if (!hasSupport(SUPPORTED_JRE_VERSIONS)) {
+        alert("Applet will not work without supported JRE version.  Requires one of " + SUPPORTED_JRE_VERSIONS.join(", "));
+    }
+})();
+</script>
+
 <APPLET CODE="org.nrg.upload.ui.UploadAssistantApplet"
   CODEBASE="$content.getURI("applet/")"
   ARCHIVE="UploadAssistant-0.1-SNAPSHOT.jar,wizard-0.998.2-SNAPSHOT.jar,json-20080701.jar,DicomUtils-1.0.jar,DicomEdit-1.2-SNAPSHOT.jar,dcm4che-core-2.0.22-SNAPSHOT.jar,dcm4che-net-2.0.22-SNAPSHOT.jar,log4j-1.2.15.jar,slf4j-api-1.5.2.jar,slf4j-log4j12-1.5.2.jar,antlr-runtime-3.2.jar,stringtemplate-3.2.jar,ecat-io-0.1-SNAPSHOT.jar,ecat-edit-0.1-SNAPSHOT.jar"

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

   </table>
         #foreach($key in $data.getParameters().getKeys())
         	#if ($key!="action" && $key!="template" &&$key!="password" &&!$key.startsWith("xdat:user") &&$key!="username" &&$key!="exception")
-        	<input type="hidden" name="$key" value="$turbineUtils.escapeHTML($data.getParameters().getString($key))">	
+        	<input type="hidden" name="$key" value="$!turbineUtils.escapeHTML($!data.getParameters().getString($key))">	
         	#end
         #end
 </form>

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

 			#foreach ($parameter in $parameters)
 			<TR>
 			  <TD><input type="hidden"  id=$dblQts${schemaType}.parameters.parameter[$c].name$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].name$dblQts value="$parameter.getName()"/><font size="-1">$parameter.getName()</font>
-			<a href="#" style="outline: none;" onclick="return !showPopup('desc$c', event);">(?)</a>
 			</TD> 
-			   <td>	
-			  <input type="text" size="45" id=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts value="$!parameter.getSchemalink()"/>
-			  </td>
+			  <input type="hidden" size="45" id=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts value="$!parameter.getSchemalink()"/>
+			  #if ($!parameter.getCsvvalues())
 			  <TD><input type="text" size="45" id=$dblQts${schemaType}.parameters.parameter[$c].csvValues$dblQts  name=$dblQts${schemaType}.parameters.parameter[$c].csvValues$dblQts value="$!parameter.getCsvvalues()"/></TD>
+			  #else 
+			  <TD>$!parameter.getSchemalink() </TD>
+			 #end	
+			 <TD> <a href="#" style="outline: none;" onclick="return !showPopup('desc$c', event);">Help</a> </TD>
 			</tr>
 		<input type="hidden" id=$dblQts${schemaType}.parameters.parameter[$c].description$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].description$dblQts value="$!parameter.getDescription()"/>
 	#set ($c = $c + 1)

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-templates/screens/XDATScreen_download_dicomdir.vm

+<SCRIPT language="javascript">
+function toggleAll(check,names) {
+  for(var j=0;j<names.length;j++){
+    var allScans = document.getElementsByName(names[j]);
+    for (var i=0;i<allScans.length;i++){
+      allScans[i].checked=check.checked;
+    }
+  }
+}
+
+function validateForm(){ 
+   var typeSelected = false;
+   var scans = document.getElementsByName("scans");
+   for (var i=0;i<scans.length;i++){
+      if (scans[i].checked){
+        typeSelected=true;
+      }
+   }
+   if (!typeSelected){
+      alert("Please select at least one scan.");
+      return false;
+   }
+   return true;
+}
+
+function remove_last_char(s){
+  if (s.length > 1) {
+     return s.substring(0,s.length-1);
+  }
+  else {
+     return s;
+  }
+}
+
+function build_comma_delimited(items) {
+    var comma_delimited = ""
+    var num_items = items.length;
+    for (var i=0;i<num_items;i++) {
+	if (items[i].checked) {			  
+        comma_delimited = comma_delimited + items[i].value + ",";
+        }
+    }
+    return remove_last_char(comma_delimited);
+}
+
+function buildDicomDir () {
+  if (this.validateForm()) {
+    var label = document.getElementById("label").value;
+    var project = document.getElementById("project").value;
+    var subject = document.getElementById("subject").value;
+    var comma_delimited_scans = build_comma_delimited(document.getElementsByName("scans"));
+    var pathname = serverRoot + "/" + "REST/projects/" + project + "/subjects/" + subject + "/experiments/" + label + "/scans/" + comma_delimited_scans + "/DICOMDIR";
+    window.location.pathname = pathname;			  
+  }
+}
+</SCRIPT>
+
+<FORM name="downloadForm" ACTION="">
+  <DIV class="edit_header1">Dicom DIR Download</DIV>
+  <DIV class="spacer">&nbsp;</DIV>
+  <TABLE border="0">
+    <TR>
+      <TD><DIV class="edit_header2">Select scans to download</DIV></TD>
+      <TD></TD>
+      <INPUT type="hidden" value=$om.getLabel() id="label">
+      <INPUT type="hidden" value=$om.getProject() id="project">
+      <INPUT type="hidden" value=$om.getSubjectId() id="subject">
+    <TR>
+      <TD VALIGN="top" class="withColor" style="border: 1px solid grey;" ROWSPAN="4">
+	<DIV ID="dataTable" style="dispay:none">
+	  <DIV STYLE="overflow:auto;height:300px;width:300px;">
+	    <TABLE border="0" ID="subTable" cellspacing="0">
+	      <TR class="">
+		<TD ><INPUT type="checkbox" value="" ONCLICK="toggleAll(this,['scans']);" ID="toggleAllScans" /></TD>
+		<TD NOWRAP colspan="2"><label for="toggleAllScans">Toggle All ($om.getSortedScans().size())</label></TD>
+	      </TR>
+	      #set($rowColor="even")
+	      #foreach($scan in $om.getSortedScans())
+	           <TR class="$rowColor">
+	           	<TD></TD>
+	           	<TD ><INPUT type="checkbox" value="$scan.getId()" name="scans"/></TD>
+	           #if($scan.getType())	
+  	           	<TD NOWRAP>$!scan.getId() : $!scan.getType()</TD>
+                   #else
+	           	<TD NOWRAP>$!scan.getId() : Unassigned</TD>
+                   #end
+	           </TR>
+	           #if($rowColor=="even")
+	           #set($rowColor="")
+	           #else
+	           #set($rowColor="even")
+	           #end
+	      #end
+	    </TABLE>
+	  </DIV>
+	</DIV>
+      </TD>
+    </TR>
+  </TABLE>
+  <br>
+  <br>
+  <DIV class="edit_header2">Submit Data Request</DIV>
+  <input type="button" value="Submit" onClick="buildDicomDir()"/>
+</FORM>

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

       <td align ="left">
         <font face="$ui.sansSerifFonts">
         #foreach($key in $data.getParameters().getKeys())
-        	#if ($key!="action" && $key!="template" &&$key!="password" &&!$key.startsWith("xdat:user") &&$key!="username" &&$key!="exception" &&$key!="username" &&$key!="exception")
-        		<input type="hidden" name="$key" value="$turbineUtils.escapeHTML($data.getParameters().getString($key))">	
-        	#end
+          	#if ($key!="action" && $key!="template" &&$key!="password" &&!$key.startsWith("xdat:user") &&$key!="username" &&$key!="exception" &&$key!="username" &&$key!="exception")
+            		<input type="hidden" name="$key" value="$!turbineUtils.escapeHTML($!data.getParameters().getString($key))">	
+          	#end
         #end
           <input type="submit" value="Login">
         </font>
       </td>
     </tr>
    </table>
-</form>
+</form>

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

         <font face="$ui.sansSerifFonts">
         #foreach($key in $data.getParameters().getKeys())
         	#if ($key!="action" && $key!="template" &&$key!="password" &&$key!="username" &&$key!="exception")
-        	<input type="hidden" name="$key" value="$turbineUtils.escapeHTML($data.getParameters().getString($key))">	
+        	<input type="hidden" name="$key" value="$!turbineUtils.escapeHTML($!data.getParameters().getString($key))">	
         	#end
         #end
           <input type="submit" value="Login">
       </td>
     </tr>
    </table>
-</form>
+</form>

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

         <input type="hidden" name="xdat:user.primary_password.encrypt" value="true">
         #foreach($key in $data.getParameters().getKeys())
         	#if ($key!="action" && $key!="template" &&$key!="password" &&!$key.startsWith("xdat:user") &&$key!="username" &&$key!="exception")
-        		<input type="hidden" name="$key" value="$turbineUtils.escapeHTML($data.getParameters().getString($key))">	
+        		<input type="hidden" name="$key" value="$!turbineUtils.escapeHTML($!data.getParameters().getString($key))">	
         	#end
         #end
-              </form>
+              </form>

plugin-resources/webapp/xnat-templates/screens/xnat_mrSessionData/edit/scans.vm

 	  #foreach($scani in [0..$TOP_SCAN])
     #set($scan=$om.getSortedScans().get($scani))
     var tempScan = window.classMapping.newInstance("$!scan.getXSIType()");
-    tempScan.setProperty("ID","$!scan.getId()");
-    tempScan.setProperty("type","$!scan.getType()");
-    tempScan.setProperty("quality","$!scan.getQuality()");
-    tempScan.setProperty("note","$!scan.getNote()");
-    tempScan.setProperty("series_description","$!scan.getSeriesDescription()");
-    tempScan.setProperty("parameters/scanTime","$!scan.getParameters_scantime()");
-		    tempScan.setProperty("parameters/imageType","$!scan.getParameters_imagetype()");
-		    tempScan.setProperty("parameters/scanSequence","$!scan.getParameters_scansequence()");
-		    tempScan.setProperty("parameters/seqVariant","$!scan.getParameters_seqvariant()");
-		    tempScan.setProperty("parameters/scanOptions","$!scan.getParameters_scanoptions()");
-		    tempScan.setProperty("parameters/acqType","$!scan.getParameters_acqtype()");
-		    tempScan.setProperty("frames","$!scan.getFrames()");
-		    tempScan.setProperty("parameters/flip","$!scan.getParameters_flip()");
+    tempScan.setProperty("ID","$!turbineUtils.escapeJS($!scan.getId())"); 
+    tempScan.setProperty("type","$!turbineUtils.escapeJS($!scan.getType())");
+    tempScan.setProperty("quality","$!turbineUtils.escapeJS($!scan.getQuality())");
+    tempScan.setProperty("note","$!turbineUtils.escapeJS($!scan.getNote())");
+    tempScan.setProperty("series_description","$!turbineUtils.escapeJS($!scan.getSeriesDescription())");
+    tempScan.setProperty("parameters/scanTime","$!turbineUtils.escapeJS($!scan.getParameters_scantime())");
+		    tempScan.setProperty("parameters/imageType","$!turbineUtils.escapeJS($!scan.getParameters_imagetype())");
+		    tempScan.setProperty("parameters/scanSequence","$!turbineUtils.escapeJS($!scan.getParameters_scansequence())");
+		    tempScan.setProperty("parameters/seqVariant","$!turbineUtils.escapeJS($!scan.getParameters_seqvariant())");
+		    tempScan.setProperty("parameters/scanOptions","$!turbineUtils.escapeJS($!scan.getParameters_scanoptions())");
+		    tempScan.setProperty("parameters/acqType","$!turbineUtils.escapeJS($!scan.getParameters_acqtype())");
+		    tempScan.setProperty("frames","$!turbineUtils.escapeJS($!scan.getFrames())");
+		    tempScan.setProperty("parameters/flip","$!turbineUtils.escapeJS($!scan.getParameters_flip())");
     tempScan.stats="$!scanprops.get($scani).get("files") files, $!scanprops.get($scani).get("size") MB";
     tempScan.setProperty("xnat_imageScanData_id","$!scan.getProperty('xnat_imagescandata_id')");
     window.scanSet.scans.push(tempScan);
       }
    #end
   #end
-  
+   
   window.scanSet.onLoad.subscribe(function(obj){
     var listing=new scanListingEditor("scan_tbody",this);
     listing.render();

plugin-resources/webapp/xnat-templates/screens/xnat_petSessionData/xnat_petSessionData_keyFields.vm

 						#if($!item.getProperty("xnat:petSessionData/start_time_scan"))
 							<TR><TH align="left">Emission Scan Time</TH><TD>$!item.getProperty("xnat:petSessionData/start_time_scan")</TD></TR>
 							#end
+						
+						#if($!item.getProperty("xnat:petSessionData/blood_glucose"))
+							<TR><TH align="left">Blood Glucose Level</TH>
+								<TD>
+									$!item.getProperty("xnat:petSessionData/blood_glucose")&nbsp;
+									$!item.getProperty("xnat:petSessionData/blood_glucose_units")
+								</TD>
+							</TR>
+							#end
+						#if($!item.getProperty("xnat:petSessionData/blood_glucose_collection_time"))
+							<TR><TH align="left">Blood Glucose Collection Time</TH><TD>$!item.getProperty("xnat:petSessionData/blood_glucose_collection_time")</TD></TR>
+							#end
     </table>
    </span>
   </TD>

plugin-resources/webapp/xnat-templates/screens/xnat_subjectAssessorData/upload/xnat_subjectAssessorData_projSubj.vm

  <tr>
   <td align="left" colspan="3"><div style="color:red" id="subj_msg"></div></td>
  </tr>
- <tr>
-  <th align="left">Session</th>
-  <td><input type="text" id="$!item.getXSIType()/label" name="$!item.getXSIType()/label" value="$!item.getProperty("label")"  onkeyup="this.value=fixSessionID(this.value);verifyExptId(this);if(this.validated==false)confirmValues(false);" onblur="confirmValues(false);"/></td>
-  <td id="label_msg"></td>
- </tr>
+#parse($turbineUtils.getTemplateName("_session.vm",$om.getXSIType(),$project,"upload"))
 		<script type="text/javascript" LANGUAGE="javascript" src="$content.getURI('scripts/subjectAssessorData/proj_subj_selector.js')"></SCRIPT>
 <script type="text/javascript">
 var elementName="$!item.getXSIType()";

plugin-resources/webapp/xnat-templates/screens/xnat_subjectAssessorData/upload/xnat_subjectAssessorData_session.vm

+ <tr>
+  <th align="left">Session</th>
+  <td><input type="text" id="$!item.getXSIType()/label" name="$!item.getXSIType()/label" value="$!item.getProperty("label")"  onkeyup="this.value=fixSessionID(this.value);verifyExptId(this);if(this.validated==false)confirmValues(false);" onblur="confirmValues(false);"/></td>
+  <td id="label_msg"></td>
+ </tr>

plugin-resources/webapp/xnat-templates/screens/xnat_subjectData/xnat_subjectData_edit_keyFields.vm

 <DIV class="edit_header1">Demographics</DIV><BR>
 <table>
 	#parse("/screens/xnat_subjectData/xnat_subjectData_edit_core_demographics.vm")
-	#parse("/screens/xnat_subjectData/xnat_subjectData_edit_addtl_demographics.vm")
+	#parse($turbineUtils.getTemplateName("_edit_addtl_demographics","xnat:subjectData",$project))
 </table>
 		<script type="text/javascript">
 		function validateKeyFields(){

plugin-resources/webapp/xnat-templates/screens/xnat_subjectData/xnat_subjectData_report.vm

-#set ( $exptHeadings = ["Date", "Type", "ID", "Investigator" ] )
-		<style>
-DIV.container{
-	border: 1px solid #AAAAAA;
-    width:250px;  
-}
-DIV.containerTitle{
-			    border: 1px solid #AAAAAA;
-    padding:3px;
-    font-weight:500;
-	font-family:verdana,geneva,helvetica;
-}
-DIV.containerBody{
-    width:99%;
-    overflow:auto;
-    font-size:13px;
-    line-height:15px;
-    padding:3px;
-    
-		</style>
-<script type="text/javascript">  
-if(XNAT.app.subject==undefined)XNAT.app.subject=new Object(); 
-</script>
-<TABLE width="100%">
-	<TR>
-		<TD>
-			<table width="100%">				
-				<TR>
-					<TD align="left" valign="middle">
-<DIV class="edit_title">Subject Details: #if($!om.getIdentifier($project,true))$!om.getIdentifier($project,true)#elseif($om.getLabel())$!om.getLabel()#else$!om.getId()#end</DIV>
-					</TD>
-				</TR>
-			</TABLE>
-		</TD>
-	</TR>
-	<TR>
-		<TD>
-			<TABLE width="100%">
-				<TR>
-					<TD valign="top">
-		<!--BEGIN SUBJECT SUMMARY TABS -->
-<STYLE>
-span.spacer{
-height:12px;
-width:1px;
-}
-</STYLE>
-<div ID="subject_summary_module" style="display:none">
- <DIV id="subjectSummary" class="yui-navset">
-  <ul class="yui-nav" style="">
-      <li class="selected"><a href="#tab1"><em>Details<span class="spacer"></span></em></a></li>
-      <li><a href="#tab2"><em>Projects<span class="spacer"></span></em></a></li>
-  </ul>
- <div class="yui-content">   
-  <div id="tab1"><p>
- <table>
-#parse($turbineUtils.getTemplateName("_keyFields","xnat:subjectData",$!project))
-						</table>
-</p></div>  
- 
-  <div id="tab2"><p>
-#parse($turbineUtils.getTemplateName("sharing","xnat:subjectData",$!project))
-</p></div> 
-  </div> 
- </DIV>
-</div>
-<script type="text/javascript">  
-function summaryIndexChanged(){
-   var activeIndex=this.get("activeIndex");
-   YAHOO.util.Cookie.set("${project.getId()}.summary.index",activeIndex);
-}
-   
-function summaryTabManagerInit(){
-    window.summaryTabView = new YAHOO.widget.TabView('subjectSummary');   
-    window.subject_summary_module = new YAHOO.widget.Module("subject_summary_module",{visible:false,zIndex:5});
-    
-    window.subject_summary_module.show(); 		    
-    
-#if($canReadSubjects)
-    var tabIndex=YAHOO.util.Cookie.get("${om.getId()}.summary.index");
-    window.summaryTabView.set('activeIndex',tabIndex||0);
-    
-    window.summaryTabView.subscribe("activeTabChange",summaryIndexChanged);
-#end
-					}
-					summaryTabManagerInit();
-</script>
-<!--END SUBJECT SUMMARY TABS -->
-					</TD>
-					<TD valign="top" align="right" rowspan="2">
-		#elementActionsBoxNoEnd($element $search_field $search_value $data.getSession().getAttribute("user") $item)
-	      <li class="yuimenuitem">
-													       <A href="" ONCLICK="showFiles();return false;"><div class="ic"><img border="0" src="$content.getURI("scripts/yui/build/treeview/assets/img/folders/cf.gif")"/></div><div class="ic_spacer">&nbsp;</div>Manage Files</A>
-													      </li>
-													      	#if ($item.canDelete($user))
-													      <li class="yuimenuitem">
-													       <A href="" ONCLICK="restDelete();return false;"><div class="ic"><img border="0" src="$content.getURI("images/delete.gif")"/></div><div class="ic_spacer">&nbsp;</div>Delete</A>
-													      </li>
-													      #end
-													     </ul>
-     </DIV>
-    </DIV>
-					</TD>
-				</TR>
-				<script type="text/javascript" src="$content.getURI("scripts/BasePopup.js")"></script>
-<script type="text/javascript" src="$content.getURI("scripts/restDeleter.js")"></script>
-<style type="text/css">   
-  .icon-of { display:block; height: 19px; padding-left: 20px; background: transparent url($content.getURI("scripts/yui/build/treeview/assets/img/folders/of.gif")) no-repeat;}   
-  .icon-f { display:block; font-size:9px; height: 17px; padding-left: 4px;}   
-  .icon-cf { display:block; height: 19px; padding-left: 20px; background: transparent url($content.getURI("scripts/yui/build/treeview/assets/img/folders/cf.gif")) no-repeat;} 
-  .ygtvcheck0 { background: url($content.getURI("scripts/yui/build/treeview/assets/img/check/check0.gif")) 0 0 no-repeat; width:16px; cursor:pointer }
-  .ygtvcheck1 { background: url($content.getURI("scripts/yui/build/treeview/assets/img/check/check1.gif")) 0 0 no-repeat; width:16px; cursor:pointer }
-  .ygtvcheck2 { background: url($content.getURI("scripts/yui/build/treeview/assets/img/check/check2.gif")) 0 0 no-repeat; width:16px; cursor:pointer }
-</style>
-				<script type="text/javascript">
-								var _a = new Array();
-				var expt=null;
-				  #if($project)
-				    #set($pScope=$project)
-				  #else
-				    #set($project=$om.getProject())
-				  #end
-#foreach ($assessor in $subject.getMinimalLoadAssessors())
-   var _t=window.available_elements.getByName("$assessor.getXSIType()");
-   if(_t==null){
-   	   _t={singular:"$!assessor.getItem().getProperName()",plural:"$!assessor.getItem().getProperName()",			element_name:"$assessor.getXSIType()",actions:{},"lbg":"","dbg":""}
-   }
-#if($assessor.getItem().instanceOf("xnat:imageAssessorData"))
-													   _a.push({"label": _t.singular +" $!assessor.getIdentifier($project) ($!assessor.getId())","ru":"/REST/projects/$project/subjects/$om.getId()/experiments/$assessor.getImagesessionId()/assessors/$assessor.getId()" #if($assessor.canRead($user)),canRead:true#else,canRead:false#end,checked:true,xsiType:_t.singular,date:"$!assessor.getDate()",primary_label:"$!assessor.getIdentifier($project)",#if($pScope)"hasProject":"$!assessor.hasProject($pScope)"#else"hasProject":"true"#end});
-#else
-													   if(expt!=null)_a.push(expt);
-													   expt=null;
-													   expt={"label": _t.singular +" $!assessor.getIdentifier($project) ($!assessor.getId())",xsiType:_t.singular,date:"$!assessor.getDate()",primary_label:"$!assessor.getIdentifier($project)","ru":"/REST/projects/$project/subjects/$om.getId()/experiments/$assessor.getId()" #if($assessor.canRead($user)),canRead:true#else,canRead:false#end,checked:true,#if($pScope)"hasProject":"$!assessor.hasProject($pScope)"#else"hasProject":"true"#end};
-#end
-#end
-   if(expt!=null)_a.push(expt);
-   expt=null;
-													   _a.push({"label": "Subject $!om.getIdentifier($project) ($!om.getId())","ru":"/REST/projects/$project/subjects/$om.getId()","redirect":serverRoot+"/REST/projects/$project",canRead:true,checked:true,xsiType:window.available_elements.getByName("$om.getXSIType()").singular,date:"",primary_label:"$!om.getIdentifier($project)","hasProject":"true"});
-													
-				function restDelete(){
-   window.deleter=new RestDeleter(_a,{defaultHeight:450,defaultWidth:600});
-   window.deleter.init();
-				}
-				
-				</script>
-	<TR><TD colspan="3"><BR>
-			#parse("/screens/ReportProjectSpecificFields.vm")
-	</TD></TR>
-			</TABLE>
-		</TD>
-	</TR>
-	<TR>
-		<TD>
-			#parse($turbineUtils.getTemplateName("_assessors","xnat:subjectData",$project))
-		</TD>
-	</TR>
-			#parse($turbineUtils.getTemplateName("_resources","xnat:subjectData",$project))
-</TABLE>
+#set ( $exptHeadings = ["Date", "Type", "ID", "Investigator" ] )
+		<style>
+DIV.container{
+	border: 1px solid #AAAAAA;
+    width:250px;  
+}
+DIV.containerTitle{
+			    border: 1px solid #AAAAAA;
+    padding:3px;
+    font-weight:500;
+	font-family:verdana,geneva,helvetica;
+}
+DIV.containerBody{
+    width:99%;
+    overflow:auto;
+    font-size:13px;
+    line-height:15px;
+    padding:3px;
+    
+		</style>
+<script type="text/javascript">  
+if(XNAT.app.subject==undefined)XNAT.app.subject=new Object(); 
+</script>
+<TABLE width="100%">
+	<TR>
+		<TD>
+			<table width="100%">				
+				<TR>
+					<TD align="left" valign="middle">
+<DIV class="edit_title">Subject Details: #if($!om.getIdentifier($project,true))$!om.getIdentifier($project,true)#elseif($om.getLabel())$!om.getLabel()#else$!om.getId()#end</DIV>
+					</TD>
+				</TR>
+			</TABLE>
+		</TD>
+	</TR>
+	<TR>
+		<TD>
+			<TABLE width="100%">
+				<TR>
+					<TD valign="top">
+		<!--BEGIN SUBJECT SUMMARY TABS -->
+<STYLE>
+span.spacer{
+height:12px;
+width:1px;
+}
+</STYLE>
+<div ID="subject_summary_module" style="display:none">
+ <DIV id="subjectSummary" class="yui-navset">
+  <ul class="yui-nav" style="">
+      <li class="selected"><a href="#tab1"><em>Details<span class="spacer"></span></em></a></li>
+      <li><a href="#tab2"><em>Projects<span class="spacer"></span></em></a></li>
+  </ul>
+ <div class="yui-content">   
+  <div id="tab1"><p>
+ <table>
+#parse($turbineUtils.getTemplateName("_keyFields","xnat:subjectData",$!project))
+ </table>
+</p></div>  
+ 
+  <div id="tab2"><p>
+#parse($turbineUtils.getTemplateName("sharing","xnat:subjectData",$!project))
+</p></div> 
+  </div> 
+ </DIV>
+</div>
+<script type="text/javascript">  
+function summaryIndexChanged(){
+   var activeIndex=this.get("activeIndex");
+   YAHOO.util.Cookie.set("${project.getId()}.summary.index",activeIndex);
+}
+   
+function summaryTabManagerInit(){
+    window.summaryTabView = new YAHOO.widget.TabView('subjectSummary');   
+    window.subject_summary_module = new YAHOO.widget.Module("subject_summary_module",{visible:false,zIndex:5});
+    
+    window.subject_summary_module.show(); 		    
+    
+#if($canReadSubjects)
+    var tabIndex=YAHOO.util.Cookie.get("${om.getId()}.summary.index");
+    window.summaryTabView.set('activeIndex',tabIndex||0);
+    
+    window.summaryTabView.subscribe("activeTabChange",summaryIndexChanged);
+#end
+					}
+					summaryTabManagerInit();
+</script>
+<!--END SUBJECT SUMMARY TABS -->
+					</TD>
+					<TD valign="top" align="right" rowspan="2">
+		#elementActionsBoxNoEnd($element $search_field $search_value $data.getSession().getAttribute("user") $item)
+	      <li class="yuimenuitem">
+													       <A href="" ONCLICK="showFiles();return false;"><div class="ic"><img border="0" src="$content.getURI("scripts/yui/build/treeview/assets/img/folders/cf.gif")"/></div><div class="ic_spacer">&nbsp;</div>Manage Files</A>
+													      </li>
+													      	#if ($item.canDelete($user))
+													      <li class="yuimenuitem">
+													       <A href="" ONCLICK="restDelete();return false;"><div class="ic"><img border="0" src="$content.getURI("images/delete.gif")"/></div><div class="ic_spacer">&nbsp;</div>Delete</A>
+													      </li>
+													      #end
+														  #parse($turbineUtils.getTemplateName("actionsBoxAddons","xnat:subjectData",$!project))
+													     </ul>
+     </DIV>
+    </DIV>
+					</TD>
+				</TR>
+				<script type="text/javascript" src="$content.getURI("scripts/BasePopup.js")"></script>
+<script type="text/javascript" src="$content.getURI("scripts/restDeleter.js")"></script>
+<style type="text/css">   
+  .icon-of { display:block; height: 19px; padding-left: 20px; background: transparent url($content.getURI("scripts/yui/build/treeview/assets/img/folders/of.gif")) no-repeat;}   
+  .icon-f { display:block; font-size:9px; height: 17px; padding-left: 4px;}   
+  .icon-cf { display:block; height: 19px; padding-left: 20px; background: transparent url($content.getURI("scripts/yui/build/treeview/assets/img/folders/cf.gif")) no-repeat;} 
+  .ygtvcheck0 { background: url($content.getURI("scripts/yui/build/treeview/assets/img/check/check0.gif")) 0 0 no-repeat; width:16px; cursor:pointer }
+  .ygtvcheck1 { background: url($content.getURI("scripts/yui/build/treeview/assets/img/check/check1.gif")) 0 0 no-repeat; width:16px; cursor:pointer }
+  .ygtvcheck2 { background: url($content.getURI("scripts/yui/build/treeview/assets/img/check/check2.gif")) 0 0 no-repeat; width:16px; cursor:pointer }
+</style>
+				<script type="text/javascript">
+								var _a = new Array();
+				var expt=null;
+				  #if($project)
+				    #set($pScope=$project)
+				  #else
+				    #set($project=$om.getProject())
+				  #end
+#foreach ($assessor in $subject.getMinimalLoadAssessors())
+   var _t=window.available_elements.getByName("$assessor.getXSIType()");
+   if(_t==null){
+   	   _t={singular:"$!assessor.getItem().getProperName()",plural:"$!assessor.getItem().getProperName()",			element_name:"$assessor.getXSIType()",actions:{},"lbg":"","dbg":""}
+   }
+#if($assessor.getItem().instanceOf("xnat:imageAssessorData"))
+													   _a.push({"label": _t.singular +" $!assessor.getIdentifier($project) ($!assessor.getId())","ru":"/REST/projects/$project/subjects/$om.getId()/experiments/$assessor.getImagesessionId()/assessors/$assessor.getId()" #if($assessor.canRead($user)),canRead:true#else,canRead:false#end,checked:true,xsiType:_t.singular,date:"$!assessor.getDate()",primary_label:"$!assessor.getIdentifier($project)",#if($pScope)"hasProject":"$!assessor.hasProject($pScope)"#else"hasProject":"true"#end});
+#else
+													   if(expt!=null)_a.push(expt);
+													   expt=null;
+													   expt={"label": _t.singular +" $!assessor.getIdentifier($project) ($!assessor.getId())",xsiType:_t.singular,date:"$!assessor.getDate()",primary_label:"$!assessor.getIdentifier($project)","ru":"/REST/projects/$project/subjects/$om.getId()/experiments/$assessor.getId()" #if($assessor.canRead($user)),canRead:true#else,canRead:false#end,checked:true,#if($pScope)"hasProject":"$!assessor.hasProject($pScope)"#else"hasProject":"true"#end};
+#end
+#end
+   if(expt!=null)_a.push(expt);
+   expt=null;
+													   _a.push({"label": "Subject $!om.getIdentifier($project) ($!om.getId())","ru":"/REST/projects/$project/subjects/$om.getId()","redirect":serverRoot+"/REST/projects/$project",canRead:true,checked:true,xsiType:window.available_elements.getByName("$om.getXSIType()").singular,date:"",primary_label:"$!om.getIdentifier($project)","hasProject":"true"});
+													
+				function restDelete(){
+   window.deleter=new RestDeleter(_a,{defaultHeight:450,defaultWidth:600});
+   window.deleter.init();
+				}
+				
+				</script>
+	<TR><TD colspan="3"><BR>
+			#parse("/screens/ReportProjectSpecificFields.vm")
+	</TD></TR>
+			</TABLE>
+		</TD>
+	</TR>
+	<TR>
+		<TD>
+			#parse($turbineUtils.getTemplateName("_assessors","xnat:subjectData",$project))
+		</TD>
+	</TR>
+			#parse($turbineUtils.getTemplateName("_resources","xnat:subjectData",$project))
+</TABLE>

plugin-resources/webapp/xnat/java/org/nrg/pipeline/BuildSpecification.java

-
-/*
- *	Copyright Washington University in St Louis 2006
- *	All rights reserved
- *
- * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
-
-*/
-
-package org.nrg.pipeline;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-
-import javax.xml.transform.sax.SAXSource;
-
-import net.sf.saxon.om.Item;
-import net.sf.saxon.om.SequenceIterator;
-import net.sf.saxon.sxpath.XPathEvaluator;
-import net.sf.saxon.sxpath.XPathExpression;
-import net.sf.saxon.trans.IndependentContext;
-
-import org.apache.log4j.Logger;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.nrg.pipeline.build.xmlbeans.BuildData;
-import org.nrg.pipeline.build.xmlbeans.BuildDocument;
-import org.nrg.pipeline.build.xmlbeans.ImageSessionData;
-import org.nrg.pipeline.build.xmlbeans.PipelineData;
-import org.nrg.pipeline.build.xmlbeans.PipelineParameterData;
-import org.nrg.pipeline.build.xmlbeans.ImageSessionData.Pipeline;
-import org.nrg.pipeline.build.xmlbeans.PipelineParameterData.Parameter;
-import org.nrg.xdat.om.WrkWorkflowdata;
-import org.nrg.xdat.turbine.utils.TurbineUtils;
-import org.nrg.xft.ItemWrapper;
-import org.nrg.xft.XFTItem;
-import org.nrg.xft.meta.XFTMetaManager;
-import org.nrg.xft.schema.Wrappers.XMLWrapper.XMLWrapperElement;
-import org.nrg.xft.schema.Wrappers.XMLWrapper.XMLWrapperFactory;
-import org.nrg.xft.search.CriteriaCollection;
-import org.xml.sax.InputSource;
-
-public class BuildSpecification {
-
-    
-    String specFilePath ;
-    private BuildSpecification() {
-        
-    }
-    
-    
-    
-    
-    public static BuildSpecification GetInstance() {
-        if (self == null) {
-            self = new BuildSpecification(); 
-         }
-         return self;
-    }
-    
-    public  void init(String settingsDirectory) throws Exception {
-        if (!settingsDirectory.endsWith(File.separator))
-            settingsDirectory += File.separator;
-        specFilePath = settingsDirectory + "BuildSpec.xml";
-        load();
-        logger.info("BuildSpec File Loaded");
-    }
-
-    private void load() throws Exception {
-        File xmlFile = new File(specFilePath);
-        try {
-            buildDoc = (BuildDocument)XmlObject.Factory.parse(xmlFile);
-            BuildDocument tmpBuildDoc = BuildDocument.Factory.newInstance();
-            BuildData tmpBuild = tmpBuildDoc.addNewBuild();
-            int nprojects = buildDoc.getBuild().sizeOfProjectArray();
-            for (int i = 0; i < nprojects; i++) {
-                if (buildDoc.getBuild().getProjectArray(i).getType().contains(",")) {
-                    String[] types = buildDoc.getBuild().getProjectArray(i).getType().split(",");
-                    for (int j = 0; j < types.length; j++) {
-                       ImageSessionData tmpProject =  tmpBuild.addNewProject();
-                       tmpProject.set(buildDoc.getBuild().getProjectArray(i));
-                       tmpProject.setType(types[j].trim());
-                    }
-                }else {
-                    tmpBuild.addNewProject().set(buildDoc.getBuild().getProjectArray(i));
-                }
-            }
-            buildDoc = tmpBuildDoc;
-        }catch(Exception e) {
-            logger.error("Couldnt parse BuildSpec file " , e);
-            throw new Exception("Invalid content found in " + specFilePath + " expecting a Build document");
-        }
-
-    }
-    
-    public void reload() throws Exception {
-        load();
-        logger.info("BuildSpec File re-loaded");
-   }
-    
-    public  ArrayList getWorkFlowStatus(String id, String data_type, org.nrg.xft.security.UserI user) {
-        org.nrg.xft.search.CriteriaCollection cc = new CriteriaCollection("AND");
-        cc.addClause("wrk:workflowData.ID",id);
-        cc.addClause("wrk:workflowData.data_type",data_type);
-        return WrkWorkflowdata.getWrkWorkflowdatasByField(cc,user,false);
-        
-    }
-    
-    public ArrayList getWorkFlowsOrderByLaunchTimeDesc(String id, String dataType, org.nrg.xft.security.UserI user) {
-        ArrayList workflows = new ArrayList();
-        org.nrg.xft.search.CriteriaCollection cc = new CriteriaCollection("AND");
-        cc.addClause("wrk:workflowData.ID",id);
-        cc.addClause("wrk:workflowData.data_type",dataType);
-        //Sort by Launch Time
-        try {
-            org.nrg.xft.collections.ItemCollection items = org.nrg.xft.search.ItemSearch.GetItems(cc,user,false);
-            ArrayList workitems = items.getItems("wrk:workflowData.launch_time","DESC");
-            Iterator iter = workitems.iterator();
-            while (iter.hasNext())
-            {
-                WrkWorkflowdata vrc = new WrkWorkflowdata((XFTItem)iter.next());
-                workflows.add(vrc);
-            }
-        }catch(Exception e) {
-            logger.debug("",e);
-        }
-       logger.info("Workflows by Ordered by Launch Time " + workflows.size());
-        return workflows;
-    }
-
-    public String getWorkFlowStatus(String id, String data_type, String pipelinePath, org.nrg.xft.security.UserI user) {
-        String rtn = null;
-        org.nrg.xft.search.CriteriaCollection cc = new CriteriaCollection("AND");
-        cc.addClause("wrk:workflowData.ID",id);
-        cc.addClause("wrk:workflowData.data_type",data_type);
-        cc.addClause("wrk:workflowData.pipeline_name",pipelinePath);
-        ArrayList rtns = WrkWorkflowdata.getWrkWorkflowdatasByField(cc,user,false,"wrk:workflowData.launch_time","desc");
-        if (rtns != null && rtns.size() > 0) {
-                rtn = ((WrkWorkflowdata)rtns.get(0)).getStatus();
-        }
-        return rtn;
-    }
-    
-    public ImageSessionData getProjectElement(String projectType) {
-        ImageSessionData rtn = null;
-        ImageSessionData projects[] = buildDoc.getBuild().getProjectArray();
-        for (int i = 0; i < projects.length; i++) {
-            if (projects[i].getType().equals("^ALL^")) {
-                rtn = projects[i];
-            }
-            if (projects[i].getType().equals(projectType)) {
-                rtn = projects[i];
-                break;
-            }
-        }
-        return rtn;
-    }
-    
-    public boolean hasSpecificProjectElement(String projectType) {
-        boolean rtn = false;
-        ImageSessionData projects[] = buildDoc.getBuild().getProjectArray();
-        for (int i = 0; i < projects.length; i++) {
-            if (projects[i].getType().equals(projectType)) {
-                rtn = true;
-                break;
-            }
-        }
-        return rtn;
-    }
-    
-    public Pipeline[] getPipelinesForProject(String projectType) {
-        ImageSessionData project = getProjectElement(projectType);
-        return project.getPipelineArray();
-    }
-    
-    public Pipeline getPipelineForProject(String projectType, String stepId) {
-        Pipeline rtn = null;
-        Pipeline[] pipelines = getPipelinesForProject(projectType);
-        for (int i = 0; i < pipelines.length; i++) {
-            if (pipelines[i].getStepId().equals(stepId)) {
-                rtn = pipelines[i];
-                break;
-            }
-        }
-        return rtn;
-    }
-
-    public Pipeline getPipelineForProject(String projectType, int stepNo) {
-        Pipeline rtn = null;
-        Pipeline[] pipelines = getPipelinesForProject(projectType);
-        if (stepNo > pipelines.length) {
-            return rtn;
-        }
-        rtn = pipelines[stepNo];
-        return rtn;
-    }
-    
-    public String getPathToPipelineForProject(String projectType, String stepId) {
-        String rtn = "";
-        Pipeline pipeline = getPipelineForProject(projectType, stepId);
-        if (pipeline != null) {
-            if (pipeline.getLocation().endsWith(File.separator)) {
-                pipeline.setLocation(pipeline.getLocation().substring(0,pipeline.getLocation().length()-1));
-            }
-            rtn = pipeline.getLocation() + File.separator + pipeline.getName();
-        }
-        if (!rtn.endsWith(".xml")) rtn += ".xml";
-        return rtn;
-    }
-    
-
-    private  ArrayList getProjectElementForProjectType(String projectType) throws Exception{
-        return getProjectElementForProjectType(projectType, false);
-    }
-    
-    private  ArrayList getProjectElementForProjectType(String sessionType, boolean exact) throws Exception{
-        ArrayList imageSessions = new ArrayList();
-        for (int i = 0; i < buildDoc.getBuild().getProjectArray().length; i++) {
-            //System.out.println("Scanning type " + buildDoc.getBuild().getProjectArray(i).getType());
-            if (buildDoc.getBuild().getProjectArray(i).getType().equals(sessionType)) {
-                imageSessions.add(buildDoc.getBuild().getProjectArray(i));
-                if (exact) return imageSessions;
-            }
-            if (!exact) {
-                if (buildDoc.getBuild().getProjectArray(i).getType().equals("^ALL^") ) {
-                    imageSessions.add(buildDoc.getBuild().getProjectArray(i));
-                }
-            }
-        }
-        return imageSessions;
-    }
-
-    public  LinkedHashMap getResolvedParametersForPipeline(String stepId, String projectType, ItemWrapper item) throws Exception {
-        LinkedHashMap parametersHash = new LinkedHashMap();
-        PipelineParameterData parameters = getParametersForPipeline(projectType,stepId);
-        if (parameters == null) {
-            return parametersHash;
-        }
-        for (int i = 0; i < parameters.sizeOfParameterArray(); i++) {
-            Parameter aParameter = parameters.getParameterArray(i);
-            if (aParameter.isSetCsvValues()) {
-                String csvValues = aParameter.getCsvValues().trim();
-                ArrayList<String> values = new ArrayList<String>(Arrays.asList(csvValues.split(",")));
-                parametersHash.put(aParameter,values);
-            }else if (aParameter.isSetSchemaLink()){
-                // ArrayList values = this.resolveXPath(aParameter.getSchemaLink(), item);
-                // if (values != null) parametersHash.put(aParameter,values);
-                //Saxon seems to have problem evaluating recursively. 
-                // SXXP0003 Premature end of file
-            }else {
-                ArrayList<String> values = new ArrayList(); values.add("");
-                parametersHash.put(aParameter,values);
-            }
-        }
-        return parametersHash;
-    }
-
-    public  PipelineParameterData getParametersForPipeline(String projectType, String stepId) throws Exception{
-        PipelineParameterData rtn = null;
-        ArrayList projectElements = getProjectElementForProjectType(projectType);
-        if (projectElements == null)  return rtn;
-        ImageSessionData project = (ImageSessionData) projectElements.get(0);
-        if (project == null)  return rtn;
-        rtn = getParametersForPipeline(project,stepId);
-        return rtn;
-    } 
-
-    private  PipelineParameterData getParametersForPipeline(ImageSessionData project,String stepId) {
-        PipelineParameterData rtn = null;
-        for (int i = 0; i < project.getPipelineArray().length; i++) {
-            if (project.getPipelineArray(i).getStepId().equals(stepId)) {
-                rtn = project.getPipelineArray(i).getParameters();
-                break;
-            }
-        }
-        return rtn;
-    }
-
-/*    private  PipelineParameterData getParametersForPipeline(ImageSessionData imageSession,String pipelineName) {
-        PipelineParameterData rtn = null;
-        for (int i = 0; i < imageSession.getPipelineArray().length; i++) {
-            if (imageSession.getPipelineArray(i).getName().equals(pipelineName)) {
-                rtn = imageSession.getPipelineArray(i).getParameters();
-                break;
-            }
-        }
-        return rtn;
-    }
-*/
-    
-    public  String getPipelinePath(String projectType, String stepId) throws Exception{
-        String rtn = null;
-        ArrayList projects = getProjectElementForProjectType(projectType, true);
-        if (projects == null || projects.size() <1) {
-            return null;
-        }
-        ImageSessionData project = (ImageSessionData)projects.get(0);
-        if (project != null) {
-            for (int i = 0; i < project.getPipelineArray().length; i++) {
-                if (project.getPipelineArray(i).getStepId().equals(stepId)) {
-                    rtn = project.getPipelineArray(i).getLocation();
-                    break;
-                }
-            }
-        }
-        if (rtn == null) throw new Exception("Couldnt find pipeline with Step Id " + stepId + " associated with " + projectType);
-        return rtn;
-    }
-
-    
-    
-    
-    public LinkedHashMap getBatchParametersForPipeline(String projectType, String stepId) {
-            LinkedHashMap rtn = new LinkedHashMap();
-            try {
-                PipelineParameterData params = this.getParametersForPipeline(projectType, stepId);
-                if (params != null) {
-                    for (int i = 0; i < params.sizeOfParameterArray(); i++) {
-                        if (params.getParameterArray(i).isSetBatchParam()) {
-                            Parameter batchParam = params.getParameterArray(i);
-                            if (batchParam.isSetCsvValues()) {
-                                String csvValues = batchParam.getCsvValues().trim();
-                                ArrayList<String> values = new ArrayList<String>(Arrays.asList(csvValues.split(",")));
-                                rtn.put(batchParam,values);
-                            }else {
-                                ArrayList<String> values = new ArrayList(); values.add("");
-                                rtn.put(batchParam,values);
-                            }
-                        }
-                    }
-                }
-            }catch(Exception e){}
-            return rtn;
-    }
-    
-    public LinkedHashMap getExactBatchParametersForPipeline(String projectType, String stepId) {
-        LinkedHashMap rtn = new LinkedHashMap();
-        try {
-            ArrayList projectElements = getProjectElementForProjectType(projectType, true);
-            if (projectElements == null || projectElements.size() == 0)  return rtn;
-            ImageSessionData project = (ImageSessionData) projectElements.get(0);
-            if (project == null)  return rtn;
-            PipelineParameterData params  = getParametersForPipeline(project,stepId);
-            if (params != null) {
-                for (int i = 0; i < params.sizeOfParameterArray(); i++) {
-                    if (params.getParameterArray(i).isSetBatchParam()) {
-                        Parameter batchParam = params.getParameterArray(i);
-                        if (batchParam.isSetCsvValues()) {
-                            String csvValues = batchParam.getCsvValues().trim();
-                            ArrayList<String> values = new ArrayList<String>(Arrays.asList(csvValues.split(",")));
-                            rtn.put(batchParam,values);
-                        }else {
-                            ArrayList<String> values = new ArrayList(); values.add("");
-                            rtn.put(batchParam,values);
-                        }
-                    }
-                }
-            }
-        }catch(Exception e){e.printStackTrace();}
-        return rtn;
-    }
-    
-    public LinkedHashMap getBestGuessBatchParametersForPipeline(String projectType, String stepId) {
-        LinkedHashMap rtn = new LinkedHashMap();
-        rtn = getExactBatchParametersForPipeline(projectType, stepId);
-        if (rtn == null || rtn.size()==0) {
-            rtn = getBatchParametersForPipeline(projectType, stepId);
-        }
-        return rtn;
-    }    
-    
-    public boolean saveBatchParametersForProject(Hashtable<String,String> commonParams,String projectId,String step) {
-        boolean rtn = false;
-        boolean hasOwnSpecification = hasSpecificProjectElement(projectId);
-        ImageSessionData projectBuildSpec = null;
-        if (!hasOwnSpecification) {
-            ImageSessionData projectImageSessionData = getProjectElement(projectId);
-            projectBuildSpec =  buildDoc.getBuild().addNewProject();
-            projectBuildSpec.set(projectImageSessionData);
-            projectBuildSpec.setType(projectId);
-        }else {
-            try {
-                projectBuildSpec = (ImageSessionData)(getProjectElementForProjectType(projectId).get(0));
-            }catch(Exception e) {
-                logger.debug("Unable to get specific project element for project " + projectId + " " + e.getMessage() );
-                return rtn;
-            }
-        }
-        PipelineParameterData pipelineParameters = getParametersForPipeline(projectBuildSpec, step);
-        if (commonParams != null && commonParams.size() > 0 ) {
-            if (pipelineParameters != null) {
-                for (int i = 0; i < pipelineParameters.sizeOfParameterArray(); i++) {
-                    if (pipelineParameters.getParameterArray(i).isSetBatchParam()) {
-                        Parameter batchParam = pipelineParameters.getParameterArray(i);
-                        if (commonParams.containsKey(batchParam.getName())) {
-                            if (batchParam.isSetCsvValues()) {
-                                String csvValues = commonParams.get(batchParam.getName());
-                                batchParam.setCsvValues(csvValues);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        save();
-        rtn = true;
-        return rtn;
-    }
-    
-    private void save() {
-        try {
-            buildDoc.save(new File(specFilePath),new XmlOptions().setSavePrettyPrint().setSaveAggressiveNamespaces());
-        }catch(Exception e) {
-            logger.debug(e);
-        }
-    }
-    
-    public  LinkedHashMap getPipelinesForProject(String projectID,  org.nrg.xft.security.UserI user) throws Exception {
-        LinkedHashMap pipelines = new LinkedHashMap();
-        ArrayList imageSessions = getProjectElementForProjectType(projectID);
-        if (imageSessions == null || imageSessions.size()==0) return null;
-        for (int j = 0; j < imageSessions.size(); j++) {
-            ImageSessionData imageSession = (ImageSessionData) imageSessions.get(j);
-            for (int i = 0; i < imageSession.getPipelineArray().length; i++) {
-                PipelineData pipeline = imageSession.getPipelineArray(i);
-                String pipelinePath = pipeline.getLocation();
-                if (!pipelinePath.endsWith(File.separator))
-                        pipelinePath += File.separator;
-                pipelinePath += pipeline.getName();
-                if (!pipeline.getName().endsWith(".xml")) pipelinePath += ".xml";
-                pipelines.put(imageSession.getPipelineArray(i), imageSession.getType());
-            }
-        }
-        return pipelines;
-        
-    }
-    
-    /*public  LinkedHashMap getPipelinesForSessionType(String sessionType, String data_type, String id,  org.nrg.xft.security.UserI user, boolean checkDependency) throws Exception {
-        String transferStatus = getWorkFlowStatus(id,data_type,"Transfer",user);
-        if (transferStatus == null || !transferStatus.equals("Complete"))
-            return new LinkedHashMap();
-        LinkedHashMap linkedHash = new LinkedHashMap();
-        ArrayList imageSessions = getImageSessionForSessionType(sessionType);
-        if (imageSessions == null) return null;
-        for (int j = 0; j < imageSessions.size(); j++) {
-            ImageSessionData imageSession = (ImageSessionData) imageSessions.get(j);
-            boolean previousStepComplete = true;
-            boolean disabled = true;
-            for (int i = 0; i < imageSession.getPipelineArray().length; i++) {
-                disabled = true;
-                PipelineData pipeline = imageSession.getPipelineArray(i);
-                if (previousStepComplete) disabled = false;
-                String pipelinePath = pipeline.getLocation();
-                if (!pipelinePath.endsWith(File.separator))
-                        pipelinePath += File.separator;
-                pipelinePath += pipeline.getName();
-                if (!pipeline.getName().endsWith(".xml")) pipelinePath += ".xml";
-                System.out.println("Looking for Path " + pipelinePath);
-                String workFlowStatus = getWorkFlowStatus(id,data_type,pipelinePath,user);
-                if (workFlowStatus == null) workFlowStatus ="";
-                if (checkDependency) {
-                   if (pipeline.isSetIndependent() && pipeline.getIndependent()) {
-                       disabled = false;
-                   }
-                }
-                linkedHash.put(imageSession.getPipelineArray(i),new BuildStatus(workFlowStatus,disabled));
-                previousStepComplete = workFlowStatus.equals("Complete");
-            }
-        }
-        return linkedHash;
-    }*/
-
-
-
-    public  ArrayList resolveXPath(String xpathStmt, ItemWrapper itemW) throws Exception {
-        ArrayList rtn = new ArrayList();
-
-        XPathEvaluator xpe = new XPathEvaluator();
-        XMLWrapperElement element = (XMLWrapperElement)XFTMetaManager.GetWrappedElementByName(XMLWrapperFactory.GetInstance(),itemW.getXSIType());
-
-        if (element.getSchemaTargetNamespacePrefix() != null && element.getSchemaTargetNamespacePrefix().equals("") && element.getSchemaTargetNamespaceURI() != null) {
-            ((IndependentContext)xpe.getStaticContext()).declareNamespace("", element.getSchemaTargetNamespaceURI());
-        }else if (element.getSchemaTargetNamespacePrefix() != null && !element.getSchemaTargetNamespacePrefix().equals("") && element.getSchemaTargetNamespaceURI() != null) {
-            ((IndependentContext)xpe.getStaticContext()).declareNamespace(element.getSchemaTargetNamespacePrefix(), element.getSchemaTargetNamespaceURI());
-        }
-
-        SAXSource ss = new SAXSource(new  InputSource(new ByteArrayInputStream(itemW.toXML_BOS(TurbineUtils.GetFullServerPath() + "/schemas").toByteArray())));
-        XPathExpression xExpr =  xpe.createExpression(xpathStmt);
-        SequenceIterator rtns = xExpr.rawIterator(ss);
-        Item xpathObj = rtns.next();
-        while (xpathObj != null) {
-            xpathObj = rtns.current();
-            rtn.add(xpathObj.getStringValue());
-            xpathObj = rtns.next();
-        }
-        return rtn;
-    }
-    
-    public ArrayList resolveXPath(String xpathStmt, SAXSource ss,XMLWrapperElement element ) throws Exception {
-        ArrayList rtn = new ArrayList();
-
-        XPathEvaluator xpe = new XPathEvaluator();
-        if (element.getSchemaTargetNamespacePrefix() != null && element.getSchemaTargetNamespacePrefix().equals("") && element.getSchemaTargetNamespaceURI() != null) {
-            ((IndependentContext)xpe.getStaticContext()).declareNamespace("", element.getSchemaTargetNamespaceURI());
-        }else if (element.getSchemaTargetNamespacePrefix() != null && !element.getSchemaTargetNamespacePrefix().equals("") && element.getSchemaTargetNamespaceURI() != null) {
-            ((IndependentContext)xpe.getStaticContext()).declareNamespace(element.getSchemaTargetNamespacePrefix(), element.getSchemaTargetNamespaceURI());
-        }
-        XPathExpression xExpr =  xpe.createExpression(xpathStmt);
-        SequenceIterator rtns = xExpr.rawIterator(ss);
-        Item xpathObj = rtns.next();
-        while (xpathObj != null) {
-            xpathObj = rtns.current();
-            rtn.add(xpathObj.getStringValue());
-            xpathObj = rtns.next();
-        }
-        return rtn;
-    }
-
-
-    public  Parameter getParameterByName(LinkedHashMap parametersHash, String name, boolean ignorecase) {
-        Iterator paramIter = parametersHash.keySet().iterator();
-        Parameter rtn = null;
-        while (paramIter.hasNext()) {
-            Parameter param = (Parameter)paramIter.next();
-            if ((ignorecase?param.getName().equalsIgnoreCase(name):param.getName().equals(name))) {
-                rtn = param;
-                break;
-            }
-        }
-        return rtn;
-    }
-
-    public  Parameter getParameterByName(String projectType, String step,String nameToMatch, boolean ignoreCase) throws Exception{
-        PipelineParameterData  params = getParametersForPipeline(projectType,step);
-        Parameter rtn = null;
-        if (params == null) return null;
-        for (int i = 0; i < params.sizeOfParameterArray(); i++) {
-            if ((ignoreCase?params.getParameterArray(i).getName().equalsIgnoreCase(nameToMatch):params.getParameterArray(i).getName().equals(nameToMatch))) {
-                rtn = params.getParameterArray(i);
-                break;
-            }
-        }
-        return rtn;
-    } 
-
-   
-    public static void main(String args[]) {
-        try {
-            BuildSpecification.GetInstance().init("C:\\eclipse\\workspace\\xdat_release\\projects\\cnda_xnat");
-            System.out.println("All done");
-            String firstStepPipelinePath =  BuildSpecification.GetInstance().getPathToPipelineForProject("Pilot PIB (NP633)","1");
-            System.out.println("First Step Pipeline Path " + firstStepPipelinePath);
-        }catch(Exception e) {
-            e.printStackTrace();
-        }
-    }
-    
-    private static BuildSpecification self;
-    private  BuildDocument buildDoc;
-    static org.apache.log4j.Logger logger = Logger.getLogger(BuildSpecification.class);
-
-}

plugin-resources/webapp/xnat/java/org/nrg/pipeline/XnatPipelineLauncher.java

     static org.apache.log4j.Logger logger = Logger.getLogger(XnatPipelineLauncher.class);
 
     public static final String SCHEDULE = "schedule";
-    
+
     String pipelineName;
     String id, label = null;
     String externalId; //Workflows External Id
 
             parameters.put("builddir",temp);
         }
+    	setNeedsBuildDir(false);
+
     }
 
     public XnatPipelineLauncher(RunData data, Context context) {
     }
 
 
-    
+
     public boolean launch() {
     	return launch(XFT.GetPipelinePath() + "bin" + File.separator + SCHEDULE);
     }
-    
+
     public boolean launch (String cmdPrefix) {
         String command = " ";
         String pcommand = "";

plugin-resources/webapp/xnat/java/org/nrg/pipeline/utils/FileUtils.java

-/* 
+/*
  *	Copyright Washington University in St Louis 2006
  *	All rights reserved
- * 	
+ *
  * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
 
 */
 import java.io.File;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 
 import org.apache.xmlbeans.XmlException;
 import org.nrg.xnat.turbine.utils.ArcSpecManager;
 
 public class FileUtils {
-	
+
 	public static PipelineDocument GetDocument(String pathToPipelineXmlFile) throws Exception {
         if (!pathToPipelineXmlFile.endsWith(".xml")) pathToPipelineXmlFile += ".xml";
-        File xmlFile = new File(pathToPipelineXmlFile); 
+        File xmlFile = new File(pathToPipelineXmlFile);
         //Bind the instance to the generated XMLBeans types.
         ArrayList errors = new ArrayList();
         XmlOptions xopt = new XmlOptions();
         if (!(xo instanceof PipelineDocument)) {
             throw new Exception("Invalid XML file supplied " + pathToPipelineXmlFile + " ==> Expecting a pipeline document");
         }
-        PipelineDocument pipelineDoc = (PipelineDocument)xo; 
+        PipelineDocument pipelineDoc = (PipelineDocument)xo;
         //String error = XMLBeansUtils.validateAndGetErrors(pipelineDoc);
         //if (error != null) {
           //  throw new XmlException("Invalid XML " + pathToPipelineXmlFile + "\n" + errors);
         return pipelineDoc;
 }
 
-	
+
     public static  String getMaxMatching(String file1, String file2, String scanId1, String scanId2) {
         String rtn = null;
         if (file1 == null || file2 == null || scanId1 == null || scanId2 == null) return null;
-        int index = 0; 
+        int index = 0;
         while (true) {
-            if (file2.charAt(index) != file1.charAt(index)) 
+            if (file2.charAt(index) != file1.charAt(index))
                 break;
             index++;
         }
         if (slash != -1) {
             rtn = rtn.substring(slash+1,rtn.length());
         }
-        
+
         if (rtn.endsWith(".")) rtn = rtn.substring(0,rtn.length()-1);
-        
+
         System.out.println("Returnning formatted " + rtn);
         return rtn;
     }
-    
+
     public static String getName(String path) {
         String rtn = path;
         int indexOfLastSlash = path.lastIndexOf(File.separator);
         }
         return rtn;
     }
-    
+
 	public static String getBuildDir(String project,  boolean postfixTimestamp) {
 		ArcProject arcProject = ArcSpecManager.GetInstance().getProjectArc(project);
 		String buildPath = XFT.GetPipelinePath()  ;
 			buildPath = arcProject.getPaths().getBuildpath();
 		}
 		if (postfixTimestamp) {
-			Date date = new Date();
-		    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
-		    String s = formatter.format(date);
+			Calendar cal = Calendar.getInstance();
+		    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd_HHmmss");
+		    String s = formatter.format(cal.getTime());
 			buildPath += s + "/" ;
 		}
 		return buildPath;
 	}
-	
 
-    
+
+
 }

plugin-resources/webapp/xnat/java/org/nrg/xdat/om/base/BaseXnatExperimentdata.java

 import java.net.URI;
 import java.net.URISyntaxException;
 import java.sql.SQLException;
+import java.text.DateFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Enumeration;
         return null;
     }
 
-
+	public String getFreeFormDate(String dateParam){
+		try{
+			Date now = Calendar.getInstance().getTime();
+			DateFormat dateFormat = new SimpleDateFormat(dateParam);
+			String dateStr = dateFormat.format(now); 
+			return dateStr;
+		} catch (Exception e1) {logger.error(e1);return null;}
+	}
 
     Hashtable fieldsByName = null;
     public Hashtable getFieldsByName(){
     		if(newLabel==null)newLabel = this.getLabel();
     		if(newLabel==null)newLabel = this.getId();
     		
-    		File newSessionDir = new File(new File(newProject.getRootArchivePath(),newProject.getCurrentArc()),newLabel);
+    		final File newSessionDir = new File(new File(newProject.getRootArchivePath(),newProject.getCurrentArc()),newLabel);
     		
     		String current_label=this.getLabel();
     		if(current_label==null)current_label=this.getId();
         				existingSessionDir=uri.substring(0,lastIndex);