From 76ada86dee430e0f10883f5092416b2bc30bb38f Mon Sep 17 00:00:00 2001
From: "Mark M. Florida" <mflorida@gmail.com>
Date: Wed, 8 Jun 2016 10:18:53 -0500
Subject: [PATCH] XNAT-4303: tweaked horizontal positioning of prearchive ui;
 tweaks to styling of prearchive details page; fixed reference to
 jquery-migrate script in 'Noninteractive' template.

---
 src/main/webapp/WEB-INF/tags/page/xnat.tag    |  7 +-
 src/main/webapp/scripts/footer.js             | 19 -----
 src/main/webapp/style/app.css                 | 12 +++-
 .../xdat-templates/layouts/Noninteractive.vm  |  3 +-
 .../xdat-templates/navigations/powered_by.vm  | 28 +++++++-
 .../xnat-templates/navigations/BaseJS.vm      |  2 +-
 .../screens/PrearchiveFileList.vm             | 70 ++++++++-----------
 7 files changed, 68 insertions(+), 73 deletions(-)

diff --git a/src/main/webapp/WEB-INF/tags/page/xnat.tag b/src/main/webapp/WEB-INF/tags/page/xnat.tag
index 4e53dc7e..5d2d156e 100644
--- a/src/main/webapp/WEB-INF/tags/page/xnat.tag
+++ b/src/main/webapp/WEB-INF/tags/page/xnat.tag
@@ -726,6 +726,8 @@ ${bodyTop}
             version: "1.7.0-SNAPSHOT"
         };
 
+        XNAT.version = buildInfo.version;
+
         // add version to title attribute of XNAT logos
         var version = buildInfo.version + " build: " + buildInfo.buildNumber;
 
@@ -772,11 +774,6 @@ ${bodyTop}
     })();
 
 </script>
-<%--<script src="${SITE_ROOT}/scripts/footer.js"></script>--%>
-
-<%--<div id="xmodal-loading" style="position:fixed;left:-9999px;top:-9999px;">--%>
-    <%--<img src="${SITE_ROOT}/scripts/xmodal/loading_bar.gif" alt="loading">--%>
-<%--</div>--%>
 
 ${bodyBottom}
 
diff --git a/src/main/webapp/scripts/footer.js b/src/main/webapp/scripts/footer.js
index 4fe49805..312816ab 100644
--- a/src/main/webapp/scripts/footer.js
+++ b/src/main/webapp/scripts/footer.js
@@ -508,8 +508,6 @@ XNAT.app.toggle=function (_name){
     }
 };
 
