Changeset 34285

23.07.2020 18:33:28 (12 days ago)

1. Dictionary string for the CSV filefilter extension description. 2. Gone back to attempting to upload any meta.csv created directly in the collection folder to server, and fixed an oversight in RemoteGreenstoneServer?.getPathRelativeToDirectory() that prevented this because of an extra File separator char. However, even though the file now gets successfully uploaded, it won't get downloaded to the client again when the collection is reopened. (Also happens if the meta.csv file was exported into the collection's etc subfolder). This is because the remote server carefully selects which files get sent back to the client when a collection is opened, and csv files outside the import directory are not part of the existing selection. There's no compelling reason to incorporate csv files either, as the client's collect folder is stored in a hidden gli user folder anyway, and it's best the client-gli user choose an easily discoverable and accessible folder into which their exported meta csv is saved.

4 modified


  • main/trunk/gli/classes/

    r34283 r34285  
     538MetaToCSV.CSVFileExtensionType:CSV spreadsheet file (*.csv) 
    538539MetaToCSV.ChooseMetaCSVFile:{0} metadata from GLI to a new CSV file or add to existing 
    539540MetaToCSV.ConvertMetaXMLToCSV_Warning_Message:Warning, this will remove all metadata from GLI (metadata.xml files) after exporting to CSV.\nThis means you will no longer be able to edit this metadata from within GLI.\nProceed? 
  • main/trunk/gli/src/org/greenstone/gatherer/gui/

    r34284 r34285  
    225225        // refresh coll view if meta.csv was created somewhere inside this coll's import folder 
    226         // And for remote case, also upload any new file that's inside 
    227         // the collection's import dir to the remote server 
    228         if(success && csvFile.exists() && csvFile.getAbsolutePath().startsWith(importDir)) { 
     226        // And for remote case, also upload any new meta csv file if created anywhere inside the collection dir 
     227        // (incl especially its import dir) to the remote server 
     228        if(success && csvFile.exists() && csvFile.getAbsolutePath().startsWith(collection_directory_path)) { 
     229            // When the user *converts* metadata to CSV, it's set up to be easiest to create in the import folder 
     230            // When the user *exports* meta to CSV, it's set up to create this easiest in the collection folder 
     232            // Beware in export case: client-gli can create a metadata CSV file in the collection 
     233            // folder and this will get successfully uploaded and store into the collect folder 
     234            // on the remote server. However, when the collection is reopened in client-gli, the 
     235            // collection that's downloaded will NOT contain such a metadata CSV file (even though it 
     236            // still exists on the remote server in the collection folder) since the remote server 
     237            // selectively sends files across when a collection is opened.  
     238            // Not just anything and everything that exists in the collection folder (or its etc 
     239            // subfolder) is sent back to the client. There must be a reason why the GS3 server sends 
     240            // across some files and not others, so I'm not going to change that to incorporate any 
     241            // *.csv files found anywhere in the server's collection folder. 
     242            // When someone is using client-GLI it may not anyway make sense for them to save a file 
     243            // into their collection folder: the coll folder is hidden away in the gli user directory 
     244            // and even if client-GLI got it transferred back from the server and shows the user that 
     245            // their metadata.csv file exists locally, they still can't locate it that easily on 
     246            // their filesystem. It's best for the user to create the exported metadata in an easily 
     247            // located location on the client file system. 
    229248            if(Gatherer.isGsdlRemote) { 
    230249            Gatherer.remoteGreenstoneServer.uploadFilesIntoCollection(currCollName, new File[] {csvFile}, csvFile.getParentFile()); 
    231250            } 
    232             Gatherer.g_man.refreshCollectionTree(DragTree.COLLECTION_CONTENTS_CHANGED); 
    233         } 
     251            if(csvFile.getAbsolutePath().startsWith(importDir)) { 
     252            Gatherer.g_man.refreshCollectionTree(DragTree.COLLECTION_CONTENTS_CHANGED); 
     253            } 
     254        }        
    234255        } 
  • main/trunk/gli/src/org/greenstone/gatherer/metadata/

    r34283 r34285  
    572572    chooser.setDialogTitle(Dictionary.get("MetaToCSV.ChooseMetaCSVFile", actionName)); 
    573573    chooser.setApproveButtonText(Dictionary.get("MetaToCSV.Choose"));//actionName); 
    574     FileNameExtensionFilter filter = new FileNameExtensionFilter("CSV spreadsheet file", "csv"); 
     574    FileNameExtensionFilter filter = new FileNameExtensionFilter(Dictionary.get("MetaToCSV.CSVFileExtensionType"), "csv"); 
    575575    chooser.setFileFilter(filter);//.addChoosableFileFilter(filter); 
    576576    int returnVal = chooser.showOpenDialog(parent); 
  • main/trunk/gli/src/org/greenstone/gatherer/remote/

    r34160 r34285  
    836836    { 
    837837    String file_path = file.getAbsolutePath(); 
     839    // Special case: if file path is longer by File separator, 
     840    // still dealing with practcally the same folder path, return relative path as "." 
     841    if(directory_path.equals(file_path + File.separator)) { 
     842        return "."; 
     843    } 
    838844    if (!file_path.startsWith(directory_path)) { 
    839845        System.err.println("ERROR: File path " + file_path + " is not a child of " + directory_path);