Ignore:
Timestamp:
2008-12-05T18:13:28+13:00 (15 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.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.