summaryrefslogtreecommitdiffstats
path: root/idrop-web
diff options
context:
space:
mode:
authorMike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-06-21 17:50:44 (GMT)
committer Mike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-06-21 17:50:44 (GMT)
commit1d1fe5d542f99a893403a0f88368d543003c7e8b (patch)
tree9310629ad07d41827d6dfad501f03bcdf5321697 /idrop-web
parenta21d2b178ff7c9861a324531fb08363206f642d2 (diff)
downloadQCG-Data-1d1fe5d542f99a893403a0f88368d543003c7e8b.zip
QCG-Data-1d1fe5d542f99a893403a0f88368d543003c7e8b.tar.gz
QCG-Data-1d1fe5d542f99a893403a0f88368d543003c7e8b.tar.bz2
adding idrop lite launch code in idrop-web
Diffstat (limited to 'idrop-web')
-rw-r--r--idrop-web/application.properties12
-rw-r--r--idrop-web/grails-app/conf/spring/resources.groovy4
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/FileController.groovy1
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/IdropLiteController.groovy50
-rw-r--r--idrop-web/grails-app/views/browse/browseDetails.gsp1
-rw-r--r--idrop-web/grails-app/views/home/index.gsp3
-rw-r--r--idrop-web/grails-app/views/idropLite/appletLoader.gsp11
-rw-r--r--idrop-web/test/unit/org/irods/mydrop/controller/IdropLiteControllerTests.groovy47
-rw-r--r--idrop-web/web-app/WEB-INF/applicationContext.xml2
-rw-r--r--idrop-web/web-app/css/main.css2
-rw-r--r--idrop-web/web-app/js/mydrop/home.js38
11 files changed, 161 insertions, 10 deletions
diff --git a/idrop-web/application.properties b/idrop-web/application.properties
index fbf9c89..7dc9db1 100644
--- a/idrop-web/application.properties
+++ b/idrop-web/application.properties
@@ -1,8 +1,8 @@
#Grails Metadata file
-#Fri Mar 04 14:10:26 EST 2011
-app.version=0.9.1-SNAPSHOT
-app.servlet.version=2.4
-app.grails.version=1.3.6
-plugins.tomcat=1.3.5
-plugins.hibernate=1.3.5
+#Tue Jun 21 11:12:25 EDT 2011
+app.grails.version=1.3.7
app.name=idrop-web
+app.servlet.version=2.4
+app.version=0.9.1-SNAPSHOT
+plugins.hibernate=1.3.7
+plugins.tomcat=1.3.7
diff --git a/idrop-web/grails-app/conf/spring/resources.groovy b/idrop-web/grails-app/conf/spring/resources.groovy
index 18a2d2c..2bdd8e4 100644
--- a/idrop-web/grails-app/conf/spring/resources.groovy
+++ b/idrop-web/grails-app/conf/spring/resources.groovy
@@ -24,4 +24,8 @@ beans = {
irodsAccessObjectFactory = ref("irodsAccessObjectFactory")
}
+ idropLiteController(org.irods.mydrop.controller.MetadataController) {
+ irodsAccessObjectFactory = ref("irodsAccessObjectFactory")
+ }
+
}
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/FileController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/FileController.groovy
index dbb8026..ad493d0 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/FileController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/FileController.groovy
@@ -2,7 +2,6 @@ package org.irods.mydrop.controller
import org.irods.jargon.core.connection.IRODSAccount
-import org.irods.jargon.core.connection.IRODSAccount
import org.irods.jargon.core.exception.DataNotFoundException
import org.irods.jargon.core.exception.JargonException
import org.irods.jargon.core.exception.JargonRuntimeException
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/IdropLiteController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/IdropLiteController.groovy
new file mode 100644
index 0000000..48a8a36
--- /dev/null
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/IdropLiteController.groovy
@@ -0,0 +1,50 @@
+package org.irods.mydrop.controller
+
+import grails.converters.*
+
+import org.irods.jargon.core.connection.IRODSAccount
+import org.irods.jargon.core.exception.JargonException
+import org.irods.jargon.core.exception.JargonRuntimeException
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory
+import org.irods.jargon.core.pub.UserAO
+import org.springframework.security.core.context.SecurityContextHolder
+
+
+
+class IdropLiteController {
+
+ IRODSAccessObjectFactory irodsAccessObjectFactory
+ IRODSAccount irodsAccount
+
+ /**
+ * Interceptor grabs IRODSAccount from the SecurityContextHolder
+ */
+ def beforeInterceptor = {
+ def irodsAuthentication = SecurityContextHolder.getContext().authentication
+
+ if (irodsAuthentication == null) {
+ throw new JargonRuntimeException("no irodsAuthentication in security context!")
+ }
+
+ irodsAccount = irodsAuthentication.irodsAccount
+ log.debug("retrieved account for request: ${irodsAccount}")
+ }
+
+ def afterInterceptor = {
+ log.debug("closing the session")
+ irodsAccessObjectFactory.closeSession()
+ }
+
+ def appletLoader = {
+ def absPath = params['absPath']
+ if (absPath == null) {
+ throw new JargonException("no absolute path passed to the method")
+ }
+
+ UserAO userAO = irodsAccessObjectFactory.getUserAO(irodsAccount)
+ def password = userAO.getTemporaryPasswordForConnectedUser()
+ log.info "temporary user password is: ${password}"
+ render(view:"appletLoader", model:[password:password, account:irodsAccount, absPath:absPath])
+
+ }
+}
diff --git a/idrop-web/grails-app/views/browse/browseDetails.gsp b/idrop-web/grails-app/views/browse/browseDetails.gsp
index 1ac453b..5b8aeea 100644
--- a/idrop-web/grails-app/views/browse/browseDetails.gsp
+++ b/idrop-web/grails-app/views/browse/browseDetails.gsp
@@ -1,5 +1,6 @@
<div>
+ <div id="idropLiteArea"><!-- area to show idrop lite applet --></div>
<table cellspacing="0" cellpadding="0" border="0"
id="browseDataDetailsTable" style="width: 100%;">
<thead>
diff --git a/idrop-web/grails-app/views/home/index.gsp b/idrop-web/grails-app/views/home/index.gsp
index 8ea2797..ebb4a36 100644
--- a/idrop-web/grails-app/views/home/index.gsp
+++ b/idrop-web/grails-app/views/home/index.gsp
@@ -86,6 +86,9 @@
<button type="button" id="upload"
class="ui-state-default ui-corner-all" value="upload"
onclick="showUploadDialog()")>Upload</button>
+ <button type="button" id="idroplite"
+ class="ui-state-default ui-corner-all" value="uploadWithIdropLite"
+ onclick="showIdropLite()")>iDrop Lite</button>
</div>
diff --git a/idrop-web/grails-app/views/idropLite/appletLoader.gsp b/idrop-web/grails-app/views/idropLite/appletLoader.gsp
new file mode 100644
index 0000000..3f03647
--- /dev/null
+++ b/idrop-web/grails-app/views/idropLite/appletLoader.gsp
@@ -0,0 +1,11 @@
+<div>
+<applet archive="idrop-lite-1.0-SNAPSHOT.jar" code="iDropLiteApplet.class?" width="400" height="300">
+<param name="host" value="${account.host}" />
+<param name="port" value="${account.port}" />
+<param name="zone" value="${account.zone}" />
+<param name="zone" value="${account.zone}" />
+<param name="defaultStorageResource" value="${account.defaultStorageResource}" />
+<param name="password" value="${password}" />
+<param name="absPath" value="${absPath}" />
+</applet>
+</div> \ No newline at end of file
diff --git a/idrop-web/test/unit/org/irods/mydrop/controller/IdropLiteControllerTests.groovy b/idrop-web/test/unit/org/irods/mydrop/controller/IdropLiteControllerTests.groovy
new file mode 100644
index 0000000..1980194
--- /dev/null
+++ b/idrop-web/test/unit/org/irods/mydrop/controller/IdropLiteControllerTests.groovy
@@ -0,0 +1,47 @@
+package org.irods.mydrop.controller
+
+import java.util.Properties;
+
+import org.irods.jargon.core.connection.IRODSAccount;
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
+import org.irods.jargon.core.pub.IRODSFileSystem;
+import org.irods.jargon.spring.security.IRODSAuthenticationToken
+import org.irods.jargon.testutils.TestingPropertiesHelper;
+import org.springframework.security.core.context.SecurityContextHolder
+
+
+import grails.test.*
+
+class IdropLiteControllerTests extends ControllerUnitTestCase {
+ IRODSAccessObjectFactory irodsAccessObjectFactory
+ IRODSAccount irodsAccount
+ Properties testingProperties
+ TestingPropertiesHelper testingPropertiesHelper
+ IRODSFileSystem irodsFileSystem
+
+
+ protected void setUp() {
+ super.setUp()
+ testingPropertiesHelper = new TestingPropertiesHelper()
+ testingProperties = testingPropertiesHelper.getTestProperties()
+ irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties)
+ irodsFileSystem = IRODSFileSystem.instance()
+ irodsAccessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory()
+ def irodsAuthentication = new IRODSAuthenticationToken(irodsAccount)
+ SecurityContextHolder.getContext().authentication = irodsAuthentication
+ }
+
+ protected void tearDown() {
+ super.tearDown()
+ }
+
+ void testAppletLoader() {
+ controller.params.absPath = "/"
+ controller.irodsAccessObjectFactory = irodsAccessObjectFactory
+ controller.irodsAccount = irodsAccount
+ controller.appletLoader()
+ def controllerResponse = controller.response.contentAsString
+ assertNotNull("missing applet info", controllerResponse)
+
+ }
+}
diff --git a/idrop-web/web-app/WEB-INF/applicationContext.xml b/idrop-web/web-app/WEB-INF/applicationContext.xml
index 86acc04..6f42796 100644
--- a/idrop-web/web-app/WEB-INF/applicationContext.xml
+++ b/idrop-web/web-app/WEB-INF/applicationContext.xml
@@ -4,8 +4,6 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-
<bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
<description>Grails application factory bean</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
diff --git a/idrop-web/web-app/css/main.css b/idrop-web/web-app/css/main.css
index 506de33..054c9d9 100644
--- a/idrop-web/web-app/css/main.css
+++ b/idrop-web/web-app/css/main.css
@@ -216,7 +216,7 @@ div#tabs {
display:block;
overflow:auto;
width:100%;
- height:30px;
+ height:55px;
position:relative;
}
diff --git a/idrop-web/web-app/js/mydrop/home.js b/idrop-web/web-app/js/mydrop/home.js
index 6433950..abc23b0 100644
--- a/idrop-web/web-app/js/mydrop/home.js
+++ b/idrop-web/web-app/js/mydrop/home.js
@@ -18,6 +18,8 @@ var aclDialogMessageSelector = "#aclDialogMessageArea";
*/
var aclUpdateUrl = '/sharing/updateAcl';
+var idropLiteUrl = '/idropLite/appletLoader';
+
/**
* Initialize the tree control for the first view by issuing an ajax directory
@@ -452,3 +454,39 @@ function buildFormFromACLDetailsTable() {
formData.push({name:'absPath',value:selectedPath});
return formData;
}
+
+
+/**
+ * Display the iDrop lite gui, passing in the given irods base collection name
+ */
+function showIdropLite() {
+ alert("showing idrop lite");
+ var idropLiteSelector = "#idropLiteArea";
+ var myPath = selectedPath;
+ if (selectedPath == null) {
+ myPath = "/";
+ }
+
+ lcShowBusyIconInDiv(idropLiteSelector);
+
+ var params = {
+ absPath : myPath
+ }
+
+ var jqxhr = $.post(context + idropLiteUrl, params,
+ function(data, status, xhr) {
+ lcClearDivAndDivClass(idropLiteSelector);
+ $(idropLiteSelector).html(data);
+ }, "html").error(function(xhr, status, error) {
+ setMessageInArea(idropLiteSelector, xhr.responseText);
+ }).success(
+ function() {
+
+ }).error(function(xhr, status, error) {
+ setMessageInArea(idropLiteSelector, xhr.responseText);
+ });
+
+
+
+
+}