Index: main/trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java	(revision 22410)
@@ -44,5 +44,4 @@
 import org.greenstone.gatherer.gui.GComboBox;
 import org.greenstone.gatherer.gui.GLIButton;
-import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
 import org.greenstone.gatherer.util.JarTools;
 import org.greenstone.gatherer.util.StaticStrings;
Index: main/trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java	(revision 22410)
@@ -441,5 +441,5 @@
 		// Set the title
 		String collection_title = name_textfield.getText();
-		String collection_name = CollectionManager.getLoadedGroupQualifiedCollectionName(true);
+		String collection_name = CollectionManager.getLoadedCollectionName(true);
 		Gatherer.g_man.setTitle(collection_title, collection_name);
                 collection_name_collectionmeta.setValue(collection_title);
Index: main/trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java	(revision 22410)
@@ -49,5 +49,4 @@
 import org.greenstone.gatherer.gui.ModalDialog;
 import org.greenstone.gatherer.gui.WarningDialog;
-import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
 import org.greenstone.gatherer.util.JarTools;
 import org.greenstone.gatherer.util.StaticStrings;
Index: main/trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java	(revision 22410)
@@ -210,5 +210,5 @@
       {
 	collection_checklist_model = new ArrayList();
-	current_coll_name = CollectionManager.getLoadedGroupQualifiedCollectionName(true);
+	current_coll_name = CollectionManager.getLoadedCollectionName(true);
 	File collect_directory = new File(Gatherer.getCollectDirectoryPath());
 	add_collections_to_model(collect_directory);
Index: main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 22410)
@@ -212,5 +212,5 @@
 	if(!Gatherer.isGsdlRemote) {
 	    command_parts_list.add("-collectdir");
-	    command_parts_list.add(getCollectDirectory());
+	    command_parts_list.add(getCollectDirectory()); // <../collect/>
 	}
 
@@ -220,5 +220,5 @@
 	}
 
-	command_parts_list.add(collection.getName());
+	command_parts_list.add(collection.getGroupQualifiedName(false)); // (colgroup/)colname
 
 	// Run the buildcol.pl and
@@ -270,5 +270,5 @@
 	}
 
-	import_list.add(collection.getName());	
+	import_list.add(collection.getGroupQualifiedName(false)); // (colgroup/)colname
 
 	String[] import_parts = (String[]) import_list.toArray(new String[0]); 
@@ -311,5 +311,5 @@
 	}
 
-	build_list.add(collection.getName());
+	build_list.add(collection.getGroupQualifiedName(false)); // (colgroup/)colname
 	
 	//build actual string
@@ -413,5 +413,5 @@
 	// Remove the lock file on the server
 	if (Gatherer.isGsdlRemote) {
-	    Gatherer.remoteGreenstoneServer.deleteCollectionFile(collection.getName(), lock_file);
+	    Gatherer.remoteGreenstoneServer.deleteCollectionFile(collection.getGroupQualifiedName(false), lock_file);
 	}
 
@@ -442,5 +442,5 @@
 //	command_parts_list.add("-collectdir");
 //	command_parts_list.add(getCollectDirectory());
-//    	command_parts_list.add(collection.getName());
+//    	command_parts_list.add(collection.getGroupQualifiedName(false)); // (colgroup/)colname
 //
 //	// Run the convert_coll_from_gs2.pl command
@@ -936,10 +936,21 @@
 
 
-    /** Returns the name of the loaded collection.
+    /** Returns the (group-qualified) name of the loaded collection with 
+     * OS-dependent file separator.
      */
     static public String getLoadedCollectionName()
     {
+	return CollectionManager.getLoadedCollectionName(false);
+    }
+
+    /** Returns the (group-qualified) name of the loaded collection with 
+     * OS-dependent space separator.
+     * @url true if url-type forward slashes, false if OS-dependent filesystem slashes.
+     */
+    static public String getLoadedCollectionName(boolean url)
+    {
 	if (collection != null) {
-	    return collection.getName();
+	    //return collection.getName();
+	    return collection.getGroupQualifiedName(url);
 	}
 
@@ -1087,5 +1098,5 @@
 	}
 
