Ignore:
Timestamp:
2020-07-12T02:51:45+12:00 (4 years ago)
Author:
ak19
Message:
  1. Added moveMetaXMLToCSV 2. Both this and exportMetaAsCSV now also made to work for the remote case. 3. Bugfix to oversight in GUIManager that in the previous commit used to ignore user selected csvfile and always created a metdata.csv in import folder. 4. Tidied up MetaToCSV.java some more.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r34263 r34264  
    199199        eap = null;
    200200    }
    201     else if (esrc == menu_bar.file_exportmeta) {
     201    else if (esrc == menu_bar.file_exportmeta || esrc == menu_bar.file_movemeta) {
    202202        String currCollName = Gatherer.c_man.getCollection().getName();
    203203        String collection_directory_path = CollectionManager.getCollectionDirectoryPath(currCollName);
    204204       
    205         String importDir = collection_directory_path + File.separator + "import";
    206         File selectedFile = MetadataToCSV.chooseMetaCSVFile(importDir, this);
    207         if(selectedFile != null) {
    208         MetadataToCSV toCSV = new MetadataToCSV(collection_directory_path, selectedFile);
    209         //toCSV.printOrderedCollectionMeta();       
    210         toCSV.exportGLIMetaToCSV(new File(importDir, "metadata.csv"));
    211         }
     205        String importDir = collection_directory_path + "import";
     206        File csvFile = MetadataToCSV.chooseMetaCSVFile(importDir, this);
     207        if(csvFile != null) {
     208        MetadataToCSV toCSV = new MetadataToCSV(collection_directory_path, csvFile);
     209       
     210        boolean success = false;
     211        if(esrc == menu_bar.file_movemeta) {
     212            success = toCSV.moveMetaXMLToCSV(csvFile, this);
     213        } else {
     214            success = toCSV.exportMetaXMLToCSV(csvFile);
     215        }
     216
     217        // refresh coll view if meta.csv was created somewhere inside this coll's import folder
     218        // And for remote case, also upload any new file that's inside import dir to server
     219        if(success && csvFile.exists() && csvFile.getAbsolutePath().startsWith(importDir)) {
     220            if(Gatherer.isGsdlRemote) {
     221            Gatherer.remoteGreenstoneServer.uploadFilesIntoCollection(currCollName, new File[] {csvFile}, csvFile.getParentFile());
     222            }
     223            Gatherer.g_man.refreshCollectionTree(DragTree.COLLECTION_CONTENTS_CHANGED);
     224        }
     225        }
     226       
    212227    }
    213228    else if (esrc == menu_bar.file_exit) {
Note: See TracChangeset for help on using the changeset viewer.