Changeset 7740


Ignore:
Timestamp:
2004-07-16T13:53:15+12:00 (20 years ago)
Author:
davidb
Message:

General changes made to support GLI as an applet.

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

Legend:

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

    r7601 r7740  
    4040import java.awt.event.*;
    4141import java.io.*;
     42import java.net.*;
    4243import javax.swing.*;
    4344import javax.swing.event.*;
     
    315316        }
    316317
     318        if (Gatherer.isGsdlRemote) {
     319               
     320        String launch_cgi  = Gatherer.cgiBase + "launch?cmd=deldir";
     321
     322        String col_name = collection.getShortName();
     323        String dir = ".";
     324
     325        try {
     326
     327            String col_name_encoded = URLEncoder.encode(col_name,"UTF-8");
     328            String dir_encoded = URLEncoder.encode(dir,"UTF-8");
     329
     330            launch_cgi += "&c=" + col_name_encoded;
     331            launch_cgi += "&dir=" + dir_encoded;
     332       
     333            URL launch_url = new URL(launch_cgi);
     334            URLConnection launch_connection = launch_url.openConnection();
     335            InputStream stdis = launch_connection.getInputStream();
     336            InputStreamReader stdisr = new InputStreamReader(stdis, "UTF-8"  );
     337           
     338            BufferedReader stdbr = new BufferedReader(stdisr);
     339           
     340            while(true) {
     341            String line = stdbr.readLine();
     342            // ignore output of running lauch command
     343           
     344            if (line == null) { break; }
     345            }       
     346           
     347            stdbr.close();
     348        }
     349        // Exception
     350        catch (Exception exception) {
     351            Gatherer.println("Exception in GShell.runRemove() - unexpected");
     352            Gatherer.printStackTrace(exception);
     353        }
     354        }
     355
    317356        File delete_me;
    318357        if (Gatherer.GS3) {
     
    321360        delete_me = new File(Utility.getCollectionDir(Gatherer.config.gsdl_path, collection.getShortName()));
    322361        }
    323         if(Utility.delete(delete_me)) {
     362        if (Utility.delete(delete_me)) {
    324363        if (Gatherer.c_man.getCollection() != null && collection.getShortName().equals(Gatherer.c_man.getCollection().getName())) {
    325364            current_coll_deleted = true;
  • trunk/gli/src/org/greenstone/gatherer/gui/MirrorPane.java

    r7663 r7740  
    9191
    9292    current_mode = Gatherer.config.getMode();
    93     String user_dir = System.getProperty("user.dir");
    94     System.err.println("user dir = "+user_dir);
     93    // String user_dir = System.getProperty("user.dir"); // ****
     94    // System.err.println("**** user dir = "+user_dir);
    9595    // Create
    9696    JPanel edit_pane = new JPanel();
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java

    r7542 r7740  
    228228    // Retrieve the first 8 non-whitespace characters of title_final.
    229229    StringBuffer name_buffer = new StringBuffer("");
     230
     231    if (Gatherer.isGsdlRemote) {
     232        String username = System.getProperty("user.name");
     233        if ((username != null) && (username != "")) {
     234        name_buffer.append(username + "-");
     235        }
     236    }
     237
    230238    int i = 0;
    231     while(i < title_final.length() && name_buffer.length() < 8) {
     239    int u = 0;
     240    while(i < title_final.length() && u < 8) {
    232241        char c = title_final.charAt(i);
    233242        // Arg. We need a few more tests than just whitespace
    234243        if(Character.isLetterOrDigit(c)) {
    235244        name_buffer.append(Character.toLowerCase(c));
     245        u++;
    236246        }
    237247        i++;
  • trunk/gli/src/org/greenstone/gatherer/help/HelpFrame.java

    r7398 r7740  
    167167        // Load the XML help file and build the contents structure from it
    168168        try {
    169         DOMParser parser = new DOMParser();
    170         parser.parse(Utility.getHelpFolder() + StaticStrings.HELP_INDEX_FILENAME);
    171         Document document = parser.getDocument();
     169        // DOMParser parser = new DOMParser();
     170        // parser.parse(Utility.getHelpFolder() + StaticStrings.HELP_INDEX_FILENAME);
     171        // Document document = parser.getDocument();
     172
     173        String help_index = Utility.getHelpFolder() + StaticStrings.HELP_INDEX_FILENAME;
     174        Document document = Utility.parse(help_index,true);
    172175
    173176        // Traverse the document hierarchy, building a tree representing its structure
     
    295298    public URL getURL()
    296299    {
     300        URL url = null;
     301
     302        String help_file = Utility.getHelpFolder() + name + StaticStrings.HTM_FILE_EXTENSION;
     303
    297304        if (name != null && !name.equals(NULL_STRING)) {
    298305        try {
    299             File file = new File(Utility.getHelpFolder() + name + StaticStrings.HTM_FILE_EXTENSION);
    300             return file.toURL();
    301         }
    302         catch (Exception e) {
    303         }
    304         }
    305 
    306         return null;
     306            url = Utility.base.getResource("/"+help_file);
     307        }
     308        catch (Exception error) {
     309            // Most likely file name.
     310            try {
     311            File file = new File(Utility.BASE_DIR + help_file);
     312            url = file.toURL();
     313
     314            }
     315            catch (Exception e) {
     316            Gatherer.printStackTrace(e);
     317            }
     318        }
     319        }
     320        return url;
    307321    }
    308322
Note: See TracChangeset for help on using the changeset viewer.