From 34498518db26dae2a86e86eabc8c8b0a9ca2f51d Mon Sep 17 00:00:00 2001 From: "Mark M. Florida" <mflorida@gmail.com> Date: Tue, 24 May 2016 16:26:04 -0500 Subject: [PATCH] Fix for issues with iframe xmodal dialogs and the timeout script. Removed title from some loading dialogs. --- src/main/webapp/page/admin/content.jsp | 21 ++++++------------- src/main/webapp/page/admin/info/content.jsp | 2 -- src/main/webapp/page/admin/info/index.jsp | 2 +- src/main/webapp/page/index.jsp | 8 +++---- src/main/webapp/scripts/FileViewer.js | 2 +- src/main/webapp/scripts/footer.js | 4 ++-- src/main/webapp/scripts/xnat/app/timeout.js | 7 ++++--- .../screens/XDATScreen_report_xdat_user.vm | 2 +- .../XDATScreen_report_xdat_userGroup.vm | 2 +- .../xdat-templates/screens/admin_bar.vm | 9 ++++---- .../screens/XDATScreen_admin_options.vm | 2 +- .../xnat-templates/screens/workflow_alert.vm | 2 +- 12 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/main/webapp/page/admin/content.jsp b/src/main/webapp/page/admin/content.jsp index 7f9c30cf..897cbbd8 100755 --- a/src/main/webapp/page/admin/content.jsp +++ b/src/main/webapp/page/admin/content.jsp @@ -2,7 +2,12 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="pg" tagdir="/WEB-INF/tags/page" %> -<pg:restricted> +<c:set var="redirect"> + <p>Not authorized. Redirecting...</p> + <script> window.location.href = XNAT.url.rootUrl('/') </script> +</c:set> + +<pg:restricted msg="${redirect}"> <link rel="stylesheet" type="text/css" href="${sessionScope.siteRoot}/page/admin/style.css"> @@ -43,28 +48,14 @@ // get rid of the 'targetSource' property delete XNAT.data.siteConfig.targetSource; - -// var jsonUrl = XNAT.url.rootUrl('/page/admin/data/config/site-admin-sample-new.yaml'); var jsonUrl = XNAT.url.rootUrl('/xapi/spawner/resolve/siteAdmin/adminPage'); -// var jsonUrl = XNAT.url.rootUrl('/page/admin/data/site-admin-page.json'); $.get({ url: jsonUrl, - // dataType: 'text', success: function(data){ - - if (typeof data === 'string') { - data = YAML.parse(data); - } - - // console.log(JSON.stringify(data, ' ', 1)); - var adminTabs = XNAT.spawner.spawn(data); adminTabs.render('#admin-config-tabs > .xnat-tab-content'); XNAT.app.adminTabs = adminTabs; - - // xmodal.loading.closeAll(); - } }); diff --git a/src/main/webapp/page/admin/info/content.jsp b/src/main/webapp/page/admin/info/content.jsp index 282eb405..a6c12017 100644 --- a/src/main/webapp/page/admin/info/content.jsp +++ b/src/main/webapp/page/admin/info/content.jsp @@ -10,8 +10,6 @@ </pg:init> </c:if> -<c:set var="pageName" value="info" scope="request"/> - <c:set var="_msg"> Nope. </c:set> diff --git a/src/main/webapp/page/admin/info/index.jsp b/src/main/webapp/page/admin/info/index.jsp index 9acf00fb..2b09ca29 100755 --- a/src/main/webapp/page/admin/info/index.jsp +++ b/src/main/webapp/page/admin/info/index.jsp @@ -3,7 +3,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <pg:wrapper> - <pg:xnat> + <pg:xnat title="Info."> <jsp:include page="content.jsp"/> diff --git a/src/main/webapp/page/index.jsp b/src/main/webapp/page/index.jsp index d52a01fc..aa8cdd53 100755 --- a/src/main/webapp/page/index.jsp +++ b/src/main/webapp/page/index.jsp @@ -5,13 +5,13 @@ <pg:wrapper> <pg:xnat> - <c:set var="view" value="${param.view}"/> + <c:set var="incl" value="content.jsp"/> - <c:if test="${empty view}"> - <c:set var="view" value="content"/> + <c:if test="${not empty param.view}"> + <c:set var="incl" value="/page/${param.view}/content.jsp"/> </c:if> - <jsp:include page="${view}.jsp"/> + <jsp:include page="${incl}"/> </pg:xnat> </pg:wrapper> diff --git a/src/main/webapp/scripts/FileViewer.js b/src/main/webapp/scripts/FileViewer.js index 5d91a6f6..3b10e47e 100644 --- a/src/main/webapp/scripts/FileViewer.js +++ b/src/main/webapp/scripts/FileViewer.js @@ -637,7 +637,7 @@ function FileViewer(_obj){ }; YAHOO.util.Connect.asyncRequest('POST', this.obj.refresh + '×tamp=' + (new Date()).getTime(), catalogRefreshCallback, null); //xmodal.close(); - xmodal.loading.open('Please wait...'); + xmodal.loading.open('#wait'); }; this.catalogRefreshCancel = function () { diff --git a/src/main/webapp/scripts/footer.js b/src/main/webapp/scripts/footer.js index 66804209..f87b763e 100644 --- a/src/main/webapp/scripts/footer.js +++ b/src/main/webapp/scripts/footer.js @@ -530,9 +530,9 @@ $(function(){ e.stopImmediatePropagation(); return false; }); - + // add version to title attribute of XNAT logos - if (typeof logged_in != 'undefined' && logged_in == true){ + 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; diff --git a/src/main/webapp/scripts/xnat/app/timeout.js b/src/main/webapp/scripts/xnat/app/timeout.js index 0b499ab8..84f2a499 100644 --- a/src/main/webapp/scripts/xnat/app/timeout.js +++ b/src/main/webapp/scripts/xnat/app/timeout.js @@ -103,7 +103,7 @@ var XNAT = getObject(XNAT); // has it been cancelled? cookie.SESSION_DIALOG_CANCELLED = timeoutCookie('SESSION_DIALOG_CANCELLED').set('false'); - // has the session timed out? + // is the session still active? (could have been logged out in another window) cookie.SESSION_ACTIVE = timeoutCookie('SESSION_ACTIVE').get(); // has the session timed out? @@ -119,7 +119,7 @@ var XNAT = getObject(XNAT); cookie.SESSION_LAST_LOGIN = timeoutCookie('SESSION_LAST_LOGIN'); // what was the last page visited? - cookie.SESSION_LAST_PAGE = timeoutCookie('SESSION_LAST_PAGE').set(window.location.href); + cookie.SESSION_LAST_PAGE = timeoutCookie('SESSION_LAST_PAGE').get(); timeout.expCookie = ''; @@ -247,6 +247,7 @@ var XNAT = getObject(XNAT); cookie.SESSION_DIALOG_CANCELLED.set('false'); cookie.SESSION_TIMED_OUT.set('true'); cookie.SESSION_LOGOUT_REDIRECT.set('true'); + cookie.SESSION_LAST_PAGE.set(window.location.href); timeoutCookie('WARNING_BAR').set('OPEN'); timeoutCookie('guest').set('true'); // need to wait a little longer before reloading @@ -331,7 +332,7 @@ var XNAT = getObject(XNAT); return false; } - // redirect if the logged out from another window + // redirect if logged out from another window if (cookie.SESSION_ACTIVE.is('false')) { redirectToLogin(); return false; diff --git a/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_user.vm b/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_user.vm index 990b141e..09a1fb86 100644 --- a/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_user.vm +++ b/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_user.vm @@ -48,7 +48,7 @@ $page.setVlinkColor($ui.vlink) <script type="text/javascript"> function goToUsersPage(){ - xmodal.loading.open('Please wait...'); + xmodal.loading.open('#wait'); window.top.location.href = serverRoot + '/app/template/XDATScreen_admin.vm'; } diff --git a/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_userGroup.vm b/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_userGroup.vm index e1a61f84..48676336 100644 --- a/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_userGroup.vm +++ b/src/main/webapp/xdat-templates/screens/XDATScreen_report_xdat_userGroup.vm @@ -135,7 +135,7 @@ $page.setVlinkColor($ui.vlink) </TABLE> <script type="text/javascript"> function goToGroupsPage(){ - xmodal.loading.open('Please wait...'); + xmodal.loading.open('#wait'); window.top.location.href = serverRoot + '/app/template/XDATScreen_groups.vm'; } </script> diff --git a/src/main/webapp/xdat-templates/screens/admin_bar.vm b/src/main/webapp/xdat-templates/screens/admin_bar.vm index 5af5f3f1..117aa021 100644 --- a/src/main/webapp/xdat-templates/screens/admin_bar.vm +++ b/src/main/webapp/xdat-templates/screens/admin_bar.vm @@ -128,16 +128,17 @@ url = url.replace(/\/\/popup/,'/popup/'); // watch out for '//popup' xmodal.iframe({ src: url, - width: '60%', + width: '80%', height: '80%', minHeight: 540, - minWidth: 720, - maxWidth: 960, + minWidth: 840, +// maxWidth: 960, + padding: '20px', title: url, titleStyle: 'visibility:hidden;opacity:0;', footer: false, onClose: function(){ - xmodal.loading.open('Please wait...'); + xmodal.loading.open('#wait'); window.top.location.reload(true); } }); diff --git a/src/main/webapp/xnat-templates/screens/XDATScreen_admin_options.vm b/src/main/webapp/xnat-templates/screens/XDATScreen_admin_options.vm index 45aee6d7..8556a4d1 100644 --- a/src/main/webapp/xnat-templates/screens/XDATScreen_admin_options.vm +++ b/src/main/webapp/xnat-templates/screens/XDATScreen_admin_options.vm @@ -74,7 +74,7 @@ $!template.setLayoutTemplate("DefaultExptList.vm") title: ' ', // titleStyle: 'visibility:hidden;opacity:0;', // onClose: function(){ -// xmodal.loading.open('Please wait...'); +// xmodal.loading.open('#wait'); // window.top.location.reload(true); // }, footer: false diff --git a/src/main/webapp/xnat-templates/screens/workflow_alert.vm b/src/main/webapp/xnat-templates/screens/workflow_alert.vm index dd76edf7..b39887d2 100644 --- a/src/main/webapp/xnat-templates/screens/workflow_alert.vm +++ b/src/main/webapp/xnat-templates/screens/workflow_alert.vm @@ -78,7 +78,7 @@ function workflowUpdate(){ - xmodal.loading.open('Please wait...'); + xmodal.loading.open('#wait'); function workflowUpdateOK(data, status, o){ xmodal.loading.close(); -- GitLab