From 8232d906513bcdd6023d6cbf0f30757d9aa1cf10 Mon Sep 17 00:00:00 2001
From: Mike McKay <mfmckay@wustl.edu>
Date: Wed, 18 May 2016 00:34:03 -0500
Subject: [PATCH] XNAT-4209 Added four pages for the different ways of
 uploading data, in addition to a main page that lists all of them. Also
 listed the options in a submenu under Upload->Images.

---
 .../screens/CompressedUploaderPage.java       |  32 +
 .../turbine/modules/screens/DICOMSCPPage.java |  32 +
 .../modules/screens/UploadAssistantPage.java  |  24 +
 .../modules/screens/UploadOptions.java        |  41 ++
 src/main/webapp/WEB-INF/tags/page/xnat.tag    |  13 +-
 .../webapp/WEB-INF/tags/spawner/layout.tag    |  13 +-
 .../xnat-templates/navigations/DefaultTop.vm  |   2 +-
 .../screens/CompressedUploaderPage.vm         | 579 ++++++++++++++++
 .../xnat-templates/screens/DICOMSCPPage.vm    |  24 +
 .../screens/LaunchUploadApplet.vm             |   2 -
 .../screens/UploadAssistantPage.vm            |  12 +
 .../xnat-templates/screens/UploadOptions.vm   | 646 ++++++++++++++++++
 .../screens/topBar/Upload/Default.vm          |  11 +-
 13 files changed, 1423 insertions(+), 8 deletions(-)
 create mode 100644 src/main/java/org/nrg/xnat/turbine/modules/screens/CompressedUploaderPage.java
 create mode 100644 src/main/java/org/nrg/xnat/turbine/modules/screens/DICOMSCPPage.java
 create mode 100644 src/main/java/org/nrg/xnat/turbine/modules/screens/UploadAssistantPage.java
 create mode 100644 src/main/java/org/nrg/xnat/turbine/modules/screens/UploadOptions.java
 create mode 100644 src/main/webapp/xnat-templates/screens/CompressedUploaderPage.vm
 create mode 100644 src/main/webapp/xnat-templates/screens/DICOMSCPPage.vm
 create mode 100644 src/main/webapp/xnat-templates/screens/UploadAssistantPage.vm
 create mode 100644 src/main/webapp/xnat-templates/screens/UploadOptions.vm

diff --git a/src/main/java/org/nrg/xnat/turbine/modules/screens/CompressedUploaderPage.java b/src/main/java/org/nrg/xnat/turbine/modules/screens/CompressedUploaderPage.java
new file mode 100644
index 00000000..ab7ac9fe
--- /dev/null
+++ b/src/main/java/org/nrg/xnat/turbine/modules/screens/CompressedUploaderPage.java
@@ -0,0 +1,32 @@
+/*
+ * org.nrg.xnat.turbine.modules.screens.ReportIssue
+ * XNAT http://www.xnat.org
+ * Copyright (c) 2014, Washington University School of Medicine
+ * All Rights Reserved
+ *
+ * Released under the Simplified BSD.
+ *
+ * Last modified 7/10/13 9:04 PM
+ */
+package org.nrg.xnat.turbine.modules.screens;
+
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+import org.nrg.xdat.om.ArcArchivespecification;
+import org.nrg.xdat.turbine.modules.screens.SecureScreen;
+import org.nrg.xnat.turbine.utils.ArcSpecManager;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+public class CompressedUploaderPage extends SecureScreen {
+
+	@Override
+	protected void doBuildTemplate(RunData data, Context context) throws Exception {
+		final SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd_hhmmss");
+		context.put("uploadID", formatter.format(Calendar.getInstance().getTime()));
+		final ArcArchivespecification arc = ArcSpecManager.GetInstance();
+		context.put("arc", arc);
+	}
+
+}
diff --git a/src/main/java/org/nrg/xnat/turbine/modules/screens/DICOMSCPPage.java b/src/main/java/org/nrg/xnat/turbine/modules/screens/DICOMSCPPage.java
new file mode 100644
index 00000000..29b4036e
--- /dev/null
+++ b/src/main/java/org/nrg/xnat/turbine/modules/screens/DICOMSCPPage.java
@@ -0,0 +1,32 @@
+/*
+ * org.nrg.xnat.turbine.modules.screens.ReportIssue
+ * XNAT http://www.xnat.org
+ * Copyright (c) 2014, Washington University School of Medicine
+ * All Rights Reserved
+ *
+ * Released under the Simplified BSD.
+ *
+ * Last modified 7/10/13 9:04 PM
+ */
+package org.nrg.xnat.turbine.modules.screens;
+
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+import org.nrg.xdat.om.ArcArchivespecification;
+import org.nrg.xdat.turbine.modules.screens.SecureScreen;
+import org.nrg.xnat.turbine.utils.ArcSpecManager;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+public class DICOMSCPPage extends SecureScreen {
+
+	@Override
+	protected void doBuildTemplate(RunData data, Context context) throws Exception {
+		final SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd_hhmmss");
+		context.put("uploadID", formatter.format(Calendar.getInstance().getTime()));
+		final ArcArchivespecification arc = ArcSpecManager.GetInstance();
+		context.put("arc", arc);
+	}
+
+}
diff --git a/src/main/java/org/nrg/xnat/turbine/modules/screens/UploadAssistantPage.java b/src/main/java/org/nrg/xnat/turbine/modules/screens/UploadAssistantPage.java
new file mode 100644
index 00000000..25dbf7a1
--- /dev/null
+++ b/src/main/java/org/nrg/xnat/turbine/modules/screens/UploadAssistantPage.java
@@ -0,0 +1,24 @@
+/*
+ * org.nrg.xnat.turbine.modules.screens.ReportIssue
+ * XNAT http://www.xnat.org
+ * Copyright (c) 2014, Washington University School of Medicine
+ * All Rights Reserved
+ *
+ * Released under the Simplified BSD.
+ *
+ * Last modified 7/10/13 9:04 PM
+ */
+package org.nrg.xnat.turbine.modules.screens;
+
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+import org.nrg.xdat.turbine.modules.screens.SecureScreen;
+
+public class UploadAssistantPage extends SecureScreen {
+
+	@Override
+	protected void doBuildTemplate(RunData data, Context context) throws Exception {
+		// doesn't currently need any context, just needed to subclass SecureScreen
+	}
+
+}
diff --git a/src/main/java/org/nrg/xnat/turbine/modules/screens/UploadOptions.java b/src/main/java/org/nrg/xnat/turbine/modules/screens/UploadOptions.java
new file mode 100644
index 00000000..bf9f2a75
--- /dev/null
+++ b/src/main/java/org/nrg/xnat/turbine/modules/screens/UploadOptions.java
@@ -0,0 +1,41 @@
+/*
+ * org.nrg.xnat.turbine.modules.screens.ReportIssue
+ * XNAT http://www.xnat.org
+ * Copyright (c) 2014, Washington University School of Medicine
+ * All Rights Reserved
+ *
+ * Released under the Simplified BSD.
+ *
+ * Last modified 7/10/13 9:04 PM
+ */
+package org.nrg.xnat.turbine.modules.screens;
+
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+import org.nrg.xdat.om.ArcArchivespecification;
+import org.nrg.xdat.turbine.modules.screens.SecureScreen;
+import org.nrg.xnat.turbine.utils.ArcSpecManager;
+import org.nrg.xnat.utils.AppletConfig;
+import org.nrg.xnat.utils.XnatHttpUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nrg.framework.utilities.Reflection;
+import org.nrg.xdat.om.XnatPvisitdata;
+import org.nrg.xdat.turbine.utils.TurbineUtils;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.List;
+
+public class UploadOptions extends SecureScreen {
+
+	@Override
+	protected void doBuildTemplate(RunData data, Context context) throws Exception {
+		final SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd_hhmmss");
+		context.put("uploadID", formatter.format(Calendar.getInstance().getTime()));
+		final ArcArchivespecification arc = ArcSpecManager.GetInstance();
+		context.put("arc", arc);
+	}
+
+}
diff --git a/src/main/webapp/WEB-INF/tags/page/xnat.tag b/src/main/webapp/WEB-INF/tags/page/xnat.tag
index ea3d6e19..2fd10120 100644
--- a/src/main/webapp/WEB-INF/tags/page/xnat.tag
+++ b/src/main/webapp/WEB-INF/tags/page/xnat.tag
@@ -285,7 +285,16 @@ ${bodyTop}
                     <ul>
                         <!-- Sequence: 10 -->
                         <!-- Upload/Default -->
