From 8e0cf27ec64f503d18ca5c43213f020be6f59a7c Mon Sep 17 00:00:00 2001 From: Kalina Jasinska Date: Thu, 05 Sep 2013 09:53:42 +0000 Subject: Merge branch 'plgrid' of https://git.man.poznan.pl/gitroot/QCG-Data into plgrid --- 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 17cc84d..68a20fb 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 @@ -47,6 +47,7 @@ class MetadataSearchController { /** * Search iRODS metadata + * Here the data from inputs is posted. */ def search (MetadataSearchCommand metadataSearchCommand) { @@ -88,7 +89,7 @@ class MetadataSearchController { render(view:"/search/searchResult", model:[results:results]) } - + //method used to finding files as well as folders matching every metadata query, final result is the sum of these results private def connectedByAnd(AVUNode avuNode, DataObjectAO dataObjAO, CollectionAO collectionAO) { List queryRes1 = collectionAO.findMetadataValuesByMetadataQuery(createAVUQ(avuNode), true) //match folders names List queryRes2 = dataObjAO.findMetadataValuesByMetadataQuery(createAVUQ(avuNode)) //match dataObj names @@ -97,6 +98,7 @@ class MetadataSearchController { queryResults } + //method used to finding files as well as folders matching AT LEAST ONE metadata query private def connectedByOr(AVUNode avuNode, DataObjectAO dataObjAO, CollectionAO collectionAO) { List metadataQuery = new ArrayList() List finalResult = new ArrayList() @@ -104,7 +106,7 @@ class MetadataSearchController { List queryRes2 = new ArrayList() List queryResults = new ArrayList() - for(AVUCommand avu in avuNode.AVUs){ + for(AVUCommand avu in avuNode.AVUs) { metadataQuery.clear() metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.ATTRIBUTE, AVUQueryOperatorEnum.EQUAL, avu.attribute)); metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.VALUE, chooseOperator(avu.operator), avu.value)); @@ -123,7 +125,7 @@ class MetadataSearchController { } - def createAVUQ(AVUNode avuNode) { + def createAVUQ(AVUNode avuNode) { //create list of metadata queries List metadataQuery = new ArrayList() @@ -154,6 +156,8 @@ class MetadataSearchController { list2 } + + //create list in which there are files and collections occured in both input lists private def intersectLists(List list1, List list2) { List finalList = new ArrayList() @@ -204,18 +208,19 @@ class MetadataSearchController { } - -class MetadataSearchCommand { //constists of the condition nodes and operators connecting them +//Class which constists of the list of condition nodes and list of operators connecting them +class MetadataSearchCommand { List AVUNodes = ListUtils.lazyList([], FactoryUtils.instantiateFactory(AVUNode)) List AVUOps = ListUtils.lazyList([], FactoryUtils.instantiateFactory(String)) } +//class consisted of AVU + operator class AVUCommand { String attribute String operator //=, <, >, <=, >=, <>, like, not like String value - String unit //unused + String unit static constraints = { attribute(blank:false) @@ -224,6 +229,7 @@ class AVUCommand { } +//Class consisted of list of conditions and the option (in GUI radiobutton), decripted below class AVUNode { List AVUs = ListUtils.lazyList([], FactoryUtils.instantiateFactory(AVUCommand)) String andOr //every condition fulfilled or at least one diff --git a/idrop-web/grails-app/views/metadataSearch/index.gsp b/idrop-web/grails-app/views/metadataSearch/index.gsp index 7076b50..734b9d6 100644 --- a/idrop-web/grails-app/views/metadataSearch/index.gsp +++ b/idrop-web/grails-app/views/metadataSearch/index.gsp @@ -3,7 +3,6 @@ - @@ -23,8 +22,12 @@

- There'll be help -







+ To search by metadata please enter some conditions to inputs. One table limited by the lines is one condition node. + In this node you can enter as much queries as you want to. Additionaly, you can connect them by option choosing suitable + radiobutton. The nodes of conditions can also be connected, by "AND" - then the result will have to fulfill EVERY conditions + node according to the chosen option - or "OR" - at least one node. To add new query, press "ADD CONDITION", to delete it + "DELETE" , to add new node "New condition node", to delete node press the "X" button in the right corner of chosen table. + Eventually, to search by entered queries press "SEARCH" and be satisfied by results!

