Changeset 5815 for trunk


Ignore:
Timestamp:
2003-11-10T14:04:13+13:00 (20 years ago)
Author:
kjdon
Message:

added support for build types and search types in the Collection and CollectionConfiguration classes so that the preview pane can set the right url based on the collection'sbuild type

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/collection/Collection.java

    r5785 r5815  
    185185    return collect_cfg.getDescription();
    186186    }
     187
     188    public String getCollectionType() {
     189    return collect_cfg.getBuildType();
     190    }
     191
     192    public String getSearchTypes() {
     193    return collect_cfg.getSearchTypes();
     194    }
    187195    /** Retrieve a specific directory mapping associated with this collection.
    188196     * @param name The name of the mapping to retrieve as a <strong>String</strong>.
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionConfiguration.java

    r5722 r5815  
    1919    private Element name_element;
    2020    private File file;
     21    private String build_type;
    2122    private String creator;
    2223    private String description;
    2324    private String maintainer;
    2425    private String name;
     26    private String search_types;
    2527
    2628    public CollectionConfiguration(File file) {
     
    5456                else if(temp.equalsIgnoreCase("maintainer")) {
    5557                maintainer = tokenizer.nextToken();
     58                }
     59                else if (temp.equalsIgnoreCase("buildtype")) {
     60                build_type = tokenizer.nextToken();
     61                }
     62                else if (temp.equalsIgnoreCase("searchtype")) {
     63                search_types = tokenizer.nextToken();
     64                temp = tokenizer.nextToken();
     65                if (temp!=null && !temp.equals("")) {
     66                    search_types += ","+temp;
     67                }
    5668                }
    5769                else if(temp.equalsIgnoreCase("collectionmeta")) {
     
    114126            }
    115127        }
     128        // just check a couple of things
     129        if (search_types != null && build_type==null) {
     130            build_type = "mgpp";
     131        }
    116132        command = null;
    117133        br.close();
     
    143159    }
    144160
     161    public String getBuildType() {
     162    String result = "";
     163       
     164    if (build_type != null) {
     165        result = build_type;
     166    }
     167    return result;
     168    }
     169
    145170    public String getCreator() {
    146171    String result = "";
     
    187212    else if(name != null) {
    188213        result = name;
     214    }
     215    return result;
     216    }
     217
     218    public String getSearchTypes() {
     219    String result = "";
     220       
     221    if (search_types != null) {
     222        result = search_types;
    189223    }
    190224    return result;
  • trunk/gli/src/org/greenstone/gatherer/gui/PreviewPane.java

    r5571 r5815  
    4343import javax.swing.*;
    4444import org.greenstone.gatherer.Dictionary;
     45import org.greenstone.gatherer.collection.Collection;
    4546import org.greenstone.gatherer.Gatherer;
    4647import org.greenstone.gatherer.util.GURL;
     
    107108        try {
    108109        // Now load the collection
    109         homepage = new URL(Gatherer.config.exec_address.toString() + "?a=p&p=about&c=" + Gatherer.c_man.getCollection().getName());
     110        Collection this_coll = Gatherer.c_man.getCollection();
     111        String extra_args = "";
     112        String build_type = this_coll.getCollectionType();
     113        if (build_type.equals("mgpp")) {
     114            // we need some more args on the url
     115            String search_types = this_coll.getSearchTypes();
     116            if (search_types.equals("")) {
     117            extra_args = "&ct=1&qt=0&qto=3";
     118            } else if (search_types.equals("plain")) {
     119            extra_args = "&ct=1&qt=0&qto=1";
     120            } else if (search_types.equals("form")) {
     121            extra_args = "&ct=1&qt=1&qto=2";
     122            } else if (search_types.equals("plain,form")) {
     123            extra_args = "&ct=1&qt=0&qto=3";
     124            } else if (search_types.equals("form,plain")) {
     125            extra_args = "&ct=1&qt=1&qto=3";
     126            }
     127        }
     128       
     129        homepage = new URL(Gatherer.config.exec_address.toString() + "?a=p&p=about&c=" + this_coll.getName()+extra_args);
    110130        String[] args = new String[1];
    111131        args[0] = homepage.toString();
Note: See TracChangeset for help on using the changeset viewer.