Project

General

Profile

« Previous | Next » 

Revision 1956

Added by Matt Jones over 20 years ago

Enabled stylesheet parameters to be passed through metacat even when the
'query' function is called. Previously, query would interpret all
parameters except a few hardcoded ones to be pathexpressions that should be
built into a squery. Now, metacat.properties contains a new configuration
parameter called "query.ignored.params" which is a comma separated list of
paramters that should be passed through DBQuery.createSQuery without being
interpreted as a path expression. This allows these additional paramters to
be used in stylesheets and other places (html files) to customize the L&F
of particular skins.

The feature was implemented in order to allow the 'enableediting' parameter
for resultset.xsl to be passed through metacat without altering the query.
This parameter, when set to true, causes an 'edit' and 'delete' button to be
included for each record in the resultset. These buttons call the registry
edit and delete functions for the OBFS and (later) NRS and other registries.

View differences:

DBQuery.java
33 33

  
34 34
import edu.ucsb.nceas.morpho.datapackage.*;
35 35
import java.io.*;
36
import java.util.StringTokenizer;
36 37
import java.util.Vector;
37 38
import java.util.zip.*;
38 39
import java.net.URL;
......
954 955
      //make sure we aren't querying for any of these
955 956
      //parameters since the are already in the query
956 957
      //in one form or another.
957
      if (!nextkey.toString().equals("returndoctype") && 
958
         !nextkey.toString().equals("filterdoctype")  &&
959
         !nextkey.toString().equals("action")  &&
960
         !nextkey.toString().equals("qformat") && 
961
         !nextkey.toString().equals("anyfield") &&
962
         !nextkey.toString().equals("returnfield") &&
963
         !nextkey.toString().equals("owner") &&
964
         !nextkey.toString().equals("site") &&
965
         !nextkey.toString().equals("operator") )
966
      {
958
      Vector ignoredParams = new Vector();
959
      ignoredParams.add("returndoctype");
960
      ignoredParams.add("filterdoctype");
961
      ignoredParams.add("action");
962
      ignoredParams.add("qformat");
963
      ignoredParams.add("anyfield");
964
      ignoredParams.add("returnfield");
965
      ignoredParams.add("owner");
966
      ignoredParams.add("site");
967
      ignoredParams.add("operator");
968

  
969
      // Also ignore parameters listed in the properties file
970
      // so that they can be passed through to stylesheets
971
      String paramsToIgnore = MetaCatUtil.getOption("query.ignored.params");
972
      StringTokenizer st = new StringTokenizer(paramsToIgnore, ",");
973
      while (st.hasMoreTokens()) {
974
          ignoredParams.add(st.nextToken());
975
      }
976
      if (!ignoredParams.contains(nextkey.toString())) {
967 977
        //allow for more than value per field name
968
        for(int i=0; i<((String[])nextelement).length; i++)
969
        {
970
          if (!((String[])nextelement)[i].equals(""))
971
          {
978
        for(int i=0; i<((String[])nextelement).length; i++) {
979
          if (!((String[])nextelement)[i].equals("")) {
972 980
            query.append("<queryterm casesensitive=\"" + casesensitive +"\" " + 
973 981
                         "searchmode=\"" + searchmode + "\">" +
974 982
                         "<value>" +

Also available in: Unified diff