-                        <li><a href="${SITE_ROOT}/app/template/LaunchUploadApplet.vm">Images</a></li>
+                        <li><a href="${SITE_ROOT}/app/template/UploadOptions.vm">Images</a>
+                            <ul>
+                                <!-- Sequence: 10 -->
+                                <!-- Images -->
+                                <li><a href="${SITE_ROOT}/app/template/LaunchUploadApplet.vm">Upload Applet</a></li>
+                                <li><a href="${SITE_ROOT}/app/template/UploadAssistantPage.vm">Upload Assistant</a></li>
+                                <li><a href="${SITE_ROOT}/app/template/CompressedUploaderPage.vm">Compressed Uploader</a></li>
+                                <li><a href="${SITE_ROOT}/app/template/DICOMSCPPage.vm">DICOM SCP</a></li>
+                            </ul>
+                        </li>
                         <li><a href="${SITE_ROOT}/app/template/XMLUpload.vm">XML</a></li>
                         <li><a href="${SITE_ROOT}/app/template/XDATScreen_uploadCSV.vm">Spreadsheet</a></li>
                         <li><a href="${SITE_ROOT}/app/template/XDATScreen_prearchives.vm">Go to prearchive</a></li>
@@ -507,7 +516,7 @@ ${bodyTop}
                                 li$.find('ul.subnav').each(function(){
                                     var sub$ = $(this);
                                     var offsetL = sub$.closest('ul').outerWidth();
-                                    sub$.css({ 'left': offsetL + -25 })
+                                    sub$.css({ 'left': offsetL + -37 })
                                 });
                                 if (body$.hasClass('applet')) {
                                     coverApplet(li$.find('> ul'));
diff --git a/src/main/webapp/WEB-INF/tags/spawner/layout.tag b/src/main/webapp/WEB-INF/tags/spawner/layout.tag
index 9680c90c..b7875977 100644
--- a/src/main/webapp/WEB-INF/tags/spawner/layout.tag
+++ b/src/main/webapp/WEB-INF/tags/spawner/layout.tag
@@ -326,7 +326,16 @@
                 <ul>
                     <!-- Sequence: 10 -->
                     <!-- Upload/Default -->
-                    <li><a href="/app/template/LaunchUploadApplet.vm">Images</a></li>
+                    <li><a href="/app/template/UploadOptions.vm">Images</a>
+                        <ul>
+                            <!-- Sequence: 10 -->
+                            <!-- Images -->
+                            <li><a href="/app/template/LaunchUploadApplet.vm">Upload Applet</a></li>
+                            <li><a href="/app/template/UploadAssistantPage.vm">Upload Assistant</a></li>
+                            <li><a href="/app/template/CompressedUploaderPage.vm">Compressed Uploader</a></li>
+                            <li><a href="/app/template/DICOMSCPPage.vm">DICOM SCP</a></li>
+                        </ul>
+                    </li>
                     <li><a href="/app/template/XMLUpload.vm">XML</a></li>
                     <li><a href="/app/template/XDATScreen_uploadCSV.vm">Spreadsheet</a></li>
                     <li><a href="/app/template/XDATScreen_prearchives.vm">Go to prearchive</a></li>
@@ -535,7 +544,7 @@
                         li$.find('ul.subnav').each(function () {
                             var sub$ = $(this);
                             var offsetL = sub$.closest('ul').outerWidth();
-                            sub$.css({'left': offsetL + -25})
+                            sub$.css({'left': offsetL + -37})
                         });
                         if (body$.hasClass('applet')) {
                             coverApplet(li$.find('> ul'));
diff --git a/src/main/webapp/xnat-templates/navigations/DefaultTop.vm b/src/main/webapp/xnat-templates/navigations/DefaultTop.vm
index 4b7abb72..5b4c8152 100644
--- a/src/main/webapp/xnat-templates/navigations/DefaultTop.vm
+++ b/src/main/webapp/xnat-templates/navigations/DefaultTop.vm
@@ -200,7 +200,7 @@
                     li$.find('ul.subnav').each(function(){
                         var sub$ = $(this);
                         var offsetL = sub$.closest('ul').outerWidth();
-                        sub$.css({ 'left': offsetL + -25 })
+                        sub$.css({ 'left': offsetL + -37 })
                     });
                     if (body$.hasClass('applet')) {
                         coverApplet(li$.find('> ul'));
diff --git a/src/main/webapp/xnat-templates/screens/CompressedUploaderPage.vm b/src/main/webapp/xnat-templates/screens/CompressedUploaderPage.vm
new file mode 100644
index 00000000..cdb8ad38
--- /dev/null
+++ b/src/main/webapp/xnat-templates/screens/CompressedUploaderPage.vm
@@ -0,0 +1,579 @@
+<script type="text/javascript">
+    function disableForm(theform) {
+        if (document.getElementById) {
+            document.getElementById('progressBar').style.display = 'block';
+        }
+        else if (document.all) {
+            document.all['progressBar'].style.display = 'block';
+        }
+
+        if (document.all || document.getElementById) {
+            for (i = 0; i < theform.length; i++) {
+                var tempobj = theform.elements[i];
+                if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset" || tempobj.type.toLowerCase() == "button")
+                    tempobj.disabled = true;
+            }
+            return true;
+        }
+        else {
+            return true;
+        }
+    }
+
+    function enableForm() {
+        var theform;
+        if (document.getElementById) {
+            theform = document.getElementById('uploadFORM');
+        }
+        else if (document.all) {
+            theform = document.all['uploadFORM'];
+        }
+
+        if (document.all || document.getElementById) {
+            for (i = 0; i < theform.length; i++) {
+                var tempobj = theform.elements[i];
+                if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset" || tempobj.type.toLowerCase() == "button")
+                    tempobj.disabled = false;
+            }
+            return true;
+        } else {
+            return true;
+        }
+    }
+</script>
+<script type="text/javascript">
+    var i;
+    var req;
+
+    var uploadCount = 0;
+    var extractCount = 0;
+    var progressBar;
+    var progressPercent;
+    var uploadID = "$uploadID";
+    var started = 0;
+    var extractTimeOut = 300;
+
+    function setUploadProgress(i) {
+        if (i == 0) {
+            document.getElementById("uploadPercent").innerHTML = "";
+            document.getElementById("uploadBar").style.width = 0 + "px";
+        } else {
+            if (i > 100) {
+
+            } else {
+                var pixels = i * 3;
+                if (i > 10) {
+                    document.getElementById("uploadPercent").innerHTML = parseInt(i) + "%";
+                }
+                else {
+                    document.getElementById('preparing').innerHTML = "";
+                }
+                document.getElementById("uploadBar").style.width = pixels + "px";
+                document.getElementById('preparing').innerHTML = "Loading File...&nbsp";
+            }
+        }
+    }
+
+    function setExtractSummary(jsonobj) {
+        var messages = "";
+        try {
+            var respPos = jsonobj.msgs[0].length - 1;
+            for (i = 0; i <= respPos; i++) {
+                var level = jsonobj.msgs[0][i].status;
+                var message = jsonobj.msgs[0][i].msg;
+                if (level == "COMPLETED") {
+                    message = "<tr bgcolor='#CCFFCC'><td>" + message;
+                } else if (level == "PROCESSING") {
+                    message = "<tr bgcolor='#CCFFFF'><td>" + message;
+                } else if (level == "WARNING") {
+                    message = "<tr bgcolor='#FFCCC'><td>" + message;
+                } else if (level == "FAILED") {
+                    message = "<tr bgcolor='#FF99CC'><td>" + message;
+                } else {
+                    message = "<tr bgcolor='#CCCCCC'><td>" + message;
+                }
+                messages = messages + message + "</td></tr>";
+            }
+        } catch (e) {
+        }
+        document.getElementById("extractSummary").innerHTML =
+                "<table width='100%' cellpadding='2' cellspacing='0'><tr><th>Extraction / Review summary:</th></tr>" +
+                messages +
+                "</table>";
+    }
+
+    function toggleExtractSummary() {
+        if (document.getElementById("extractSummary").style.display == "none") {
+            document.getElementById("extractSummaryTable").border = "1";
+            document.getElementById("extractSummary").style.display = "block";
+        } else {
+            document.getElementById("extractSummaryTable").border = "0";
+            document.getElementById("extractSummary").style.display = "none";
+        }
+    }
+
+    function setExtractProgress(i) {
+        if (i == 0) {
+            document.getElementById("extractPercent").innerHTML = "";
+            document.getElementById("extractBar").style.width = 0 + "px";
+        } else {
+            if (i > 100) {
+
+            } else {
+                var pixels = i * 3;
+                if (i > 10) {
+                    document.getElementById("extractPercent").innerHTML = parseInt(i) + "%";
+                }
+                document.getElementById("extractBar").style.width = pixels + "px";
+            }
+        }
+    }
+
+    function evaluateDestination(ele) {
+        if (ele.value == '2') {
+            document.getElementById("auto-archive").value = 'true';
+            document.getElementById("quarantine").value = 'true';
+        } else if (ele.value == '1') {
+            document.getElementById("auto-archive").value = 'true';
+            document.getElementById("quarantine").value = 'false';
+        } else if (ele.value == '0') {
+            document.getElementById("auto-archive").value = 'false';
+            document.getElementById("quarantine").value = 'false';
+        }
+    }
+
+    var checkProgressFinal = 0;
+
+    function prog(theform) {
+        var imageArchive = document.getElementById("image_archive");
+        if (!imageArchive.value) {
+            xModalMessage('Upload Action', 'Please select an archive to upload.');
+            return false;
+        }
+        if (!(imageArchive.value.endsWith(".gz") || imageArchive.value.endsWith(".tgz") || imageArchive.value.endsWith(".zip"))) {
+            xModalMessage('Upload Action', 'Please select a tar or zip archive to upload.');
+            return false;
+        }
+        if (document.getElementById("project").selectedIndex == 0) {
+            xModalMessage('Upload Action', 'Please select a $displayManager.getSingularDisplayNameForProject().toLowerCase().');
+            return false;
+        }
+        disableForm(theform);
+        document.getElementById("iframe").src = "";
+        started = 0;
+        checkProgressFinal = 0;
+        progressBar = document.getElementById("uploadBar");
+        progressPercent = document.getElementById("uploadPercent");
+
+        document.getElementById('preparing').style.display = 'block';
+        document.getElementById('preparing').innerHTML = "Loading File...&nbsp";
+        setUploadProgress(0);
+        setExtractProgress(0);
+        setExtractSummary("");
+        resetProgress();
+        checkProgress();
+
+        return true;
+    }
+
+    function callback() {
+        if (req.readyState == 4) {
+            if (req.status == 200) {
+                started = 1;
+                // handle response
+                var respDat = YAHOO.lang.JSON.parse(req.responseText);
+                var respPos = respDat.msgs[0].length - 1;
+                var uploadI = 0;
+                var extractI = 0;
+                var statusCount = 0;
+                if (respDat.msgs[0].length > 0) {
+                    if (respDat.msgs[0].length > 0) {
+                        var level = respDat.msgs[0][respPos].status;
+                        var message = respDat.msgs[0][respPos].msg;
+                    }
+                }
+
+                if (req.responseText.indexOf("file uploaded") >= 0) {
+                    uploadI = 100;
+                }
+                if (req.responseText.indexOf("Successfully uploaded") >= 0) {
+                    extractI = 100;
+                }
+                if (req.responseText.indexOf("archiving operation complete") >= 0) {
+                    extractI = 100;
+                }
+                setExtractSummary(respDat);
+                setCurrentStep(message);
+
+                //alert("Upload(" + uploadI + "); Extract(" + extractI + ");\r\n" + statusText + "\r\n" + req.responseText);
+
+                if (uploadI == -1) {
+                    document.getElementById('preparing').innerHTML = "&nbsp;&nbsp;&nbsp;<font color=red><B>Error: Upload Failed.  Please retry at a later time or contact technical support.</B></font>";
+                    document.getElementById('preparing').style.display = 'block';
+                } else if (extractI == -1) {
+                    document.getElementById('preparing').innerHTML = "&nbsp;&nbsp;&nbsp;<font color=red><B>Error: Extraction/Review Failed.  Please verify the integrity of the zipped file and the contained image files.</B></font>";
+                    document.getElementById('preparing').style.display = 'block';
+                } else if (uploadI != 100) {
+                    //upload complete
+
+                    if (uploadCount != 98) {
+                        uploadCount = uploadCount + 1;
+                    }
+
+                    if (uploadCount > 40) {
+                        extractTimeOut = 600;
+                    }
+                    if (uploadCount > 50) {
+                        extractTimeOut = 800;
+                    }
+                    if (uploadCount > 60) {
+                        extractTimeOut = 1000;
+                    }
+                    if (uploadCount > 70) {
+                        extractTimeOut = 2000;
+                    }
+                    if (uploadCount > 80) {
+                        extractTimeOut = 3000;
+                    }
+                    if (uploadCount > 85) {
+                        extractTimeOut = 6000;
+                    }
+                    if (uploadCount > 88) {
+                        extractTimeOut = 9000;
+                    }
+
+                    setUploadProgress(uploadCount);
+                    setExtractProgress(0);
+
+                    setTimeout("checkProgress();", extractTimeOut);
+                } else if (extractI == 100) {
+                    //extract complete
+                    setUploadProgress(100);
+                    setExtractProgress(100);
+
+                    setExtractSummary(respDat);
+                    setCurrentStep(message);
+                    if (checkProgressFinal == 0) {
+                        checkProgressFinal = 1;
+                        //check progress one final time to capture final step summary
+                        setTimeout("checkProgress();", 200);
+                    }
+                } else {
+                    //extract in progress
+                    setUploadProgress(100);
+
+                    if (extractCount != 98) {
+                        extractCount = extractCount + 1;
+                    }
+                    if (extractCount < 10) {
+                        extractTimeOut = 500;
+                    }
+                    if (extractCount > 10) {
+                        extractTimeOut = 100;
+                    }
+                    if (extractCount > 20) {
+                        extractTimeOut = 1500;
+                    }
+                    if (extractCount > 30) {
+                        extractTimeOut = 2000;
+                    }
+                    if (extractCount > 50) {
+                        extractTimeOut = 2800;
+                    }
+                    if (extractCount > 60) {
+                        extractTimeOut = 3300;
+                    }
+                    if (extractCount > 70) {
+                        extractTimeOut = 4000;
+                    }
+                    if (extractCount > 80) {
+                        extractTimeOut = 5000;
+                    }
+                    if (extractCount > 85) {
+                        extractTimeOut = 6000;
+                    }
+                    if (extractCount > 88) {
+                        extractTimeOut = 9000;
+                    }
+
+                    setExtractProgress(extractCount);
+
+                    if (statusCount > 0) {
+                        setExtractSummary(respDat);
+                        setCurrentStep(message);
+                    }
+                    setTimeout("checkProgress();", extractTimeOut);
+                }
+            }
+        }
+    }
+
+
+    function setCurrentStep(message) {
+        if (message != null && message != undefined) {
+            document.getElementById("current_step").innerHTML = "<A href='' ONCLICK='toggleExtractSummary();return false;'>" + message + "...</A>";
+        }
+    }
+
+    function resetProgress() {
+        var url = "$content.getURI("servlet/AjaxServlet")?remote-class=org.nrg.xnat.ajax.UploadProgress";
+        url = url + "&remote-method=start";
+        url = url + "&ID=" + uploadID;
+        if (window.XMLHttpRequest) {
+            req = new XMLHttpRequest();
+        } else if (window.ActiveXObject) {
+            req = new ActiveXObject("Microsoft.XMLHTTP");
+        }
+        req.open("GET", url, true);
+        req.send(null);
+    }
+
+    function checkProgress() {
+        //var url = "$content.getURI("/REST/status/$uploadID")?format=json";
+        var url = "$content.getURI("/REST/status/$uploadID")?format=json&stamp=" + (new Date()).getTime();
+        if (window.XMLHttpRequest) {
+            req = new XMLHttpRequest();
+        } else if (window.ActiveXObject) {
+            req = new ActiveXObject("Microsoft.XMLHTTP");
+        }
+        req.open("GET", url, true);
+        req.onreadystatechange = callback;
+        req.send(null);
+    }
+    function makeTheFormGo() {
+        var form = document.getElementById("uploadFORM");
+        prog(form);
+        form.submit();
+    }
+</script>
+
+<table border="0" cellpadding="5" cellspacing="0">
+    <tr>
+        <td>
+            <h4>
+                Compressed upload</h4></td>
+    </tr>
+    <tr>
+        <td valign="top" align="left">
+            <div style="width:500px">Raw image files can be zipped (.zip or .tar.gz) and uploaded using the form. This
+                tool currently supports DICOM and ECAT files. Selecting 'Prearchive' will place your images into a
+                temporary holding space. You will then have the ability to review the details and match the data to the
+                proper $displayManager.getSingularDisplayNameForSubject().toLowerCase() & $displayManager.getSingularDisplayNameForImageSession().toLowerCase() ID. If you are confident the data will be mapped properly, you can directly
+                'Archive' the files and specify whether the resulting $displayManager.getSingularDisplayNameForImageSession().toLowerCase() should go into a quarantine state.
+            </div>
+            <div class="alert" style="margin:15px 0;max-width:696px;min-width:400px;">
+                The compressed uploader does not yet support splitting PET/MR sessions based on the site-wide or
+                project-specific settings for handling PET/MR data. If you are uploading PET/MR data and need to have
+                the data split into separate PET and MR sessions or created as a PET session rather than a PET/MR
+                session, you should use either the <a href="$link.setPage("LaunchUploadApplet.vm")">upload applet</a> or the
+                DICOM C-STORE receiver as described below.
+            </div>
+        </td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+    </tr>
+    <tr id="option1">
+        <td>
+            <input type="hidden" name="popup" value="true"/>
+            <form id="uploadFORM" class="noHide" target="iframe" enctype="multipart/form-data" method="POST"
+                  action="$content.getURI("/REST/services/import?http-session-listener=$uploadID&format=html&XNAT_CSRF=$!XNAT_CSRF")">
+                <input type="hidden" name="threshhold" value="51516279"/>
+
+                #if($session)
+                    <input type="hidden" name="EXPT_LABEL" value="$!session.getLabel()"/>
+                    <input type="hidden" name="SUBJECT_ID" value="$!session.getSubjectData().getLabel()"/>
+                #end
+
+                <table border=0 cellpadding="5" cellspacing="0">
+                    <tr>
+                        <th align="left">$displayManager.getSingularDisplayNameForProject()</th>
+                        <td>
+                            #if(!$session)
+                                <select id="project" name="project" disabled=true></select>
+                            #else
+                                <input type="hidden" name="project" id="project"
+                                       value="$session.getProject()"/>$session.getProject()
+                            #end
+                        </td>
+                    </tr>
+
+                    #if($session)
+                        <tr>
+                            <th align="left">$displayManager.getSingularDisplayNameForImageSession()</th>
+                            <td>$!session.getLabel()</td>
+                        </tr>
+                    #end
+                    <tr>
+                        <th align="left">Destination</th>
+                        <td>
+                            <label><input id="pc_0" type='radio' name='prearchive_code' value='0'
+                                          #if(!$session)CHECKED#end onchange="evaluateDestination(this)"/>
+                                Prearchive</label>&nbsp;&nbsp;&nbsp;
+                            <label><input id="pc_2" type='radio' name='prearchive_code' value='1'
+                                          #if($session)CHECKED#end onchange="evaluateDestination(this)"/>
+                                Archive</label>
+                            #if($session)
+                                <input type="hidden" name="overwrite" value="append"/>
+                                <input type="hidden" id="auto-archive" name='auto-archive' value='TRUE'/>
+                            #else
+                                <input type="hidden" id="auto-archive" name='auto-archive' value='FALSE'/>
+                            #end
+                            <input type="hidden" id="quarantine" name='quarantine' value='FALSE'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th align="left">File</th>
+                        <td><input type="file" id="image_archive" name="image_archive" size="60"
+                                   accept="application/zip, application/x-gzip, application/x-tgz"/></td>
+                    </tr>
+                    #auditBoxes("3" "" "Standard Upload" "Upload Images")
+                    #hideFormJustification()
+                    <tr>
+                        <td>&nbsp;</td>
+                        <td><input id="directButton" type="button" name="eventSubmit_doPerform" value="Begin Upload" onclick="makeTheFormGo();"/>
+                        </td>
+                    </tr>
+                </table>
+            </form>
+
+<span id="progressBar" style="position:relative; display:none;">
+<div id="ex" style="position:relative;width:468px;background:#eeeeee;border:3px double #000000;">
+    <table width="100%">
+        <tr>
+            <td colspan=2 align="left">
+                <div id="preparing">Loading File...&nbsp;</div>
+            </td>
+        </tr>
+        <tr>
+            <td>
+                <div id="uploadLabel">Upload:&nbsp;</div>
+            </td>
+            <td align="center">
+                <div id="emptyUpload"
+                     style="background-color:#cccccc;border:1px solid black;height:22px;width:300px;padding:0;"
+                     align="left">
+                    <div id="uploadBar"
+                         style="position:relative;top:0;left:0;background-color:#333333;height:22px;width:0;padding-top:5px;padding:0;">
+                        <div id="uploadPercent"
+                             style="position:relative;top:0;left:0;color:#f0ffff;height:22px;text-align:center;font:bold;padding:0;padding-top:5px;">
+                        </div>
+                    </div>
+                </div>
+            </td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td>
+                <div id="extractLabel">Extract/Review:&nbsp;</div>
+            </td>
+            <td align="center">
+                <div id="emptyExtract"
+                     style="background-color:#cccccc;border:1px solid black;height:22px;width:300px;padding:0;"
+                     align="left">
+                    <div id="extractBar"
+                         style="position:relative;top:0;left:0;background-color:#333333;height:22px;width:0;padding-top:5px;padding:0;">
+                        <div id="extractPercent"
+                             style="position:relative;top:0;left:0;color:#f0ffff;height:22px;text-align:center;font:bold;padding:0;padding-top:5px;">
+                        </div>
+                    </div>
+                </div>
+            </td>
+        </tr>
+        <tr>
+            <td colspan=2 align="center">
+                <div id="current_step"></div>
+            </td>
+        </tr>
+    </table>
+</div>
+<br>
+<table id="extractSummaryTable" border=0 style="border-collapse: collapse;">
+    <tr>
+        <td>
+            <span id="extractSummary"
+                  style="position:relative;width:468px;height:100px;display:none;overflow:auto;	"></span>
+        </td>
+    </tr>
+</table>
+<br>
+<iframe id="iframe" name="iframe" src="" width="468" height="80" frameborder="0">
+    PROGRESS BAR DISABLED. <br>Try using a more recent web browser.
+</iframe>
+</span>
+            <script type="text/javascript">
+                progressBar = document.getElementById("uploadBar");
+                progressPercent = document.getElementById("uploadPercent");
+            </script>
+        </td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+    </tr>
+    <script type="text/javascript">
+        // Adapted from Sun Java Web Start Auto-Install Demo
+        // http://java.sun.com/developer/technicalArticles/JavaLP/javawebstart/AutoInstallDemo.html
+        var detect = navigator.userAgent.toLowerCase();
+        var windowsIE = (checkPlatform("msie") && checkPlatform("win"));
+
+        function checkPlatform(string) {
+            place = detect.indexOf(string) + 1;
+            thestring = string;
+            return place;
+        }
+    </script>
+</table>
+
+#if(!$session)
+<script type="text/javascript" src="$content.getURI('scripts/subjectAssessorData/proj_tools.js')"></script>
+
+<script type="text/javascript">
+    //load projects
+    window.defaultProject = "$!project";
+
+    window.projectLoader = new ProjectLoader();
+
+    window.projectLoader.onLoadComplete.subscribe(function () {
+        renderProjects(document.getElementById("project"), window.projectLoader.list, window.defaultProject);
+    });
+
+    document.getElementById("project").onchange = function (o) {
+        if (this.selectedIndex > 0) {
+            var s = this.options[this.selectedIndex];
+            var pc = document.getElementById("pc_0");
+            if (pc != undefined && pc != null) {
+                if (s.pc == "4") {
+                    if (s.qc == "0") {
+                        document.getElementById("pc_2").click();
+                    } else {
+                        document.getElementById("pc_1").click();
+                    }
+                } else {
+                    document.getElementById("pc_0").click();
+                }
+            }
+        }
+    };
+
+    window.projectLoader.init();
+
+    function prepApplet(_form) {
+        return true;
+    }
+
+    //build breadcrumb
+    var breadcrumbs = document.getElementById('breadcrumbs');
+
+    if (breadcrumbs != null) {
+        var bread = "";
+        #if($project)
+            bread = bread + "<a href='$link.setAction("DisplayItemAction").addPathInfo("search_element","xnat:projectData").addPathInfo("search_field","xnat:projectData.ID").addPathInfo("search_value","$project")'>$displayManager.getSingularDisplayNameForProject().toUpperCase(): $!project</a>";
+            bread = bread + "&nbsp;>&nbsp;Upload Images";
+        #end
+        breadcrumbs.innerHTML = bread;
+    }
+
+</script>
+#end
\ No newline at end of file
diff --git a/src/main/webapp/xnat-templates/screens/DICOMSCPPage.vm b/src/main/webapp/xnat-templates/screens/DICOMSCPPage.vm
new file mode 100644
index 00000000..e40241f0
--- /dev/null
+++ b/src/main/webapp/xnat-templates/screens/DICOMSCPPage.vm
@@ -0,0 +1,24 @@
+<table>
+<tr>
+    <td>
+        <h4>DICOM C-STORE Service Class User</h4>
+    </td>
+</tr>
+<tr>
+    <td valign="top" align="left">
+        <div style="width:500px">Any DICOM C-STORE SCU, including scanner consoles or DICOM applications like
+            <a href="http://www.osirix-viewer.com">OsiriX</a> or <a href="http://nrg.wustl.edu/software/dicom-browser">DicomBrowser</a>,
+            can send files directly to this server.
+        </div>
+</tr>
+<tr id="option4">
+    <td>
+        <br><b>DICOM C-STORE receiver (SCP) Specifications</b>
+        <ul>
+            <li>Host Name: $!arc.getDcm_dcmHost()</li>
+            <li>Port: $!arc.getDcm_dcmPort()</li>
+            <li>AE Title(s): $!arc.getDcm_dcmAe()</li>
+        </ul>
+    </td>
+</tr>
+    </table>
\ No newline at end of file
diff --git a/src/main/webapp/xnat-templates/screens/LaunchUploadApplet.vm b/src/main/webapp/xnat-templates/screens/LaunchUploadApplet.vm
index b41ea47f..b0d56362 100644
--- a/src/main/webapp/xnat-templates/screens/LaunchUploadApplet.vm
+++ b/src/main/webapp/xnat-templates/screens/LaunchUploadApplet.vm
@@ -125,8 +125,6 @@
  </div> <!-- end of hideIfProtocol -->
 <div id="forProtocolContent" style="display:none"></div>
 
-    <p style="width:500px;margin:20px 0;">Looking for other ways to upload images? <a href="$link.setPage("AlternateImageUpload.vm")">Click here.</a></p>
-
 </form>
 
 <script type="text/javascript">
diff --git a/src/main/webapp/xnat-templates/screens/UploadAssistantPage.vm b/src/main/webapp/xnat-templates/screens/UploadAssistantPage.vm
new file mode 100644
index 00000000..20c3dc90
--- /dev/null
+++ b/src/main/webapp/xnat-templates/screens/UploadAssistantPage.vm
@@ -0,0 +1,12 @@
+<table>
+        <tr>
+            <td>
+                <h4>Download Upload Assistant application</h4>
+            </td>
+        </tr>
+        <tr>
+            <td valign="top" align="left">
+                <div style="width:500px">You can download the XNAT Upload Assistant application and use it to upload your session. If the Upload Applet does not work for you, you might want to try this. <a href="https://bitbucket.org/xnatdev/upload-assistant/downloads">Click here</a> to find the appropriate version of the XNAT Upload Assistant application for your operating system.
+                </div>
+        </tr>
+</table>
\ No newline at end of file
diff --git a/src/main/webapp/xnat-templates/screens/UploadOptions.vm b/src/main/webapp/xnat-templates/screens/UploadOptions.vm
new file mode 100644
index 00000000..89b03f05
--- /dev/null
+++ b/src/main/webapp/xnat-templates/screens/UploadOptions.vm
@@ -0,0 +1,646 @@
+<script type="text/javascript">
+    function disableForm(theform) {
+        if (document.getElementById) {
+            document.getElementById('progressBar').style.display = 'block';
+        }
+        else if (document.all) {
+            document.all['progressBar'].style.display = 'block';
+        }
+
+        if (document.all || document.getElementById) {
+            for (i = 0; i < theform.length; i++) {
+                var tempobj = theform.elements[i];
+                if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset" || tempobj.type.toLowerCase() == "button")
+                    tempobj.disabled = true;
+            }
+            return true;
+        }
+        else {
+            return true;
+        }
+    }
+
+    function enableForm() {
+        var theform;
+        if (document.getElementById) {
+            theform = document.getElementById('uploadFORM');
+        }
+        else if (document.all) {
+            theform = document.all['uploadFORM'];
+        }
+
+        if (document.all || document.getElementById) {
+            for (i = 0; i < theform.length; i++) {
+                var tempobj = theform.elements[i];
+                if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset" || tempobj.type.toLowerCase() == "button")
+                    tempobj.disabled = false;
+            }
+            return true;
+        } else {
+            return true;
+        }
+    }
+</script>
+<script type="text/javascript">
+    var i;
+    var req;
+
+    var uploadCount = 0;
+    var extractCount = 0;
+    var progressBar;
+    var progressPercent;
+    var uploadID = "$uploadID";
+    var started = 0;
+    var extractTimeOut = 300;
+
+    function setUploadProgress(i) {
+        if (i == 0) {
+            document.getElementById("uploadPercent").innerHTML = "";
+            document.getElementById("uploadBar").style.width = 0 + "px";
+        } else {
+            if (i > 100) {
+
+            } else {
+                var pixels = i * 3;
+                if (i > 10) {
+                    document.getElementById("uploadPercent").innerHTML = parseInt(i) + "%";
+                }
+                else {
+                    document.getElementById('preparing').innerHTML = "";
+                }
+                document.getElementById("uploadBar").style.width = pixels + "px";
+                document.getElementById('preparing').innerHTML = "Loading File...&nbsp";
+            }
+        }
+    }
+
+    function setExtractSummary(jsonobj) {
+        var messages = "";
+        try {
+            var respPos = jsonobj.msgs[0].length - 1;
+            for (i = 0; i <= respPos; i++) {
+                var level = jsonobj.msgs[0][i].status;
+                var message = jsonobj.msgs[0][i].msg;
+                if (level == "COMPLETED") {
+                    message = "<tr bgcolor='#CCFFCC'><td>" + message;
+                } else if (level == "PROCESSING") {
+                    message = "<tr bgcolor='#CCFFFF'><td>" + message;
+                } else if (level == "WARNING") {
+                    message = "<tr bgcolor='#FFCCC'><td>" + message;
+                } else if (level == "FAILED") {
+                    message = "<tr bgcolor='#FF99CC'><td>" + message;
+                } else {
+                    message = "<tr bgcolor='#CCCCCC'><td>" + message;
+                }
+                messages = messages + message + "</td></tr>";
+            }
+        } catch (e) {
+        }
+        document.getElementById("extractSummary").innerHTML =
+                "<table width='100%' cellpadding='2' cellspacing='0'><tr><th>Extraction / Review summary:</th></tr>" +
+                messages +
+                "</table>";
+    }
+
+    function toggleExtractSummary() {
+        if (document.getElementById("extractSummary").style.display == "none") {
+            document.getElementById("extractSummaryTable").border = "1";
+            document.getElementById("extractSummary").style.display = "block";
+        } else {
+            document.getElementById("extractSummaryTable").border = "0";
+            document.getElementById("extractSummary").style.display = "none";
+        }
+    }
+
+    function setExtractProgress(i) {
+        if (i == 0) {
+            document.getElementById("extractPercent").innerHTML = "";
+            document.getElementById("extractBar").style.width = 0 + "px";
+        } else {
+            if (i > 100) {
+
+            } else {
+                var pixels = i * 3;
+                if (i > 10) {
+                    document.getElementById("extractPercent").innerHTML = parseInt(i) + "%";
+                }
+                document.getElementById("extractBar").style.width = pixels + "px";
+            }
+        }
+    }
+
+    function evaluateDestination(ele) {
+        if (ele.value == '2') {
+            document.getElementById("auto-archive").value = 'true';
+            document.getElementById("quarantine").value = 'true';
+        } else if (ele.value == '1') {
+            document.getElementById("auto-archive").value = 'true';
+            document.getElementById("quarantine").value = 'false';
+        } else if (ele.value == '0') {
+            document.getElementById("auto-archive").value = 'false';
+            document.getElementById("quarantine").value = 'false';
+        }
+    }
+
+    var checkProgressFinal = 0;
+
+    function prog(theform) {
+        var imageArchive = document.getElementById("image_archive");
+        if (!imageArchive.value) {
+            xModalMessage('Upload Action', 'Please select an archive to upload.');
+            return false;
+        }
+        if (!(imageArchive.value.endsWith(".gz") || imageArchive.value.endsWith(".tgz") || imageArchive.value.endsWith(".zip"))) {
+            xModalMessage('Upload Action', 'Please select a tar or zip archive to upload.');
+            return false;
+        }
+        if (document.getElementById("project").selectedIndex == 0) {
+            xModalMessage('Upload Action', 'Please select a $displayManager.getSingularDisplayNameForProject().toLowerCase().');
+            return false;
+        }
+        disableForm(theform);
+        document.getElementById("iframe").src = "";
+        started = 0;
+        checkProgressFinal = 0;
+        progressBar = document.getElementById("uploadBar");
+        progressPercent = document.getElementById("uploadPercent");
+
+        document.getElementById('preparing').style.display = 'block';
+        document.getElementById('preparing').innerHTML = "Loading File...&nbsp";
+        setUploadProgress(0);
+        setExtractProgress(0);
+        setExtractSummary("");
+        resetProgress();
+        checkProgress();
+
+        return true;
+    }
+
+    function callback() {
+        if (req.readyState == 4) {
+            if (req.status == 200) {
+                started = 1;
+                // handle response
+                var respDat = YAHOO.lang.JSON.parse(req.responseText);
+                var respPos = respDat.msgs[0].length - 1;
+                var uploadI = 0;
+                var extractI = 0;
+                var statusCount = 0;
+                if (respDat.msgs[0].length > 0) {
+                    if (respDat.msgs[0].length > 0) {
+                        var level = respDat.msgs[0][respPos].status;
+                        var message = respDat.msgs[0][respPos].msg;
+                    }
+                }
+
+                if (req.responseText.indexOf("file uploaded") >= 0) {
+                    uploadI = 100;
+                }
+                if (req.responseText.indexOf("Successfully uploaded") >= 0) {
+                    extractI = 100;
+                }
+                if (req.responseText.indexOf("archiving operation complete") >= 0) {
+                    extractI = 100;
+                }
+                setExtractSummary(respDat);
+                setCurrentStep(message);
+
+                //alert("Upload(" + uploadI + "); Extract(" + extractI + ");\r\n" + statusText + "\r\n" + req.responseText);
+
+                if (uploadI == -1) {
+                    document.getElementById('preparing').innerHTML = "&nbsp;&nbsp;&nbsp;<font color=red><B>Error: Upload Failed.  Please retry at a later time or contact technical support.</B></font>";
+                    document.getElementById('preparing').style.display = 'block';
+                } else if (extractI == -1) {
+                    document.getElementById('preparing').innerHTML = "&nbsp;&nbsp;&nbsp;<font color=red><B>Error: Extraction/Review Failed.  Please verify the integrity of the zipped file and the contained image files.</B></font>";
+                    document.getElementById('preparing').style.display = 'block';
+                } else if (uploadI != 100) {
+                    //upload complete
+
+                    if (uploadCount != 98) {
+                        uploadCount = uploadCount + 1;
+                    }
+
+                    if (uploadCount > 40) {
+                        extractTimeOut = 600;
+                    }
+                    if (uploadCount > 50) {
+                        extractTimeOut = 800;
+                    }
+                    if (uploadCount > 60) {
+                        extractTimeOut = 1000;
+                    }
+                    if (uploadCount > 70) {
+                        extractTimeOut = 2000;
+                    }
+                    if (uploadCount > 80) {
+                        extractTimeOut = 3000;
+                    }
+                    if (uploadCount > 85) {
+                        extractTimeOut = 6000;
+                    }
+                    if (uploadCount > 88) {
+                        extractTimeOut = 9000;
+                    }
+
+                    setUploadProgress(uploadCount);
+                    setExtractProgress(0);
+
+                    setTimeout("checkProgress();", extractTimeOut);
+                } else if (extractI == 100) {
+                    //extract complete
+                    setUploadProgress(100);
+                    setExtractProgress(100);
+
+                    setExtractSummary(respDat);
+                    setCurrentStep(message);
+                    if (checkProgressFinal == 0) {
+                        checkProgressFinal = 1;
+                        //check progress one final time to capture final step summary
+                        setTimeout("checkProgress();", 200);
+                    }
+                } else {
+                    //extract in progress
+                    setUploadProgress(100);
+
+                    if (extractCount != 98) {
+                        extractCount = extractCount + 1;
+                    }
+                    if (extractCount < 10) {
+                        extractTimeOut = 500;
+                    }
+                    if (extractCount > 10) {
+                        extractTimeOut = 100;
+                    }
+                    if (extractCount > 20) {
+                        extractTimeOut = 1500;
+                    }
+                    if (extractCount > 30) {
+                        extractTimeOut = 2000;
+                    }
+                    if (extractCount > 50) {
+                        extractTimeOut = 2800;
+                    }
+                    if (extractCount > 60) {
+                        extractTimeOut = 3300;
+                    }
+                    if (extractCount > 70) {
+                        extractTimeOut = 4000;
+                    }
+                    if (extractCount > 80) {
+                        extractTimeOut = 5000;
+                    }
+                    if (extractCount > 85) {
+                        extractTimeOut = 6000;
+                    }
+                    if (extractCount > 88) {
+                        extractTimeOut = 9000;
+                    }
+
+                    setExtractProgress(extractCount);
+
+                    if (statusCount > 0) {
+                        setExtractSummary(respDat);
+                        setCurrentStep(message);
+                    }
+                    setTimeout("checkProgress();", extractTimeOut);
+                }
+            }
+        }
+    }
+
+
+    function setCurrentStep(message) {
+        if (message != null && message != undefined) {
+            document.getElementById("current_step").innerHTML = "<A href='' ONCLICK='toggleExtractSummary();return false;'>" + message + "...</A>";
+        }
+    }
+
+    function resetProgress() {
+        var url = "$content.getURI("servlet/AjaxServlet")?remote-class=org.nrg.xnat.ajax.UploadProgress";
+        url = url + "&remote-method=start";
+        url = url + "&ID=" + uploadID;
+        if (window.XMLHttpRequest) {
+            req = new XMLHttpRequest();
+        } else if (window.ActiveXObject) {
+            req = new ActiveXObject("Microsoft.XMLHTTP");
+        }
+        req.open("GET", url, true);
+        req.send(null);
+    }
+
+    function checkProgress() {
+        //var url = "$content.getURI("/REST/status/$uploadID")?format=json";
+        var url = "$content.getURI("/REST/status/$uploadID")?format=json&stamp=" + (new Date()).getTime();
+        if (window.XMLHttpRequest) {
+            req = new XMLHttpRequest();
+        } else if (window.ActiveXObject) {
+            req = new ActiveXObject("Microsoft.XMLHTTP");
+        }
+        req.open("GET", url, true);
+        req.onreadystatechange = callback;
+        req.send(null);
+    }
+    function makeTheFormGo() {
+        var form = document.getElementById("uploadFORM");
+        prog(form);
+        form.submit();
+    }
+</script>
+
+<table border="0" cellpadding="5" cellspacing="0">
+    <tr>
+        <td>&nbsp;</td>
+    </tr>
+    <tr>
+        <td><h3>Options for Uploading $displayManager.getPluralDisplayNameForImageSession()</h3></td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+    </tr>
+
+
+        <tr>
+            <td>
+                <hr/>
+                <h4>Option 1: Upload Applet</h4>
+            </td>
+        </tr>
+        <tr>
+            <td valign="top" align="left">
+                <div style="width:500px">DICOM and ECAT files can be uploaded via the Upload Applet. <a href="$link.setPage("LaunchUploadApplet.vm")">Click here</a> to upload using the Upload Applet.
+                </div>
+        </tr>
+
+
+
+        <tr>
+            <td>
+                <hr/>
+                <h4>Option 2: Download Upload Assistant application</h4>
+            </td>
+        </tr>
+        <tr>
+            <td valign="top" align="left">
+                <div style="width:500px">You can download the XNAT Upload Assistant application and use it to upload your session. If the Upload Applet does not work for you, you might want to try this. <a href="https://bitbucket.org/xnatdev/upload-assistant/downloads">Click here</a> to find the appropriate version of the XNAT Upload Assistant application for your operating system.
+                </div>
+        </tr>
+
+
+
+    <tr>
+        <td>
+            <hr/>
+            <h4>
+                    Option 3: Compressed upload</h4></td>
+    </tr>
+    <tr>
+        <td valign="top" align="left">
+            <div style="width:500px">Raw image files can be zipped (.zip or .tar.gz) and uploaded using the form. This
+                tool currently supports DICOM and ECAT files. Selecting 'Prearchive' will place your images into a
+                temporary holding space. You will then have the ability to review the details and match the data to the
+                proper $displayManager.getSingularDisplayNameForSubject().toLowerCase() & $displayManager.getSingularDisplayNameForImageSession().toLowerCase() ID. If you are confident the data will be mapped properly, you can directly
+                'Archive' the files and specify whether the resulting $displayManager.getSingularDisplayNameForImageSession().toLowerCase() should go into a quarantine state.
+            </div>
+            <div class="alert" style="margin:15px 0;max-width:696px;min-width:400px;">
+                The compressed uploader does not yet support splitting PET/MR sessions based on the site-wide or
+                project-specific settings for handling PET/MR data. If you are uploading PET/MR data and need to have
+                the data split into separate PET and MR sessions or created as a PET session rather than a PET/MR
+                session, you should use either the <a href="$link.setPage("LaunchUploadApplet.vm")">upload applet</a> or the
+                DICOM C-STORE receiver as described below.
+            </div>
+        </td>
+    </tr>
+    <tr>
+        <td>&nbsp;</td>
+    </tr>
+    <tr id="option3">
+        <td>
+            <input type="hidden" name="popup" value="true"/>
+            <form id="uploadFORM" class="noHide" target="iframe" enctype="multipart/form-data" method="POST"
+                  action="$content.getURI("/REST/services/import?http-session-listener=$uploadID&format=html&XNAT_CSRF=$!XNAT_CSRF")">
+                <input type="hidden" name="threshhold" value="51516279"/>
+
+                #if($session)
+                    <input type="hidden" name="EXPT_LABEL" value="$!session.getLabel()"/>
+                    <input type="hidden" name="SUBJECT_ID" value="$!session.getSubjectData().getLabel()"/>
+                #end
+
+                <table border=0 cellpadding="5" cellspacing="0">
+                    <tr>
+                        <th align="left">$displayManager.getSingularDisplayNameForProject()</th>
+                        <td>
+                            #if(!$session)
+                                <select id="project" name="project" disabled=true></select>
+                            #else
+                                <input type="hidden" name="project" id="project"
+                                       value="$session.getProject()"/>$session.getProject()
+                            #end
+                        </td>
+                    </tr>
+
+                    #if($session)
+                        <tr>
+                            <th align="left">$displayManager.getSingularDisplayNameForImageSession()</th>
+                            <td>$!session.getLabel()</td>
+                        </tr>
+                    #end
+                    <tr>
+                        <th align="left">Destination</th>
+                        <td>
+                            <label><input id="pc_0" type='radio' name='prearchive_code' value='0'
+                                          #if(!$session)CHECKED#end onchange="evaluateDestination(this)"/>
+                                Prearchive</label>&nbsp;&nbsp;&nbsp;
+                            <label><input id="pc_2" type='radio' name='prearchive_code' value='1'
+                                          #if($session)CHECKED#end onchange="evaluateDestination(this)"/>
+                                Archive</label>
+                            #if($session)
+                                <input type="hidden" name="overwrite" value="append"/>
+                                <input type="hidden" id="auto-archive" name='auto-archive' value='TRUE'/>
+                            #else
+                                <input type="hidden" id="auto-archive" name='auto-archive' value='FALSE'/>
+                            #end
+                            <input type="hidden" id="quarantine" name='quarantine' value='FALSE'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th align="left">File</th>
+                        <td><input type="file" id="image_archive" name="image_archive" size="60"
+                                   accept="application/zip, application/x-gzip, application/x-tgz"/></td>
+                    </tr>
+                    #auditBoxes("3" "" "Standard Upload" "Upload Images")
+                    #hideFormJustification()
+                    <tr>
+                        <td>&nbsp;</td>
+                        <td><input id="directButton" type="button" name="eventSubmit_doPerform" value="Begin Upload" onclick="makeTheFormGo();"/>
+                        </td>
+                    </tr>
+                </table>
+            </form>
+
+<span id="progressBar" style="position:relative; display:none;">
+<div id="ex" style="position:relative;width:468px;background:#eeeeee;border:3px double #000000;">
+    <table width="100%">
+        <tr>
+            <td colspan=2 align="left">
+                <div id="preparing">Loading File...&nbsp;</div>
+            </td>
+        </tr>
+        <tr>
+            <td>
+                <div id="uploadLabel">Upload:&nbsp;</div>
+            </td>
+            <td align="center">
+                <div id="emptyUpload"
+                     style="background-color:#cccccc;border:1px solid black;height:22px;width:300px;padding:0;"
+                     align="left">
+                    <div id="uploadBar"
+                         style="position:relative;top:0;left:0;background-color:#333333;height:22px;width:0;padding-top:5px;padding:0;">
+                        <div id="uploadPercent"
+                             style="position:relative;top:0;left:0;color:#f0ffff;height:22px;text-align:center;font:bold;padding:0;padding-top:5px;">
+                        </div>
+                    </div>
+                </div>
+            </td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td>
+                <div id="extractLabel">Extract/Review:&nbsp;</div>
+            </td>
+            <td align="center">
+                <div id="emptyExtract"
+                     style="background-color:#cccccc;border:1px solid black;height:22px;width:300px;padding:0;"
+                     align="left">
+                    <div id="extractBar"
+                         style="position:relative;top:0;left:0;background-color:#333333;height:22px;width:0;padding-top:5px;padding:0;">
+                        <div id="extractPercent"
+                             style="position:relative;top:0;left:0;color:#f0ffff;height:22px;text-align:center;font:bold;padding:0;padding-top:5px;">
+                        </div>
+                    </div>
+                </div>
+            </td>
+        </tr>
+        <tr>
+            <td colspan=2 align="center">
+                <div id="current_step"></div>
+            </td>
+        </tr>
+    </table>
+</div>
+<br>
+<table id="extractSummaryTable" border=0 style="border-collapse: collapse;">
+    <tr>
+        <td>
+            <span id="extractSummary"
+                  style="position:relative;width:468px;height:100px;display:none;overflow:auto;	"></span>
+        </td>
+    </tr>
+</table>
+<br>
+<iframe id="iframe" name="iframe" src="" width="468" height="80" frameborder="0">
+    PROGRESS BAR DISABLED. <br>Try using a more recent web browser.
+</iframe>
+</span>
+            <script type="text/javascript">
+                progressBar = document.getElementById("uploadBar");
+                progressPercent = document.getElementById("uploadPercent");
+            </script>
+        </td>
+    </tr>
+
+
+        <tr>
+            <td>
+                <hr/>
+                <h4>Option 4: DICOM C-STORE Service Class User</h4>
+            </td>
+        </tr>
+        <tr>
+            <td valign="top" align="left">
+                <div style="width:500px">Any DICOM C-STORE SCU, including scanner consoles or DICOM applications like
+                    <a href="http://www.osirix-viewer.com">OsiriX</a> or <a href="http://nrg.wustl.edu/software/dicom-browser">DicomBrowser</a>,
+                    can send files directly to this server.
+                </div>
+        </tr>
+        <tr id="option4">
+            <td>
+                <br><b>DICOM C-STORE receiver (SCP) Specifications</b>
+                <ul>
+                    <li>Host Name: $!arc.getDcm_dcmHost()</li>
+                    <li>Port: $!arc.getDcm_dcmPort()</li>
+                    <li>AE Title(s): $!arc.getDcm_dcmAe()</li>
+                </ul>
+            </td>
+        </tr>
+    <tr>
+        <td>
+            <hr/>
+        </td>
+    </tr>
+    <script type="text/javascript">
+        // Adapted from Sun Java Web Start Auto-Install Demo
+        // http://java.sun.com/developer/technicalArticles/JavaLP/javawebstart/AutoInstallDemo.html
+        var detect = navigator.userAgent.toLowerCase();
+        var windowsIE = (checkPlatform("msie") && checkPlatform("win"));
+
+        function checkPlatform(string) {
+            place = detect.indexOf(string) + 1;
+            thestring = string;
+            return place;
+        }
+    </script>
+</table>
+
+#if(!$session)
+<script type="text/javascript" src="$content.getURI('scripts/subjectAssessorData/proj_tools.js')"></script>
+
+<script type="text/javascript">
+    //load projects
+    window.defaultProject = "$!project";
+
+    window.projectLoader = new ProjectLoader();
+
+    window.projectLoader.onLoadComplete.subscribe(function () {
+        renderProjects(document.getElementById("project"), window.projectLoader.list, window.defaultProject);
+    });
+
+    document.getElementById("project").onchange = function (o) {
+        if (this.selectedIndex > 0) {
+            var s = this.options[this.selectedIndex];
+            var pc = document.getElementById("pc_0");
+            if (pc != undefined && pc != null) {
+                if (s.pc == "4") {
+                    if (s.qc == "0") {
+                        document.getElementById("pc_2").click();
+                    } else {
+                        document.getElementById("pc_1").click();
+                    }
+                } else {
+                    document.getElementById("pc_0").click();
+                }
+            }
+        }
+    };
+
+    window.projectLoader.init();
+
+    function prepApplet(_form) {
+        return true;
+    }
+
+    //build breadcrumb
+    var breadcrumbs = document.getElementById('breadcrumbs');
+
+    if (breadcrumbs != null) {
+        var bread = "";
+        #if($project)
+            bread = bread + "<a href='$link.setAction("DisplayItemAction").addPathInfo("search_element","xnat:projectData").addPathInfo("search_field","xnat:projectData.ID").addPathInfo("search_value","$project")'>$displayManager.getSingularDisplayNameForProject().toUpperCase(): $!project</a>";
+            bread = bread + "&nbsp;>&nbsp;Upload Images";
+        #end
+        breadcrumbs.innerHTML = bread;
+    }
+
+</script>
+#end
\ No newline at end of file
diff --git a/src/main/webapp/xnat-templates/screens/topBar/Upload/Default.vm b/src/main/webapp/xnat-templates/screens/topBar/Upload/Default.vm
index ce743b31..012965a5 100644
--- a/src/main/webapp/xnat-templates/screens/topBar/Upload/Default.vm
+++ b/src/main/webapp/xnat-templates/screens/topBar/Upload/Default.vm
@@ -1,6 +1,15 @@
 <!-- Sequence: 10 -->
 <!-- Upload/Default -->
-    <li><a href="$link.setPage("LaunchUploadApplet.vm")">Images</a></li>
+    <li><a href="$link.setPage("UploadOptions.vm")">Images</a>
+        <ul>
+            <!-- Sequence: 10 -->
+            <!-- Images -->
+            <li><a href="$link.setPage("LaunchUploadApplet.vm")">Upload Applet</a></li>
+            <li><a href="$link.setPage("UploadAssistantPage.vm")">Upload Assistant</a></li>
+            <li><a href="$link.setPage("CompressedUploaderPage.vm")">Compressed Uploader</a></li>
+            <li><a href="$link.setPage("DICOMSCPPage.vm")">DICOM SCP</a></li>
+        </ul>
+    </li>
     <li><a href="$link.setPage("XMLUpload.vm")">XML</a></li>
     <li><a href="$link.setPage("XDATScreen_uploadCSV.vm")">Spreadsheet</a></li>
     <li><a href="$link.setPage("XDATScreen_prearchives.vm")">Go to prearchive</a></li>
-- 
GitLab