Index: /main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 34245)
+++ /main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 34246)
@@ -68,4 +68,6 @@
 import org.greenstone.gatherer.metadata.MetadataSetManager;
 import org.greenstone.gatherer.metadata.MetadataXMLFileManager;
+import org.greenstone.gatherer.metadata.MetadataElement;
+import org.greenstone.gatherer.metadata.MetadataValue;
 import org.greenstone.gatherer.metadata.ProfileXMLFileManager;
 import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
@@ -153,6 +155,42 @@
 	}
     }
-
-
+    
+    /** helper methods to export metadata for collection files to csv */
+    public TreeMap<File, ArrayList> getAllAssignedMetadataForAllFiles() {
+	TreeMap<File, ArrayList> files_with_meta = new TreeMap<File, ArrayList>();
+	
+	ArrayList<File> files = listFilesInCollection();
+	Iterator<File> i = files.iterator();
+	
+	while(i.hasNext()) {
+	    File f = i.next();
+	    ArrayList file_meta = MetadataXMLFileManager.getMetadataAssignedToFile(f);
+	    files_with_meta.put(f, file_meta);
+	    
+	    // debugging display
+	    System.err.println("Meta for file: " + f.getAbsolutePath());
+	    Iterator it = file_meta.iterator();
+	    while(it.hasNext()) {
+		MetadataValue meta = (MetadataValue)it.next();
+		String metaVal = meta.getValue();
+		MetadataElement metaEl = meta.getMetadataElement();
+		String metaName = metaEl.getFullName();
+		System.err.println("   field: " + metaName);
+		System.err.println("   value: " + metaVal);
+	    }
+
+	}
+
+	return files_with_meta;
+    }
+    
+    public ArrayList<File> listFilesInCollection() {
+	ArrayList<File> files = new ArrayList<File>();
+	if(collection_tree_model != null) {
+	    collection_tree_model.getFileListing(files);
+	}
+	return files;
+    }
+    
     static public void addCollectionContentsChangedListener(CollectionContentsChangedListener listener)
     {
@@ -1307,12 +1345,26 @@
 		File external_metadata_set_file = external_metadata_set.getMetadataSetFile();
 		File metadata_set_file = new File(getLoadedCollectionMetadataDirectoryPath(), external_metadata_set_file.getName());
+
 		// If we're using a remote Greenstone server, upload the metadata file
 		if (Gatherer.isGsdlRemote) {
 		    Gatherer.remoteGreenstoneServer.uploadCollectionFile(collection.getGroupQualifiedName(false), metadata_set_file);
 		}
-	    }
-	    catch (Exception exception) {
-		DebugStream.printStackTrace(exception);
-	    }	
+		
+		// It's not enough that the local collection's mds file in gli user location
+		// (e.g. AppData/Roaming/Greenstone/GLI/collect/<collname>/metadata gets updated,
+		// Need to also update local GS3's installation's gli/metadatacopy of the .mds file
+		if (metadata_set_file.exists()) {
+		    System.err.println("@@@ Replacing: " + metadata_set_file);
+		    System.err.println("@@@ With: " + external_metadata_set_file);
+		    
+		    // delete GLI's copy and replace
+		    //if(metadata_set_file.delete()) { // only if deletion was sucessful, try to replace
+		    //Gatherer.f_man.getQueue().copyFile(external_metadata_set_file, metadata_set_file, true);// true for overwrite
+		    //}
+		    
+		}
+	} catch (Exception exception) {
+	    DebugStream.printStackTrace(exception);
+	}	
     }
     
Index: /main/trunk/gli/src/org/greenstone/gatherer/file/FileNode.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/file/FileNode.java	(revision 34245)
+++ /main/trunk/gli/src/org/greenstone/gatherer/file/FileNode.java	(revision 34246)
@@ -378,4 +378,7 @@
 	/** Tests if this enumeration contains more elements. */
 	public boolean hasMoreElements() {
+	    if(child_nodes == null) { // special case needed handling
+		return false;
+	    }
 	    return (index < child_nodes.size());
 	}
Index: /main/trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java	(revision 34245)
+++ /main/trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java	(revision 34246)
@@ -31,4 +31,30 @@
     }
 