-	command_parts_list.add(collection.getName());
+	command_parts_list.add(collection.getGroupQualifiedName(false)); // (colgroup/)colname
 
 	// Run the import.pl command
@@ -1120,5 +1131,5 @@
 		// If we're using a remote Greenstone server, upload the metadata file
 		if (Gatherer.isGsdlRemote) {
-		    Gatherer.remoteGreenstoneServer.uploadCollectionFile(collection.getName(), metadata_set_file);
+		    Gatherer.remoteGreenstoneServer.uploadCollectionFile(collection.getGroupQualifiedName(false), metadata_set_file);
 		}
 	    }
@@ -1703,5 +1714,5 @@
 	    // If we're using a remote Greenstone server, delete the metadata file on the server
 	    if (Gatherer.isGsdlRemote) {
-		Gatherer.remoteGreenstoneServer.deleteCollectionFile(collection.getName(), metadata_set_file);
+		Gatherer.remoteGreenstoneServer.deleteCollectionFile(collection.getGroupQualifiedName(false), metadata_set_file);
 	    }
 	}
@@ -1789,7 +1800,10 @@
     // used as arg in the perl scripts
     private String getCollectDirectory() {
+	return Gatherer.getCollectDirectoryPath();
 	
-	String collect_dir = collection.getCollectionDirectory().getParentFile().getPath();
-	return collect_dir;
+	// the following will stick any colgroup at the end of the collect directory, making it no longer
+	// possible to get the real collect dir in a general manner if this were located outside greenstone
+	//String collect_dir = collection.getCollectionDirectory().getParentFile().getPath();
+	//return collect_dir;
     }
 
@@ -1844,6 +1858,6 @@
 		if (Gatherer.isGsdlRemote) {
 		    Gatherer.remoteGreenstoneServer.deleteCollectionFile(
-                             collection.getName(), new File(getLoadedCollectionIndexDirectoryPath()));
-		    Gatherer.remoteGreenstoneServer.moveCollectionFile(collection.getName(), 
+                             collection.getGroupQualifiedName(false), new File(getLoadedCollectionIndexDirectoryPath()));
+		    Gatherer.remoteGreenstoneServer.moveCollectionFile(collection.getGroupQualifiedName(false), 
                     new File(getLoadedCollectionBuildingDirectoryPath()), new File(getLoadedCollectionIndexDirectoryPath()));
 		}
Index: main/trunk/gli/src/org/greenstone/gatherer/file/FileManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/file/FileManager.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/file/FileManager.java	(revision 22410)
@@ -171,5 +171,5 @@
 		file_queue.addJob(id, source, source_nodes, target, target_node, type);
 		if (Gatherer.isGsdlRemote) {
-		    String collection_name = CollectionManager.getLoadedGroupQualifiedCollectionName(true);
+		    String collection_name = CollectionManager.getLoadedCollectionName();
 
 		    // Perform the appropriate action based on the job type (RemoteGreenstoneServer will queue)
@@ -274,5 +274,5 @@
 		if (file.getAbsolutePath().startsWith(Gatherer.getCollectDirectoryPath()) && file.length() == 0) {
 		    if (Gatherer.remoteGreenstoneServer.downloadCollectionFile(
-                                 CollectionManager.getLoadedGroupQualifiedCollectionName(true), file).equals("")) {
+                                 CollectionManager.getLoadedCollectionName(), file).equals("")) {
 			// Something has gone wrong downloading the file
 			return;
@@ -350,5 +350,5 @@
 			    if (Gatherer.isGsdlRemote) {
 				Gatherer.remoteGreenstoneServer.uploadCollectionFile(
-                                         CollectionManager.getLoadedGroupQualifiedCollectionName(true), folder_file);
+                                         CollectionManager.getLoadedCollectionName(), folder_file);
 			    }
 			}
