Changeset 642
- Timestamp:
- Jul 2, 2010, 10:16:19 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/query/SimpleQueryController.groovy
r594 r642 18 18 import dbnp.studycapturing.Study 19 19 import org.compass.core.engine.SearchEngineQueryParseException 20 import dbnp.rest.common.CommunicationManager 20 21 21 22 class SimpleQueryController { … … 31 32 def pagesFlow = { 32 33 34 // Starting simpleQuery flow, initialize variables 33 35 onStart { 34 36 println "Starting webflow simpleQuery" 35 37 flow.search_term = null 36 flow.page = 038 flow.page = 0 37 39 flow.pages = [ 38 40 [title: 'Query'], … … 44 46 query { 45 47 render(view: "/simpleQuery/mainPage") 48 46 49 onRender { 47 50 println "Rendering mainPage" 51 flow.operators = ['>', '=', '<'] 52 flow.showFirstRowCompounds = true 48 53 flow.species = Term.findAll() 49 54 flow.page = 1 … … 64 69 searching { 65 70 action { 71 println "Starting search..." 72 def searchResult 73 def searchGscfResult 74 def searchSamResult 66 75 67 println "Searching"68 println params 69 76 // TODO: walk parameters, remove empty entries 77 78 // Map parameters 70 79 flow.search_term = params.search_term 71 80 flow.search_sa_compounds = params.sa_compound 81 flow.search_sa_operators = params.sa_operator 72 82 flow.search_sa_values = params.sa_value 73 83 flow.search_tt_genepaths = params.sa_genepath 74 84 flow.search_tt_regulations = params.sa_regulation 75 85 76 // Searchable plugin not yielding results yet 77 /* 86 // Check to see how parameters are being handled 87 if (flow.search_sa_compounds.class.getName() == "java.lang.String") { 88 println "string" 89 } else { 90 println "array of size " + flow.search_sa_compounds.length 91 } 92 93 // Search the keyword with the Searchable plugin 78 94 try { 79 println searchableService.countHits("mouse")95 searchGscfResult = searchableService.search(flow.search_term) 80 96 } catch (SearchEngineQueryParseException ex) { 81 //return [parseException: true]82 97 println ex 98 return [parseException: true] 83 99 } 84 */85 100 86 // Search for the term in Terms87 // results = searchableService.search(flow.search_term, type:"Term")101 // Map non-study objects to Studies 102 // ... todo when the plugin works and I can see the output 88 103 89 // Map the Terms to Studies 90 // ... 104 // Search in the SAM module 105 println "checking compounds" 106 if (flow.search_sa_compounds) { 107 objComs = new CommunicationManager() 91 108 92 // Save the results in the flow 93 // flow.studies = results 109 if (flow.search_sa_compounds.class.getName() == "java.lang.String") { 110 searchSamResult = objComs.getSAMStudies(flow.search_sa_compounds, flow.search_sa_values, flow.search_sa_operators) 111 } else { 112 def tmpSamResult 113 flow.search_sa_compounds.each { 114 obj, i -> println " ${i}: ${obj}" // objComs.getSAMStudies() 115 tmpSamResult = objComs.getSAMStudies(flow.search_sa_compounds[i], flow.search_sa_values[i], flow.search_sa_operators[i]) 116 117 // Combine each search 118 // searchSamResult = Merge(searchSamResult, tmpSamResult) 119 searchSamResult = tmpSamResult 120 }; 121 } 122 } 123 124 // Merge the results of all searches 125 /* 126 if (searchGscfResult.size() > 0) { 127 searchResult = Merge(searchSamResult, searchGscfResult) 128 } 129 */ 94 130 95 131 96 97 // As a usable result set we will use all studies for now 98 flow.listStudies = Study.findAll() 132 // Save the results in the flow 133 flow.listStudies = searchGscfResult.results 99 134 100 135 } … … 113 148 flow.page = 2 114 149 150 // TODO: Fix the showing of entered data, broke with plugin develeopment 115 151 if (flow.search_sa_compounds) { 116 152 if (flow.search_sa_compounds.class.getName() == "java.lang.String") { … … 120 156 } 121 157 } 122 123 println flow.search_sa_compounds.getClass()124 158 } 125 159 -
trunk/grails-app/views/simpleQuery/common/_query.gsp
r594 r642 25 25 </div> 26 26 </div> 27 <g:submitButton name="search" value="Search" /> <g:if test="${search_term}"><g:submitButton name="reset" value="Clear" /></g:if> 27 28 <br> 29 30 <g:submitButton name="search" value="Search" /> <g:if test="${search_term}"><g:submitButton name="reset" value="Clear" /></g:if> 28 31 29 32 <br><br> … … 33 36 <div class="element"> 34 37 <div id="compoundGroup"> 35 <g:if test="${resultString}"> 38 39 <g:if test="${showFirstRowCompounds}"> 36 40 <div id="compoundRow1"> 37 <div class="description ">Compound (e.g. 'glucose')</div>41 <div class="descriptionSA">Compound</div> 38 42 <div class="input"><g:textField name="sa_compound" value="${search_sa_compounds}"/></div> 39 <div class="description">Value</div> 43 <div class="descriptionSA">Operator</div> 44 <div class="input" id="operatorInput"><g:select name="operator" from="${operators}" value="="/></div> 45 <div class="descriptionSA">Value</div> 40 46 <div class="input"><g:textField name="sa_value" value="${search_sa_values}"/></div> 41 47 </div> 42 48 </g:if> 49 43 50 <g:else> 44 51 <g:each status="i" in="${search_sa_compounds}" var="compound"> 45 52 <div id="compoundRow${i}"> 46 <div class="description ">Compound (e.g. 'glucose')</div>53 <div class="descriptionSA">Compound (e.g. 'glucose')</div> 47 54 <div class="input"><g:textField name="sa_compound" value="${compound}"/></div> 48 <div class="description">Value</div> 55 <div class="descriptionSA">Type of regulations</div> 56 <div class="input"><g:select name="operator" from="${operators}" value="="/></div> 57 <div class="descriptionSA">Value</div> 49 58 <div class="input"><g:textField name="sa_value" value="${search_sa_values[i]}"/></div> 50 59 </div> … … 52 61 </g:else> 53 62 </div> 54 <div id="addCompound" >Add compound</div>63 <div id="addCompound" class="submit">Add compound</div> 55 64 </div> 56 65 -
trunk/web-app/css/simpleQuery.css
r628 r642 21 21 display: inline-block; 22 22 font-size: 11px; 23 width: 75px;23 width: 100px; 24 24 word-wrap: break-word; 25 25 } -
trunk/web-app/js/simpleQuery.js
r594 r642 27 27 28 28 var newCompoundRowDiv1 = document.createElement('div'); 29 newCompoundRowDiv1.setAttribute('class', 'description ');29 newCompoundRowDiv1.setAttribute('class', 'descriptionSA'); 30 30 newCompoundRowDiv1.innerHTML = "Compound"; 31 31 newCompoundDiv.appendChild(newCompoundRowDiv1); … … 37 37 38 38 var newCompoundRowDiv3 = document.createElement('div'); 39 newCompoundRowDiv3.setAttribute('class', 'description ');40 newCompoundRowDiv3.innerHTML = " Value";39 newCompoundRowDiv3.setAttribute('class', 'descriptionSA'); 40 newCompoundRowDiv3.innerHTML = "Operator"; 41 41 newCompoundDiv.appendChild(newCompoundRowDiv3); 42 42 43 43 var newCompoundRowDiv4 = document.createElement('div'); 44 44 newCompoundRowDiv4.setAttribute('class', 'input'); 45 newCompoundRowDiv4.innerHTML = "<input type='text' name='sa_value' value=''>"; 45 var newSelectBox = document.getElementById('operatorInput'); 46 newCompoundRowDiv4 = newSelectBox.cloneNode(true); 46 47 newCompoundDiv.appendChild(newCompoundRowDiv4); 47 48 49 var newCompoundRowDiv5 = document.createElement('div'); 50 newCompoundRowDiv5.setAttribute('class', 'descriptionSA'); 51 newCompoundRowDiv5.innerHTML = "Value"; 52 newCompoundDiv.appendChild(newCompoundRowDiv5); 53 54 var newCompoundRowDiv6 = document.createElement('div'); 55 newCompoundRowDiv6.setAttribute('class', 'input'); 56 newCompoundRowDiv6.innerHTML = "<input type='text' name='sa_value' value=''>"; 57 newCompoundDiv.appendChild(newCompoundRowDiv6); 48 58 compoundGroup.appendChild(newCompoundDiv); 49 59
Note: See TracChangeset
for help on using the changeset viewer.