Index: src/main/webapp/plotlog.xhtml
===================================================================
--- src/main/webapp/plotlog.xhtml	(revision 18)
+++ src/main/webapp/plotlog.xhtml	(revision 19)
@@ -87,6 +87,7 @@
         */
         function processLogFile(json) {
+        	
         	if (json['SAOPState']!=undefined) {
-        		processSAOP(json['SAOPState']);
+        		processStandard(json['SAOPState'], 'SAOP');
         	} else if (json['SHAOPState']!=undefined) {
         		processSHAOP(json['SHAOPState']);
@@ -94,5 +95,5 @@
         		// just use the SAOP processor, which shows the
         		// utilities of all Offers in sequence.
-        		processSAOP(json['MOPACState']);
+        		processStandard(json['MOPACState'], 'MOPAC');
         	} else{
             	setStatus("Unknown log file contents "+Object.keys(json));
@@ -101,7 +102,8 @@
         
         /**
-        Handle SAOP protocol result.
-        */
-        function processSAOP(json) {
+        Handle standard protocol result.
+        @param protocol either SAOP or MOPAC or another SAOP-like protocol
+        */
+        function processStandard(json, protocol) {
         	var partyprofiles={}
         	var profs=json['partyprofiles'];
@@ -110,5 +112,5 @@
         	}
         	
-        	getProfiles(json, partyprofiles);
+        	getProfiles(json, partyprofiles, protocol);
         }
         
@@ -129,5 +131,5 @@
 			
         	
-        	getProfiles(json, partyprofiles);
+        	getProfiles(json, partyprofiles, "SHAOP");
         }
 
@@ -148,12 +150,13 @@
         /**
         Get the partyprofiles.
-        @json the json protocol result
-        @partyprofileURIs dict with the websocket addresses for each party'as profile
-        @partyprofiles dict with each party's profile. Initially should be {}
-        */
-        function getProfiles(json, partyprofileURIs, partyprofiles={}) {
+        @param json the json protocol result
+        @param partyprofileURIs dict with the websocket addresses for each party'as profile
+        @param partyprofiles dict with each party's profile. Initially should be {}
+        @param protocol protocolname, eg "SAOP"
+        */
+        function getProfiles(json, partyprofileURIs, protocol, partyprofiles={} ) {
         	var keys = Object.keys(partyprofileURIs);
 			if (keys.length==0) {
-				plotResults(computeUtils(json, partyprofiles), isAgreement(json));
+				plotResults(computeUtils(json, partyprofiles), isAgreement(json, protocol));
 				return;
 			}
@@ -178,5 +181,5 @@
             	}
             	partyprofiles[party]=profile['LinearAdditiveUtilitySpace'];
-            	getProfiles(json, partyprofileURIs, partyprofiles);
+            	getProfiles(json, partyprofileURIs, protocol, partyprofiles);
             };
             ws.onerror=function(event) {
@@ -186,10 +189,27 @@
         
         /**
-        @return true if there is agreement
-        */
-        function isAgreement(logfile) {
-        	var actions=logfile['actions'];
-			var lastact = actions[actions.length -1];
-			return 'accept' in lastact;
+        @param logfile the logfile content, but below the protocol header
+        @param protocol the protocol name, eg SAOP, SHAOP, MOPAC
+        @return 'Yes' if there is agreement, 'No' if there is no agreement at all, 
+        or 'Partial'  if part of the parties agreed and part did not.
+        or '?' if unsupported protocol
+        */
+        function isAgreement(logfile, protocol) {
+			switch (protocol) {
+				case "SAOP":
+				case "SHAOP":
+					var actions=logfile['actions'];
+					var lastact = actions[actions.length -1];
+					return 'accept' in lastact ? 'Yes':'No';
+				case "MOPAC":
+					var finalstate=logfile['phase']['partyStates'];
+					var nagrees=Object.keys(finalstate['agreements']).length;
+					var nparties=Object.keys(finalstate['powers']).length;
+					if (nagrees==nparties) return "Yes";
+					if (nagrees==0) return "No"
+					return "Partial";
+				default:
+					return "?";
+				}
         }
         /**
@@ -235,5 +255,5 @@
         /**
         @param utilities the dict with key=party id  of the utilities of all steps for each party )
-        @param isAgreement true iff there is agreement reached
+        @param isAgreement either Yes, No, Partial or ?
         */
         
@@ -241,5 +261,5 @@
         	setStatus("Plotting" )
         	
-            document.getElementById('agreement').innerHTML=isAgreement?"Yes":"No";
+            document.getElementById('agreement').innerHTML=isAgreement;
 
         	var parties=Object.keys(utilities);
@@ -287,5 +307,5 @@
     						scaleLabel: {
     							display: true,
-    							labelString: 'Turn'
+    							labelString: 'Offer'
     						}
     					}],