+    /** helper methods to export metadata for collection files to csv */
+    public void getFileListing(ArrayList<File> files) {
+	getFileListing(root, files);
+	return;
+    }
+    
+    private void getFileListing(TreeNode node, ArrayList<File> files) {
+	if(node == null) return;
+	
+	if(!(node instanceof FileNode)) {
+	    return;
+	} else {
+	    FileNode current = (FileNode)node;
+	    files.add(current.getFile());
+	    if(current.isLeaf()) {
+		return;
+	    }
+	    
+	    Enumeration children = current.children();	    
+	    while(children.hasMoreElements()) {
+		FileNode child = (FileNode)children.nextElement();
+		getFileListing(child, files);
+	    }
+	}
+    }
+    
     public FileFilter[] getFilters() {
 	if(filters == null) {
Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/ConfigFileEditor.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/ConfigFileEditor.java	(revision 34245)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/ConfigFileEditor.java	(revision 34246)
@@ -204,10 +204,15 @@
 	    }	    
 	}
+	
 
 	// Final dialog setup & positioning.
-	setDefaultCloseOperation(DISPOSE_ON_CLOSE); // get rid of this dialog when it's closed (on dispose())
+	this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); // get rid of this dialog when it's closed (on dispose())
 	this.addWindowListener(new WindowAdapter() { // called on dispose. Return focus to any curr GLI Pane
-		public void windowClose(WindowEvent we) {
+		@Override
+		public void windowClosed(WindowEvent we) {
+		    super.windowClosed(we);		    
 		    Gatherer.g_man.doRegainFocus();
+		    //Gatherer.g_man.refresh(Gatherer.COLLECTION_OPENED, true);
+		    Gatherer.g_man.updateUI();
 		}
 	    });
@@ -228,4 +233,5 @@
 	editor.requestFocusInWindow();
     }
+
 
     public void actionPerformed(ActionEvent e) {
Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java	(revision 34245)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java	(revision 34246)
@@ -87,5 +87,4 @@
     public FileOpenActionListener foa_listener = new FileOpenActionListener();
 
-
     /** A reference to the currently instantiated help window, if any. */
     private HelpFrame help = null;
@@ -305,4 +304,6 @@
 		} 
 		//Gatherer.c_man.saveCollection(); //shouldn't have to do this, in theory. See above comment
+
+		Gatherer.c_man.getAllAssignedMetadataForAllFiles();
 		
 		ConfigFileEditor configEditor = new ConfigFileEditor();
@@ -1083,5 +1084,4 @@
     // remember to click other panes whenever they want to edit the collConfig.xml.    
     private void doLoseFocus() {
-    
 	if (previous_pane != null) {
 	    if (previous_pane == gather_pane) {
@@ -1103,5 +1103,4 @@
     }
     public void doRegainFocus() {
-    
 	if (previous_pane != null) {
 	    if (previous_pane == gather_pane) {
Index: /main/trunk/gli/src/org/greenstone/gatherer/util/Codec.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/util/Codec.java	(revision 34245)
+++ /main/trunk/gli/src/org/greenstone/gatherer/util/Codec.java	(revision 34246)
@@ -42,4 +42,5 @@
     static final public String ENCODE_SQUARE_BRACKETS = "ENCODE_SQUARE_BRACKETS";
     static final public String ESCAPEDHTML_TO_UNESCAPED = "ESCAPEDHTML_TO_UNESCAPED";
+    static final public String REINSTATE_HTML_TAGS = "REINSTATE_HTML_TAGS";
     static final public String GREENSTONE_TO_DOM = "GREENSTONE_TO_DOM";
     static final public String GREENSTONE_TO_TEXT = "GREENSTONE_TO_TEXT";
@@ -175,5 +176,5 @@
 	    "&", "&amp;",
 	    "\"", "&quot;",
-	    "\'", "&apos;"
+	    //"\'", "&apos;"
 	};
 	TRANSFORMS.put(TEXT_TO_DOM_PRESERVE_TAGS, text_to_dom_preserve_tags);
@@ -190,4 +191,13 @@
 	TRANSFORMS.put(ESCAPEDHTML_TO_UNESCAPED, escapedhtml_to_unescaped);
 	escapedhtml_to_unescaped = null;
+	
+	// Reinstate tag markers <>
+	String[] reinstate_html_tags = {
+	    "&lt;", "<", 
+	    "&gt;", ">",
+	};
+	TRANSFORMS.put(REINSTATE_HTML_TAGS, reinstate_html_tags);
+	reinstate_html_tags = null;
+	
 
 	// Transform plain html text into greenstone encoding
