Changeset 18131


Ignore:
Timestamp:
2008-12-05T18:13:28+13:00 (16 years ago)
Author:
ak19
Message:

Updated method missingEXEC() to present the user with the likely URL of the greenstone 3 server when GLI is launched in a GS3 context. (Previously the URL field was empty and the message was a bit more like a warning.)

Location:
gli/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/classes/dictionary.properties

    r17264 r18131  
    836836MissingEXEC.Title:Missing Greenstone Library Address
    837837#***** Missing EXEC_GS3 *****
    838 MissingEXEC_GS3.Message:Warning! You will not be able to view your new collections within the Librarian Interface unless you specify the path to the Greenstone context in the locally running Tomcat Webserver. You can enter this now in the text field below, or later by going to Preferences and choosing the Connection tab. Remember that a valid url must start with the protocol "http://". The default address is http://localhost:8080/greenstone3.
    839 MissingEXEC_GS3.Title:Missing Greenstone 3 Library Address
     838MissingEXEC_GS3.Message:Please enter the Greenstone 3 library URL. You will not be able to view your new collections within the Librarian Interface unless you specify the path to the Greenstone context in the locally running Tomcat Webserver. You can enter this now in the text field below, or later by going to Preferences and choosing the Connection tab. Remember that a valid URL must start with the protocol "http://".
     839MissingEXEC_GS3.Title:Greenstone 3 Library URL
    840840#***** Missing GLIServer *****
    841841MissingGLIServer.Message:Enter the address of the remote Greenstone "gliserver.pl" script in the text field below. Remember that a valid URL must start with the protocol "http://" and end with "gliserver".
  • gli/trunk/src/org/greenstone/gatherer/Gatherer.java

    r17628 r18131  
    821821
    822822    if (GS3) {
    823         dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC_GS3.Title"), Dictionary.get("MissingEXEC_GS3.Message"), configPropertyName, false);
     823        // Warning dialog with no cancel button and no "turn off warning" checkbox
     824        dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC_GS3.Title"), Dictionary.get("MissingEXEC_GS3.Message"), configPropertyName, false, false);
    824825    } else { // local case
    825826        dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC.Title"), Dictionary.get("MissingEXEC.Message"), configPropertyName, false);
    826827    }
    827828
    828     dialog.setValueField(new URLField.Text(Configuration.getColor("coloring.editable_foreground", false), Configuration.getColor("coloring.editable_background", false)));
     829    JTextField field = new URLField.Text(Configuration.getColor("coloring.editable_foreground", false), Configuration.getColor("coloring.editable_background", false));
     830
     831    // Set the default library URL to the tomcat server and port number
     832    // specified in the build.properties located in the gsdl3_src_path
     833    if (GS3) {
     834        String host = "localhost";
     835        String port = "8080";
     836       
     837        File buildPropsFile = new File(Configuration.gsdl3_src_path + File.separator + "build.properties");
     838        if(buildPropsFile.exists()) {
     839        Properties props = new Properties();
     840        try{
     841            props.load(new FileInputStream(buildPropsFile));
     842            host = props.getProperty("tomcat.server", host);
     843            port = props.getProperty("tomcat.port", port);
     844        }catch(Exception e){
     845            DebugStream.println("Could not load build.properties file");
     846            System.err.println("Could not load build.properties file");
     847        }
     848        props = null;
     849        }
     850        String defaultURL = "http://"+host+":"+port+"/"+"greenstone3/library";
     851        field.setText(defaultURL);
     852        field.selectAll();
     853    }
     854    dialog.setValueField(field);
    829855    dialog.display();
    830856    dialog.dispose();
     
    834860    if (!library_url_string.equals("")) {
    835861        try {
     862        // WarningDialog does not allow invalid URLs, so the following is ignored:
     863        // make sure the URL the user provided contains the http:// prefix
     864        // and then save the corrected URL
     865        if(!library_url_string.startsWith("http://")
     866           && !library_url_string.startsWith("https://")) {
     867            library_url_string = "http://"+library_url_string;
     868            Configuration.setString(configPropertyName, true, configPropertyName);
     869        }
    836870        Configuration.library_url = new URL(library_url_string);
    837871        }
     
    864898   
    865899    boolean showLogin = true;
    866  
    867900    do {
    868901        if(!dialog.loginRequested()) { // user pressed cancel to exit the FedoraLogin dialog
Note: See TracChangeset for help on using the changeset viewer.