summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormconway <michael.c.conway@gmail.com>2013-01-31 12:23:29 (GMT)
committer mconway <michael.c.conway@gmail.com>2013-01-31 12:23:29 (GMT)
commit57915d33062dca6d62943f6a8b08afa4c3f85554 (patch)
tree068d622fcc167a63903d888ef593ba3a44bba34b
parent95bcee38a3b4e0e2683e708d344d1cf7317c0e98 (diff)
downloadQCG-Data-57915d33062dca6d62943f6a8b08afa4c3f85554.zip
QCG-Data-57915d33062dca6d62943f6a8b08afa4c3f85554.tar.gz
QCG-Data-57915d33062dca6d62943f6a8b08afa4c3f85554.tar.bz2
[#511] add share now working
-rwxr-xr-xidrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy8
-rwxr-xr-xidrop-web/grails-app/views/sharing/addShareDialog.gsp2
-rwxr-xr-xidrop-web/web-app/js/mydrop/home.js42
3 files changed, 40 insertions, 12 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy
index b168091..720d4b8 100755
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy
@@ -177,7 +177,10 @@ class SharingController {
}
- def prepareExistingShareDialog = {
+ /**
+ * SHow a dialog that can edit the share
+ */
+ def prepareEditShareDialog = {
log.info("prepareExistingShareDialog")
log.info(params)
def absPath = params['absPath']
@@ -204,7 +207,7 @@ class SharingController {
}
}
- render(view:"sharingPanelWrapper", model:[absPath:absPath, irodsSharedFileOrCollection:irodsSharedFileOrCollection, action:action])
+ render(view:"addShareDialog", model:[absPath:absPath, shareName:irodsSharedFileOrCollection.shareName, action:action])
}
def processUpdateShareDialog = {
@@ -238,6 +241,7 @@ class SharingController {
log.info("adding share:${shareName}")
IRODSSharedFileOrCollection irodsSharedFileOrCollection = sharingService.createShare(absPath, shareName, irodsAccount)
log.info("rendering new share:${irodsSharedFileOrCollection}")
+ flash.message = message(code:"message.share.update.successful")
render(view:"sharingPanelWrapper", model:[absPath:absPath, irodsSharedFileOrCollection:irodsSharedFileOrCollection, action:action])
}
diff --git a/idrop-web/grails-app/views/sharing/addShareDialog.gsp b/idrop-web/grails-app/views/sharing/addShareDialog.gsp
index 85d3da0..08ee36f 100755
--- a/idrop-web/grails-app/views/sharing/addShareDialog.gsp
+++ b/idrop-web/grails-app/views/sharing/addShareDialog.gsp
@@ -27,7 +27,7 @@
</div>
<div class="control-group">
<div class="controls">
- <button type="submit" class="btn" onclick="updateShare()">
+ <button type="button" class="btn" id="btnUpdateNamedShare" onclick="updateNamedShare()">
<g:message code="text.update" />
</button>
<button type="cancel" class="btn">
diff --git a/idrop-web/web-app/js/mydrop/home.js b/idrop-web/web-app/js/mydrop/home.js
index 4a38021..3bf7f2f 100755
--- a/idrop-web/web-app/js/mydrop/home.js
+++ b/idrop-web/web-app/js/mydrop/home.js
@@ -638,7 +638,7 @@ function updateBrowseDetailsForPathBasedOnCurrentModel(absPath) {
}
if (browseOptionVal == null) {
- browseOptionVal = "browse";
+ browseOptionVal = "info";
}
@@ -2611,19 +2611,44 @@ function addShareAtPath() {
});
}
+
+/*
+* Edit the share at the given path
+*/
+function editShareAtPath() {
+ $("#sharingPanelContainingDiv").html();
+ var path = selectedPath;
+ if (selectedPath == null) {
+ return false;
+ }
+
+ // show the public link dialog
+ var url = "/sharing/prepareEditShareDialog";
+ var params = {
+ absPath : path
+ }
+
+ lcSendValueWithParamsAndPlugHtmlInDiv(url, params, "", function(data) {
+ fillInShareDialog(data);
+ });
+}
+
/*
* put content into the share dialog
*/
function fillInShareDialog(data) {
$("#sharingPanelContainingDiv").html(data);
-
+ $("#btnUpdateNamedShare").click(function(e){
+ e.stopPropagation()
+ updateNamedShare();
+ });
}
/**
* Submit the dialog to add or update a share
*/
-function updateShare() {
+function updateNamedShare() {
var path = $("#aclDetailsAbsPath").val();
var shareName = $("#shareName").val();
showBlockingPanel();
@@ -2637,20 +2662,19 @@ function updateShare() {
absPath : path,
shareName: shareName
}
-
-
+
var jqxhr = $.post(context + "/sharing/processUpdateShareDialog", params,
function(data, status, xhr) {
- }, "html").success(function(returnedData, status, xhr) {
- var continueReq = checkForSessionTimeout(returnedData, xhr);
+
+ var continueReq = checkForSessionTimeout(data, xhr);
if (!continueReq) {
return false;
}
- $("#sharingPanelContainingDiv").html(returnedData);
+ $("#sharingPanelContainingDiv").empty().append( data );
unblockPanel();
- }).error(function(xhr, status, error) {
+ }).fail(function(xhr, status, error) {
setErrorMessage(xhr.responseText);
unblockPanel();
});