From 4d039a689e6a9a735608bffba118bfbab1fafb10 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Mon, 21 Dec 2015 08:14:14 +0100 Subject: [PATCH] add webside implementation for party show --- web/Obj/brisk.phh | 3 +++ web/Obj/dbase_pgsql.phh | 21 +++++++++++++++++++++ web/index.php | 11 ++++++++--- web/info.js | 1 + 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 4592179..830a239 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -1693,6 +1693,8 @@ class Brisk } $user_tos_vers = $user_item->tos_vers_get(); + $partyskill = $bdb->usersnet_partyskill($user->code, $user_item->code); + $widefriend = $bdb->usersnet_widefriend($user->code, $user_item->code); $widefriend['skill'] = $bdb->usersnet_wideskill($user->code, $user_item->code); $narrowfriend = $bdb->usersnet_narrowfriend($user->code, $user_item->code); @@ -1731,6 +1733,7 @@ class Brisk "Normale" : "Stato sconosciuto"))), "guar" => ($user_item->type & USER_FLAG_TY_APPR ? "" : $guar_login), + "party" => $partyskill, "match" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->match_cnt) , "game" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->game_cnt), "friend" => usersnet_friend_getlabel($usersnet_item->friend), diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 48ca78e..8027377 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -942,6 +942,27 @@ INSERT INTO %smails (code, ucode, type, tstamp, subj, body_txt, body_htm, hash) return ($narrowskill); } + function usersnet_partyskill($owner, $target) + { + GLOBAL $G_dbpfx; + + $partyskill = "non disponibile"; + + $pskl_sql = sprintf("SELECT * FROM %susersnet_party WHERE owner = %d AND target = %d;", + $G_dbpfx, $owner, $target); + if (($pskl_pg = $this->query($pskl_sql)) == FALSE) { + return ($partyskill); + } + + if (pg_numrows($pskl_pg) > 0) { + $pskl_obj = pg_fetch_object($pskl_pg, 0); + // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL + // if ($wskl_obj->count >= 3) + $partyskill = sprintf("%3.2f", $pskl_obj->skill); + } + return ($partyskill); + } + function usersnet_bycode($owner, $target, $widefriend, $narrowfriend) { GLOBAL $G_dbpfx; diff --git a/web/index.php b/web/index.php index 2f3b04b..8a2de19 100644 --- a/web/index.php +++ b/web/index.php @@ -240,6 +240,10 @@ $mlang_room = array( 'userpassuse' => array('it' => 'Il tuo nickname è g 'en' => 'Matches'), 'info_match_tit' => array('it' => 'Partite giocate ai tavoli riservati.', 'en' => 'Matches played at reserved tables.'), + 'info_party' => array('it' => 'Party', + 'en' => 'Party'), + 'info_party_tit' => array('it' => 'Bravura calcolata in base ad amici, agli amici fidati e agli amici degli amici fidati in base alla credibilità degli amici fidati.', + 'en' => 'Skill calculated with party rules.'), 'info_game' => array('it' => 'Mani', 'en' => 'Hands'), 'info_game_tit' => array('it' => 'Mani giocate ai tavoli riservati.', @@ -1398,12 +1402,13 @@ type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chi : - +: + -: - +: + : diff --git a/web/info.js b/web/info.js index bf63b9c..54d9093 100644 --- a/web/info.js +++ b/web/info.js @@ -46,6 +46,7 @@ function info_fld(dobj) } }, match: { type: 'value', perms: 'ro' }, game: { type: 'value', perms: 'ro' }, + party: { type: 'value', perms: 'ro' }, friend: { type: 'radio' }, skill: { type: 'radio' }, trust: { type: 'radio' } -- 2.17.1