summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-09-07 03:04:52 (GMT)
committer Mike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-09-07 03:04:52 (GMT)
commit0db4e17389f295aa63d32b9f21a4fa262cf5a9ec (patch)
treebf107b2444edd2b3ad7611675736dc7abb00f822
parent38c41ab8e78595ff9eeba78b890e06026f37f035 (diff)
downloadQCG-Data-0db4e17389f295aa63d32b9f21a4fa262cf5a9ec.zip
QCG-Data-0db4e17389f295aa63d32b9f21a4fa262cf5a9ec.tar.gz
QCG-Data-0db4e17389f295aa63d32b9f21a4fa262cf5a9ec.tar.bz2
[#459] add metadata dialog now shows, need to consolidate and test
-rw-r--r--idrop-web/grails-app/views/metadata/metadataDialog.gsp36
-rw-r--r--idrop-web/web-app/js/mydrop/metadata.js103
2 files changed, 139 insertions, 0 deletions
diff --git a/idrop-web/grails-app/views/metadata/metadataDialog.gsp b/idrop-web/grails-app/views/metadata/metadataDialog.gsp
new file mode 100644
index 0000000..2182061
--- /dev/null
+++ b/idrop-web/grails-app/views/metadata/metadataDialog.gsp
@@ -0,0 +1,36 @@
+<div id="metadataDialogDiv" class="roundedContainer">
+ <div id="metadataDialogMessageArea" style="width:90%;">
+ <!-- message area for acl dialogs -->
+ </div>
+ <div style="clear: both;">
+ <g:form controller="metadata" action="addMetadata" method="post"
+ name="metadataUpdateForm">
+ <fieldset id="verticalForm">
+ <g:hiddenField name="isCreate" value="${isCreate}" />
+ <label for="absPath">Path:</label>
+ <g:textArea name="absPath" value="${absPath}" readonly="true" />
+
+ <br /> <label for="attribute">Attribute:</label>
+ <g:textField name="attribute" />
+ <br />
+ <label for="value">Value:</label>
+ <g:textField name="value" />
+ <br />
+ <label for="unit">Unit:</label>
+ <g:textField name="unit" />
+ <br />
+ <div id="detailsDialogToolbar" class="fg-toolbar ui-widget-header">
+ <div id="detailsDialogMenu" class="fg-buttonset fg-buttonset-multi"
+ style="float: left, clear : both; width: 90%;">
+ <button type="button" id="updateMetadataDetailButton"
+ class="ui-state-default ui-corner-all" value="addMetadata"
+ onclick="submitMetadataDialog()")>Save</button>
+ <button type="button" id="cancelAddMetadataButton"
+ class="ui-state-default ui-corner-all" value="cancelAdd"
+ onclick="closeMetadataAddDialog()")>Cancel</button>
+ </div>
+ </div>
+ </fieldset>
+ </g:form>
+ </div>
+</div>
diff --git a/idrop-web/web-app/js/mydrop/metadata.js b/idrop-web/web-app/js/mydrop/metadata.js
new file mode 100644
index 0000000..e27b901
--- /dev/null
+++ b/idrop-web/web-app/js/mydrop/metadata.js
@@ -0,0 +1,103 @@
+/**
+ * Javascript for metadata functions
+ *
+ * author: Mike Conway - DICE
+ */
+
+/**
+ * Global var
+ */
+var messageAreaSelector = "#metadataMessageArea";
+var metadataUpdateUrl = '/metadata/updateMetadata';
+
+
+/**
+ * Called by data table upon submit of an acl change
+ */
+function metadataUpdate(currentAcl, newAcl, path) {
+
+ lcPrepareForCall();
+
+ if (!path) {
+ throw "No collection or data object selected";
+ }
+
+ if (!newAcl) {
+ throw "No newAcl provided";
+ }
+
+ if (!currentAcl) {
+ throw "no currentAcl provided";
+ }
+
+ lcShowBusyIconInDiv(messageAreaSelector);
+
+ var params = {
+ absPath : selectedPath,
+ currentAclAttribute : currentAcl['attribute'],
+ currentAclValue : currentAcl['value'],
+ currentAclUnit : currentAcl['unit'],
+ newAclAttribute : newAcl['attribute'],
+ newAclValue : newAcl['value'],
+ newAclUnit : newAcl['unit']
+ }
+
+ var jqxhr = $.post(context + metadataUpdateUrl, params,
+ function(data, status, xhr) {
+ lcClearDivAndDivClass(messageAreaSelector);
+ }, "html").error(function() {
+ setMessageInArea(messageAreaSelector, "Error updating metadata");
+ }).complete(
+ function() {
+ setMessageInArea(messageAreaSelector,
+ "Metadata update successful");
+ });
+
+}
+
+/**
+ * The metadata dialog is prepared and ready to display as a JQuery dialog box, show
+ * it
+ *
+ */
+function prepareMetadataDialog(data) {
+
+ if (selectedPath == null) {
+ alert("No path is selected, metadata cannot be entered");
+ return;
+ }
+
+
+ var url = "/metadata/prepareMetadataDialog";
+ var params = {
+ absPath : selectedPath,
+ create : true
+ }
+
+ lcSendValueWithParamsAndPlugHtmlInDiv(url, params, "", function(data) {
+ showMetadataDialog(data);
+ });
+
+
+}
+
+/**
+* The metadata dialog is prepared and ready to display as a JQuery dialog box, show
+* it
+*
+* @param data
+*/
+function showMetadataDialog(data) {
+ lcPrepareForCall();
+ $("#metadataDialogArea").html(data).fadeIn('slow');
+
+ /**
+ * $("#aclDialogArea").html(data); $("#aclDialogArea").dialog({ "width" :
+ * 400, "modal" : true, "buttons" : { "Ok" : function() { submitAclDialog(); },
+ * "Cancel" : function() { $(this).dialog("close"); } }, "title" : "Edit
+ * Share Permission" });
+ */
+
+}
+
+