type of stream selection added
[brisk.git] / web / xynt_test01.php
index 32b4cb9..38ddda0 100644 (file)
@@ -1,5 +1,13 @@
 <?php
 
+$transs = array( "iframe", "xhr", "htmlfile" );
+if (!isset($f_trans))
+    $f_trans = $transs[0];
+
+if (!isset($f_test))
+    $f_test = 1;
+
+
 function mop_flush()
 {
     for ($i = 0; $i < ob_get_level(); $i++)
@@ -22,12 +30,15 @@ if ($isstream == "true") {
     require_once("Obj/transports.phh");
 
 
-    // TODO: what stream ? 
-    //       iframe, htmlfile, xhr
-
-    // $transp = new Transport_iframe();
-    $transp = new Transport_xhr();
-
+    if (isset($transp) && $transp == "xhr") {
+        $transp = new Transport_xhr();
+    }
+    else if (isset($transp) && $transp == "htmlfile") {
+        $transp = new Transport_htmlfile();
+    }
+    else {
+        $transp = new Transport_iframe();
+    }
     $header_out = array();
 
     $init_string = "";
@@ -46,7 +57,7 @@ if ($isstream == "true") {
     print($body);
     mop_flush();
 
-    for ($i = 1 ; $i < 20 ; $i++) {
+    for ($i = 1 ; $i < 10 ; $i++) {
         $chunk = $transp->chunk($i, sprintf("\$('container').innerHTML = '%d';", $i));
         print($chunk);
         mop_flush();
@@ -65,30 +76,36 @@ if ($isstream == "true") {
 <script type="text/javascript" src="commons.js"></script>
 
 <!-- <script type="text/javascript" src="myconsole.js"></script> -->
-<!-- 
-<script type="text/javascript" src="menu.js"></script>
-<script type="text/javascript" src="ticker.js"></script>
-<script type="text/javascript" src="heartbit.js"></script>
-<script type="text/javascript" src="room.js"></script>
-<script type="text/javascript" src="preload_img.js"></script>
-<script type="text/javascript" src="AC_OETags.js"></script>
-<script type="text/javascript" src="probrowser.js"></script>
--->
-<SCRIPT type="text/javascript"><!--
+
+<script type="text/javascript"><!--
      var sess = "for_test";
      var stat = "";
      var subst = "";
      var gst = new globst();
      window.onload = function() {
-     xstm = new xynt_streaming(window, "xhr", null /* console */, gst, 'xynt_test01_php', 'sess', sess, null, 'xynt_test01.php?isstream=true', function(com){eval(com);});
+     xstm = new xynt_streaming(window, "<?php echo "$f_trans";?>", null /* console */, gst, 'xynt_test01_php', 'sess', sess, null, 'xynt_test01.php?isstream=true', function(com){eval(com);});
      /*     xstm.hbit_set(heartbit); */
      xstm.start();
  }
  //-->
-</SCRIPT>
+</script>
 </head>
-<!-- if myconsole <body onunload="deconsole();"> -->
 <body>
+<div>
+<?php
+
+printf("<table>");
+for ($test = 1 ; $test <= 2 ; $test++) {
+    printf("<tr>");
+    foreach ($transs as $trans) {
+        printf("<td style=\"padding: 8px; border: 1px solid black;\"><a href=\"?f_trans=%s&f_test=%d\">Test %s %02d</a></td>", $trans, $test, $trans, $test);
+    }
+    printf("</tr>\n");
+}
+printf("</table>");
+printf("<br>[%s]<br>Test: %d<br>", $f_trans, $f_test);
+?>
+</div>
 <div id="container">
 BEGIN
 </div>