$table_wellarr = Array( 'it' => Array ( 'Benvenuto al tavolo. Se almeno tre giocatori non sbloccano l\'uscita cliccando il lucchetto, chi esce non può risedersi a un qualunque tavolo per '.floor(BAN_TIME/60).' minuti.'),
'en' => Array ( 'EN Benvenuto al tavolo. Se almeno tre giocatori non sbloccano l\'uscita cliccando il lucchetto, chi esce non può risedersi a un qualunque tavolo per '.floor(BAN_TIME/60).' minuti.') );
+
+// FIXME - DYNAMIC WITH CACHE AND RELOAD FROM DB
+function deck_keys()
+{
+ return array('xx', 'yy');
+}
+
+function deck_id2descr($id, $lang)
+{
+ if ($id == 'xx')
+ return 'carte originali';
+ else if ($id == 'yy')
+ return 'carte strette';
+
+ return 'carte sconosciute';
+}
+
function multoval($mult)
{
GLOBAL $G_lang;
echo "$ret";
}
+function dom_select_deck($cur_sel)
+{
+ GLOBAL $G_lang;
+
+ $ret = "<select id='select_deck'>\n";
+ foreach (deck_keys() as $key) {
+ $value = deck_id2descr($key, $G_lang);
+ $ret .= sprintf("<option value='%s'%s>%s</option>\n", $key, ($key == $cur_sel ? " selected='selected'" : ""), $value);
+ }
+ $ret .= "</select>\n";
+
+ echo "$ret";
+}
+
class Card {
var $value; /* 0 - 39 card value */
var $stat; /* 'bunch', 'hand', 'table', 'take' */
var mlang_briskin5 = { 'is_calling' : { 'it' : ' sta chiamando',
'en' : ' is calling' } }
+function Preferences(ring_endauct, deck, deck_old)
+{
+ this.ring_endauct = ring_endauct;
+ this.deck = deck;
+ this.deck_old = deck_old;
+}
+
+Preferences.prototype = {
+ ring_endauct: true,
+ deck: null,
+ deck_old: null
+}
+
function background_set()
{
$("bg").style.backgroundImage = 'url("img/brisk_table_sand'+table_pos+'.jpg")';
}
}
+var preferences = new Preferences(true, 'xx', 'xx');
+// FIXME move it in the html dynamic generation scope
+var deck_list = { 'xx': 'Normal cards',
+ 'yy': 'Slim cards' }
function preferences_init()
{
var rd;
if ((rd = readCookie("CO_bin5_pref_ring_endauct")) != null) {
- $('pref_ring_endauct').checked = (rd == "true" ? true : false);
+ preferences.ring_endauct = $('pref_ring_endauct').checked = (rd == "true" ? true : false);
+ }
+ else {
+ preferences.ring_endauct = $('pref_ring_endauct').checked = true;
+ }
+
+ if ((rd = readCookie("CO_bin5_pref_deck")) != null && rd in deck_list) {
+ $$('#pref_deck').val(rd);
+ preferences.deck = rd;
+ preferences.deck_old = rd;
}
else {
- $('pref_ring_endauct').checked = false;
+ rd = 'xx';
+ $$('#pref_deck').val(rd);
+ preferences.deck = rd;
+ preferences.deck_old = rd;
}
- $('preferences').ring_endauct = $('pref_ring_endauct').checked;
}
function preferences_update()
{
var ret;
- createCookie("CO_bin5_pref_ring_endauct", ($('preferences').ring_endauct ? "true" : "false"), 24*3650, cookiepath);
+ createCookie("CO_bin5_pref_ring_endauct", (preferences.ring_endauct ? "true" : "false"), 24*3650, cookiepath);
+ createCookie("CO_bin5_pref_deck", preferences.deck, 24*3650, cookiepath);
ret = server_request('mesg', 'preferences_update');
}
function act_preferences_update()
{
- preferences_update()
+ preferences_update();
+ if (preferences.deck != preferences.deck_old) {
+ // FIXME: with dynamic text
+ x = new notify(gst,'<br/>Per rendere visibile il nuovo mazzo di carte<br/><br/>occorre fare reload della pagina.',
+ 0, "Close", 400, 110);
+ }
preferences_showhide();
}
function pref_ring_endauct_set(obj)
{
- $('preferences').ring_endauct = obj.checked;
+ preferences.ring_endauct = obj.checked;
+}
+
+function pref_deck_set(obj)
+{
+ preferences.deck = $$(obj).val();
}
send_mesg("chatt|/rules " + rule_id);
}
+function act_select_deck(deck_id)
+{
+ preferences.deck = deck_id;
+}
+
function rules_set(id)
{
$('select_rules').value = id;
* brisk - briskin5/index.php
*
* Copyright (C) 2006-2012 Matteo Nastasi
- * mailto: nastasi@alternativeoutput.it
+ * mailto: nastasi@alternativeoutput.it
* matteo.nastasi@milug.org
* web: http://www.alternativeoutput.it
*
if (($sess = gpcs_var('sess', $get, $post, $cookie)) === FALSE)
unset ($sess);
+ fprintf(STDERR, "PREF_DECK SET %s", (isset($cookie['CO_bin5_pref_deck']) ? "YES" : "NO"));
+
+ $deck = (isset($cookie['CO_bin5_pref_deck']) ? $cookie['CO_bin5_pref_deck'] : 'xx');
+
// header('Content-type: text/html; charset="utf-8"',true);
?>
<html>
<title>Brisk - Tavolo <?php echo "$table_idx";?></title>
<link rel="shortcut icon" href="../img/brisk_ico.png">
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
-<script type="text/javascript" src="../commons.js?v=<? echo BSK_BUSTING; ?>"></script>
+<script type="text/javascript" src="../commons.js?v=<? echo BSK_BUSTING; ?>"></script>
<script type="text/javascript" src="../heartbit.js?v=<? echo BSK_BUSTING; ?>"></script>
<script type="text/javascript" src="../xynt-streaming.js?v=<? echo BSK_BUSTING; ?>"></script>
<script type="text/javascript" src="dnd.js?v=<? echo BSK_BUSTING; ?>"></script>
var subst = "none";
var table_pos = "";
var g_jukebox = null;
+ var g_deck = "<?php echo "$deck"; ?>";
var asta_ptr;
var area_ptr;
var gst = new globst();
- gst.st = <?php
+ gst.st = <?php
log_load("bin5/index.php");
if (isset($laststate) == false) {
sess = "<?php echo "$sess"; ?>";
xstm = new xynt_streaming(window, <?php printf("\"%s\", %d", $transp_type, $transp_port); ?>, 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;
+
+ window.onbeforeunload = onbeforeunload_cb;
+ window.onunload = onunload_cb;
xstm.start();
addEvent($('select_rules'), "change", function() { act_select_rules(this.value); } );
+ addEvent($('select_deck'), "change", function() { act_select_deck(this.value); } );
// 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);
<img id="asta8" src="img/asta8.png" class="astacard">
<img id="asta9" src="img/asta9.png" class="astacard">
<div id="astaptdiv" class="punti">
- <input class="puntifield" id="astapt" name="astapt" type="text" maxsize="3" size="3" value="61">
+ <input class="puntifield" id="astapt" name="astapt" type="text" maxsize="3" size="3" value="61">
</div>
<img id="astaptsub" src="img/astaptsub_ro.png" class="astacard">
- <img id="astapasso" src="img/astapasso_ro.png" class="astacard">
- <img id="astalascio" src="img/astalascio_ro.png" class="astacard">
+ <img id="astapasso" src="img/astapasso_ro.png" class="astacard">
+ <img id="astalascio" src="img/astalascio_ro.png" class="astacard">
</div>
<div id="name" class="pubinfo"></div>
<div id="public" class="public">
<div class="vert_midfloat">
<div id="pubasta" class="vert_innfloat_so">
- <img id="pubacard" src="img/astapasso_ro.png" class="pubacard">
+ <img id="pubacard" src="img/astapasso_ro.png" class="pubacard">
<div id="pubapnt"></div>
</div>
</div>
<div id="public_ea" class="public_ea">
<div class="vert_midfloat">
<div id="pubasta_ea" class="vert_innfloat">
- <img id="pubacard_ea" src="img/astapasso_ro.png" class="pubacard_ea">
+ <img id="pubacard_ea" src="img/astapasso_ro.png" class="pubacard_ea">
<div id="pubapnt_ea"></div>
</div>
</div>
<div id="public_ne" class="public_ne">
<div class="vert_midfloat">
<div id="pubasta_ne" class="vert_innfloat">
- <img id="pubacard_ne" src="img/astapasso_ro.png" class="pubacard_ne">
+ <img id="pubacard_ne" src="img/astapasso_ro.png" class="pubacard_ne">
<div id="pubapnt_ne"></div>
</div>
</div>
<div id="public_nw" class="public_nw">
<div class="vert_midfloat">
<div id="pubasta_nw" class="vert_innfloat">
- <img id="pubacard_nw" src="img/astapasso_ro.png" class="pubacard_nw">
+ <img id="pubacard_nw" src="img/astapasso_ro.png" class="pubacard_nw">
<div id="pubapnt_nw"></div>
</div>
</div>
<div id="public_we" class="public_we">
<div class="vert_midfloat">
<div id="pubasta_we" class="vert_innfloat">
- <img id="pubacard_we" src="img/astapasso_ro.png" class="pubacard_we">
+ <img id="pubacard_we" src="img/astapasso_ro.png" class="pubacard_we">
<div id="pubapnt_we"></div>
</div>
</div>
</div>
<div id="preferences" class="notify" style="z-index: 200; width: 400px; margin-left: -200px; height: 200px; top: 126px; visibility: hidden;">
-<div id="preferences_child" style="border-bottom: 1px solid gray; overflow: auto; height: 170px;">
+<div id="preferences_child" style="border-bottom: 1px solid gray; overflow: auto; height: 170px; text-align: center">
<h2><?php echo $mlang_bin5_index['tit_pref'][$G_lang]; ?></h2>
<div style="width: 95%; /* background-color: red; */ margin: auto; text-align: left;">
-<br><br>
-<input type="checkbox" name="pref_ring_endauct" id="pref_ring_endauct" onclick="pref_ring_endauct_set(this);"><?php echo $mlang_bin5_index['itm_ringauc'][$G_lang] ?>
<div>
- <label>Regole:</label><?php dom_select_rules();?>
+ <input type="checkbox" name="pref_ring_endauct" id="pref_ring_endauct" onclick="pref_ring_endauct_set(this);"><?php echo $mlang_bin5_index['itm_ringauc'][$G_lang] ?>
</div>
-</div>
-
-
+ <div>
+ <label>Regole:</label> <?php dom_select_rules();?>
+ </div>
+ <div>
+ <label>Tipo di carte:</label> <?php dom_select_deck($deck);?>
+ </div>
</div>
<div class="notify_clo"><input type="submit" class="input_sub" style="bottom: 4px;" onclick="act_preferences_update();" value="<?php echo $mlang_bin5_index['btn_update'][$G_lang]; ?>"/></div>
</div>