diff --git a/idrop-web/web-app/css/dhx_comboStyle.css b/idrop-web/web-app/css/dhx_comboStyle.css deleted file mode 100644 index 2f80286..0000000 --- a/idrop-web/web-app/css/dhx_comboStyle.css +++ /dev/null @@ -1,73 +0,0 @@ - -.dhx_combo_img{position:absolute; top:0px; right:0px; width:23px; height:25px} -.dhx_combo_option_img{position:relative; top:1px; margin:0px; margin-left:2px; left:0px; width:23px; height:25px; padding:0px} -.dhx_combo_input{color:#333333; font-family: Arial; font-size: 9pt; border:0px; padding:2px 2px 2px 2px; position:absolute; top:0px; outline: none 0} -.dhx_combo_box{position:relative; text-align:left; border:1px solid #7F9DB9; height:25px; _height:22px; overflow:hidden; background-color: white; margin-bottom: 9px; -} -.dhx_combo_list{position:absolute; z-index:230; overflow-y:auto; -webkit-overflow-scrolling: touch; overflow-x:hidden; border:1px solid black; height:100px; font-family: Arial; font-size: 9pt; background-color: white; z-index: 12000} -.dhx_combo_list div{cursor:default; padding:2px 2px 2px 2px} -.dhx_selected_option{background-color:navy; color:white} -.dhx_combo_img_rtl{position:absolute; top:0px; left:1px; width:17px; height:20px} -.dhx_combo_option_img_rtl{float:right; margin-right :0px; width:18px; height:18px} -.dhx_combo_list_rtl{direction: rtl; position:absolute; z-index:230; overflow-y:auto; -webkit-overflow-scrolling: touch; overflow-x:hidden; border:1px solid black; height:100px; font-family: Arial; font-size: 9pt; background-color: white} -.dhx_combo_list_rtl div{direction: rtl; padding:2px 2px 2px 2px} -.dhx_combo_list_rtl div div{float :right !important; cursor:default; -} -.dhx_combo_list_rtl div img{float :right !important} -.dhx_combo_list_rtl div input{float :right !important} -.dhx_combo_input{box-sizing: border-box} -.dhx_combo_box.dhx_terrace .dhx_combo_img{height:30px; top: -2px} -.dhx_combo_box.dhx_terrace{height: 25px; line-height: 23px; _height:27px; padding:0px} -.dhx_combo_box.dhx_terrace .dhx_combo_img_rtl{height:30px} -.dhx_combo_box.dhx_terrace{border:1px solid #CECECE} -.combo_dhx_terrace_sel{background:#FFF3A1; color:black} -.dhx_combo_list.dhx_terrace_list div{cursor:default; padding:6px 4px} -.dhx_combo_list.dhx_terrace_list{background-color: white; border:1px solid #CECECE; font-family:Arial; font-size: 13px} -.dhx_combo_list_rtl.dhx_terrace_list{background-color: white; border:1px solid #CECECE; font-family:Arial; font-size: 13px} -.dhx_combo_box.dhx_terrace .dhx_combo_input {height: 26px; line-height: 24px; font-family:Arial; font-size: 13px; padding:0px 0px 0px 2px; -} -.dhx_combo_box.dhx_skyblue{border:1px solid #a4bed4} -.dhx_combo_box.dhx_skyblue .dhx_combo_input {font-family:Tahoma; font-size: 14px; margin-bottom: 9px; - height:25px; line-height:20px; padding:0 0 0 2px} -.dhx_combo_list.dhx_skyblue_list{background-color: #eaf2fb; border:1px solid #a4bed4; font-family:Tahoma; font-size: 11px} -.dhx_combo_list.dhx_skyblue_list div{cursor:default; padding:3px 4px} -.dhx_combo_list_rtl.dhx_skyblue_list{background-color: #eaf2fb; border:1px solid #a4bed4; font-family:Tahoma; font-size: 11px} -.combo_dhx_skyblue_sel{background-image: url('imgs/bg_selection.gif') !important; background-position: bottom; background-repeat: repeat-x; color:black} -.combo_dhx_web_sel{background-color: #ACDAF0; color:black; -} -.dhx_combo_box.dhx_web .dhx_combo_input {height:20px; line-height:20px; padding:0 0 0 2px} -.dhx_combo_box.dhx_web,.dhx_combo_list.dhx_web_list,.dhx_combo_list_rtl.dhx_web_list {border: 1px solid #8B8B8B} -.dhtmlx_message_area{position:fixed; right:5px; width:250px; z-index:1000; padding:5px 0px} -.dhtmlx-info{color:#444; border-radius:4px; min-width: 120px; padding:10px 10px 10px 20px; background-color:#FFFFCC; font-size:12px; font-family:Tahoma; z-index: 10000; margin:0px 5px 5px 5px; border:1px solid #d3d3d3; box-shadow: 0px 0px 5px #ccc; - -webkit-transition: all .5s ease; -moz-transition: all .5s ease; -o-transition: all .5s ease; transition: all .5s ease} -.dhtmlx-info.hidden{height:0px; padding-bottom:0px; padding-top:0px; border-width:0px; margin-top:0px; margin-bottom:0px; overflow:hidden} -.dhtmlx-error{background-color: #f17373; color:#fff} -.dhtmlx_modal_box{overflow:hidden; display: inline-block; min-width: 300px; width: 300px !important; text-align: center; position:fixed; background-color: #fff; z-index:20000; - -moz-box-shadow: 0px 0px 5px #AAAAAA; -webkit-box-shadow: 0px 0px 0px #AAAAAA; box-shadow: 0px 0px 5px #AAAAAA; border:1px solid #a4bed4; border-radius: 6px} -.dhtmlx_popup_title{padding: 5px 0; font-size: 12px; -webkit-border-top-right-radius:6px; -webkit-border-top-left-radius:6px; border-radius-top-right:6px; line-height: 16px; font-family:Tahoma; font-weight: bold} -.dhtmlx-info, .dhtmlx_popup_title, .dhtmlx_popup_button{-webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none; -moz-user-select:-moz-none; cursor:pointer} -.dhtmlx_popup_text{font-size: 13px; font-family: Tahoma; color:#444; min-height: 30px; padding: 20px 10px 10px 10px !important; overflow:hidden} -.dhtmlx_popup_controls{font-family: Tahoma; font-weight:bold; padding: 10px 10px 17px 10px !important} -.dhtmlx_popup_button{font-size: 12px; font-family: Tahoma; font-weight: bold; min-width: 120px; width: 120px; height: 20px; display: inline-block; margin: 0 5px; border-radius: 4px} -.dhtmlx_popup_button div{line-height:20px} -div.dhx_modal_cover {background-color:#000; cursor:default; opacity: 0.2; filter:alpha(opacity = 0.2); position: fixed; z-index:19999; left: 0px; top: 0px; width: 100%; height: 100%; border: none; zoom: 1} -.dhtmlx_popup_button{color: #2e3947; text-shadow: 0 1px 0 #ffffff; border: 1px solid #a4bed4; background-color: #d5e6fc; background-image: -moz-linear-gradient(center bottom, #e1eeff 0%, #cce2fe 12%, #ecf2f7 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.00, #ecf2f7), color-stop(0.88, #cce2fe), color-stop(1.00, #e1eeff)); background: -o-linear-gradient( top, #e1eeff, #cce2fe 12%, #ecf2f7); background: linear-gradient(top, #e1eeff, #cce2fe 12%, #ecf2f7 ); background: -ms-linear-gradient(top, #e1eeff 0%,#cce2fe 12%,#ecf2f7 100%)} -.dhtmlx_popup_button:active, .dhtmlx_popup_button:focus{box-shadow: inset 0 0 2px #aaaaaa; background: #bdd9fc; - background: -moz-linear-gradient(top, #C4DDFF 0%, #bdd9fc 88%, #deeaf4 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C4DDFF), color-stop(88%,#bdd9fc), color-stop(100%,#deeaf4)); - background: -o-linear-gradient(top, #C4DDFF 0%,#bdd9fc 88%,#deeaf4 100%); - background: -ms-linear-gradient(top, #C4DDFF 0%,#bdd9fc 88%,#deeaf4 100%); - background: linear-gradient(top, #C4DDFF 0%,#bdd9fc 88%,#deeaf4 100%); -} -.dhtmlx_popup_title{box-shadow:inset 0 0 2px #ffffff; display: block} -.dhtmlx-alert-error, .dhtmlx-confirm-error{} -.dhtmlx-alert-error .dhtmlx_popup_title, .dhtmlx-confirm-error .dhtmlx_popup_title{color : white; border: 1px solid #f17373; background: #f17373; background: -webkit-linear-gradient(top,#ff7c7c, #f17373 88%, #ff7361); background: -moz-linear-gradient(top, #ff7c7c, #f17373 88%, #ff7361); background: -o-linear-gradient(top, #ff7c7c, #f17373 88%, #ff7361); background: linear-gradient(top, #ff7c7c, #f17373 88%, #ff7361); background: -ms-linear-gradient(top, #ff7c7c 0%,#f17373 88%,#ffbc75 100%)} -.dhtmlx-alert-error.dhtmlx_modal_box, .dhtmlx-confirm-error.dhtmlx_modal_box{border: 1px solid #f17373} -.dhtmlx-alert-warning .dhtmlx_popup_title, .dhtmlx-confirm-warning .dhtmlx_popup_title{color : #000; border: 1px solid #d2b07f; background: #ff9f37; - background: -webkit-linear-gradient(top, #ffc786, #ff9523 88%, #ffbc75); background: -moz-linear-gradient(top,#ffc786,#ff9523 88%, #ffbc75); background: -o-linear-gradient(top, #ffc786, #ff9523 88%, #ffbc75); background: linear-gradient(top, #ffc786, #ff9523 88%, #ffbc75); background: -ms-linear-gradient(top, #ffc786 0%,#ff9523 88%,#ffbc75 100%)} -.dhtmlx-alert-warning .dhtmlx_popup_controls, .dhtmlx-confirm-warning .dhtmlx_popup_controls {border: 1px solid #d5d5d5; border-width: 0 1px 1px 1px} -.dhtmlx-alert-warning .dhtmlx_popup_text, .dhtmlx-confirm-warning .dhtmlx_popup_text{border: 1px solid #d5d5d5; border-width: 0 1px 0 1px} -.dhtmlx-alert .dhtmlx_popup_title, .dhtmlx-confirm .dhtmlx_popup_title{color : #000; border: 1px solid #a4bed4; background: #d5e6fc; background: -moz-linear-gradient(center bottom, #e1eeff 0%, #cce2fe 12%, #ecf2f7 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0.00, #ecf2f7), color-stop(0.88, #cce2fe), color-stop(1.00, #e1eeff)); background: -o-linear-gradient( top, #e1eeff, #cce2fe 12%, #ecf2f7); background: linear-gradient(top, #e1eeff, #cce2fe 12%, #ecf2f7 ); background: -ms-linear-gradient(top, #e1eeff 0%,#cce2fe 12%,#ecf2f7 100%); -} -.dhtmlx-alert .dhtmlx_popup_controls, .dhtmlx-confirm .dhtmlx_popup_controls{border: 1px solid #d5d5d5; border-width: 0 1px 1px 1px} -.dhtmlx-alert .dhtmlx_popup_text, .dhtmlx-confirm .dhtmlx_popup_text{border: 1px solid #d5d5d5; border-width: 0 1px 0 1px} diff --git a/idrop-web/web-app/imgs/bg_selection.gif b/idrop-web/web-app/imgs/bg_selection.gif deleted file mode 100644 index 9bec728..0000000 --- a/idrop-web/web-app/imgs/bg_selection.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/blank.gif b/idrop-web/web-app/imgs/blank.gif deleted file mode 100644 index d7ae406..0000000 --- a/idrop-web/web-app/imgs/blank.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select.gif b/idrop-web/web-app/imgs/combo_select.gif deleted file mode 100644 index 2372682..0000000 --- a/idrop-web/web-app/imgs/combo_select.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dhx_black.gif b/idrop-web/web-app/imgs/combo_select_dhx_black.gif deleted file mode 100644 index ddaebe6..0000000 --- a/idrop-web/web-app/imgs/combo_select_dhx_black.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dhx_blue.gif b/idrop-web/web-app/imgs/combo_select_dhx_blue.gif deleted file mode 100644 index ba6bd0a..0000000 --- a/idrop-web/web-app/imgs/combo_select_dhx_blue.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dhx_skyblue.gif b/idrop-web/web-app/imgs/combo_select_dhx_skyblue.gif deleted file mode 100644 index 1e2fdad..0000000 --- a/idrop-web/web-app/imgs/combo_select_dhx_skyblue.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dhx_terrace.gif b/idrop-web/web-app/imgs/combo_select_dhx_terrace.gif deleted file mode 100644 index 305d943..0000000 --- a/idrop-web/web-app/imgs/combo_select_dhx_terrace.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dhx_web.gif b/idrop-web/web-app/imgs/combo_select_dhx_web.gif deleted file mode 100644 index ca33ae2..0000000 --- a/idrop-web/web-app/imgs/combo_select_dhx_web.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dis_dhx_skyblue.gif b/idrop-web/web-app/imgs/combo_select_dis_dhx_skyblue.gif deleted file mode 100644 index ec897aa..0000000 --- a/idrop-web/web-app/imgs/combo_select_dis_dhx_skyblue.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dis_dhx_terrace.gif b/idrop-web/web-app/imgs/combo_select_dis_dhx_terrace.gif deleted file mode 100644 index 981ac9b..0000000 --- a/idrop-web/web-app/imgs/combo_select_dis_dhx_terrace.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/imgs/combo_select_dis_dhx_web.gif b/idrop-web/web-app/imgs/combo_select_dis_dhx_web.gif deleted file mode 100644 index 2735656..0000000 --- a/idrop-web/web-app/imgs/combo_select_dis_dhx_web.gif +++ /dev/null Binary files differ diff --git a/idrop-web/web-app/js/mydrop/metaFiltering.js b/idrop-web/web-app/js/mydrop/metaFiltering.js index 0eb699f..a1f2f54 100644 --- a/idrop-web/web-app/js/mydrop/metaFiltering.js +++ b/idrop-web/web-app/js/mydrop/metaFiltering.js @@ -1,38 +1,40 @@ $(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() { //after mouse entering on some buttons 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 = "
Attribute
\n\ + case 1: + newCell = "
Attribute
\n\ "; - break; - case 2: - newCell = "
Operator
\n\ + break; + case 2: + newCell = "
Operator
\n\ "; - break; - case 3: - newCell = "
Value
\n\ + break; + case 3: + newCell = "
Value
\n\ \n\
Unit
\n\ "; - break; - case 4: - newCell = "
\n\ + break; + case 4: + newCell = "
\n\ "; -} -return newCell; -} + } + return newCell; + } -function addNewCondition() { + function addNewCondition() { //after 'ADD CONDITION' click -var curTab = $(this).closest(".filterMetaTable"); // current filterMetaTable + var curTab = $(this).closest(".filterMetaTable"); // current filterMetaTable var newCell1 = newPartOfForm(1); //Attribute @@ -71,127 +73,135 @@ var curTab = $(this).closest(".filterMetaTable"); // current filterMetaTable var newRow = " " + newCell1 + "" + "" + newCell2 + "" + "" + newCell3 + "" + "" + newCell4 + ""; $(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() { //after 'DELETE' click + + 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() { //after 'New condition node' click -var operator = "
\n\ + var operator = "
\n\
"; + var head = "\n\ \n\ \n\ " + - "\n\ + "\n\ \n\ \n\ " + - "\n\ + "\n\ \n\ \n\ "; + var foot = "\n\ \n\ \n\ \n\ "; + var cell1 = newPartOfForm(1); var cell2 = newPartOfForm(2); var cell3 = newPartOfForm(3); var cell4 = newPartOfForm(4); + $(this).parent().before(operator + "" + head + "" + - "" + - "" + foot + "
" + cell1 + "" + cell2 + "" + cell3 + "" + cell4 + "
"); + "" + cell1 + "" + cell2 + "" + cell3 + "" + cell4 + "" + + " " + foot + ""); + $('.filterMetaTable[name=none]').removeAttr('name').animate({'backgroundColor': '#D6D6D6'}, 700, function() { -$(this).animate({'backgroundColor': '#FFFFFF'}, 700); -}); - $(this).parents(".span9").find(".deleteNodeBtn").removeAttr("disabled"); + $(this).animate({'backgroundColor': '#FFFFFF'}, 700); + }); + + $(this).parents(".span9").find(".deleteNodeBtn").removeAttr("disabled"); //unblock deleting first condition $.updateRadioNames(); -} + } -function deleteCondNode() { + function deleteCondNode() { -var tablesLeft = $(".filterMetaTable").length; - if (tablesLeft <= 2) - $(this).parents(".span9").find(".deleteNodeBtn").attr("disabled", "disabled"); + var tablesLeft = $(".filterMetaTable").length; + if (tablesLeft <= 2) //check how many nodes left + $(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(); -}); -} + if ($(curTab).index() == 0) //if the first node is going to be deleted, delete also operator after it otherwise operator before + { + $(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() { //after inserting, deleting or accepting nodes update radiobuttons names to make them the same in one node + $("input[type=radio]").each(function() { + var newName = "AVUNodes[" + $(this).parents('table').index('table') + "].andOr"; + $(this).attr('name', newName); + }); + } }); - function giveAVUNames() { +function giveAVUNames() { //give names to every element which is significant to searching by metadata, such as inputs and selects (operators) - $("input[name*=attr]").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() { + $(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); - }); - $("input[name*=unit]").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() { + $(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 2e95f8c..d3a30ee 100755 --- a/idrop-web/web-app/js/mydrop/search.js +++ b/idrop-web/web-app/js/mydrop/search.js @@ -91,7 +91,7 @@ function askForSearchDetailsPulldown(absPath, detailsId) { function processMetadataQuery() { - if (($("input[name*='val']").val()=="") || ($("input[name*='attr']").val()=="")) + if (($("input[name*='val']").val()=="") || ($("input[name*='attr']").val()=="")) //checking if any input is empty { alert("Please fill every attribute and value input or delete some conditions"); return; -- cgit