Index: /main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts.js	(revision 31908)
+++ /main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts.js	(revision 31909)
@@ -20,4 +20,7 @@
 */
 var new_metadata_field_input_type = "plain";
+/* add all metadata button? only valid with fixedlist or autocomplete metadata element selection */
+var enable_add_all_metadata_button = true;
+
 /* Metadata elements to be used in the fixedlist/autocomplete options above */
 var availableMetadataElements = ["dc.Title", "dc.Subject"];
@@ -30,5 +33,4 @@
 */
 
-
 /************************
 * METADATA EDIT SCRIPTS *
@@ -40,5 +42,4 @@
 	var id = cell.attr("id").substring(6);
 	var metaTable = gs.jqGet("meta" + id);
-
 	var row = cell.parent();
 	var newCell = $("<td>", {"style": "font-size:0.7em; padding:0px 10px", "class": "editMetadataButton"});
@@ -68,5 +69,8 @@
 			metaTable.css("display", "block");
 			metaTable.metaNameField.css("display", "inline");
-			metaTable.addRowButton.css("display", "inline");
+		    metaTable.addRowButton.css("display", "inline");
+		    if (enable_add_all_metadata_button == true) {
+			metaTable.addAllButton.css("display", "inline");
+		    }
 		}
 		else
@@ -76,5 +80,8 @@
 			metaTable.css("display", "none");
 			metaTable.metaNameField.css("display", "none");
-			metaTable.addRowButton.css("display", "none");
+		    metaTable.addRowButton.css("display", "none");
+		    if (enable_add_all_metadata_button == true) {
+			metaTable.addAllButton.css("display", "none");
+		    }
 		}
 	});
@@ -87,5 +94,8 @@
 	addFunctionalityToTable(metaTable);
 	metaTable.metaNameField.css("display", "none");
-	metaTable.addRowButton.css("display", "none");
+    metaTable.addRowButton.css("display", "none");
+    if (enable_add_all_metadata_button == true) {
+	metaTable.addAllButton.css("display", "none");
+    }
 }
 
@@ -120,5 +130,8 @@
 			$(this).css("display", "none");
 			$(this.metaNameField).css("display", "none");
-			$(this.addRowButton).css("display", "none");
+		    $(this.addRowButton).css("display", "none");
+		    if (enable_add_all_metadata_button == true) {
+			$(this.addAllButton).css("display", "none");
+		    }
 		}
 	});
@@ -137,5 +150,4 @@
 	addCKEEditableState(evt,editableInitStates);
     });
-
 	if($("#metadataSetList").length)
 	{
@@ -378,5 +390,11 @@
 	
 	}
-	return true;
-}
-
+    // if get here, this must be a new node, as wasn't in init states
+    // make sure its not empty - we won't add empty nodes.
+    if (StateToCheck.initHTML == "") {
+	return false;
+    } 
+    return true;
+    
+}
+
Index: /main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts_util.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts_util.js	(revision 31908)
+++ /main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts_util.js	(revision 31909)
@@ -830,5 +830,15 @@
 	table.metaNameField = metaNameField;
 	
-	var addRowButton = $("<button>",{"class": "ui-state-default ui-corner-all", "style": "margin: 5px;"});
+    /* add the buttons */
+    // check enable_add_all_button - only valid for fixedlist and autocomplete
+    if (enable_add_all_metadata_button == true) {
+	if (new_metadata_field_input_type != "fixedlist" && new_metadata_field_input_type != "autocomplete") {
+	    enable_add_all_metadata_button = false;
+	}
+    }
+
+    // add single metadata button
+    var addRowButton = $("<button>",{"class": "ui-state-default ui-corner-all", "style": "margin: 5px;"});
+
 	addRowButton.html(gs.text.de.add_new_metadata);
 	addRowButton.click(function() 
@@ -840,41 +850,63 @@
 			return;
 		}
-	        var clean_name = name.replace(/[\.-]/g, "");
-		var newRow = $("<tr>", {"style": "display: table-row;"});
-		var nameCell = $("<td>" + name + "</td>");
-		nameCell.attr("class", "metaTableCellName");
-		var valueCell = $("<td>", {"class": "metaTableCell"}); 	
-	        var textValue = $("<textarea>", {"class": "metaTableCellArea "+ clean_name}); 
-	    
-	    if (jQuery.inArray(name, autocompleteMetadata) != -1) {
-		    var source_obje = window[clean_name +"_values"];
-		    if (source_obje) {
-			textValue.autocomplete({
-			    minLength: 0,
-			    source: source_obje
-			});
-		    }
-		}
-		valueCell.append(textValue);
-		newRow.append(nameCell);
-		newRow.append(valueCell);
-		addRemoveLinkToRow(newRow.get(0));
-		table.append(newRow);
-		
-		var undo = new Array();
-		undo.op = "delMeta";
-		undo.srcElem = newRow;
-		undo.removeTransaction = false;
-		_undoOperations.push(undo);
-		if ( hierarchyStorage && hierarchyStorage[name])
-                {
-                        setHierarchyEventsWrappers(name);
-                }
+	    addNewMetadataRow(table, name);
 
 		
 	});
-	table.addRowButton = addRowButton;
-	metaNameField.after(addRowButton);
-
+    table.addRowButton = addRowButton;
+    metaNameField.after(addRowButton);
+
+    // add all metadata button
+    if (enable_add_all_metadata_button == true) {
+	var addAllButton = $("<button>",{"class": "ui-state-default ui-corner-all", "style": "margin: 5px;"});
+	addAllButton.html(gs.text.de.add_all_metadata);
+	addAllButton.click(function()
+			   {
+			       for(var i=0; i<availableMetadataElements.length; i++) {
+				   
+			           addNewMetadataRow(table, availableMetadataElements[i])
+			       }
+			       
+			   });
+	table.addAllButton = addAllButton;
+	addRowButton.after(addAllButton);
+    
+    }
+
+}
+
+function addNewMetadataRow(table, name) {
+
+    var clean_name = name.replace(/[\.-]/g, "");
+    var newRow = $("<tr>", {"style": "display: table-row;"});
+    var nameCell = $("<td>" + name + "</td>");
+    nameCell.attr("class", "metaTableCellName");
+    var valueCell = $("<td>", {"class": "metaTableCell"}); 	
+    var textValue = $("<textarea>", {"class": "metaTableCellArea "+ clean_name}); 
+    
+    if (jQuery.inArray(name, autocompleteMetadata) != -1) {
+	var source_obje = window[clean_name +"_values"];
+	if (source_obje) {
+	    textValue.autocomplete({
+		minLength: 0,
+		source: source_obje
+	    });
+	}
+    }
+    valueCell.append(textValue);
+    newRow.append(nameCell);
+    newRow.append(valueCell);
+    addRemoveLinkToRow(newRow.get(0));
+    table.append(newRow);
+    
+    var undo = new Array();
+    undo.op = "delMeta";
+    undo.srcElem = newRow;
+    undo.removeTransaction = false;
+    _undoOperations.push(undo);
+    if ( hierarchyStorage && hierarchyStorage[name])
+    {
+        setHierarchyEventsWrappers(name);
+    }
 }
 
