Changeset 12036


Ignore:
Timestamp:
2006-07-06T14:28:57+12:00 (18 years ago)
Author:
mdewsnip
Message:

Added "combiner" arguments to addQueryTerm() and addIndexValue().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cic-hcap/macros/extra.dm

    r12035 r12036  
    12511251      if (document.QueryForm.aqv[i].value != "") \{
    12521252         var real_index = /aqv([0-9]+)field/.exec(document.QueryForm.aqv[i].id)[1];
    1253          addQueryTerm(document.QueryForm.q, "[" + document.QueryForm.aqv[i].value + "]:" + document.QueryForm.aqi[real_index].value);
     1253         addQueryTerm(document.QueryForm.q, "[" + document.QueryForm.aqv[i].value + "]:" + document.QueryForm.aqi[real_index].value, "&");
    12541254      \}
    12551255   \}
    12561256
    1257    addIndexValue(document.QueryForm.q, document.QueryForm.fuq, "FU");
    1258    addIndexValue(document.QueryForm.q, document.QueryForm.tmq, "TM");
    1259    addIndexValue(document.QueryForm.q, document.QueryForm.syq, "SY");
    1260    addIndexValue(document.QueryForm.q, document.QueryForm.maq, "MA");
    1261    addIndexValue(document.QueryForm.q, document.QueryForm.deq, "DE");
    1262    addIndexValue(document.QueryForm.q, document.QueryForm.stq, "ST");
    1263 \}
    1264 
    1265 function addIndexValue(query_field_reference, select_reference, index_code)
     1257   addIndexValue(document.QueryForm.q, document.QueryForm.fuq, "FU", "&");
     1258   addIndexValue(document.QueryForm.q, document.QueryForm.tmq, "TM", "&");
     1259   addIndexValue(document.QueryForm.q, document.QueryForm.syq, "SY", "&");
     1260   addIndexValue(document.QueryForm.q, document.QueryForm.maq, "MA", "&");
     1261   addIndexValue(document.QueryForm.q, document.QueryForm.deq, "DE", "&");
     1262   addIndexValue(document.QueryForm.q, document.QueryForm.stq, "ST", "&");
     1263
     1264   // Remove the trailing combiner
     1265   if (document.QueryForm.q.value.lastIndexOf('\)') != -1) \{
     1266      document.QueryForm.q.value = document.QueryForm.q.value.substring(0, document.QueryForm.q.value.lastIndexOf('\)') + 1);
     1267   \}
     1268   alert(document.QueryForm.q.value);
     1269\}
     1270
     1271function addQueryTerm(query_field_reference, index_value, combiner)
     1272\{
     1273   if (index_value != "") \{
     1274      query_field_reference.value += "(" + index_value + ") " + combiner + " ";
     1275   \}
     1276\}
     1277
     1278function addIndexValue(query_field_reference, select_reference, index_code, combiner)
    12661279\{
    12671280   var index_value = "";
    12681281   for (var i = 0; i < select_reference.options.length; i++) \{
    12691282      if (select_reference.options[i].selected) \{
    1270          index_value += ((index_value != "") ? " & " : "");
     1283         index_value += ((index_value != "") ? " " + combiner + " " : "");
    12711284     index_value += '["' + select_reference.options[i].value + '"]:' + index_code;
    12721285      \}
    12731286   \}
    1274    addQueryTerm(query_field_reference, index_value);
    1275 \}
    1276 
    1277 function addQueryTerm(query_field_reference, index_value)
    1278 \{
    1279    if (index_value != "") \{
    1280       query_field_reference.value += ((query_field_reference.value != "") ? " & " : "");
    1281       query_field_reference.value += "(" + index_value + ")";
    1282    \}
     1287   addQueryTerm(query_field_reference, index_value, "&");
    12831288\}
    12841289
Note: See TracChangeset for help on using the changeset viewer.