summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulina Jankowska <paulinkaj1@gmail.com>2013-08-27 11:00:12 (GMT)
committer Paulina Jankowska <paulinkaj1@gmail.com>2013-08-27 11:00:12 (GMT)
commit4dd989f2fb9599a901b8ce538b8bc41544721362 (patch)
tree4508fdad491301bf4e041e43d7288fb59a74822e
parentbeb47b04fc8916a953ab59a9c2a81972c3ada4de (diff)
downloadQCG-Data-4dd989f2fb9599a901b8ce538b8bc41544721362.zip
QCG-Data-4dd989f2fb9599a901b8ce538b8bc41544721362.tar.gz
QCG-Data-4dd989f2fb9599a901b8ce538b8bc41544721362.tar.bz2
MetadataSearch engine for idrop-web 1.1
-rw-r--r--idrop-web/web-app/js/mydrop/metaFiltering.js58
-rwxr-xr-xidrop-web/web-app/js/mydrop/search.js128
2 files changed, 119 insertions, 67 deletions
diff --git a/idrop-web/web-app/js/mydrop/metaFiltering.js b/idrop-web/web-app/js/mydrop/metaFiltering.js
index 80f6f47..d9def69 100644
--- a/idrop-web/web-app/js/mydrop/metaFiltering.js
+++ b/idrop-web/web-app/js/mydrop/metaFiltering.js
@@ -38,29 +38,31 @@ $(document).ready(function() {
case 1:
newCell = "<div class='meta-header'> Attribute </div>\n\
<div class='dhx_combo_box dhx_skyblue' style='width: 177px;'>\n\
- <input class='dhx_combo_input' type='text' autocomplete='off' style='width: 155px;'>\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='_new_value' value='false'>\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\
- <select class='metaOperator'> \n\
+ <select name='op' class='metaOperator'> \n\
<option> = </option> \n\
<option> > </option>\n\
<option> < </option>\n\
<option> >= </option>\n\
<option> <= </option>\n\
<option> <> </option>\n\
+ <option> like </option>\n\
+ <option> not like </option>\n\
</select> ";
break;
case 3:
newCell = "<div class='meta-header'> Value </div>\n\
- <input type='text'>";
+ <input name='val' type='text'>";
break;
case 4:
newCell = "<br>\n\
- <button class='delConditionBtn' disabled>DELETE</button>";
+ <input type='button' class='delConditionBtn' value='DELETE' disabled >";
}
return newCell;
}
@@ -109,7 +111,7 @@ $(document).ready(function() {
function addNewNode() {
var operator = "<div style='text-align: center; vertical-align: middle; display: block'>\n\
- <select class='metaOperator'>\n\
+ <select name='mainOp' class='metaOperator'>\n\
<option>AND</option>\n\
<option>OR</option>\n\
</select></div>";
@@ -117,19 +119,19 @@ $(document).ready(function() {
var head = "<thead>\n\
<tr>\n\
<th colspan='2'></th>\n\
- <th colspan='2'><button class='deleteNodeBtn' disabled>X</button></th></tr>" +
+ <th colspan='2'><input type='button' class='deleteNodeBtn' value='X'disabled></th></tr>" +
"<tr>\n\
<th colspan='2'>\n\
- <input type='radio' value='Every' name=condOption" + $(".filterMetaTable").length + " checked>\n\
+ <input type='radio' value='Every' checked>\n\
<label class='labelRadio'> Every condition fulfilled </label></th>" +
- "<th colspan='2'><input type='radio' value='One' name=condOption" + $(".filterMetaTable").length + ">\n\
+ "<th colspan='2'><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'> button class='addConditionBtn'>ADD CONDITION</button> >/td>\n\
+ <td colspan='2'><input type='button' class='addConditionBtn' value='ADD CONDITION'></td>\n\
</tr>\n\
</tfoot>";
@@ -148,6 +150,8 @@ $(document).ready(function() {
});
$(this).parents(".span9").find(".deleteNodeBtn").removeAttr("disabled");
+
+ $.updateRadioNames();
}
@@ -175,14 +179,44 @@ $(document).ready(function() {
}
-
$(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);
+ });
}
-}); \ No newline at end of file
+});
+
+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() {
+ var name = "AVUNodes[" + $(this).parents('table').index('table') + "].AVUs[" + $(this).parents('tr').index() + "].value";
+ $(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() {
+ var name = "AVUOps[" + $(this).parent().index('form > div') + "]";
+ $(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 8b40d69..34f2a43 100755
--- a/idrop-web/web-app/js/mydrop/search.js
+++ b/idrop-web/web-app/js/mydrop/search.js
@@ -1,6 +1,6 @@
/**
-
-= * Javascript for search page, processing the search table
+
+ = * Javascript for search page, processing the search table
*
* author: Mike Conway - DICE
*/
@@ -14,76 +14,94 @@
*
* @return
*/
+
+
function prosecuteSearch(searchTerm, searchType) {
- var url = "/search/search";
+ var url = "/search/search";
- var params = {
- searchTerm : searchTerm,
- searchType : searchType
- }
+ var params = {
+ searchTerm: searchTerm,
+ searchType: searchType
+ }
- lcSendValueAndBuildTable(url, params, "#searchTableDiv",
- "#searchResultTable", searchDetailsClick, ".search-detail-icon");
+ lcSendValueAndBuildTable(url, params, "#searchTableDiv",
+ "#searchResultTable", searchDetailsClick, ".search-detail-icon");
}
function searchDetailsClick(minMaxIcon) {
- var searchTable = $("#searchResultTable").dataTable();
- var nTr = minMaxIcon.parentNode.parentNode;
- if (minMaxIcon.parentNode.innerHTML.match('circle-minus')) {
- lcCloseTableNodes(searchTable);
- } else {
- try {
- searchDetailsFunction(minMaxIcon, nTr);
- } catch (err) {
- setErrorMessage("error in searchDetailsClick():" + err);
- }
-
- }
+ var searchTable = $("#searchResultTable").dataTable();
+ var nTr = minMaxIcon.parentNode.parentNode;
+ if (minMaxIcon.parentNode.innerHTML.match('circle-minus')) {
+ lcCloseTableNodes(searchTable);
+ } else {
+ try {
+ searchDetailsFunction(minMaxIcon, nTr);
+ } catch (err) {
+ setErrorMessage("error in searchDetailsClick():" + err);
+ }
+
+ }
}
function searchDetailsFunction(clickedIcon, rowActionIsOn) {
- var searchTable = $("#searchResultTable").dataTable();
- /* Open this row */
- lcCloseTableNodes(searchTable);
- // nTr points to row and has absPath in id
- var absPath = $(rowActionIsOn).attr('id');
- var detailsId = "details_" + absPath;
- var detailsHtmlDiv = "details_html_" + absPath;
- var buildDetailsLayoutVal = buildSearchLayout(detailsId);
- clickedIcon.setAttribute("class", "ui-icon ui-icon-circle-minus");
- newRowNode = searchTable.fnOpen(rowActionIsOn,
- buildDetailsLayoutVal, 'details');
- newRowNode.setAttribute("id", detailsId);
- askForSearchDetailsPulldown(absPath, detailsId)
-
+ var searchTable = $("#searchResultTable").dataTable();
+ /* Open this row */
+ lcCloseTableNodes(searchTable);
+ // nTr points to row and has absPath in id
+ var absPath = $(rowActionIsOn).attr('id');
+ var detailsId = "details_" + absPath;
+ var detailsHtmlDiv = "details_html_" + absPath;
+ var buildDetailsLayoutVal = buildSearchLayout(detailsId);
+ clickedIcon.setAttribute("class", "ui-icon ui-icon-circle-minus");
+ newRowNode = searchTable.fnOpen(rowActionIsOn,
+ buildDetailsLayoutVal, 'details');
+ newRowNode.setAttribute("id", detailsId);
+ askForSearchDetailsPulldown(absPath, detailsId)
+
}
function buildSearchLayout(detailsId) {
- var td = document.createElement("TD");
- td.setAttribute("colspan", "4");
-
- var detailsPulldownDiv = document.createElement("DIV");
- detailsPulldownDiv.setAttribute("id", detailsId);
- detailsPulldownDiv.setAttribute("class", "detailsPulldown");
- var img = document.createElement('IMG');
- img.setAttribute("src", context + "/images/ajax-loader.gif");
- detailsPulldownDiv.appendChild(img);
- td.appendChild(detailsPulldownDiv);
- return $(td).html();
+ var td = document.createElement("TD");
+ td.setAttribute("colspan", "4");
+
+ var detailsPulldownDiv = document.createElement("DIV");
+ detailsPulldownDiv.setAttribute("id", detailsId);
+ detailsPulldownDiv.setAttribute("class", "detailsPulldown");
+ var img = document.createElement('IMG');
+ img.setAttribute("src", context + "/images/ajax-loader.gif");
+ detailsPulldownDiv.appendChild(img);
+ td.appendChild(detailsPulldownDiv);
+ return $(td).html();
}
function askForSearchDetailsPulldown(absPath, detailsId) {
-
- var url = "/browse/miniInfo";
- var params = {
- absPath:absPath
- }
-
- lcSendValueWithParamsAndPlugHtmlInDiv(url, params, ".details",
- null);
-
+
+ var url = "/browse/miniInfo";
+ var params = {
+ absPath: absPath
+ }
+
+ lcSendValueWithParamsAndPlugHtmlInDiv(url, params, ".details",
+ null);
+
+}
+
+function processMetadataQuery() {
+ $.updateRadioNames(); //from metaFiltering.js
+ giveAVUNames();
+
+ var data = $('form').serialize();
+
+ var tableParams = {"bJQueryUI": false, "bFilter": false, "iDisplayLength": "5000"}
+
+ // show result tab
+ $('#searchTabs a[href="#resultsTab"]').tab('show');
+
+ lcSendValueAndBuildTable("/metadataSearch/search", data, "#resultsTabInner",
+ "#searchResultTable", searchDetailsClick, ".search-detail-icon", tableParams);
+
}