@@ -357,5 +357,5 @@
 			    if (Gatherer.isGsdlRemote) {
 				Gatherer.remoteGreenstoneServer.newCollectionDirectory(
-                                         CollectionManager.getLoadedGroupQualifiedCollectionName(true), folder_file);
+                                         CollectionManager.getLoadedCollectionName(), folder_file);
 			    }
 			}
@@ -418,5 +418,5 @@
 		if (Gatherer.isGsdlRemote) {
 		    Gatherer.remoteGreenstoneServer.moveCollectionFile(
-                             CollectionManager.getLoadedGroupQualifiedCollectionName(true), collection_file, new_collection_file);
+                             CollectionManager.getLoadedCollectionName(), collection_file, new_collection_file);
 		}
 	    }
@@ -467,5 +467,5 @@
 	    file_queue.addJob(System.currentTimeMillis(), Gatherer.g_man.gather_pane.workspace_tree, new FileNode[] { source_node }, collection_tree, (FileNode)collection_tree_node.getParent(),  FileJob.COPY_FILE_ONLY);
 	    if (Gatherer.isGsdlRemote) {
-		String collection_name = CollectionManager.getLoadedGroupQualifiedCollectionName(true);
+		String collection_name = CollectionManager.getLoadedCollectionName();
 		Gatherer.remoteGreenstoneServer.deleteCollectionFile(collection_name, collection_tree_node.getFile());
 		Gatherer.remoteGreenstoneServer.uploadFilesIntoCollection(collection_name, new File[] { new_file }, target_directory);
Index: main/trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java	(revision 22410)
@@ -169,5 +169,5 @@
 	    // If the specified folder is open, it must be refreshed
 	    if (tree_node_path_str.equals(folder_path_str)) {
-		System.err.println("Must refresh node " + tree_node_path_str + "!");
+		//System.err.println("Must refresh node " + tree_node_path_str + "!");
 		((WorkspaceTreeModel) getModel()).refresh(expanded_tree_path);
 	    }
Index: main/trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java	(revision 22410)
@@ -168,7 +168,10 @@
 			  
 			  // One last piece of magic so we can determine the current collection
-			  // I don't think this will work properly with groups,
-			  // as it may give a false positive??
-			  collection_root.is_in_loaded_collection = cols[i].getName().equals(CollectionManager.getLoadedCollectionName());
+			  // Now made to work with collection groups
+			  String groupQualifiedColName = cols[i].getName();
+			  if(is_group_node) { // then title would have stored the colgroup name
+			      groupQualifiedColName = title + File.separator + cols[i].getName();
+			  }
+			  collection_root.is_in_loaded_collection = groupQualifiedColName.equals(CollectionManager.getLoadedCollectionName());
 			  child_nodes.add(collection_root);
 			}
Index: main/trunk/gli/src/org/greenstone/gatherer/gui/PreviewButton.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/gui/PreviewButton.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/gui/PreviewButton.java	(revision 22410)
@@ -77,6 +77,6 @@
 	// we could be working with standalone collections or collection groups
 	// so getting a collection-name may have a collection group prefix
-	// This means CollectionManager.getLoadedCollectionName() is no longer sufficient
-	String collGroupWithName = CollectionManager.getLoadedGroupQualifiedCollectionName(true);
+	// This means CollectionManager.getLoadedCollectionName() needs to (and does) return (colgroup/)subcolname
+	String collGroupWithName = CollectionManager.getLoadedCollectionName(true);
 
 	// set up the home page for the current collection
Index: main/trunk/gli/src/org/greenstone/gatherer/gui/WriteCDImagePrompt.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/gui/WriteCDImagePrompt.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/gui/WriteCDImagePrompt.java	(revision 22410)
@@ -546,5 +546,5 @@
 
 	    // Find the size of the "etc", "images" and "index" directories of the collection
