Changeset 594


Ignore:
Timestamp:
Jun 21, 2010, 8:42:50 AM (6 years ago)
Author:
vinlud
Message:

Dynamic simple Assays tab

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/query/SimpleQueryController.groovy

    r555 r594  
    3333        onStart {
    3434            println "Starting webflow simpleQuery"
    35             flow.term = null
     35            flow.search_term            = null
    3636            flow.page = 0
    3737                        flow.pages = [
     
    4949              flow.page = 1
    5050            }
    51             on("addCompound") {
    52                 println "addCompound"             
    53             }.to "query"
    54 
    55             on("addTransciptome") {
    56               println "addTransciptome"
    57             }.to "query"
    5851
    5952            on("search") {
    6053              println "Search!"
    61               println params
    62               if (!params.term.trim()) {
     54              if (!params.search_term.trim()) {
    6355                return [:]
    6456              }
    65 
    66               flow.term = params.term
    6757            }.to "searching"
    6858
     
    7464        searching {
    7565           action {
     66
     67              println "Searching"
     68              println params
     69             
     70              flow.search_term            = params.search_term
     71              flow.search_sa_compounds    = params.sa_compound
     72              flow.search_sa_values       = params.sa_value
     73              flow.search_tt_genepaths    = params.sa_genepath
     74              flow.search_tt_regulations  = params.sa_regulation
     75
    7676              // Searchable plugin not yielding results yet
    7777              /*
     
    8585
    8686              // Search for the term in Terms
    87               // results = searchableService.search(flow.term, type:"Term")
     87              // results = searchableService.search(flow.search_term, type:"Term")
    8888
    8989              // Map the Terms to Studies
     
    112112              println "Rendering resultPage"
    113113              flow.page = 2
    114               println flow.term
     114
     115              if (flow.search_sa_compounds) {
     116                if (flow.search_sa_compounds.class.getName() == "java.lang.String") {
     117                  flow.resultString = true
     118                } else {
     119                  flow.resultString = false
     120                }
     121              }
     122
     123              println flow.search_sa_compounds.getClass()
    115124            }
    116125
    117126            on("reset") {
    118               flow.term = null
    119               flow.studies = null
     127              flow.search_term            = null
     128              flow.studies                = null
     129              flow.search_sa_compounds    = null
     130              flow.search_sa_values       = null
     131              flow.search_tt_genepaths    = null
     132              flow.search_tt_regulations  = null
    120133              println "Resetting query flow"
    121134            }.to "query"
     
    126139
    127140    }
    128  
    129 
    130 
    131 
    132 
    133141}
  • trunk/grails-app/views/simpleQuery/common/_query.gsp

    r570 r594  
    1010
    1111    <g:form action="pages" name="simpleQueryForm" id="simpleQueryForm">
    12     <g:if test="${term}"><g:set var="preterm" value="${term}" /></g:if>
     12    <g:if test="${search_term}"><g:set var="preterm" value="${search_term}" /></g:if>
    1313    <div class="content">
    1414      <div class="element">
    1515        <div class="description">Search term (e.g. 'paracetamol')</div>
    16         <div class="input"><g:textField name="term" value="${preterm}" /></div>
     16        <div class="input"><g:textField name="search_term" value="${preterm}" /></div>
    1717      </div>
    1818      <div class="element">
     
    2525      </div>
    2626    </div>
    27     <g:submitButton name="search" value="Search" /> <g:if test="${term}"><g:submitButton name="reset" value="Clear" /></g:if>
     27    <g:submitButton name="search" value="Search" /> <g:if test="${search_term}"><g:submitButton name="reset" value="Clear" /></g:if>
    2828
    2929    <br><br>
     
    3333      <div class="element">
    3434        <div id="compoundGroup">
     35          <g:if test="${resultString}">
    3536          <div id="compoundRow1">
    3637            <div class="description">Compound (e.g. 'glucose')</div>
    37             <div class="input"><g:textField name="compound" value="" id="compound1" /></div>
     38            <div class="input"><g:textField name="sa_compound" value="${search_sa_compounds}"/></div>
    3839            <div class="description">Value</div>
    39             <div class="input"><g:textField name="compound_value" value="" id="compoundValue1" /></div>
     40            <div class="input"><g:textField name="sa_value" value="${search_sa_values}"/></div>
    4041          </div>
     42          </g:if>
     43          <g:else>
     44            <g:each status="i" in="${search_sa_compounds}" var="compound">
     45            <div id="compoundRow${i}">
     46              <div class="description">Compound (e.g. 'glucose')</div>
     47              <div class="input"><g:textField name="sa_compound" value="${compound}"/></div>
     48              <div class="description">Value</div>
     49              <div class="input"><g:textField name="sa_value" value="${search_sa_values[i]}"/></div>
     50            </div>
     51            </g:each>
     52          </g:else>
    4153        </div>
    4254        <div id="addCompound">Add compound</div>
     
    5163            <div class="input"><g:textField name="genepath" value="" /></div>
    5264            <div class="description">Type of regulations</div>
    53             <div class="input"><g:select name="regulation" from="" value="${regulation}" noSelection="['':'--- select regulation ---']"/></div>
     65            <div class="input" id="regulationInput"><g:select name="regulation" from="" value="${regulation}" noSelection="['':'--- select regulation ---']"/></div>
    5466          </div>
    5567        </div>
     
    6173    <br><br>
    6274
    63     <g:if test="${term}">
    64         <h1><g:message code="Search results for term ${term}"/></h1>
     75    <g:if test="${search_term}">
     76        <h1><g:message code="Search results for term ${search_term}"/></h1>
    6577
    6678        <g:if test="${listStudies}">
  • trunk/web-app/js/simpleQuery.js

    r570 r594  
    2323    $('#addCompound').click(function() {
    2424        var compoundGroup = document.getElementById('compoundGroup');
    25 
    2625        var newCompoundDiv = document.createElement('div');
    2726        newCompoundDiv.setAttribute('id', 'compoundRow' + compoundCounter);
    2827
    29         newCompoundDiv.innerHTML = '<div class="description">Compound</div> <div class="input"><input type="text" name="compound" value=""></div> <div class="description">Value</div> <div class="input"><input id="compoundValue' + compoundCounter + '" type="text"></div>';
     28        var newCompoundRowDiv1 = document.createElement('div');
     29        newCompoundRowDiv1.setAttribute('class', 'description');
     30        newCompoundRowDiv1.innerHTML = "Compound";
     31        newCompoundDiv.appendChild(newCompoundRowDiv1);
     32
     33        var newCompoundRowDiv2 = document.createElement('div');
     34        newCompoundRowDiv2.setAttribute('class', 'input');
     35        newCompoundRowDiv2.innerHTML = '<input type="text" name="sa_compound" value="">';
     36        newCompoundDiv.appendChild(newCompoundRowDiv2);
     37
     38        var newCompoundRowDiv3 = document.createElement('div');
     39        newCompoundRowDiv3.setAttribute('class', 'description');
     40        newCompoundRowDiv3.innerHTML = "Value";
     41        newCompoundDiv.appendChild(newCompoundRowDiv3);
     42
     43        var newCompoundRowDiv4 = document.createElement('div');
     44        newCompoundRowDiv4.setAttribute('class', 'input');
     45        newCompoundRowDiv4.innerHTML = "<input type='text' name='sa_value' value=''>";
     46        newCompoundDiv.appendChild(newCompoundRowDiv4);
    3047
    3148        compoundGroup.appendChild(newCompoundDiv);
     
    3956          var transcriptomeGroup = document.getElementById('transcriptomeGroup');
    4057          var newTranscriptomeDiv = document.createElement('div');
    41 
    4258          newTranscriptomeDiv.setAttribute('id', 'transcriptomeRow' + transcriptomeCounter);
    4359
     
    5975          var newTranscriptomeRowDiv4 = document.createElement('div');
    6076          newTranscriptomeRowDiv4.setAttribute('class', 'input');
    61           var newSelectBox = document.getElementById('regulation');
     77          var newSelectBox = document.getElementById('regulationInput');
    6278          newTranscriptomeRowDiv4 = newSelectBox.cloneNode(true);
    6379          newTranscriptomeRowDiv4.setAttribute('id', 'regulation' + transcriptomeCounter);
Note: See TracChangeset for help on using the changeset viewer.