diff options
author | mconway <michael.c.conway@gmail.com> | 2013-02-20 14:13:29 (GMT) |
---|---|---|
committer | mconway <michael.c.conway@gmail.com> | 2013-02-20 14:13:29 (GMT) |
commit | aec8225fd964595f15cb29409c5397e6d24addbf (patch) | |
tree | 92e3452f0d1afa0a863972248f070249564605b4 | |
parent | e7de93334ae241acab34763f3931d76eecf1c0b8 (diff) | |
download | QCG-Data-aec8225fd964595f15cb29409c5397e6d24addbf.zip QCG-Data-aec8225fd964595f15cb29409c5397e6d24addbf.tar.gz QCG-Data-aec8225fd964595f15cb29409c5397e6d24addbf.tar.bz2 |
[#1222] click over from shared folder now broken
8 files changed, 89 insertions, 29 deletions
diff --git a/idrop-web/grails-app/conf/Config.groovy b/idrop-web/grails-app/conf/Config.groovy index 71545df..cc67fdf 100755 --- a/idrop-web/grails-app/conf/Config.groovy +++ b/idrop-web/grails-app/conf/Config.groovy @@ -183,7 +183,7 @@ log4j = { 'net.sf.ehcache.hibernate' //info 'org.irods.mydrop' - info 'org.irods.jargon' + warn 'org.irods.jargon' warn 'org.irods.jargon.spring.security' warn 'org.springframework' diff --git a/idrop-web/grails-app/conf/spring/resources.groovy b/idrop-web/grails-app/conf/spring/resources.groovy index ba4e9b7..0e15cc8 100755 --- a/idrop-web/grails-app/conf/spring/resources.groovy +++ b/idrop-web/grails-app/conf/spring/resources.groovy @@ -45,6 +45,11 @@ beans = { profileController(org.irods.mydrop.controller.ProfileController) { irodsAccessObjectFactory = ref("irodsAccessObjectFactory") } + homeController(org.irods.mydrop.controller.HomeController) { + irodsAccessObjectFactory = ref("irodsAccessObjectFactory") + } + + shoppingCartController(org.irods.mydrop.controller.ShoppingCartController) { irodsAccessObjectFactory = ref("irodsAccessObjectFactory") } diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy index e8be884..6e0a2db 100755 --- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy +++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy @@ -82,6 +82,19 @@ class BrowseController { return } else { log.info("path is ${absPath}") + viewState = viewStateService.saveRootPath(absPath) + + /* + * Decide what to do about the selected path, such that a path we set as root might need to wipe out the previous selected path. + * + * Keep the selected path if the new root is shorter than the selected path and it contains the path + */ + + if (viewState.selectedPath.indexOf(viewState.rootPath) == -1) { + log.info("getting rid of selected path, not under new root path") + viewState = viewStateService.saveSelectedPath("") + } + } } diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy index 3bda859..362aa88 100755 --- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy +++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy @@ -1,14 +1,16 @@ package org.irods.mydrop.controller import org.irods.jargon.core.connection.IRODSAccount +import org.irods.jargon.core.pub.IRODSAccessObjectFactory import org.irods.jargon.core.utils.MiscIRODSUtils import org.irods.mydrop.service.SharingService -import org.irods.mydrop.service.StarringService; +import org.irods.mydrop.service.StarringService class HomeController { StarringService starringService SharingService sharingService + IRODSAccessObjectFactory irodsAccessObjectFactory /** * Interceptor grabs IRODSAccount from the SecurityContextHolder @@ -24,7 +26,11 @@ class HomeController { irodsAccount = session["SPRING_SECURITY_CONTEXT"] } - def afterInterceptor = { log.debug("closing the session") } + def afterInterceptor = { + log.debug("closing the session") + irodsAccessObjectFactory.closeSession() + + } def index() { log.info("index") 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 c8e449a..1b404b1 100755 --- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy +++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy @@ -13,6 +13,12 @@ class LoginController { IRODSAccessObjectFactory irodsAccessObjectFactory IRODSAccount irodsAccount ViewStateService viewStateService + + def afterInterceptor = { + //log.debug("closing the session") + //irodsAccessObjectFactory.closeSession() + } + //static allowedMethods = [authenticate:'POST'] diff --git a/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy b/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy index 228e00e..5e4f754 100644 --- a/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy +++ b/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy @@ -33,13 +33,14 @@ class ViewStateService { * @param path * @return */ - public void saveRootPath(String path) { + public ViewState saveRootPath(String path) { if (path == null) { throw new IllegalArgumentException("null path") } ViewState viewState = getViewStateFromSessionAndCreateIfNotThere() viewState.rootPath = path + return viewState } @@ -53,6 +54,22 @@ class ViewStateService { } /** + * Save a path for later retrieval + * @param absolutePath + */ + public ViewState saveSelectedPath(String absolutePath) { + + + if (absolutePath == null) { + throw new IllegalArgumentException("null absolutePath") + } + + ViewState viewState = getViewStateFromSessionAndCreateIfNotThere() + viewState.selectedPath = absolutePath + return viewState + } + + /** * Save a path and mode in the view state for later retrieval * @param viewMode * @param absolutePath @@ -73,12 +90,13 @@ class ViewStateService { return viewState } - public void saveViewMode(String viewMode) { + public ViewState saveViewMode(String viewMode) { if (viewMode == null) { throw new IllegalArgumentException("null viewMode") } ViewState viewState = getViewStateFromSessionAndCreateIfNotThere() viewState.browseView = viewMode + return viewState } diff --git a/idrop-web/grails-app/views/browse/index.gsp b/idrop-web/grails-app/views/browse/index.gsp index 4280795..ec5ac6b 100755 --- a/idrop-web/grails-app/views/browse/index.gsp +++ b/idrop-web/grails-app/views/browse/index.gsp @@ -32,15 +32,24 @@ west__resizable : true
});
- var mode = $("#mode").val();
- browseOptionVal = $("#viewStateBrowseOptionVal").val();
- dataTreePath = $("#presetPath").val();
- var thisSelectedPath = $("#viewStateSelectedPath").val();
-
+ /**
+ The view state in the session keeps the root of the tree, the mode (browse, info, etc), and a path that may be selected in the tree
+ These values are passed in by the BrowseController and preservered in gsp fields to be picked up by the javascript
+ */
+
+ var mode = $("#mode").val(); // mode of building tree (detect = seek the best root, path = open to the given path, root = set to the root, etc)
+ browseOptionVal = $("#viewStateBrowseOptionVal").val(); // browse view, info view, gallery view, etc
+ dataTreePath = $("#presetPath").val(); // root of the tree
+ var thisSelectedPath = $("#viewStateSelectedPath").val(); // optional path to select
+
- if (mode == null || mode=="") {
- retrieveBrowserFirstView("detect","", thisSelectedPath);
+ if (mode == null || mode=="" || dataTreePath == null || dataTreePath == "") {
+ retrieveBrowserFirstView("detect","", thisSelectedPath); // figure out the best root and try to open the given path in the tree, that value
+ // is optional
} else {
+ /*
+ I have defined a mode and root path for the tree, the selected path to open is optional
+ */
retrieveBrowserFirstView(mode, dataTreePath, thisSelectedPath);
}
diff --git a/idrop-web/web-app/js/mydrop/home.js b/idrop-web/web-app/js/mydrop/home.js index 4d1b74a..f293a04 100755 --- a/idrop-web/web-app/js/mydrop/home.js +++ b/idrop-web/web-app/js/mydrop/home.js @@ -63,26 +63,27 @@ function retrieveBrowserFirstView(type, path, pathSelectedInTree) { dataTree = null; $("#dataTreeDiv").html(""); } - - if (type != null) { - if (type == 'root') { - path = ''; - } else if (type == 'home') { - path = ""; - } else if (type == "path") { - if (path == null || path == "") { - path = baseAbsPath; - } - } else if (type == 'detect') { - path = ""; - } else { - throw "invalid type parameter:" + type; + + // with no type, go into detect mode and show the root + if (type == null || type == "") { + type = "detect"; + } + + if (type == 'root') { + path = ''; + } else if (type == 'home') { + path = ""; + } else if (type == "path") { + if (path == null || path == "") { + path = baseAbsPath; } + } else if (type == 'detect') { + path = ""; } else { - type = "path"; - path = baseAbsPath; + throw "invalid type parameter:" + type; } + var state = {}; state["treeView"] = type; @@ -201,6 +202,8 @@ function browserFirstViewRetrieved(data) { $("#dataTreeDiv").bind("loaded.jstree", function(e, data) { if (requestedSelectedPath) { selectTreePathFromIrodsPath(requestedSelectedPath); + } else { + } }); @@ -2653,7 +2656,7 @@ function addShareAtPath() { */ function editShareAtPath() { $("#sharingPanelContainingDiv").html(); - var path = selectedPath; + var path = $("#infoAbsPath").val(); if (selectedPath == null) { return false; } |