-	    String collection_directory_path = CollectionManager.getCollectionDirectoryPath(collection.getShortName());
+	    String collection_directory_path = CollectionManager.getCollectionDirectoryPath(collection.getShortName()); // (colgroup/)subcol
 	    File etc_directory = new File(collection_directory_path + "etc");
 	    File images_directory = new File(collection_directory_path + "images");
Index: main/trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServerAction.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServerAction.java	(revision 22381)
+++ main/trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServerAction.java	(revision 22410)
@@ -118,5 +118,5 @@
 
 	    String delete_collection_command = "cmd=delete-collection";
-	    delete_collection_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    delete_collection_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    action_output = remote.sendCommandToServer(delete_collection_command, null);
 	}
@@ -150,5 +150,5 @@
 
 	    String delete_collection_file_command = "cmd=delete-collection-file";
-	    delete_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    delete_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    delete_collection_file_command += "&file=" + Base64.encodeBytes(collection_file_relative_path.getBytes());
 	    action_output = remote.sendCommandToServer(delete_collection_file_command, null);
@@ -178,5 +178,5 @@
 
 	    String download_collection_command = "cmd=download-collection";
-	    download_collection_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    download_collection_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    download_collection_command += "&lr=" + remote.lang_region;
 	    String zip_file_path = Gatherer.getCollectDirectoryPath() + collection_name + ".zip";
@@ -213,5 +213,5 @@
 
 	    String download_collection_archives_command = "cmd=download-collection-archives";
-	    download_collection_archives_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    download_collection_archives_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    download_collection_archives_command += "&lr=" + remote.lang_region;
 	    String zip_file_path = Gatherer.getCollectDirectoryPath() + collection_name + "-archives.zip";
@@ -310,5 +310,5 @@
 
 	    String file_exists_command = "cmd=file-exists";
-	    file_exists_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    file_exists_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    // base64 encode the filename to preserve special characters
 	    file_exists_command += "&file=" + Base64.encodeBytes(collection_file_relative_path.getBytes());
@@ -347,5 +347,5 @@
 
 	    String download_collection_file_command = "cmd=download-collection-file";
-	    download_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    download_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    download_collection_file_command += "&file=" + URLEncoder.encode(collection_file_relative_path, "UTF-8");
 	    download_collection_file_command += "&lr=" + remote.lang_region;
@@ -470,5 +470,5 @@
 
 	    String move_collection_file_command = "cmd=move-collection-file";
-	    move_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    move_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    move_collection_file_command += "&source=" + Base64.encodeBytes(source_collection_file_relative_path.getBytes());
 	    move_collection_file_command += "&target=" + Base64.encodeBytes(target_collection_file_relative_path.getBytes());
@@ -507,5 +507,5 @@
 
 	    String new_collection_directory_command = "cmd=new-collection-directory";
-	    new_collection_directory_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    new_collection_directory_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    new_collection_directory_command += "&directory=" + URLEncoder.encode(new_collection_directory_relative_path, "UTF-8");
 	    action_output = remote.sendCommandToServer(new_collection_directory_command, null);
@@ -541,5 +541,5 @@
 
 	    String run_script_command = "cmd=run-script";
-	    run_script_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    run_script_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    run_script_command += "&script=" + script_name;
 	    run_script_command += "&language=" + Configuration.getLanguage();
@@ -588,5 +588,5 @@
 	    // Upload the zip file
 	    String upload_collection_file_command = "cmd=upload-collection-file";
-	    upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    upload_collection_file_command += "&file=" + URLEncoder.encode(zip_file_name, "UTF-8");
 	    upload_collection_file_command += "&directory=";
@@ -643,5 +643,5 @@
 
 	    String upload_collection_file_command = "cmd=upload-collection-file";
-	    upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
+	    upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
 	    upload_collection_file_command += "&file=" + URLEncoder.encode(zip_file_name, "UTF-8");
 	    upload_collection_file_command += "&directory=" + URLEncoder.encode(target_collection_directory_relative_path, "UTF-8");
