Changeset 17 for src/main/webapp/newsession.xhtml
- Timestamp:
- 09/22/20 08:52:49 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/webapp/newsession.xhtml
r16 r17 4 4 <title>Profiles and Domains list</title> 5 5 <link rel="stylesheet" type="text/css" href="style.css" /> 6 7 6 </head> 8 7 <body onload="init()"> … … 14 13 <br /> Protocol: 15 14 <select id="selectedprotocol" onchange="selectProtocol()"> 16 <option value="SAOP">SAOP (stacked alternating offers)</option> 17 <option value="SHAOP">SHAOP (stacked human alternating 18 offers)</option> 15 <option value="SAOP">SAOP ( Stacked Alternating Offers 16 Protocol )</option> 17 <option value="MOPAC">MOPAC (Multiple Offers Partial 18 Consensus)</option> 19 <option value="AMOP">AMOP (Alternating Multiple Offers 20 Protocol)</option> 21 <option value="SHAOP">SHAOP (Stacked Human Alternating Offers 22 Protocol)</option> 19 23 </select> 20 24 25 <div id="votingevaluator"> 26 <br /> Voting Evaluator: <select id="selectedevaluator"> 27 <option value="LargestAgreement">Largest Agreement</option> 28 <option value="LargestAgreementsLoop">Largest Agreements and Repeat</option> 29 </select> 30 </div> 31 21 32 <br /> Deadline: 22 33 <input type="number" id="deadlinevalue" name="deadline" min="1" … … 29 40 <br /> Domain/Profile Server: 30 41 <input type="url" name="url" id="profilesserverurl" 31 value="localhost:8080/profilesserver-1. 4.4"42 value="localhost:8080/profilesserver-1.5.0" 32 43 pattern=".*:[0-9]+/profilesserver" size="30" 33 44 onchange="connectDomain()"> </input> … … 43 54 <br /> <b>Participants</b> <br /> Parties Server: <input type="url" 44 55 name="url" id="partiesserverurl" 45 value="localhost:8080/partiesserver-1. 4.4"56 value="localhost:8080/partiesserver-1.5.0" 46 57 pattern=".*:[0-9]+/partiesserver" size="30" 47 58 onchange="connectParties()"> </input> <br /> <br /> <b>Party … … 63 74 <input type="text" id="cobfilter" value="" maxlength="40" /> <br /> 64 75 <!-- --> 65 Parameters: { <textarea id="cobparameters" rows="2" cols="70" 66 onchange="updateCobParameters()" value="" /> } <br /> 67 <br /> 76 Parameters: { 77 <textarea id="cobparameters" rows="2" cols="70" 78 onchange="updateCobParameters()" value="" /> 79 } <br /> <br /> 68 80 </div> 69 81 </div> … … 115 127 116 128 <script type="application/javascript"> 129 130 117 131 118 132 … … 186 200 tbl.getElementsByTagName('col')[4].style.visibility=(visible?'':'collapse'); 187 201 tbl.getElementsByTagName('col')[5].style.visibility=(visible?'':'collapse'); 202 203 var evaluatorvisible=getSelectedProtocol() == "MOPAC"; 204 document.getElementById("votingevaluator").style.display=(evaluatorvisible ? 'block': 'none'); 188 205 189 206 } … … 198 215 domainwebsocket=null; 199 216 } 200 var url=document.getElementById("profilesserverurl").value; 201 var target = "ws://"+url+"/websocket/liststream"; 217 var url=new URL("http:"+document.getElementById("profilesserverurl").value); 218 // insert the liststream to the path 219 var target = "ws://"+url.host+url.pathname+"/websocket/liststream"+window.location.search+url.hash; 202 220 if ('WebSocket' in window) { 203 221 domainwebsocket = new WebSocket(target); … … 276 294 refresh table: copy all parties elements in there. 277 295 Typically parties is something like 278 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1. 4.4",296 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1.5.0", 279 297 "capabilities":{"protocols":["SAOP"]}, 280 298 "description":"places random bids until it can accept an offer with utility >0.6", 281 "id":"randomparty-1. 4.4",299 "id":"randomparty-1.5.0", 282 300 "partyClass":"geniusweb.exampleparties.randomparty.RandomParty"}, 283 301 ...] 284 302 */ 285 303 function updateParties(parties) { 286 updatePartiesCombobox(parties, document.getElementById("partyselection"),['SAOP',' SHAOP']);304 updatePartiesCombobox(parties, document.getElementById("partyselection"),['SAOP','AMOP','SHAOP']); 287 305 updatePartiesCombobox(parties, document.getElementById("cobpartyselection"),['COB']); 288 306 } … … 483 501 var logurl="log/"+this.responseText+".json"; 484 502 document.getElementById("logref").href=logurl; 485 document.getElementById("plotref").href="plotlog.xhtml?id="+this.responseText; 503 document.getElementById("plotref").href="plotlog.xhtml"+ 504 combineQuery("?id="+this.responseText,window.location.search); 486 505 487 506 sometimeWhen(function() { return urlExists(logurl) }, … … 499 518 500 519 520 521 /** 522 @param query1 a query string like &p=q (part of URL) 523 @param query2 another query string 524 @return the combined querystring of query1 and query2 525 */ 526 function combineQuery(query1, query2) { 527 if (query1=="") return query2; 528 if (query2=="") return query1; 529 return query1+"&"+query2.substring(1); 530 } 531 532 501 533 /** 502 534 @return true iff the URL exists. … … 521 553 */ 522 554 function makeRequest() { 523 524 if (getSelectedProtocol()=="SHAOP") {555 switch(getSelectedProtocol()) { 556 case "SHAOP": 525 557 return makeShaopRequest(); 526 } else { 527 return makeSaopRequest(); 558 case"SAOP": 559 case "AMOP": 560 return makeStdRequest(getSelectedProtocol()+"Settings"); 561 case "MOPAC": 562 return makeMopacRequest(); 528 563 } 529 564 } 530 565 531 566 /** 532 @return a SAOP request 533 */ 534 function makeSaopRequest() { 567 @return a SAOP/AMOP request 568 The header contains 'SAOSettings' or 'AMOPSettings' 569 */ 570 function makeStdRequest(header) { 571 return JSON.stringify({[header]: standardHeader() }); 572 } 573 574 /** 575 * @ereturn MOPAC request. Almost standard but extra 'votingEvaluator'. 576 */ 577 function makeMopacRequest() { 578 var extended = standardHeader(); 579 var combo = document.getElementById("selectedevaluator"); 580 var evaluator = combo.options[combo.selectedIndex].value; 581 extended['votingevaluator'] = { [evaluator]: {} }; 582 return JSON.stringify({"MOPACSettings": extended }); 583 } 584 585 /** 586 @return standard header with participants and deadline 587 */ 588 function standardHeader() { 535 589 var deadline={}; 536 590 var value = document.getElementById("deadlinevalue").value; … … 542 596 deadline["deadlinerounds"] = {"rounds": value, "durationms":10000}; 543 597 } 544 545 return JSON.stringify({"SAOPSettings": { "participants": partyprofiles, "deadline":deadline }}); 546 } 598 return { "participants": partyprofiles, "deadline":deadline } 599 } 600 601 547 602 548 603 /** … … 577 632 function init() { 578 633 selectProtocol(); 579 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1. 4.4"580 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1. 4.4"634 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.5.0" 635 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.5.0" 581 636 connectDomain(); 582 637 connectParties(); … … 592 647 593 648 649 650 594 651 </script> 595 652
Note:
See TracChangeset
for help on using the changeset viewer.