summaryrefslogtreecommitdiffstats
path: root/idrop-web
diff options
context:
space:
mode:
authorMike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-03-09 14:23:02 (GMT)
committer Mike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-03-09 14:23:02 (GMT)
commitb75b3c07c49e9d26fc1d90e7a9e685317105f9a2 (patch)
treeae8701e7d6953008d813de977e525d5b69a58373 /idrop-web
parent8fc19eeb93bf38b5ddad89dc73290d955090521a (diff)
downloadQCG-Data-b75b3c07c49e9d26fc1d90e7a9e685317105f9a2.zip
QCG-Data-b75b3c07c49e9d26fc1d90e7a9e685317105f9a2.tar.gz
QCG-Data-b75b3c07c49e9d26fc1d90e7a9e685317105f9a2.tar.bz2
ajax timeouts, working on expanded info for collections
Diffstat (limited to 'idrop-web')
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy5
-rw-r--r--idrop-web/grails-app/views/browse/collectionInfo.gsp17
-rw-r--r--idrop-web/web-app/js/mydrop/home.js1
-rw-r--r--idrop-web/web-app/js/mydrop/lingo_common.js67
4 files changed, 79 insertions, 11 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy
index 00d874a..c14d81d 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy
@@ -2,7 +2,10 @@ package org.irods.mydrop.controller
class LoginController {
- def login = { render(view:"login") }
+ def login = {
+ response.setHeader("apptimeout","apptimeout")
+ render(view:"login")
+ }
def index ={ redirect(action: "login") }
diff --git a/idrop-web/grails-app/views/browse/collectionInfo.gsp b/idrop-web/grails-app/views/browse/collectionInfo.gsp
index f226ccc..4dee007 100644
--- a/idrop-web/grails-app/views/browse/collectionInfo.gsp
+++ b/idrop-web/grails-app/views/browse/collectionInfo.gsp
@@ -1,3 +1,6 @@
+<div id="infoAccordion">
+<h3>Summary</h3>
+<div>
<fieldset id="verticalForm"><label for="">Parent
Collection:</label> <g:textField name="collectionParentName"
value="${collection.collectionParentName}" readonly="true" /> <br />
@@ -20,4 +23,16 @@ Collection:</label> <g:textField name="collectionParentName"
<div id="infoUpdateArea"><!-- div for any updates in info --></div>
-</fieldset> \ No newline at end of file
+</fieldset>
+</div>
+<h3>Sharing</h3>
+<div>sharing stuff here</div>
+<h3>Metadata</h3>
+<div>Metadata stuff here</div>
+</div>
+<script>
+ $(function() {
+ $( "#infoAccordion" ).accordion();
+ });
+
+ </script> \ No newline at end of file
diff --git a/idrop-web/web-app/js/mydrop/home.js b/idrop-web/web-app/js/mydrop/home.js
index 4e0e81a..60a47dc 100644
--- a/idrop-web/web-app/js/mydrop/home.js
+++ b/idrop-web/web-app/js/mydrop/home.js
@@ -26,6 +26,7 @@ function retrieveBrowserFirstView() {
}
/**
+ * FIXME: intercept timeouts here?
* Callback to initialize a browser tree for the first time, set to the root
* node as indicated in the data
*
diff --git a/idrop-web/web-app/js/mydrop/lingo_common.js b/idrop-web/web-app/js/mydrop/lingo_common.js
index d17d06a..4575182 100644
--- a/idrop-web/web-app/js/mydrop/lingo_common.js
+++ b/idrop-web/web-app/js/mydrop/lingo_common.js
@@ -9,6 +9,7 @@ var expiredSessionVal = "You have tried to access a protected area of this appli
var resourceNotFound = "resourceNotFound";
var uncaughtException = "uncaughtException";
var dataAccessFailure = "dataAccessFailure";
+var timeoutHeaderValue = "apptimeout";
var javascriptMessageArea = "#javascript_message_area";
var context = "";
@@ -21,7 +22,16 @@ function prepareForCall() {
$(javascriptMessageArea).html();
}
+function checkForSessionTimeout(data, xhr) {
+ var headers = xhr.getAllResponseHeaders();
+ if (headers.indexOf(timeoutHeaderValue) > -1) {
+ window.location = context;
+ }
+
+}
+
/**
+ * FIXME: remove..this is dumb
* check HTML coming back from an AJAX call for an indication of an error, and
* if an error is found, then set the message in the div using the given id.
* Then the appropriate exception will be thrown.
@@ -156,8 +166,8 @@ function lcSendValueAndBuildTable(getUrl, params, tableDiv, newTableId, detailsF
try {
- $.get(context + getUrl, params, function(data) {
- checkAjaxResultForError(data);
+ $.get(context + getUrl, params, function(data, status, xhr) {
+ checkForSessionTimeout(data, xhr);
lcBuildTable(data, tableDiv, newTableId, detailsFunction);
}, "html");
@@ -244,8 +254,46 @@ function lcSendValueAndPlugHtmlInDiv(getUrl, resultDiv, context,
try {
- $.get(getUrl, function(data) {
- checkAjaxResultForError(data);
+ $.get(getUrl, function(data, status, xhr) {
+ checkForSessionTimeout(data, xhr);
+ lcFillInDivWithHtml(data, resultDiv, postLoadFunction);
+ }, "html");
+
+ $(resultDiv).ajaxError(function(e, xhr, settings, exception) {
+ $(resultDiv).html("");
+ checkAjaxResultForError(xhr.responseText);
+ });
+
+ } catch (err) {
+ // FIXME: console traces are not good for IE - mcc
+ // console.trace();
+ $(resultDiv).html(""); // FIXME: some sort of error icon?
+ setMessage(err);
+ console.log("javascript error:" + err);
+ }
+
+}
+
+/**
+ * Send a query via ajax that results in html plugged into the correct div
+ */
+function lcSendValueWithParamsAndPlugHtmlInDiv(getUrl, params, resultDiv, context,
+ postLoadFunction) {
+
+ prepareForCall();
+ if (getUrl.length == 0) {
+ throw ("no get url for call");
+ }
+
+ var img = document.createElement('IMG');
+ img.setAttribute("src", +context + "/images/ajax-loader.gif");
+
+ $(resultDiv).html(img);
+
+ try {
+
+ $.get(getUrl, params, function(data, status, xhr) {
+ checkForSessionTimeout(data, xhr);
lcFillInDivWithHtml(data, resultDiv, postLoadFunction);
}, "html");
@@ -282,8 +330,8 @@ function lcSendValueAndCallbackHtmlAfterErrorCheck(getUrl, divForAjaxError,
try {
- $.get(context + getUrl, function(data) {
- checkAjaxResultForError(data);
+ $.get(context + getUrl, function(data, status, xhr) {
+ checkForSessionTimeout(data, xhr);
$(divForLoadingGif).html("");
if (callbackFunction != null) {
var myHtml = data;
@@ -330,8 +378,8 @@ function lcSendValueViaPostAndCallbackHtmlAfterErrorCheck(postUrl, params, divFo
try {
- $.post(context + postUrl, params, function(data) {
- checkAjaxResultForError(data);
+ $.post(context + postUrl, params, function(data, status, xhr) {
+ checkForSessionTimeout(data, xhr);
$(divForLoadingGif).html("");
if (callbackFunction != null) {
var myHtml = data;
@@ -368,7 +416,8 @@ function lcSendValueAndCallbackWithJsonAfterErrorCheck(getUrl, parms,
try {
- $.get(context + getUrl, parms, function(data) {
+ $.get(context + getUrl, parms, function(data, status, xhr) {
+ checkForSessionTimeout(data, xhr);
callbackFunction(data);
}, "json");