comparison index.php @ 12:774db3b4bedc

Add some informational output.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 10 Jan 2011 08:12:23 +0200
parents fb503ee5489f
children 1edbabcbcdbd
comparison
equal deleted inserted replaced
11:fb503ee5489f 12:774db3b4bedc
7 // Multi-stack item fixups 7 // Multi-stack item fixups
8 $fixItemTable = array( 8 $fixItemTable = array(
9 "(purple|green) gloves" => 'a ${1} glove', 9 "(purple|green) gloves" => 'a ${1} glove',
10 "heavy black metal rings" => "a heavy black metal ring", 10 "heavy black metal rings" => "a heavy black metal ring",
11 "bracelet mades of green crystal" => "bracelet made of green crystal", 11 "bracelet mades of green crystal" => "bracelet made of green crystal",
12 "alchemist moulded rings" => "alchemist moulded ring",
13
12 "white cloth packs for holding salves" => "white cloth pack for holding salves", 14 "white cloth packs for holding salves" => "white cloth pack for holding salves",
15 "(small|HUGE) shiny boxes for storing minerals" => 'a ${1} shiny box for storing minerals',
16 "(small|HUGE) sturdy packs for storing potions" => 'a ${1} sturdy pack for storing potions',
13 ); 17 );
14 18
15 19
16 $fixNumbers = array( 20 $fixNumbers = array(
17 "one" => 1, "two" => 2, "three" => 3, "four" => 4, 21 "one" => 1, "two" => 2, "three" => 3, "four" => 4,
251 <? printOptionSelect("curr_items", 10, TRUE); ?> 255 <? printOptionSelect("curr_items", 10, TRUE); ?>
252 <table class="buttons"> 256 <table class="buttons">
253 <tr> 257 <tr>
254 <td><input type="button" value=" Delete " onclick="deleteItems(this.form);" /></td> 258 <td><input type="button" value=" Delete " onclick="deleteItems(this.form);" /></td>
255 <td><input type="button" value=" Add new " onclick="addItems(this.form);" disabled="disabled" /></td> 259 <td><input type="button" value=" Add new " onclick="addItems(this.form);" disabled="disabled" /></td>
260 <td><b><span id="curr_nitems"></span> items</b></td>
256 <td style="width: 60%; text-align: right;"><input id="move_button" type="button" value=" Move to container " onclick="moveItems(this.form);" /></td> 261 <td style="width: 60%; text-align: right;"><input id="move_button" type="button" value=" Move to container " onclick="moveItems(this.form);" /></td>
257 </tr> 262 </tr>
258 </table> 263 </table>
259 </td> 264 </td>
260 265
261 <td id="container_editor"> 266 <td id="container_editor">
262 <h2>Editing container "<span id="curr_name"></span>" - <span id="curr_info"></span></h2> 267 <h2>Editing container "<span id="curr_name"></span>"</h2>
263 <? printOptionSelect("curr_container", 10, TRUE); ?> 268 <? printOptionSelect("curr_container", 10, TRUE); ?>
264 <table class="buttons"> 269 <table class="buttons">
265 <tr> 270 <tr>
266 <td><input type="button" value=" Remove selected " onclick="containerRemoveItems(this.form);" /></td> 271 <td><input type="button" value=" Remove selected " onclick="containerRemoveItems(this.form);" /></td>
272 <td><b><span id="curr_info"></span> items</b></td>
267 </tr> 273 </tr>
268 </table> 274 </table>
269 </td> 275 </td>
270 </tr> 276 </tr>
271 277
429 return; 435 return;
430 } 436 }
431 initAll(); 437 initAll();
432 } 438 }
433 439
440
434 function setHTML(id, str) 441 function setHTML(id, str)
435 { 442 {
436 var o = document.getElementById(id); 443 var o = document.getElementById(id);
437 if (o != null) 444 if (o != null)
438 o.innerHTML = str; 445 o.innerHTML = str;
439 } 446 }
447
440 448
441 function setListData(id, list) 449 function setListData(id, list)
442 { 450 {
443 var o = document.getElementById(id); 451 var o = document.getElementById(id);
444 o.options.length = 0; 452 o.options.length = 0;
445 for (var i = 0; i < list.length; i++) { 453 for (var i = 0; i < list.length; i++) {
446 o.options[i] = new Option(list[i], i, false, false); 454 o.options[i] = new Option(list[i], i, false, false);
447 } 455 }
448 } 456 }
449 457
458
450 // Update the form data 459 // Update the form data
451 function updatePage() 460 function updatePage()
452 { 461 {
453 // List of items 462 // List of items
454 if (list_items != null && list_items.changed) { 463 if (list_items != null && list_items.changed) {
455 list_items.changed = false; 464 list_items.changed = false;
456 setListData("curr_items", list_items.items); 465 setListData("curr_items", list_items.items);
466 setHTML("curr_nitems", list_items.items.length);
457 } 467 }
458 468
459 // List of containers 469 // List of containers
460 var container_list_editor = document.getElementById("container_list_editor"); 470 var container_list_editor = document.getElementById("container_list_editor");
461 if (list_containers.length > 0) { 471 if (list_containers.length > 0) {
475 var container_editor = document.getElementById("container_editor"); 485 var container_editor = document.getElementById("container_editor");
476 if (curr_container != null) { 486 if (curr_container != null) {
477 container_editor.style.display = "block"; 487 container_editor.style.display = "block";
478 setHTML("curr_name", curr_container.name); 488 setHTML("curr_name", curr_container.name);
479 489
480 setHTML("curr_info", "(" + curr_container.items.length+" / "+curr_container.slots+" items)"); 490 setHTML("curr_info", curr_container.items.length+" / "+curr_container.slots);
481 491
482 if (curr_container.changed) { 492 if (curr_container.changed) {
483 curr_container.changed = false; 493 curr_container.changed = false;
484 setListData("curr_container", curr_container.items); 494 setListData("curr_container", curr_container.items);
485 } 495 }