Index: /main/trunk/greenstone3/web/interfaces/oran/js/documentbasket/documentbasket.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/js/documentbasket/documentbasket.js	(revision 25095)
+++ /main/trunk/greenstone3/web/interfaces/oran/js/documentbasket/documentbasket.js	(revision 25096)
@@ -71,6 +71,4 @@
 	}
 
-	//var date = new Date();
-	//url += "&rand=" + date.getTime();
 	YAHOO.util.Connect.asyncRequest(request_type , url , callback);
 }
Index: /main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts.js	(revision 25095)
+++ /main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts.js	(revision 25096)
@@ -8,4 +8,5 @@
 var _baseURL;
 var _statusBar;
+var _metadataSetList = new Array();
 
 function init()
Index: /main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts_util.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts_util.js	(revision 25095)
+++ /main/trunk/greenstone3/web/interfaces/oran/js/documentmaker_scripts_util.js	(revision 25096)
@@ -174,11 +174,25 @@
 	{
 		var changedElem = changes[i];
-		if(hasClass(changedElem, "metadataTableCellValue"))
-		{
-			//Save metadata
-		}
+
+		//Save metadata 
+		if(hasClass(changedElem, "metaTableCell")) 
+		{
+			//Get document ID
+			var currentElem = changedElem;
+			while((currentElem = currentElem.parentNode).tagName != "TABLE");
+			var docID = currentElem.getAttribute("id").substring(4);
+			
+			//Get metadata name
+			var row = changedElem.parentNode;
+			var cells = row.getElementsByTagName("TD");
+			var nameCell = cells[0];
+			var name = nameCell.innerHTML;
+
+			gs.functions.setArchivesMetadata(gs.cgiParams.p_c /*bad*/, "localsite" /*bad*/, docID, name, null, changedElem.innerHTML, function(){console.log("SAVED ARCHIVES");});
+			gs.functions.setIndexMetadata(gs.cgiParams.p_c /*bad*/, "localsite" /*bad*/, docID, name, null, changedElem.innerHTML, function(){alert("SAVED INDEX");});
+		}
+		//Save content
 		else if(hasClass(changedElem, "renderedText"))
 		{
-			//Save content
 			var section = changedElem.parentDiv.parentItem;
 			saveTransaction('{"operation":"setText", "text":"' + changedElem.innerHTML.replace(/"/g, "\\\"").replace(/&/g, "%26") + '", "collection":"' + section.collection + '", "oid":"' + section.nodeID + '"}');
@@ -227,10 +241,13 @@
 	}
 	
-	var saveButton = document.getElementById("saveButton");
-	saveButton.innerHTML = "Saving...";
-	saveButton.disabled = true;
-	
-	statusID = _statusBar.addStatus("Modifying archive files...");
-	ajax.send("a=g&rt=r&s=DocumentExecuteTransaction&s1.transactions=" + request);
+	if(request != "[]")
+	{
+		var saveButton = document.getElementById("saveButton");
+		saveButton.innerHTML = "Saving...";
+		saveButton.disabled = true;
+		
+		statusID = _statusBar.addStatus("Modifying archive files...");
+		ajax.send("a=g&rt=r&s=DocumentExecuteTransaction&s1.transactions=" + request);
+	}
 }
 
@@ -464,4 +481,63 @@
 }
 
