renamed class Room to Brisk and Bin5 objects to $bin5 instead of $bri
[brisk.git] / web / briskin5 / index.php
index 6a0b9e1..ac0fb12 100644 (file)
@@ -2,7 +2,7 @@
 /*
  *  brisk - briskin5/index.php
  *
- *  Copyright (C) 2006-2011 Matteo Nastasi
+ *  Copyright (C) 2006-2012 Matteo Nastasi
  *                          mailto: nastasi@alternativeoutput.it 
  *                                  matteo.nastasi@milug.org
  *                          web: http://www.alternativeoutput.it
@@ -32,8 +32,14 @@ require_once("Obj/briskin5.phh");
 
 $mlang_bin5_index = array( 'aucwin' => array( 'it' => 'Hai vinto l\'asta.<br> Scegli il seme:',
                                               'en' => 'You win the auction.<br> Choose the seed:' ),
-                           'tit_pref'=>array( 'it' => 'Preferenze.',
-                                              'en' => 'Preferences.'),
+                           'tit_info'    => array( 'it' => 'Info',
+                                                   'en' => 'Info'),
+                           'tit_relo'    => array( 'it' => 'Reload',
+                                                   'en' => 'Reload'),
+                           'tit_out'     => array( 'it' => 'Fuori',
+                                                   'en' => 'Out'),
+                           'tit_pref'    => array( 'it' => 'Prefs',
+                                                   'en' => 'Prefs'),
                            'itm_ringauc' => array('it' => 'riproduci un suono di notifica alla fine dell\' asta',
                                                   'en' => 'play a sound at the end of the auction'),
                            'btn_update'  => array('it' => 'Aggiorna.',
@@ -41,19 +47,30 @@ $mlang_bin5_index = array( 'aucwin' => array( 'it' => 'Hai vinto l\'asta.<br> Sc
                            );
 
 
-// Use of proxies isn't allowed.
-if (is_proxy()) {
-  exit;
-}
+function bin5_index_main($transp_type, &$header_out, $addr, $get, $post, $cookie)
+{
+    GLOBAL $G_lang, $mlang_bin5_index;
+    if (($table_idx = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE)
+        unset ($table_idx);
+    if (($laststate = gpcs_var('laststate', $get, $post, $cookie)) === FALSE)
+        unset ($laststate);
+    if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
+        unset ($sess);
 
-header('Content-type: text/html; charset="utf-8"',true);
-?>
+    // Use of proxies isn't allowed.
+    // if (is_proxy()) {
+    // return (FALSE);
+    // }
+    
+// header('Content-type: text/html; charset="utf-8"',true);
+    ?>
 <html>
 <head>
 <title>Brisk - Tavolo <?php echo "$table_idx";?></title>
 <link rel="shortcut icon" href="../img/brisk_ico.png">
 <script type="text/javascript" src="../commons.js"></script> 
-<script type="text/javascript" src="../xhr.js"></script>
+<script type="text/javascript" src="../heartbit.js"></script>
+<script type="text/javascript" src="../xynt-streaming.js"></script>
 <script type="text/javascript" src="dnd.js"></script>
 <script type="text/javascript" src="dom-drag.js"></script>
 <script type="text/javascript" src="preload_img<?php echo langtolng($G_lang); ?>.js"></script>
@@ -65,12 +82,11 @@ header('Content-type: text/html; charset="utf-8"',true);
 <body>
 <SCRIPT type="text/javascript">
    var sess = "not_connected";
-   var hstm = null;
+   var xstm = null;
    var g_lang = "<?php echo "$G_lang"; ?>";
    var stat = "table";
    var subst = "none";
    var table_pos = "";
-   var myfrom = "table_php";
    var g_withflash = false;
 
    var asta_ptr;
@@ -78,13 +94,13 @@ header('Content-type: text/html; charset="utf-8"',true);
 
    var gst  = new globst();
    gst.st = <?php 
-log_load("bin5/index.php");
+   log_load("bin5/index.php");
 
-if (isset($laststate) == false) {
-  $laststate = -1;
-}
-echo $laststate;
-?>;
+   if (isset($laststate) == false) {
+       $laststate = -1;
+   }
+   echo $laststate;
+   ?>;
 var g_is_spawn=1;
 // var g_table_idx=<?php echo "$table_idx";?>;
 
@@ -100,14 +116,16 @@ window.onload = function() {
   preferences_update();
 
   sess = "<?php echo "$sess"; ?>";
-  hstm = new http_streaming("sess");
-  hstm.hbit_set(hbit);
+  xstm = new xynt_streaming(window, "<?php echo "$transp_type"; ?>", 80, 2, null /* console */, gst, 'table_php', 'sess', sess, $('sandbox'), 'index_rd.php', function(com){eval(com);});
+  xstm.hbit_set(heartbit);
   
   window.onbeforeunload = onbeforeunload_cb;  
   window.onunload = onunload_cb;  
 
-  hstm.start(sess); 
-  setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
+  xstm.start();
+  // FIXME: add this setTimeout(preload_images into data stream to avoid
+  // race on opened socket
+  // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct);
 }
 </SCRIPT>
 <div id="bg" class="area">
@@ -235,11 +253,13 @@ window.onload = function() {
 <div class="table_commands">
 <table>
 <tr>
-<td style="text-align: center;"><input type="button" class="button" name="xinfo"  value="Info." onclick="act_tableinfo();"></td>
-<td style="text-align: center;"><input type="button" class="button" name="xreload"  value="Reload." onclick="act_reload();"></td>
-<td style="text-align: center;"><input type="button" class="button" name="xout"  value="Out." onclick="safelogout();"></td>
+<td style="text-align: center;"><input type="button" class="button" name="xinfo"  value="<?php echo $mlang_bin5_index['tit_info'][$G_lang]; ?>" onclick="act_tableinfo();"></td>
+<td style="text-align: center;"><input type="button" class="button" name="xreload"  value="<?php echo $mlang_bin5_index['tit_relo'][$G_lang]; ?>" onclick="act_reload();"></td>
+<td style="text-align: center;"><input type="button" class="button" name="xout"  value="<?php echo $mlang_bin5_index['tit_out'][$G_lang]; ?>" onclick="safelogout();"></td>
 </tr><tr>
-<td style="text-align: center;" colspan="2"><input type="button" class="button" name="xpref"  value="<?php echo $mlang_bin5_index['tit_pref'][$G_lang]; ?>" onclick="preferences_showhide();"></td>
+<td style="text-align: center;"><img id="stm_stat" class="nobo" src="img/line-status_b.png"></td>
+<td style="text-align: center;"><input type="button" class="button" name="xpref"  value="<?php echo $mlang_bin5_index['tit_pref'][$G_lang]; ?>" onclick="preferences_showhide();"></td>
+</td>
 <td style="text-align: center;"><img id="exitlock" class="button" style="visibility: hidden; border: 0px; display: inline; position: relative;" onclick="act_exitlock();"></td>
 </tr>
 </table>
@@ -297,3 +317,6 @@ window.onload = function() {
 
 </body>
 </html>
+<?php
+}
+?>