summaryrefslogtreecommitdiffstats
path: root/idrop-web
diff options
context:
space:
mode:
authorPaulina Jankowska <paulinkaj1@gmail.com>2013-08-27 21:40:48 (GMT)
committer Paulina Jankowska <paulinkaj1@gmail.com>2013-08-27 21:40:48 (GMT)
commite9890a4a80c3e0eaf5713468c08b8e38db0d8fd0 (patch)
tree6fe3dada5cc5e76bd36f8aaa63019e3e4220a3af /idrop-web
parent56a72c92b813f2fd231fc30bd63b36bce88474fd (diff)
downloadQCG-Data-e9890a4a80c3e0eaf5713468c08b8e38db0d8fd0.zip
QCG-Data-e9890a4a80c3e0eaf5713468c08b8e38db0d8fd0.tar.gz
QCG-Data-e9890a4a80c3e0eaf5713468c08b8e38db0d8fd0.tar.bz2
Adding UNIT to metadataSearching idrop-web
Diffstat (limited to 'idrop-web')
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy7
-rwxr-xr-xidrop-web/grails-app/i18n/messages.properties1
-rwxr-xr-xidrop-web/grails-app/views/common/_topbar.gsp3
-rw-r--r--idrop-web/grails-app/views/metadataSearch/index.gsp20
-rw-r--r--idrop-web/web-app/js/mydrop/metaFiltering.js241
-rwxr-xr-xidrop-web/web-app/js/mydrop/search.js12
6 files changed, 137 insertions, 147 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy
index 8feb5b3..17cc84d 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy
@@ -108,6 +108,9 @@ class MetadataSearchController {
metadataQuery.clear()
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.ATTRIBUTE, AVUQueryOperatorEnum.EQUAL, avu.attribute));
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.VALUE, chooseOperator(avu.operator), avu.value));
+ if(!avu.unit.empty){
+ metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.UNITS, AVUQueryOperatorEnum.EQUAL, avu.unit));
+ }
queryRes1 = collectionAO.findMetadataValuesByMetadataQuery(metadataQuery, true)
queryRes2 = dataObjAO.findMetadataValuesByMetadataQuery(metadataQuery)
@@ -127,6 +130,9 @@ class MetadataSearchController {
for(AVUCommand avu in avuNode.AVUs){
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.ATTRIBUTE, AVUQueryOperatorEnum.EQUAL, avu.attribute));
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.VALUE, chooseOperator(avu.operator), avu.value));
+ if(!avu.unit.empty){
+ metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.UNITS, AVUQueryOperatorEnum.EQUAL, avu.unit));
+ }
}
metadataQuery
@@ -191,6 +197,7 @@ class MetadataSearchController {
break
case "not like":
AVUQueryOperatorEnum.NOT_LIKE;
+ break
}
}
diff --git a/idrop-web/grails-app/i18n/messages.properties b/idrop-web/grails-app/i18n/messages.properties
index ee447a1..f5ce9e6 100755
--- a/idrop-web/grails-app/i18n/messages.properties
+++ b/idrop-web/grails-app/i18n/messages.properties
@@ -59,6 +59,7 @@ text.length=Size
text.login=Login
text.logout=Logout
text.metadata=Metadata
+text.metaSearch=By Metadata
text.modified=Modified
text.name=Name
text.new.folder=New Folder
diff --git a/idrop-web/grails-app/views/common/_topbar.gsp b/idrop-web/grails-app/views/common/_topbar.gsp
index e6ce9e2..43f7c6f 100755
--- a/idrop-web/grails-app/views/common/_topbar.gsp
+++ b/idrop-web/grails-app/views/common/_topbar.gsp
@@ -21,7 +21,8 @@
<ul class="dropdown-menu">
<!-- <li><a href="#" id="searchFileName" onclick="xxx()")>Search By File Name</a></li> -->
<li><a href="#" id="searchTag"><g:link controller="tags" action="index"><g:message code="text.tags" /></g:link></li>
- <li><a href="#" id="searchMeta"><g:link controller="metadata" action="index">By Metadata</g:link></li>
+ <li><a href="#" id="searchMeta"><g:link controller="MetadataSearch" action="index"><g:message code="text.metaSearch" /></g:link></li>
+
<!-- <li><a href="#" id="searchMetadata" onclick="xxx()")>Search By Metadata</a></li> -->
</ul>
</li>
diff --git a/idrop-web/grails-app/views/metadataSearch/index.gsp b/idrop-web/grails-app/views/metadataSearch/index.gsp
index 5b05a91..7076b50 100644
--- a/idrop-web/grails-app/views/metadataSearch/index.gsp
+++ b/idrop-web/grails-app/views/metadataSearch/index.gsp
@@ -38,7 +38,7 @@
<th colspan="2">
</th>
- <th colspan="2">
+ <th colspan="3">
<input type="button" class="deleteNodeBtn" id="del" disabled value="X">
</th>
</tr>
@@ -47,7 +47,7 @@
<input type="radio" value="Every" name="AVUNodes[0].andOr" checked>
<label class="labelRadio"> Every condition fulfilled </label>
</th>
- <th colspan="2">
+ <th colspan="3">
<input type="radio" value="One" name="AVUNodes[0].andOr">
<label class="labelRadio"> At least one condition fulfilled</label>
</th>
@@ -59,12 +59,7 @@
<!-- <form class="formMeta">
<div class="singleFilter"> -->
<td> <div class="meta-header"> Attribute </div>
- <div class="dhx_combo_box dhx_skyblue" style="width: 180px;">
- <input name="attr" class="dhx_combo_input" type="text" autocomplete="off" style="width: 155px;">
- <input type="hidden" name="" value="">
- <input type="hidden" name="" value="false">
- <img class="dhx_combo_img" src="<g:resource dir="imgs" file="combo_select_dhx_skyblue.gif" alt="file icon"/>"/>
- </div>
+ <input name="attr" type="text" autocomplete="off">
</td>
<!-- </div>
<div class="singleFilter"> -->
@@ -86,6 +81,9 @@
<td> <div class="meta-header"> Value </div>
<input name="val" type="text" autocomplete="off">
</td>
+ <td> <div class="meta-header"> Unit </div>
+ <input name="unit" type="text" autocomplete="off">
+ </td>
<!--</div>
<div class="singleFilter">-->
<td>
@@ -107,9 +105,9 @@
</table>
<div><input type="button" id="newNodeBtn" value="New conditions node"></div>
- </g:form>
- <div><button id="searchBtn" onclick="processMetadataQuery()">SEARCH</button></div>
-
+ </g:form>
+ <div><button id="searchBtn" onclick="processMetadataQuery()">SEARCH</button></div>
+
</div>
</div>
diff --git a/idrop-web/web-app/js/mydrop/metaFiltering.js b/idrop-web/web-app/js/mydrop/metaFiltering.js
index d9def69..0eb699f 100644
--- a/idrop-web/web-app/js/mydrop/metaFiltering.js
+++ b/idrop-web/web-app/js/mydrop/metaFiltering.js
@@ -1,50 +1,38 @@
$(document).ready(function() {
- $(document).on({focusin: changeColorOnFocusin, focusout: changeColorOnFocusout}, ".filterMetaTable > tbody > tr");
-
- $(document).on({click: addNewCondition, mouseenter: reverseColors, mouseleave: reverseColors}, ".addConditionBtn");
- $(document).on({click: deleteCondition, mouseenter: reverseColors, mouseleave: reverseColors}, ".delConditionBtn");
- $(document).on({click: deleteCondNode, mouseenter: reverseColors, mouseleave: reverseColors}, ".deleteNodeBtn");
-
- $(document).on("click", "#newNodeBtn", addNewNode);
-
-
- function reverseColors() {
+$(document).on({focusin: changeColorOnFocusin, focusout: changeColorOnFocusout}, ".filterMetaTable > tbody > tr");
+ $(document).on({click: addNewCondition, mouseenter: reverseColors, mouseleave: reverseColors}, ".addConditionBtn");
+ $(document).on({click: deleteCondition, mouseenter: reverseColors, mouseleave: reverseColors}, ".delConditionBtn");
+ $(document).on({click: deleteCondNode, mouseenter: reverseColors, mouseleave: reverseColors}, ".deleteNodeBtn");
+ $(document).on("click", "#newNodeBtn", addNewNode);
+ function reverseColors() {
var curColor = $(this).css("color");
- var curBackG = $(this).css("background-color");
-
- if (curBackG == "transparent")
- curBackG = "#FFFFFF";
-
- if (curColor == "#FFFFFF")
- curColor = "transparent";
-
- $(this).css({"color": curBackG, "background-color": curColor});
-
- }
+ var curBackG = $(this).css("background-color");
+ if (curBackG == "transparent")
+ curBackG = "#FFFFFF";
+ if (curColor == "#FFFFFF")
+ curColor = "transparent";
+ $(this).css({"color": curBackG, "background-color": curColor});
+ }
- function changeColorOnFocusin() {
- $(this).css("background-color", "#EEEEEE");
- }
+function changeColorOnFocusin() {
+$(this).css("background-color", "#EEEEEE");
+}
- function changeColorOnFocusout() {
- $(this).css("background-color", "#FFFFFF");
- }
+function changeColorOnFocusout() {
+$(this).css("background-color", "#FFFFFF");
+}
- function newPartOfForm(which) {
- var newCell;
+function newPartOfForm(which) {
+var newCell;
switch (which) {
- case 1:
- newCell = "<div class='meta-header'> Attribute </div>\n\
- <div class='dhx_combo_box dhx_skyblue' style='width: 177px;'>\n\
- <input name='attr' class='dhx_combo_input' type='text' autocomplete='off' style='width: 155px;'>\n\
- <input type='hidden' name='' value=''>n\
- <input type='hidden' name='' value='false'>\n\
- <img class='dhx_combo_img' src='/idrop-web/imgs/combo_select_dhx_skyblue.gif'></div>";
- break;
- case 2:
- newCell = "<div class='meta-header'> Operator</div>\n\
+case 1:
+ newCell = "<div class='meta-header'> Attribute </div>\n\
+ <input name='attr' type='text' autocomplete='off'>";
+ break;
+ case 2:
+ newCell = "<div class='meta-header'> Operator</div>\n\
<select name='op' class='metaOperator'> \n\
<option> = </option> \n\
<option> > </option>\n\
@@ -55,22 +43,24 @@ $(document).ready(function() {
<option> like </option>\n\
<option> not like </option>\n\
</select> ";
- break;
- case 3:
- newCell = "<div class='meta-header'> Value </div>\n\
- <input name='val' type='text'>";
- break;
- case 4:
- newCell = "<br>\n\
+ break;
+ case 3:
+ newCell = "<div class='meta-header'> Value </div>\n\
+ <input name='val' type='text' autocomplete='off'>\n\
+ <td> <div class='meta-header'> Unit </div>\n\
+ <input name='unit' type='text' autocomplete='off'></td>";
+ break;
+ case 4:
+ newCell = "<br>\n\
<input type='button' class='delConditionBtn' value='DELETE' disabled >";
- }
- return newCell;
- }
+}
+return newCell;
+}
- function addNewCondition() {
+function addNewCondition() {
- var curTab = $(this).closest(".filterMetaTable"); // current filterMetaTable
+var curTab = $(this).closest(".filterMetaTable"); // current filterMetaTable
var newCell1 = newPartOfForm(1); //Attribute
@@ -79,144 +69,129 @@ $(document).ready(function() {
var newCell4 = newPartOfForm(4); //Delete Button
var newRow = "<tr class='none'> <td>" + newCell1 + "</td>" + "<td>" + newCell2 + "</td>" + "<td>" + newCell3 + "</td>" + "<td>" + newCell4 + "</td></tr>";
-
$(curTab).find("tbody").append(newRow);
-
$('tr.none').removeClass('none').animate({'backgroundColor': '#D6D6D6'}, 700, function() {
- $(this).animate({'backgroundColor': '#FFFFFF'}, 700);
- });
-
+$(this).animate({'backgroundColor': '#FFFFFF'}, 700);
+});
$(curTab).find(".delConditionBtn").removeAttr("disabled"); //enabling minusBtn*/
- }
+}
- function deleteCondition() {
- var rowToDel = $(this).closest("tr");
+function deleteCondition() {
+var rowToDel = $(this).closest("tr");
var curTab = $(this).closest(".filterMetaTable");
-
$(rowToDel).animate({'backgroundColor': '#D6D6D6'}, 400, function() {
- $(rowToDel).remove();
- });
-
-
+$(rowToDel).remove();
+});
var rowsLeft = $(curTab).find("tbody > tr").length; //checking amount of rows
if (rowsLeft == 2)
- {
- $(curTab).find(".delConditionBtn").attr("disabled", "disabled");
- }
- }
+{
+$(curTab).find(".delConditionBtn").attr("disabled", "disabled");
+}
+}
- function addNewNode() {
+function addNewNode() {
- var operator = "<div style='text-align: center; vertical-align: middle; display: block'>\n\
+var operator = "<div style='text-align: center; vertical-align: middle; display: block'>\n\
<select name='mainOp' class='metaOperator'>\n\
<option>AND</option>\n\
<option>OR</option>\n\
</select></div>";
-
var head = "<thead>\n\
<tr>\n\
<th colspan='2'></th>\n\
- <th colspan='2'><input type='button' class='deleteNodeBtn' value='X'disabled></th></tr>" +
- "<tr>\n\
+ <th colspan='3'><input type='button' class='deleteNodeBtn' value='X'disabled></th></tr>" +
+ "<tr>\n\
<th colspan='2'>\n\
<input type='radio' value='Every' checked>\n\
<label class='labelRadio'> Every condition fulfilled </label></th>" +
- "<th colspan='2'><input type='radio' value='One'>\n\
+ "<th colspan='3'><input type='radio' value='One'>\n\
<label class='labelRadio'> At least one condition fulfilled</label></th>\n\
</tr>\n\
</thead>";
-
var foot = "<tfoot>\n\
<tr>\n\
<td colspan='2'><input type='button' class='addConditionBtn' value='ADD CONDITION'></td>\n\
</tr>\n\
</tfoot>";
-
var cell1 = newPartOfForm(1);
var cell2 = newPartOfForm(2);
var cell3 = newPartOfForm(3);
var cell4 = newPartOfForm(4);
-
-
$(this).parent().before(operator + "<table class='filterMetaTable' name='none'>" + head + "<tbody> <tr>" +
- "<td>" + cell1 + "</td><td>" + cell2 + "</td><td>" + cell3 + "</td><td>" + cell4 + "</td>" +
- "</tr> </tbody>" + foot + "</table>");
-
+ "<td>" + cell1 + "</td><td>" + cell2 + "</td><td>" + cell3 + "</td><td>" + cell4 + "</td>" +
+ "</tr> </tbody>" + foot + "</table>");
$('.filterMetaTable[name=none]').removeAttr('name').animate({'backgroundColor': '#D6D6D6'}, 700, function() {
- $(this).animate({'backgroundColor': '#FFFFFF'}, 700);
- });
-
+$(this).animate({'backgroundColor': '#FFFFFF'}, 700);
+});
$(this).parents(".span9").find(".deleteNodeBtn").removeAttr("disabled");
-
$.updateRadioNames();
- }
-
+}
- function deleteCondNode() {
- var tablesLeft = $(".filterMetaTable").length;
+function deleteCondNode() {
+var tablesLeft = $(".filterMetaTable").length;
if (tablesLeft <= 2)
- $(this).parents(".span9").find(".deleteNodeBtn").attr("disabled", "disabled");
-
+ $(this).parents(".span9").find(".deleteNodeBtn").attr("disabled", "disabled");
var curTab = $(this).closest(".filterMetaTable");
-
-
if ($(curTab).index() == 0)
- {
- $(curTab).next().fadeOut("slow", function() {
- $(this).remove();
- });
- }
- else
- {
- $(curTab).prev().fadeOut("slow", function() {
- $(this).remove();
- });
- }
-
+{
+$(curTab).next().fadeOut("slow", function() {
+$(this).remove();
+});
+}
+else
+{
+$(curTab).prev().fadeOut("slow", function() {
+$(this).remove();
+});
+}
- $(curTab).fadeOut("slow", function() {
- $(this).remove();
- });
+$(curTab).fadeOut("slow", function() {
+$(this).remove();
+});
$.updateRadioNames();
+}
- }
-
- $.updateRadioNames = function updateRadioNames() {
- $("input[type=radio]").each(function() {
- var newName = "AVUNodes[" + $(this).parents('table').index('table') + "].andOr";
- $(this).attr('name', newName);
- });
- }
+$.updateRadioNames = function updateRadioNames() {
+$("input[type=radio]").each(function() {
+var newName = "AVUNodes[" + $(this).parents('table').index('table') + "].andOr";
+ $(this).attr('name', newName);
+});
+}
});
+ function giveAVUNames() {
-function giveAVUNames() {
- $("input[name=attr]").each(function() {
- var name = "AVUNodes[" + $(this).parents('table').index('table') + "].AVUs[" + $(this).parents('tr').index() + "].attribute";
- $(this).attr('name', name);
- });
- $("input[name=val]").each(function() {
+ $("input[name*=attr]").each(function() {
+ var name = "AVUNodes[" + $(this).parents('table').index('table') + "].AVUs[" + $(this).parents('tr').index() + "].attribute";
+ $(this).attr('name', name);
+ });
+ $("input[name*=val]").each(function() {
var name = "AVUNodes[" + $(this).parents('table').index('table') + "].AVUs[" + $(this).parents('tr').index() + "].value";
- $(this).attr('name', name);
- });
-
- $("select[name=op]").each(function() {
+ $(this).attr('name', name);
+ });
+ $("select[name*=op]").each(function() {
var name = "AVUNodes[" + $(this).parents('table').index('table') + "].AVUs[" + $(this).parents('tr').index() + "].operator";
- $(this).attr('name', name);
- });
-
- $("select[name=mainOp]").each(function() {
+ $(this).attr('name', name);
+ });
+ $("input[name*=unit]").each(function() {
+ var name = "AVUNodes[" + $(this).parents('table').index('table') + "].AVUs[" + $(this).parents('tr').index() + "].unit";
+ $(this).attr('name', name);
+ });
+ $("select[name*=Op]").each(function() {
var name = "AVUOps[" + $(this).parent().index('form > div') + "]";
- $(this).attr('name', name);
- })
-}
+ $(this).attr('name', name);
+ })
+
+
+
+ }
\ No newline at end of file
diff --git a/idrop-web/web-app/js/mydrop/search.js b/idrop-web/web-app/js/mydrop/search.js
index 34f2a43..2e95f8c 100755
--- a/idrop-web/web-app/js/mydrop/search.js
+++ b/idrop-web/web-app/js/mydrop/search.js
@@ -89,8 +89,16 @@ function askForSearchDetailsPulldown(absPath, detailsId) {
}
function processMetadataQuery() {
+
+
+ if (($("input[name*='val']").val()=="") || ($("input[name*='attr']").val()==""))
+ {
+ alert("Please fill every attribute and value input or delete some conditions");
+ return;
+ }
+
$.updateRadioNames(); //from metaFiltering.js
- giveAVUNames();
+ giveAVUNames();
var data = $('form').serialize();
@@ -98,7 +106,7 @@ function processMetadataQuery() {
// show result tab
$('#searchTabs a[href="#resultsTab"]').tab('show');
-
+
lcSendValueAndBuildTable("/metadataSearch/search", data, "#resultsTabInner",
"#searchResultTable", searchDetailsClick, ".search-detail-icon", tableParams);