-var XNAT_version;
-
 $(function(){
 
     var $body = $body || $(document.body);
@@ -531,23 +529,6 @@ $(function(){
         return false;
     });
 
-    // add version to title attribute of XNAT logos
-    if (typeof window.top.logged_in != 'undefined' && window.top.logged_in == true){
-        Cookies.set('SESSION_ACTIVE', 'true');
-        $.get(serverRoot+'/xapi/siteConfig/buildInfo',function(data){
-            XNAT_version = data.version + " build: " + data.buildNumber;
-            var isNonRelease = /.*(SNAPSHOT|BETA|RC).*/.test(data.version);
-            if (isNonRelease) {
-                XNAT_version += " (" + data.commit + ")";
-            }
-            $('#xnat_power').find('a').attr('title','XNAT version ' + XNAT_version).after('<small>version ' + XNAT_version + (isNonRelease ? "<br>" + data.buildDate : "") + '</small>');
-            $('#header_logo').attr('title','XNAT version ' + XNAT_version);
-            XNAT.app.version = XNAT_version ;
-        });
-    }
-    else {
-        Cookies.set('SESSION_ACTIVE', 'false');
-    }
 });
 
 jq(window).load(function(){
diff --git a/src/main/webapp/style/app.css b/src/main/webapp/style/app.css
index a8ccced9..55f1f6ea 100644
--- a/src/main/webapp/style/app.css
+++ b/src/main/webapp/style/app.css
@@ -2861,7 +2861,9 @@ div.xmodal #layout_content {
 /* prearchive file list modal */
 table.file-details {
     margin-top: -5px;
-    min-width: 840px;
+    margin-left: -15px;
+    width: 100%;
+    min-width: 830px;
 }
 
 table.file-details th,
@@ -3349,6 +3351,10 @@ label.disabled {
 
 /* prearchives.css */
 /***********************************************/
+#prearchive_table {
+    left: 35px !important;
+}
+
 div.instructions {
     width: 80%;
     margin: 1em;
@@ -3574,6 +3580,10 @@ hr.light {
         width: 900px !important;
     }
 
+    #prearchive_table {
+        left: -65px !important;
+    }
+
 }
 
 pre.json { outline: 1px solid #f0f0f0; padding: 20px; }
diff --git a/src/main/webapp/xdat-templates/layouts/Noninteractive.vm b/src/main/webapp/xdat-templates/layouts/Noninteractive.vm
index d3261b5b..a814724d 100644
--- a/src/main/webapp/xdat-templates/layouts/Noninteractive.vm
+++ b/src/main/webapp/xdat-templates/layouts/Noninteractive.vm
@@ -66,8 +66,7 @@
     <script type="text/javascript" src="$content.getURI("scripts/utils.js")"></script>
 
     <!-- xdat.css and xnat.css loaded last to override YUI styles -->
-    <link rel="stylesheet" type="text/css" href="$content.getURI("style/xdat.css")">
-    <link rel="stylesheet" type="text/css" href="$content.getURI("style/xnat.css")">
+    <link rel="stylesheet" type="text/css" href="$content.getURI("style/app.css")">
 
     <link rel="stylesheet" type="text/css" href="$content.getURI("scripts/xmodal-v1/xmodal.css")">
     <script type="text/javascript" src="$content.getURI("scripts/xmodal-v1/xmodal.js")"></script>
diff --git a/src/main/webapp/xdat-templates/navigations/powered_by.vm b/src/main/webapp/xdat-templates/navigations/powered_by.vm
index 920232f9..6ccb6b19 100644
--- a/src/main/webapp/xdat-templates/navigations/powered_by.vm
+++ b/src/main/webapp/xdat-templates/navigations/powered_by.vm
@@ -1,12 +1,34 @@
 
 <div class="clear"></div>
 <div id="xnat_power">
-    <a target="_blank" href="http://www.xnat.org/" style=""><img src="$content.getURI('images/xnat_power_small.png')"></a>
+    <a target="_blank" href="http://www.xnat.org/" style="">
+        <img src="$content.getURI('images/xnat_power_small.png')">
+    </a>
 </div>
 
 <script type="text/javascript">
 
-    loadjs(scriptUrl('xnat/event.js'), function(){
+    (function(){
+
+        // add version to title attribute of XNAT logos
+        if (typeof window.top.logged_in != 'undefined' && window.top.logged_in == true){
+            Cookies.set('SESSION_ACTIVE', 'true');
+            $.get(serverRoot+'/xapi/siteConfig/buildInfo',function(data){
+                var version = XNAT.version = data.version;
+                var version_string = version + " build: " + data.buildNumber;
+                var isNonRelease = /.*(SNAPSHOT|BETA|RC).*/i.test(version);
+                if (isNonRelease) {
+                    version_string += " (" + data.commit + ")";
+                }
+                $('#xnat_power').find('a').attr('title','XNAT version ' + version_string)
+                                .after('<small>version ' + version_string + (isNonRelease ? "<br>" + data.buildDate : "") + '</small>');
+                $('#header_logo').attr('title','XNAT version ' + version_string);
+                XNAT.app.version = version_string ;
+            });
+        }
+        else {
+            Cookies.set('SESSION_ACTIVE', 'false');
+        }
 
         var clicker = XNAT.event.click('#header_logo, #xnat_power > a');
 
@@ -30,6 +52,6 @@
             XNAT.ui.popup(XNAT.url.rootUrl('/xapi/swagger-ui.html'));
         });
 
-    })
+    })();
 
 </script>
\ No newline at end of file
diff --git a/src/main/webapp/xnat-templates/navigations/BaseJS.vm b/src/main/webapp/xnat-templates/navigations/BaseJS.vm
index c8651a14..bcfbea56 100644
--- a/src/main/webapp/xnat-templates/navigations/BaseJS.vm
+++ b/src/main/webapp/xnat-templates/navigations/BaseJS.vm
@@ -26,7 +26,7 @@
     <!-- required libraries -->
     <script src="$content.getURI('scripts/lib/loadjs/loadjs.js')"></script>
     <script src="$content.getURI('scripts/lib/jquery/jquery.min.js')"></script>
-    <script src="$content.getURI('scripts/lib/jquery/jquery-migrate-1.2.1.min.js')"></script>
+    <script src="$content.getURI('scripts/lib/jquery/jquery-migrate.min.js')"></script>
     <script>
         // alias jQuery to jq
         var jq = jQuery;
