summaryrefslogtreecommitdiffstats
path: root/idrop-web
diff options
context:
space:
mode:
authorMike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-02-26 19:10:21 (GMT)
committer Mike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-02-26 19:10:21 (GMT)
commit4a8b9f91d9eae9900a536e74cb7691483405ba7f (patch)
tree3419ccbdbda32bf89d15e11d7176195bf2fd49eb /idrop-web
parent96e279c64fbc4807da8929fbbb36f5a2ae718e33 (diff)
downloadQCG-Data-4a8b9f91d9eae9900a536e74cb7691483405ba7f.zip
QCG-Data-4a8b9f91d9eae9900a536e74cb7691483405ba7f.tar.gz
QCG-Data-4a8b9f91d9eae9900a536e74cb7691483405ba7f.tar.bz2
tag updates, adding search controller
Diffstat (limited to 'idrop-web')
-rw-r--r--idrop-web/grails-app/conf/BuildConfig.groovy1
-rw-r--r--idrop-web/grails-app/conf/spring/resources.groovy5
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy5
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/SearchController.groovy33
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/TagsController.groovy22
-rw-r--r--idrop-web/grails-app/views/browse/collectionInfo.gsp25
-rw-r--r--idrop-web/grails-app/views/browse/dataObjectInfo.gsp20
-rw-r--r--idrop-web/grails-app/views/layouts/main.gsp2
-rw-r--r--idrop-web/test/unit/idrop/web/SearchControllerTests.groovy17
-rw-r--r--idrop-web/test/unit/org/irods/mydrop/controller/TagsControllerTests.groovy62
-rw-r--r--idrop-web/web-app/js/mydrop/home.js116
-rw-r--r--idrop-web/web-app/js/mydrop/lingo_common.js50
-rw-r--r--idrop-web/web-app/js/mydrop/main.js6
13 files changed, 224 insertions, 140 deletions
diff --git a/idrop-web/grails-app/conf/BuildConfig.groovy b/idrop-web/grails-app/conf/BuildConfig.groovy
index 873166a..27c7fa5 100644
--- a/idrop-web/grails-app/conf/BuildConfig.groovy
+++ b/idrop-web/grails-app/conf/BuildConfig.groovy
@@ -39,6 +39,7 @@ grails.project.dependency.resolution = {
compile 'org.springframework.security:spring-security-config:3.0.5.RELEASE'
compile 'org.springframework:spring-web:3.0.5.RELEASE'
compile 'javax.servlet:servlet-api:2.5'
+ compile 'org.jsoup:jsoup:0.2.2'
compile( group: 'log4j', name: 'log4j', version: '1.2.16', export: false )
diff --git a/idrop-web/grails-app/conf/spring/resources.groovy b/idrop-web/grails-app/conf/spring/resources.groovy
index d8f633e..8b5a056 100644
--- a/idrop-web/grails-app/conf/spring/resources.groovy
+++ b/idrop-web/grails-app/conf/spring/resources.groovy
@@ -11,4 +11,9 @@ beans = {
taggingServiceFactory = ref("taggingServiceFactory")
}
+ searchController(org.irods.mydrop.controller.SearchController) {
+ irodsAccessObjectFactory = ref("irodsAccessObjectFactory")
+ taggingServiceFactory = ref("taggingServiceFactory")
+ }
+
}
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 8864511..5418baa 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy
@@ -35,6 +35,11 @@ class BrowseController {
irodsAccount = irodsAuthentication.irodsAccount
log.debug("retrieved account for request: ${irodsAccount}")
}
+
+ def afterInterceptor = {
+ log.debug("closing the session")
+ irodsAccessObjectFactory.closeSession()
+ }
/**
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
new file mode 100644
index 0000000..7a8cd22
--- /dev/null
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SearchController.groovy
@@ -0,0 +1,33 @@
+package idrop.web
+
+import org.irods.jargon.core.connection.IRODSAccount;
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
+import org.irods.jargon.usertagging.TaggingServiceFactory;
+
+class SearchController {
+
+ IRODSAccessObjectFactory irodsAccessObjectFactory
+ TaggingServiceFactory taggingServiceFactory
+ 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 index = { }
+}
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/TagsController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/TagsController.groovy
index 13cf60c..bf67bc1 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/TagsController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/TagsController.groovy
@@ -1,14 +1,16 @@
package org.irods.mydrop.controller
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.usertagging.FreeTaggingService
import org.irods.jargon.usertagging.TaggingServiceFactory
import org.irods.jargon.usertagging.UserTagCloudService
-import org.irods.jargon.usertagging.FreeTaggingService
import org.irods.jargon.usertagging.domain.UserTagCloudView
+import org.jsoup.Jsoup
+import org.jsoup.safety.Whitelist
import org.springframework.security.core.context.SecurityContextHolder
-import org.irods.jargon.core.exception.*
class TagsController {
@@ -16,6 +18,9 @@ class TagsController {
IRODSAccessObjectFactory irodsAccessObjectFactory
TaggingServiceFactory taggingServiceFactory
IRODSAccount irodsAccount
+
+ def allowedMethods = [
+ updateTags:['POST']]
/**
* Interceptor grabs IRODSAccount from the SecurityContextHolder
@@ -31,6 +36,11 @@ class TagsController {
log.debug("retrieved account for request: ${irodsAccount}")
}
+
+ def afterInterceptor = {
+ log.debug("closing any open sessions")
+ irodsAccessObjectFactory.closeSession()
+ }
def index = { }
@@ -52,15 +62,14 @@ class TagsController {
*/
def updateTags = {
String absPath = params['absPath']
- def tagString = params['tags']
-
-
+ def tagString = Jsoup.clean(params['tags'], Whitelist.basic())
+
if (absPath == null || absPath.isEmpty()) {
throw new JargonException("no absPath passed to method")
}
if (tagString == null) {
- throw new JargonRuntimeException("null tags passed to method")
+ throw new JargonException("null tags passed to method")
}
log.info("updating tags for file: ${absPath} for user: ${irodsAccount.userName}")
@@ -68,6 +77,7 @@ class TagsController {
FreeTaggingService freeTaggingService = taggingServiceFactory.instanceFreeTaggingService(irodsAccount)
freeTaggingService.updateTagsForUserForADataObjectOrCollection(absPath, irodsAccount.userName, tagString)
log.info("tags updated")
+ render "success"
}
diff --git a/idrop-web/grails-app/views/browse/collectionInfo.gsp b/idrop-web/grails-app/views/browse/collectionInfo.gsp
index 15f50b0..f226ccc 100644
--- a/idrop-web/grails-app/views/browse/collectionInfo.gsp
+++ b/idrop-web/grails-app/views/browse/collectionInfo.gsp
@@ -1,18 +1,23 @@
-<fieldset id="verticalForm">
-
-<label for="">Parent
+<fieldset id="verticalForm"><label for="">Parent
Collection:</label> <g:textField name="collectionParentName"
value="${collection.collectionParentName}" readonly="true" /> <br />
-<label for="collectionName">Collection Name:</label> <g:textField name="collectionName"
- value="${collection.collectionName}" readonly="true" /> <br />
-
+<label for="collectionName">Collection Name:</label> <g:textField
+ name="collectionName" value="${collection.collectionName}"
+ readonly="true" /> <br />
+
<label for="createdAt">Created At:</label> <g:textField name="createdAt"
value="${collection.createdAt}" readonly="true" /> <br />
-
-<label for="tags">Tags:</label> <g:textField name="tags"
+
+<label for="tags">Tags:</label> <g:textField id="infoTags" name="tags"
value="${tags.spaceDelimitedTagsForDomain}" /> <br />
+
+<g:hiddenField id="infoAbsPath" name="absolutePath"
+ value="${collection.collectionName}" />
+
+<button type="button" id="updateTags" value="updateTags"
+ onclick="updateTags()")>Update Tags</button>
-<button type="button" id="updateTags" value="updateTags" onclick="updateTags()")>Update Tags</button>
-
+<div id="infoUpdateArea"><!-- div for any updates in info --></div>
+
</fieldset> \ No newline at end of file
diff --git a/idrop-web/grails-app/views/browse/dataObjectInfo.gsp b/idrop-web/grails-app/views/browse/dataObjectInfo.gsp
index 28392b4..e2ee2d5 100644
--- a/idrop-web/grails-app/views/browse/dataObjectInfo.gsp
+++ b/idrop-web/grails-app/views/browse/dataObjectInfo.gsp
@@ -1,24 +1,28 @@
-<fieldset id="verticalForm">
-
-<label for="collectionName">Parent
+<fieldset id="verticalForm"><label for="collectionName">Parent
Collection:</label> <g:textField name="collectionName"
value="${dataObject.collectionName}" readonly="true" /> <br />
<label for="dataName">File Name:</label> <g:textField name="dataName"
value="${dataObject.dataName}" readonly="true" /> <br />
-
+
<label for="createdAt">Created At:</label> <g:textField name="createdAt"
value="${dataObject.createdAt}" readonly="true" /> <br />
-
+
<label for="dataSize">Size:</label> <g:textField name="dataSize"
value="${dataObject.dataSize}" readonly="true" /> <br />
-
+
<label for="checksum">Checksum:</label> <g:textField name="checksum"
value="${dataObject.checksum}" readonly="true" /> <br />
-<label for="tags">Tags:</label> <g:textField name="tags"
+<label for="tags">Tags:</label> <g:textField id="infoTags" name="tags"
value="${tags.spaceDelimitedTagsForDomain}" /> <br />
+
+<g:hiddenField id="infoAbsPath" name="absolutePath"
+ value="${dataObject.absolutePath}" />
+
+<button type="button" id="updateTags" value="updateTags"
+ onclick="updateTags()")>Update Tags</button>
-<button type="button" id="updateTags" value="updateTags" onclick="updateTags()")>Update Tags</button>
+ <div id="infoUpdateArea"><!-- div for any updates in info --></div>
</fieldset> \ No newline at end of file
diff --git a/idrop-web/grails-app/views/layouts/main.gsp b/idrop-web/grails-app/views/layouts/main.gsp
index 9dcc726..8794131 100644
--- a/idrop-web/grails-app/views/layouts/main.gsp
+++ b/idrop-web/grails-app/views/layouts/main.gsp
@@ -15,6 +15,8 @@
<g:javascript library="jquery-1.4.4.min" />
<g:javascript library="jquery-ui-1.8.7.custom.min" />
<g:javascript library="mydrop/lingo_common" />
+<g:javascript library="mydrop/main" />
+
<!-- preserve the application context as a js variable for use in AJAX callbacks -->
<script type="text/javascript">
context = "${request.contextPath}";
diff --git a/idrop-web/test/unit/idrop/web/SearchControllerTests.groovy b/idrop-web/test/unit/idrop/web/SearchControllerTests.groovy
new file mode 100644
index 0000000..99f7324
--- /dev/null
+++ b/idrop-web/test/unit/idrop/web/SearchControllerTests.groovy
@@ -0,0 +1,17 @@
+package idrop.web
+
+import grails.test.*
+
+class SearchControllerTests extends ControllerUnitTestCase {
+ protected void setUp() {
+ super.setUp()
+ }
+
+ protected void tearDown() {
+ super.tearDown()
+ }
+
+ void testSomething() {
+
+ }
+}
diff --git a/idrop-web/test/unit/org/irods/mydrop/controller/TagsControllerTests.groovy b/idrop-web/test/unit/org/irods/mydrop/controller/TagsControllerTests.groovy
index 5407068..a103279 100644
--- a/idrop-web/test/unit/org/irods/mydrop/controller/TagsControllerTests.groovy
+++ b/idrop-web/test/unit/org/irods/mydrop/controller/TagsControllerTests.groovy
@@ -10,6 +10,7 @@ import grails.test.*
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.core.exception.*
import org.irods.jargon.testutils.TestingPropertiesHelper
import org.irods.jargon.usertagging.FreeTaggingService;
import org.irods.jargon.usertagging.UserTagCloudService
@@ -22,7 +23,7 @@ import org.mockito.Mockito
class TagsControllerTests extends ControllerUnitTestCase {
-
+
IRODSAccessObjectFactory irodsAccessObjectFactory
IRODSAccount irodsAccount
Properties testingProperties
@@ -48,7 +49,7 @@ class TagsControllerTests extends ControllerUnitTestCase {
controller.irodsAccessObjectFactory = irodsAccessObjectFactory
UserTagCloudService userTagCloudService = Mockito.mock(UserTagCloudService.class)
TaggingServiceFactory taggingServiceFactory = Mockito.mock(TaggingServiceFactory.class)
- UserTagCloudView userTagCloudView = UserTagCloudView.instance(irodsAccount.getUserName(), new ArrayList<IRODSTagValue>(), new ArrayList<IRODSTagValue>())
+ UserTagCloudView userTagCloudView = UserTagCloudView.instance(irodsAccount.getUserName(), new ArrayList<IRODSTagValue>(), new ArrayList<IRODSTagValue>())
Mockito.when(userTagCloudService.getTagCloud()).thenReturn(userTagCloudView)
Mockito.when(taggingServiceFactory.instanceUserTagCloudService(irodsAccount)).thenReturn(userTagCloudService)
controller.irodsAccount = irodsAccount
@@ -60,9 +61,8 @@ class TagsControllerTests extends ControllerUnitTestCase {
assertEquals("view name should be tagCloud", "tagCloud", name)
def tagView = mav.model.tagCloud
assertNotNull("null tagView in model", tagView)
-
}
-
+
void testUpdateTags() {
testingPropertiesHelper = new TestingPropertiesHelper()
testingProperties = testingPropertiesHelper.getTestProperties()
@@ -82,9 +82,59 @@ class TagsControllerTests extends ControllerUnitTestCase {
controller.updateTags()
Mockito.verify(freeTaggingService).updateTagsForUserForADataObjectOrCollection(absPath, user, tags)
-
+ }
+
+ void testUpdateTagsNoPath() {
+ testingPropertiesHelper = new TestingPropertiesHelper()
+ testingProperties = testingPropertiesHelper.getTestProperties()
+ irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties)
+ FreeTaggingService freeTaggingService = Mockito.mock(FreeTaggingService.class)
+ TaggingServiceFactory taggingServiceFactory = Mockito.mock(TaggingServiceFactory.class)
+ Mockito.when(taggingServiceFactory.instanceFreeTaggingService(irodsAccount)).thenReturn(freeTaggingService)
+ controller.irodsAccessObjectFactory = irodsAccessObjectFactory
+ controller.taggingServiceFactory = taggingServiceFactory
+ controller.irodsAccount = irodsAccount
+ def tags = "tag1 tag2 tag3"
+ def user = irodsAccount.getUserName()
+ def absPath = "abspath"
+ controller.params.absPath = null
+ controller.params.tags = tags
+ shouldFail(JargonException) { controller.updateTags() }
}
+ void testUpdateTagsBlankPath() {
+ testingPropertiesHelper = new TestingPropertiesHelper()
+ testingProperties = testingPropertiesHelper.getTestProperties()
+ irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties)
+ FreeTaggingService freeTaggingService = Mockito.mock(FreeTaggingService.class)
+ TaggingServiceFactory taggingServiceFactory = Mockito.mock(TaggingServiceFactory.class)
+ Mockito.when(taggingServiceFactory.instanceFreeTaggingService(irodsAccount)).thenReturn(freeTaggingService)
+ controller.irodsAccessObjectFactory = irodsAccessObjectFactory
+ controller.taggingServiceFactory = taggingServiceFactory
+ controller.irodsAccount = irodsAccount
+ def tags = "tag1 tag2 tag3"
+ def user = irodsAccount.getUserName()
+ def absPath = "abspath"
+ controller.params.absPath = ""
+ controller.params.tags = tags
+ shouldFail(JargonException) { controller.updateTags() }
+ }
-
+ void testUpdateTagsNullTags() {
+ testingPropertiesHelper = new TestingPropertiesHelper()
+ testingProperties = testingPropertiesHelper.getTestProperties()
+ irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties)
+ FreeTaggingService freeTaggingService = Mockito.mock(FreeTaggingService.class)
+ TaggingServiceFactory taggingServiceFactory = Mockito.mock(TaggingServiceFactory.class)
+ Mockito.when(taggingServiceFactory.instanceFreeTaggingService(irodsAccount)).thenReturn(freeTaggingService)
+ controller.irodsAccessObjectFactory = irodsAccessObjectFactory
+ controller.taggingServiceFactory = taggingServiceFactory
+ controller.irodsAccount = irodsAccount
+ def tags = "tag1 tag2 tag3"
+ def user = irodsAccount.getUserName()
+ def absPath = "abspath"
+ controller.params.absPath = "path"
+ controller.params.tags = null
+ shouldFail(JargonException) { controller.updateTags() }
+ }
}
diff --git a/idrop-web/web-app/js/mydrop/home.js b/idrop-web/web-app/js/mydrop/home.js
index da7f347..37bf39e 100644
--- a/idrop-web/web-app/js/mydrop/home.js
+++ b/idrop-web/web-app/js/mydrop/home.js
@@ -21,79 +21,6 @@ function retrieveBrowserFirstView() {
browserFirstViewRetrieved);
}
-// get rid of
-function useAjaxToRetrieveATreeNode(node, path) {
- var url = "/browse/loadTree";
- strPath = "";
- // make path into a parameter for 'dir'
- for (i = 0; i < path.length; i++) {
- if (path[i] == "/") {
- // skip
- } else {
- strPath += "/";
- strPath += path[i];
- }
- }
-
- parms = {
- "dir" : strPath
- };
-
- lcSendValueAndCallbackWithJsonAfterErrorCheck(url, parms, "#dataTreeDiv",
- function(data) {
- nodeTreeRetrievedViaAjax(node, data);
- });
-
-}
-
-// get rid of
-function nodeTreeRetrievedViaAjax(targetNode, jsonData) {
-
- var directoryList = jsonData.directoryList;
-
- if (directoryList == null) {
- synchronizeDetailView(targetNode, path);
- return;
- }
-
- for (i = 0; i < directoryList.length; i++) {
- var entry = directoryList[i];
- var nodeData = {}
- if (entry.file == true) {
- nodeData = {
-
- "data" : entry.data.substring(entry.data.lastIndexOf("/") + 1)
- };
- } else {
- nodeData = {
- "state" : "closed",
- "data" : entry.data.substring(entry.data.lastIndexOf("/") + 1)
- };
- }
-
- $.jstree._reference(targetNode).create_node(targetNode, "last",
- nodeData, nodeLoadedCallback);
- }
-
- synchronizeDetailView(targetNode, path);
- $.jstree._reference(targetNode).toggle_node(targetNode, false, false);
-
-}
-
-/**
- * handy method to build the parms for an ajax request for the given path
- *
- * @param n
- * @return
- */
-// get rid of
-function buildDataForNodeRequest(n) {
- var nodeData = {
- "dir" : "/"
- };
- return nodeData;
-}
-
/**
* Callback to initialize a browser tree for the first time, set to the root
* node as indicated in the data
@@ -149,15 +76,10 @@ function browserFirstViewRetrieved(data) {
});
$("#dataTreeDiv").bind("select_node.jstree", function(e, data) {
- // alert(data.rslt.obj); // this is the object that was clicked
nodeSelected(e, data.rslt.obj);
});
- /*
- * dataTree.live("click", function(event, data) { nodeSelected(event, data)
- * });
- */
-
+
}
/**
@@ -185,36 +107,12 @@ function nodeSelected(event, data) {
}
-/**
- * Event callback to synchronize a detail view with the selected node as the
- * parent
- *
- * @param node
- * tree node that should be synchronized to
- * @param path
- * path array of the given node
- * @return
- */
-function synchronizeDetailView(node, path) {
- // alert("synch");
- // put build of data tree table view
-}
-
-/**
- * Determine if this node has been loaded (that the dir contents are retrieved
- * via ajax call)
- *
- * @param node
- * tree node in question
- * @return true if node is loaded already
+/***
+ * Linked to update tags button on info view, update the tags in iRODS
*/
-function isThisNodeLoaded(node) {
-
- return obj == -1 || !obj || obj.is(".jstree-open, .jstree-leaf")
- || obj.children("ul").children("li").size() > 0;
-
-}
-
function updateTags() {
- alert("updating tags");
+ var infoTagsVal = $("#infoTags").val();
+ var absPathVal = $("#infoAbsPath").val();
+ var params = {absPath:absPathVal, tags:infoTagsVal}
+ lcSendValueViaPostAndCallbackHtmlAfterErrorCheck("/tags/updateTags", params,"#infoUpdateArea","#infoUpdateArea", function() {$("#infoUpdateArea").html("Tags updated");});
}
diff --git a/idrop-web/web-app/js/mydrop/lingo_common.js b/idrop-web/web-app/js/mydrop/lingo_common.js
index 17f39d6..91abfc4 100644
--- a/idrop-web/web-app/js/mydrop/lingo_common.js
+++ b/idrop-web/web-app/js/mydrop/lingo_common.js
@@ -260,7 +260,7 @@ function lcSendValueAndPlugHtmlInDiv(getUrl, resultDiv, context,
}
/*
- * Send a query via ajax that results in html plugged into the correct div
+ * Send a query via ajax GET request that results in html plugged into the correct div
*/
function lcSendValueAndCallbackHtmlAfterErrorCheck(getUrl, divForAjaxError,
divForLoadingGif, callbackFunction) {
@@ -301,6 +301,54 @@ function lcSendValueAndCallbackHtmlAfterErrorCheck(getUrl, divForAjaxError,
}
+
+/**
+ * Send a query via ajax POST request that results in html plugged into the correct div
+ * @param postURL url String (sans web context, which is automatically appended) for the POST action
+ * @param params map with name/value params for the post data
+ * @param divForAjaxError JQuery selector for a DIV to display any Ajax error
+ * @param divForLoadingGif JQuery selector for a DIV in which to display a loading GIF, and then any response data
+ * @param callbackFunction optional function reference that will receive a callback
+ */
+function lcSendValueViaPostAndCallbackHtmlAfterErrorCheck(postUrl, params, divForAjaxError,
+ divForLoadingGif, callbackFunction) {
+
+ prepareForCall();
+ if (postUrl.length == 0) {
+ throw ("no post url for call");
+ }
+
+ var img = document.createElement('IMG');
+ img.setAttribute("src", context + "/images/ajax-loader.gif");
+
+ $(divForLoadingGif).html(img);
+
+ try {
+
+ $.post(context + postUrl, params, function(data) {
+ checkAjaxResultForError(data);
+ $(divForLoadingGif).html("");
+ if (callbackFunction != null) {
+ var myHtml = data;
+ callbackFunction(myHtml);
+ } else {
+ $(divForLoadingGif).html(data);
+ }
+ }, "html");
+
+ $(divForAjaxError).ajaxError(function(e, xhr, settings, exception) {
+ $(divForLoadingGif).html("");
+ checkAjaxResultForError(xhr.responseText);
+ });
+
+ } catch (err) {
+ $(divForLoadingGif).html(""); // FIXME: some sort of error icon?
+ setMessage(err);
+ console.log("javascript error:" + err);
+ }
+
+}
+
/*
* Send a query via ajax that results in json that will be returned to a
* callback function
diff --git a/idrop-web/web-app/js/mydrop/main.js b/idrop-web/web-app/js/mydrop/main.js
new file mode 100644
index 0000000..4c2c77c
--- /dev/null
+++ b/idrop-web/web-app/js/mydrop/main.js
@@ -0,0 +1,6 @@
+/**
+ * Javascript for common elements in main layout template, such as menus, headers, and footers.
+ *
+ * author: Mike Conway - DICE
+ */
+