+function onVisibleMetadataSetChange()
+{
+	var metadataList = document.getElementById("metadataSetList");
+	var index = metadataList.selectedIndex;
+	var options = metadataList.getElementsByTagName("OPTION");
+	var selectedOption = options[index];
+	
+	var selectedSet = selectedOption.innerHTML;
+	changeVisibleMetadata(selectedSet);
+}
+
+function changeVisibleMetadata(metadataSetName)
+{
+	var tables = document.getElementsByTagName("TABLE");
+	for(var i = 0; i < tables.length; i++)
+	{
+		var id = tables[i].getAttribute("id");
+		if(id && id.search(/^meta/) != -1)
+		{
+			var rows = tables[i].getElementsByTagName("TR");
+			for(var j = 0; j < rows.length; j++)
+			{
+				if(metadataSetName == "All")
+				{
+					rows[j].style.display = "table-row";
+				}
+				else
+				{
+					var cells = rows[j].getElementsByTagName("TD");
+					var cellName = cells[0].innerHTML;
+					
+					if(cellName.indexOf(".") == -1)
+					{
+						rows[j].style.display = "none";
+					}
+					else
+					{
+						var setName = cellName.substring(0, cellName.lastIndexOf("."));
+						if(setName == metadataSetName)
+						{
+							rows[j].style.display = "table-row";
+						}
+						else
+						{
+							rows[j].style.display = "none";
+						}
+					}
+				}
+			}
+		}
+	}
+}
+
+function asyncRegisterEditSection(cell)
+{
+	//This registering can cause a sizeable delay so we'll thread it (effectively) so the browser is not paused
+	setTimeout(function(){de.doc.registerEditSection(cell)}, 0);
+}
+
 function addFunctionalityToTable(table)
 {
@@ -470,8 +546,33 @@
 	{
 		var cells = rows[i].getElementsByTagName("TD");
+		var metadataName = cells[0].innerHTML;
+		
+		if(metadataName.indexOf(".") != -1)
+		{
+			var metadataSetName = metadataName.substring(0, metadataName.lastIndexOf("."));
 			
-		//This registering can cause a sizeable delay so we'll thread it (effectively) so the browser is not paused
-		setTimeout(function(){de.doc.registerEditSection(cells[1])}, 0);
-		
+			var found = false;
+			for(var j = 0; j < _metadataSetList.length; j++)
+			{
+				if(metadataSetName == _metadataSetList[j])
+				{
+					found = true;
+					break;
+				}
+			}
+			
+			if(!found)
+			{
+				_metadataSetList.push(metadataSetName);
+				
+				var metadataSetList = document.getElementById("metadataSetList");
+				var newOption = document.createElement("OPTION");
+				newOption.innerHTML = metadataSetName;
+				metadataSetList.appendChild(newOption);
+			}
+		}
+			
+		asyncRegisterEditSection(cells[1]);
+
 		addRemoveLinkToRow(rows[i]);
 	}
@@ -497,5 +598,5 @@
 		nameCell.setAttribute("class", "metaTableCellName");
 		nameCell.innerHTML = name;
-		valueCell.setAttribute("class", "metaTableCell editable");
+		valueCell.setAttribute("class", "metaTableCell");
 		
 		newRow.appendChild(nameCell);
@@ -571,4 +672,18 @@
 	var saveCell = document.createElement("TD");
 	var undoCell = document.createElement("TD");
+	var metadataListCell = document.createElement("TD");
+	
+	var metadataListLabel = document.createElement("SPAN");
+	metadataListLabel.innerHTML = "Visible metadata: ";
+	var metadataList = document.createElement("SELECT");
+	metadataList.setAttribute("id", "metadataSetList");
+	metadataList.onchange = onVisibleMetadataSetChange;
+	var allMetadataOption = document.createElement("OPTION");
+	metadataList.appendChild(allMetadataOption);
+	allMetadataOption.innerHTML = "All";
+	metadataListCell.appendChild(metadataListLabel);
+	metadataListCell.appendChild(metadataList);
+
+	metadataListCell.setAttribute("class", "headerTableTD");
 	newDocCell.setAttribute("class", "headerTableTD");
 	newSecCell.setAttribute("class", "headerTableTD");
@@ -582,4 +697,5 @@
 	row.appendChild(newDocCell);
 	row.appendChild(newSecCell);
+	row.appendChild(metadataListCell);
 
 	//The "Save changes" button
Index: /main/trunk/greenstone3/web/interfaces/oran/js/javascript-global-functions.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/js/javascript-global-functions.js	(revision 25095)
+++ /main/trunk/greenstone3/web/interfaces/oran/js/javascript-global-functions.js	(revision 25096)
@@ -196,4 +196,5 @@
 		}
 	}
+	ajax.send();
 }
 