diff --git a/src/main/webapp/xnat-templates/screens/PrearchiveFileList.vm b/src/main/webapp/xnat-templates/screens/PrearchiveFileList.vm
index f7bb3517..57737d7a 100644
--- a/src/main/webapp/xnat-templates/screens/PrearchiveFileList.vm
+++ b/src/main/webapp/xnat-templates/screens/PrearchiveFileList.vm
@@ -2,48 +2,34 @@
 	#set ($template = $data.getTemplateInfo())
 	$!template.setLayoutTemplate("ScreenOnly.vm")
 #end
-<table>
-	<tr>
-		<td>
-            <table class="file-details padding-sm" cellspacing="0">
-            	<tr class="file-details-header">
-            		<th align="left" width="">File</th>
-            		<th align="center" width="100px">Size</th>
-            		<th width="240px">&nbsp;</th>
-            	</tr>
-			#set($lastURL="0")
-            #foreach($row in $table.toArrayListOfLists())
-				#set($lastURL=$content.getURI("$!row.get(2)"))
-            	<tr class="file-details-row highlight-row">
-            		<td class="scan-image-link">
-                        <a class="image-download" href="$lastURL" style="text-decoration:underline" title="Download File: $!row.get(0)">$!row.get(0)</a>
-                    </td>
-            		<td class="scan-image-size" align="center">$!row.get(1)</td>
-            		<td class="scan-image-buttons" align="right">
-            		#if($!row.get(2).contains("/DICOM/"))
-						#set($hasDICOM="1")
-            			<button onclick="XNAT.app.headerDialog.load('$content.getURI("/REST/services/dicomdump?src=$!row.get(2).substring(5)&format=html&requested_screen=DicomFileTable.vm")','File $!row.get(0) DICOM');">Review DICOM Tags</button>
-						##&nbsp;&nbsp;<a onclick="document.getElementById('viewer').src='$lastURL'">JPEG</a>
-##                        <button onclick="popupCentered('$lastURL?format=image/jpeg', '', 256, 256, 2.2, {location:'no',scrollbars:'no',toolbar:'no',status:'no'})">View Image</button>
-                        <button
-                            class="view-image-button" data-popup-opts="$lastURL|$!row.get(0)|256|256"
-                            ##data-popup="$lastURL?format=image/jpeg | View Image | 256 | 256 | 3 | location=no,status=no,toolbar=no,scrollbars=no"
-                            ##onclick="popupCentered('$lastURL?format=image/jpeg', '', 256, 256, 'location=no,scrollbars=no,toolbar=no,status=no')"
-                            >View Image</button>
-                        ##window.open('$lastURL?format=image/jpeg','Image Popup','scrollbars=no,width=256,height=256,resizable,status,chrome,centerscreen')
-                    #end
-            		</td>
-            	</tr>
-            #end
-            </table>
-		</td>
-        #if($lastURL!="0")
-		<!--<td>
-			<img id="viewer" src="$lastURL" border="0"/>
-		</td>-->
-		#end
-	</tr>
+
+<table class="file-details padding-sm" cellspacing="0">
+    <tr class="file-details-header">
+        <th align="left" width="">File</th>
+        <th align="center" width="100px">Size</th>
+        <th width="240px">&nbsp;</th>
+    </tr>
+    #set($lastURL="0")
+    #foreach($row in $table.toArrayListOfLists())
+        #set($lastURL=$content.getURI("$!row.get(2)"))
+        <tr class="file-details-row highlight-row">
+            <td class="scan-image-link">
+                <a class="image-download" href="$lastURL" style="text-decoration:underline" title="Download File: $!row.get(0)">$!row.get(0)</a>
+            </td>
+            <td class="scan-image-size" align="center">$!row.get(1)</td>
+            <td class="scan-image-buttons" align="right">
+                #if($!row.get(2).contains("/DICOM/"))
+                    #set($hasDICOM="1")
+                    <button onclick="XNAT.app.headerDialog.load('$content.getURI("/REST/services/dicomdump?src=$!row.get(2).substring(5)&format=html&requested_screen=DicomFileTable.vm")','File $!row.get(0) DICOM');">Review DICOM Tags</button>
+                    <button class="view-image-button" data-popup-opts="$lastURL|$!row.get(0)|256|256">View Image</button>
+                #end
+            </td>
+        </tr>
+    #end
 </table>
+#if($lastURL!="0")
+<!-- <img id="viewer" src="$lastURL" border="0"/> -->
+#end
 
 <script type="text/javascript">
 
@@ -73,7 +59,7 @@
                 '</div>';
             imageModal.title = 'Image: ' + title;
             imageModal.width = parseInt(width,10);
-            imageModal.height = parseInt(height,10) + 54;
+            imageModal.height = parseInt(height,10) + 72;
             imageModal.footer = false;
             imageModal.modal = false;
             imageModal.scroll = false;
-- 
GitLab