Changeset 16884 for gli/trunk


Ignore:
Timestamp:
2008-08-18T16:35:36+12:00 (16 years ago)
Author:
ak19
Message:

When GS is local, it will use library_url_gs3 or library_url_gs2 and similarly open_collection_gs3 or open_collection_gs2 properties from the config file. (It still uses the default library_url and open_collection when GS is remote or if GLI is used with Fedora.) Method Configuration.gliPropertyNameSuffix() is added to return either the empty string or _gs2 or _gs3 in order to work out the property name in the situation. This change helps when running local GS2 and GS3 alternatively with GLI, as it preserves the library url and last opened collection for each separately.

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

Legend:

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

    r16330 r16884  
    180180
    181181    // Read the Greenstone library URL from the config file
    182     String library_url_string = getString("general.library_url", true);
     182    String library_url_string = getString("general.library_url"+gliPropertyNameSuffix(), true);
    183183    if (!library_url_string.equals("")) {
    184184        try {
     
    208208
    209209    }
     210
     211    /** @return the suffix for the the config file's library_url/open_collection propertyname.
     212     * For Fedora and remote GS2 cases, there is no suffix.
     213     * However, when dealing with a local Greenstone server, this returns suffix _gs2 or _gs3
     214     * so it can be appended to the default library_url/open_collection propertynames.
     215     * Having 2 separate library URL properties and open_collection properties for the two
     216     * local versions of Greenstone allows GLI to save the library_url and last opened
     217     * collection for both GS2 and GS3 in case anyone runs them alternatively. (This is useful
     218     * when developing and testing across GS versions.) */
     219    static public String gliPropertyNameSuffix() {
     220    if(Gatherer.isGsdlRemote || fedora_info.isActive()) {
     221        return ""; // no special suffix
     222    } else if(Gatherer.GS3) { // local GS3
     223        return "_gs3";
     224    } else { // local GS2
     225        return "_gs2";
     226    }
     227    }
     228
    210229
    211230    // Called when (gsdl3_path != null) || (Gatherer.GS3 && Gatherer.isGsdlRemote)
     
    268287        // Argument found
    269288        if (old_argument_element_name.equals(new_argument_element_name)) {
    270             if (!new_argument_element_name.equals("general.open_collection")) {
     289            if (!new_argument_element_name.equals("general.open_collection"+Configuration.gliPropertyNameSuffix())) {
    271290            String old_argument_element_value = XMLTools.getElementTextValue(old_argument_element);
    272291            if (!old_argument_element_value.equals(new_argument_element_value)) {
  • gli/trunk/src/org/greenstone/gatherer/Gatherer.java

    r16397 r16884  
    8282        */
    8383
    84     static final public String PROGRAM_VERSION = "svn-trunk";
     84    static final public String PROGRAM_VERSION = "trunk";
    8585
    8686    static private Dimension size = new Dimension(800, 540);
     
    444444        open_collection_file_path = open_collection;
    445445        if (open_collection_file_path == null) {
    446         open_collection_file_path = Configuration.getString("general.open_collection", true);
     446        open_collection_file_path = Configuration.getString(
     447            "general.open_collection"+Configuration.gliPropertyNameSuffix(), true);
    447448        }
    448449        if (no_load || open_collection_file_path.equals("")) {
     
    801802    static private void missingEXEC() {
    802803    WarningDialog dialog;
     804    String configPropertyName = "general.library_url"+Configuration.gliPropertyNameSuffix();
     805
    803806    if (GS3) {
    804         dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC_GS3.Title"), Dictionary.get("MissingEXEC_GS3.Message"), "general.library_url", false);
    805     }else {
    806         dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC.Title"), Dictionary.get("MissingEXEC.Message"), "general.library_url", false);
    807     }
     807        dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC_GS3.Title"), Dictionary.get("MissingEXEC_GS3.Message"), configPropertyName, false);
     808    } else { // local case
     809        dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC.Title"), Dictionary.get("MissingEXEC.Message"), configPropertyName, false);
     810    }
     811
    808812    dialog.setValueField(new URLField.Text(Configuration.getColor("coloring.editable_foreground", false), Configuration.getColor("coloring.editable_background", false)));
    809813    dialog.display();
     
    811815    dialog = null;
    812816
    813     String library_url_string = Configuration.getString("general.library_url", true);
     817    String library_url_string = Configuration.getString(configPropertyName, true);
    814818    if (!library_url_string.equals("")) {
    815819        try {
     
    912916    dialog.setValueField(new URLField.DropDown(Configuration.getColor("coloring.editable_foreground", false),
    913917                           Configuration.getColor("coloring.editable_background", false),
    914                            defaultURLs, "general.gliserver_url", "general.open_collection", 
    915                            "gliserver.pl"));
     918                           defaultURLs, "general.gliserver_url",
     919                           "general.open_collection"+Configuration.gliPropertyNameSuffix(),
     920                           "gliserver.pl"));
    916921
    917922    if (Gatherer.default_gliserver_url!=null){
  • gli/trunk/src/org/greenstone/gatherer/gui/GUIManager.java

    r16336 r16884  
    464464    // If we have a collection open remember it for next time, then save it and close it
    465465    if (Gatherer.c_man.ready()) {
    466         Configuration.setString("general.open_collection", true, CollectionManager.getLoadedCollectionColFilePath());
     466        Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(),
     467                    true, CollectionManager.getLoadedCollectionColFilePath());
    467468        saveThenCloseCurrentCollection();
    468469    }
    469470    else {
    470         Configuration.setString("general.open_collection", true, null);
     471        Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, null);
    471472    }
    472473
  • gli/trunk/src/org/greenstone/gatherer/gui/Preferences.java

    r14371 r16884  
    669669        }
    670670        }
    671         Configuration.setString("general.library_url", true, library_url_string);
     671
     672        Configuration.setString("general.library_url"+Configuration.gliPropertyNameSuffix(),
     673                    true, library_url_string);
    672674
    673675        if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
Note: See TracChangeset for help on using the changeset viewer.