summaryrefslogtreecommitdiffstats
path: root/idrop-web
diff options
context:
space:
mode:
authorMike Conway <mikeconway@mid-campus-04640.wireless.unc.edu>2011-02-28 18:52:17 (GMT)
committer Mike Conway <mikeconway@mid-campus-04640.wireless.unc.edu>2011-02-28 18:52:17 (GMT)
commit8a18e1f1dbd18be59d20b70071b5c3f12b8dc7f7 (patch)
tree8c4ea9614d8548baf2f843bcdf25de367ab08b7a /idrop-web
parented13fe9ff4f94ac676c95129c2cae3c805f75d6d (diff)
downloadQCG-Data-8a18e1f1dbd18be59d20b70071b5c3f12b8dc7f7.zip
QCG-Data-8a18e1f1dbd18be59d20b70071b5c3f12b8dc7f7.tar.gz
QCG-Data-8a18e1f1dbd18be59d20b70071b5c3f12b8dc7f7.tar.bz2
tag based search in web
Diffstat (limited to 'idrop-web')
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/SearchController.groovy9
-rw-r--r--idrop-web/grails-app/views/common/_secondarymain.gsp16
-rw-r--r--idrop-web/grails-app/views/common/_topbar.gsp4
-rw-r--r--idrop-web/test/unit/org/irods/mydrop/controller/SearchControllerTests.groovy37
-rw-r--r--idrop-web/web-app/js/mydrop/main.js4
5 files changed, 66 insertions, 4 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SearchController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SearchController.groovy
index e0b3755..287df80 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SearchController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SearchController.groovy
@@ -3,8 +3,12 @@ package org.irods.mydrop.controller
import org.irods.jargon.core.connection.*
import org.irods.jargon.core.exception.*
import org.irods.jargon.core.pub.*
+import org.irods.jargon.usertagging.FreeTaggingService
import org.irods.jargon.usertagging.TaggingServiceFactory
+import org.irods.jargon.usertagging.domain.TagQuerySearchResult
import org.springframework.security.core.context.SecurityContextHolder
+import org.irods.jargon.usertagging.TaggingServiceFactory
+
class SearchController {
@@ -54,6 +58,11 @@ class SearchController {
CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsAccessObjectFactory.getCollectionAndDataObjectListAndSearchAO(irodsAccount)
def results = collectionAndDataObjectListAndSearchAO.searchCollectionsAndDataObjectsBasedOnName(searchTerm);
render(view:"searchResult", model:[results:results])
+ } else if (searchType=="tag") {
+ log.info "search based on tag"
+ FreeTaggingService freeTaggingService = taggingServiceFactory.instanceFreeTaggingService(irodsAccount)
+ TagQuerySearchResult searchResult = freeTaggingService.searchUsingFreeTagString(searchTerm)
+ render(view:"searchResult", model:[results:searchResult.queryResultEntries])
}
}
}
diff --git a/idrop-web/grails-app/views/common/_secondarymain.gsp b/idrop-web/grails-app/views/common/_secondarymain.gsp
index 9eee188..a13dc28 100644
--- a/idrop-web/grails-app/views/common/_secondarymain.gsp
+++ b/idrop-web/grails-app/views/common/_secondarymain.gsp
@@ -9,6 +9,7 @@
<ul>
<li><a href="#tabs-1">Tags</a></li>
<li><a href="#tabs-2">People</a></li>
+ <li><a href="#tabs-3">iDrop Desktop</a></li>
</ul>
<div id="tabs-1">
@@ -24,4 +25,17 @@
<li>Terrell Russell</li>
<li>Art Vandalay</li>
</ul>
-</div> \ No newline at end of file
+</div>
+
+
+<div id="tabs-3">
+ <h1>Launch iDrop Desktop Client v 0.9.1 alpha - work in progress</h1>
+ <script src="http://www.java.com/js/deployJava.js"></script>
+ <script>
+ // using JavaScript to get location of JNLP file relative to HTML page
+ var url = "http://irendb.renci.org:8080/llclient/launchLLDrop.html";
+ //deployJava.createWebStartLaunchButton(url, '1.6.0');
+ </script><a onmouseover="window.status=''; return true;" href="javascript:if (!deployJava.isWebStartInstalled(&quot;1.6.0&quot;)) {if (deployJava.installLatestJRE()) {if (deployJava.launch(&quot;http://irendb.renci.org:8080/llclient/idrop.jnlp&quot;)) {}}} else {if (deployJava.launch(&quot;http://irendb.renci.org:8080/llclient/idrop.jnlp&quot;)) {}}"><img border="0" src="http://java.sun.com/products/jfc/tsc/articles/swing2d/webstart.png"></a>
+
+</div>
+
diff --git a/idrop-web/grails-app/views/common/_topbar.gsp b/idrop-web/grails-app/views/common/_topbar.gsp
index 6f9cad1..439bad7 100644
--- a/idrop-web/grails-app/views/common/_topbar.gsp
+++ b/idrop-web/grails-app/views/common/_topbar.gsp
@@ -5,7 +5,9 @@
<fieldset class=""><label for="">Search Term:</label> <input
id="searchTerm" type="text" name="searchTerm" />
-<button type="button" id="search" value="search" onclick="search()")>Search</button>
+<button type="button" id="search" value="search" onclick="search()")>Search</button> as a
+
+<g:select name="searchType" id="searchType" from="${['file', 'tag']}" noSelection="['file':'']" />
</fieldset>
</g:ifAuthenticated>
diff --git a/idrop-web/test/unit/org/irods/mydrop/controller/SearchControllerTests.groovy b/idrop-web/test/unit/org/irods/mydrop/controller/SearchControllerTests.groovy
index dcc2261..098f62c 100644
--- a/idrop-web/test/unit/org/irods/mydrop/controller/SearchControllerTests.groovy
+++ b/idrop-web/test/unit/org/irods/mydrop/controller/SearchControllerTests.groovy
@@ -11,14 +11,16 @@ 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.irods.jargon.usertagging.FreeTaggingService;
import org.irods.jargon.usertagging.domain.IRODSTagGrouping
+import org.irods.jargon.usertagging.domain.TagQuerySearchResult;
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry
import org.mockito.Mockito
import org.springframework.security.core.context.SecurityContextHolder
class SearchControllerTests extends ControllerUnitTestCase {
- IRODSAccessObjectFactory irodsAccessObjectFactory
+ IRODSAccessObjectFactory irodsAccessObjectFactory
IRODSAccount irodsAccount
Properties testingProperties
TestingPropertiesHelper testingPropertiesHelper
@@ -100,5 +102,38 @@ class SearchControllerTests extends ControllerUnitTestCase {
shouldFail(JargonException) { controller.search() }
}
+ void testSearchTag() {
+ def searchTerm = "searchTerm"
+ def searchType = "tag"
+ def irodsAccessObjectFactory = Mockito.mock(IRODSAccessObjectFactory.class)
+
+ CollectionAndDataObjectListAndSearchAO collectionListAndSearchAO = Mockito.mock(CollectionAndDataObjectListAndSearchAO.class)
+ Mockito.when(irodsAccessObjectFactory.getCollectionAndDataObjectListAndSearchAO(irodsAccount)).thenReturn(collectionListAndSearchAO)
+
+ FreeTaggingService freeTaggingService = Mockito.mock(FreeTaggingService.class)
+ def entries = new ArrayList<CollectionAndDataObjectListingEntry>()
+ tagQuerySearchResult = TagQuerySearchResult.instance("tags", entries)
+ Mockito.when(freeTaggingService.searchUsingFreeTagString(searchTerm)).thenReturn(tagQuerySearchResult)
+
+ TaggingServiceFactory taggingServiceFactory = Mockito.mock(TaggingServiceFactory.class)
+ Mockito.when(taggingServiceFactory.instanceFreeTaggingService(irodsAccount)).thenReturn(freeTaggingService)
+
+
+ controller.irodsAccount = irodsAccount
+ controller.irodsAccessObjectFactory = irodsAccessObjectFactory
+ controller.params.searchTerm = searchTerm
+ controller.params.searchType = searchType
+ controller.search()
+ def mav = controller.modelAndView
+ def name = mav.viewName
+
+ assertNotNull("null mav", mav)
+ assertEquals("view name should be searchResult", "searchResult", name)
+ def resultObj = mav.model.results
+ assertNotNull("null results", resultObj)
+
+ }
+
+
}
diff --git a/idrop-web/web-app/js/mydrop/main.js b/idrop-web/web-app/js/mydrop/main.js
index 47d1346..26c9a16 100644
--- a/idrop-web/web-app/js/mydrop/main.js
+++ b/idrop-web/web-app/js/mydrop/main.js
@@ -6,7 +6,9 @@
function search() {
var searchTerm = $("#searchTerm").val();
+ var searchType = $("#searchType").val();
+
$('#tabs').tabs({ selected: 1 }); // activate search results tab
- prosecuteSearch(searchTerm, "file");
+ prosecuteSearch(searchTerm, searchType);
}