From: Matteo Nastasi Date: Sat, 2 May 2020 16:25:54 +0000 (+0200) Subject: enabled deck select at table preferences X-Git-Tag: v5.10.0~38 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=94b406ae5451c04176ae43cad2e71f9f80d40d82;p=brisk.git enabled deck select at table preferences --- diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 72bd500..0bbd9d9 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -68,6 +68,23 @@ $mlang_bin5_bin5 = array( $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; @@ -96,6 +113,20 @@ function dom_select_rules() echo "$ret"; } +function dom_select_deck($cur_sel) +{ + GLOBAL $G_lang; + + $ret = "\n"; + + echo "$ret"; +} + class Card { var $value; /* 0 - 39 card value */ var $stat; /* 'bunch', 'hand', 'table', 'take' */ diff --git a/web/briskin5/briskin5.css b/web/briskin5/briskin5.css index 26c2854..4239a91 100644 --- a/web/briskin5/briskin5.css +++ b/web/briskin5/briskin5.css @@ -494,4 +494,7 @@ img.callerimg { top: 10px; } - +div#preferences_child div div { + text-align: center; + margin-bottom: 8px; +} diff --git a/web/briskin5/briskin5.js b/web/briskin5/briskin5.js index 4b29178..ad7aec7 100644 --- a/web/briskin5/briskin5.js +++ b/web/briskin5/briskin5.js @@ -24,6 +24,19 @@ 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")'; @@ -301,35 +314,61 @@ function set_iscalling(idx) } } +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,'
Per rendere visibile il nuovo mazzo di carte

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(); } @@ -359,6 +398,11 @@ function act_select_rules(rule_id) send_mesg("chatt|/rules " + rule_id); } +function act_select_deck(deck_id) +{ + preferences.deck = deck_id; +} + function rules_set(id) { $('select_rules').value = id; diff --git a/web/briskin5/index.php b/web/briskin5/index.php index d252f83..3b36896 100644 --- a/web/briskin5/index.php +++ b/web/briskin5/index.php @@ -3,7 +3,7 @@ * 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 * @@ -60,6 +60,10 @@ function bin5_index_main($transp_type, $header, &$header_out, $addr, $get, $post 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); ?> @@ -68,7 +72,7 @@ function bin5_index_main($transp_type, $header, &$header_out, $addr, $get, $post Brisk - Tavolo <?php echo "$table_idx";?> - + @@ -90,12 +94,13 @@ function bin5_index_main($transp_type, $header, &$header_out, $addr, $get, $post var subst = "none"; var table_pos = ""; var g_jukebox = null; + var g_deck = ""; var asta_ptr; var area_ptr; var gst = new globst(); - gst.st = "; xstm = new xynt_streaming(window, , 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); @@ -195,17 +201,17 @@ window.onload = function() {
- +
- - + +
- +
@@ -214,7 +220,7 @@ window.onload = function() {
- +
@@ -223,7 +229,7 @@ window.onload = function() {
- +
@@ -232,7 +238,7 @@ window.onload = function() {
- +
@@ -241,7 +247,7 @@ window.onload = function() {
- +
@@ -308,18 +314,19 @@ window.onload = function() {