From: Matteo Nastasi (mop) <nastasi@alternativeoutput.it> Date: Tue, 4 Dec 2012 06:19:07 +0000 (+0100) Subject: type of stream selection added X-Git-Tag: v4.3.0~1 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=14136ff3d45c9d1212d6b5e0fd789b57ed73b893;p=brisk.git type of stream selection added --- diff --git a/web/Obj/transports.phh b/web/Obj/transports.phh index 72ad49b..08ad7a0 100644 --- a/web/Obj/transports.phh +++ b/web/Obj/transports.phh @@ -135,4 +135,8 @@ push(\"%s\");\n// -->\n</script>", $step, escpush($cont) ); } } } + +class Transport_htmlfile extends Transport_iframe { +} + ?> \ No newline at end of file diff --git a/web/xynt-streaming.js b/web/xynt-streaming.js index 117c9f7..a8cad92 100644 --- a/web/xynt-streaming.js +++ b/web/xynt-streaming.js @@ -390,12 +390,15 @@ xynt_streaming.prototype = { // transport instantiation if (this.transp_type == "xhr") { + this.page = url_append_args(this.page, "transp", "xhr"); this.transp = new transport_xhr(this.doc, this, this.page); } else if (this.transp_type == "iframe") { + this.page = url_append_args(this.page, "transp", "iframe"); this.transp = new transport_iframe(this.doc, this, this.page); } else if (this.transp_type == "htmlfile") { + this.page = url_append_args(this.page, "transp", "htmlfile"); this.transp = new transport_htmlfile(this.doc, this, this.page); } else diff --git a/web/xynt_test01.php b/web/xynt_test01.php index 32b4cb9..38ddda0 100644 --- a/web/xynt_test01.php +++ b/web/xynt_test01.php @@ -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>