DONE - dbase API
DONE - add apprentices tables
- remove entry when set unknown
- - enhance info interface
- . SQL to show current evaluation
+ DONE - enhance info interface
+ DONE . SQL to show current evaluation
. disable parts of interface
<release>
- minisplash at end of the match
$user_tos_vers = $user_item->tos_vers_get();
$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);
+ $narrowfriend['skill'] = $bdb->usersnet_narrowskill($user->code, $user_item->code);
if (($usersnet_item = $bdb->usersnet_bycode($user->code, $user_item->code,
$widefriend, $narrowfriend)) == FALSE) {
return ($widefriend);
}
+ function usersnet_wideskill($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $wideskill = "//";
+
+ $wskl_sql = sprintf("SELECT * FROM %susersnet_wideskill WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($wskl_pg = $this->query($wskl_sql)) == FALSE) {
+ return ($wideskill);
+ }
+
+ if (pg_numrows($wskl_pg) > 0) {
+ $wskl_obj = pg_fetch_object($wskl_pg, 0);
+ // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL
+ // if ($wskl_obj->count >= 3)
+ $wideskill = sprintf("%3.2f", $wskl_obj->skill);
+ }
+ return ($wideskill);
+ }
+
function usersnet_narrowfriend($owner, $target)
{
GLOBAL $G_dbpfx;
return ($narrowfriend);
}
+ function usersnet_narrowskill($owner, $target)
+ {
+ GLOBAL $G_dbpfx;
+
+ $narrowskill = "//";
+
+ $nskl_sql = sprintf("SELECT * FROM %susersnet_narrowskill WHERE owner = %d AND target = %d;",
+ $G_dbpfx, $owner, $target);
+ if (($nskl_pg = $this->query($nskl_sql)) == FALSE) {
+ return ($narrowskill);
+ }
+
+ if (pg_numrows($nskl_pg) > 0) {
+ $nskl_obj = pg_fetch_object($nskl_pg, 0);
+ // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL
+ // if ($nskl_obj->count >= 3)
+ $narrowskill = sprintf("%3.2f", $nskl_obj->skill);
+ }
+ return ($narrowskill);
+ }
+
function usersnet_bycode($owner, $target, $widefriend, $narrowfriend)
{
GLOBAL $G_dbpfx;
-function __fieldify_findfirst(objarr, name)
+function __fieldify_find_ancestors(objarr, name)
{
- for (var i = 0, obj = objarr[i] ; i < objarr.length ; i++) {
+ var obj;
+
+ for (var i = 0 ; i < objarr.length ; i++) {
+ obj = objarr[i];
var item = obj.getElementsByClassName(name + '_id');
if (item.length > 0) {
return (item);
// fieldsdescr = { name: { type: 'typename' }, ... }
function Fieldify(ancestors, fieldsdescr)
{
+ var item;
+
this.ancestors = ancestors;
this.field = new Array();
for (k in fieldsdescr) {
this.field[k] = fieldsdescr[k];
if (this.field[k].type == 'fields') {
- var item = __fieldify_findfirst(this.ancestors, k);
- if (item) {
+ if (item = __fieldify_find_ancestors(this.ancestors, k)) {
this.field[k].obj = new Fieldify(item, this.field[k].fields);
}
}
fld_value_set: function(name, value)
{
- var item = __fieldify_findfirst(this.ancestors, name);
+ var item = __fieldify_find_ancestors(this.ancestors, name);
if (item) {
item[0].innerHTML = value;
}
fld_value_get: function(name)
{
- var item = __fieldify_findfirst(this.ancestors, name);
+ var item = __fieldify_find_ancestors(this.ancestors, name);
if (item) {
return (item[0].innerHTML);
}
fld_radio_set: function(name, value)
{
- var arr = __fieldify_findfirst(this.ancestors, name);
+ var arr = __fieldify_find_ancestors(this.ancestors, name);
if (arr) {
for (k in arr) {
if (arr[k].value == value)
fld_radio_get: function(name)
{
var ret = null;
- var arr = __fieldify_findfirst(this.ancestors, name);
+ var arr = __fieldify_find_ancestors(this.ancestors, name);
if (arr) {
for (k in arr) {
if (arr[k].checked == true) {
<div id="xhrdeltalog"></div>
</div>
-<div id="info" class="notify" style="z-index: 200; width: 400px; margin-left: -200px; height: 340px; top: 150px; visibility: hidden;">
+<div id="info" class="notify" style="z-index: 200; width: 500px; margin-left: -250px; height: 340px; top: 150px; visibility: hidden;">
<table class="info">
-<tr><td><b><?php echo $mlang_room['info_login'][$G_lang]; ?></b></td><td class="ri"><span class="login_id"></span></td>
-<td><b><?php echo $mlang_room['info_state'][$G_lang]; ?></b></td><td class="ri"><span class="state_id"></span></td></tr>
-<tr><td><b><?php echo $mlang_room['info_guar'][$G_lang]; ?></b></td><td class="ri"><span class="guar_id"></span></td><td></td><td></td></tr>
-<tr><td><b><?php echo $mlang_room['info_match'][$G_lang]; ?></b></td><td class="ri"><span class="match_id"></span></td>
-<td><b><?php echo $mlang_room['info_game'][$G_lang]; ?></b></td><td class="ri"><span class="game_id"></span></td></tr>
-<!-- <tr class="widefriendh_id"><td colspan="3"><b>Cosa ne pensano gli amici.</b></td>
-<td class="le info-opt">Bravura: <span class="skill_id"></span></td></tr> -->
-<tr><td colspan="4"><b>Cosa ne pensano gli amici.</b></td></tr>
-
-<tr class="widefriend_id"><td class="le info-opt">Da evitare: <span class="black_id"></span></td>
-<td class="le info-opt">In prova: <span class="test_id"></span></td>
-<td class="le info-opt">Amico: <span class="friend_id"></span></td>
-<td class="le info-opt">Fidato: <span class="bff_id"></span></td></tr>
-
-<!-- <tr class="narrowfriendh_id"><td colspan="3"><b>Cosa ne pensano gli amici fidati:</b></td>
-<td class="le info-opt">Bravura: <span class="skill_id"></span></td></tr> -->
-<tr><td colspan="4"><b>Cosa ne pensano gli amici fidati:</b></td></tr>
-
-<tr class="narrowfriend_id"><td class="le info-opt">Da evitare: <span class="black_id"></span></td>
-<td class="le info-opt">In prova: <span class="test_id"></span></td>
-<td class="le info-opt">Amico: <span class="friend_id"></span></td>
-<td class="le info-opt">Fidato: <span class="bff_id"></span></td></tr>
-<!--
-<tr><td class="le ri" colspan="2"><b><?php echo $mlang_room['info_frie'][$G_lang]; ?></b></td></tr>
-<tr><td class="le info-opt"><input type="radio" name="friend" class="friend_id" value="black">Da evitare</td>
- <td class="ri info-opt"><input type="radio" name="friend" class="friend_id" value="friend">Amico</td></tr>
-<tr><td class="le info-opt"><input type="radio" name="friend" class="friend_id" value="unknown">Sconosciuto</td>
-<td class="ri info-opt"><input type="radio" name="friend" class="friend_id" value="bff">Amico fidato</td></tr>
-<tr><td class="le info-opt"><input type="radio" name="friend" class="friend_id" value="test">In prova</td></tr>
-<tr><td class="le"><b>Bravura:</b></td><td class="le"><b>Credibilità :</b></td></tr>
-<tr><td class="info-opt">
+<tr><td><b><?php echo $mlang_room['info_login'][$G_lang]; ?></b></td><td class="ri b-right data"><span class="login_id"></span></td>
+<td><b><?php echo $mlang_room['info_state'][$G_lang]; ?></b></td><td class="ri data"><span class="state_id"></span></td></tr>
+<tr><td><b><?php echo $mlang_room['info_guar'][$G_lang]; ?></b></td><td class="ri b-right data"><span class="guar_id"></span></td><td></td><td></td></tr>
+<tr><td><b><?php echo $mlang_room['info_match'][$G_lang]; ?></b></td><td class="ri b-right data"><span class="match_id"></span></td>
+<td><b><?php echo $mlang_room['info_game'][$G_lang]; ?></b></td><td class="ri data"><span class="game_id"></span></td></tr>
+<tr class="widefriend_id"><td colspan="3"><b>Cosa ne pensano gli amici:</b></td>
+<td class="le data">Bravura: <span class="skill_id"></span></td></tr>
+
+<tr class="widefriend_id"><td class="le info-opt data">Da evitare: <span class="black_id"></span></td>
+<td class="le info-opt data">In prova: <span class="test_id"></span></td>
+<td class="le info-opt data">Amico: <span class="friend_id"></span></td>
+<td class="le data">Fidato: <span class="bff_id"></span></td></tr>
+
+<tr class="narrowfriend_id"><td colspan="3"><b>Cosa ne pensano gli amici fidati:</b></td>
+<td class="le data">Bravura: <span class="skill_id"></span></td></tr>
+
+<tr class="narrowfriend_id"><td class="le info-opt data">Da evitare: <span class="black_id"></span></td>
+<td class="le info-opt data">In prova: <span class="test_id"></span></td>
+<td class="le info-opt data">Amico: <span class="friend_id"></span></td>
+<td class="le data">Fidato: <span class="bff_id"></span></td></tr>
+<tr><td class="le ri triple" colspan="3"><b><?php echo $mlang_room['info_frie'][$G_lang]; ?></b></td>
+<td class="le data triple"><input type="radio" name="friend" class="friend_id" value="black">Da evitare</td></tr>
+<tr>
+<td class="le info-opt data"><input type="radio" name="friend" class="friend_id" value="unknown">Sconosciuto</td>
+<td class="le info-opt data"><input type="radio" name="friend" class="friend_id" value="test">In prova</td>
+<td class="ri info-opt data"><input type="radio" name="friend" class="friend_id" value="friend">Amico</td>
+<td class="ri info-opt data"><input type="radio" name="friend" class="friend_id" value="bff">Amico fidato</td>
+</tr>
+<tr><td class="le"><b>Bravura:</b></td>
+<td class="data">
<table class="fiverank" style="margin: auto;">
<tr><td class="c1t">1</td>
<td class="c2t">2</td>
<td class="c5b"><input type="radio" name="skill" class="skill_id" value="5"></td>
</tr>
</table>
-</td><td class="info-opt">
+</td>
+<td class="le"><b>Credibilità :</b></td>
+<td class="data">
<table class="fiverank" style="margin: auto;">
<tr><td class="c1t">1</td>
<td class="c2t">2</td>
</tr>
</table>
</td></tr>
--->
-<tr><td colspan="4" style="background-color: pink;">di seguito le opzioni che verranno attivate successivamente:</td></tr>
+<!-- <tr><td colspan="4" style="background-color: pink;">di seguito le opzioni che verranno attivate successivamente:</td></tr> -->
</table>
<div style="position: absolute; bottom: 8px; margin: auto; width: 100%;">
<input type="submit" class="input_sub" style="bottom: 4px;" onclick="$('info').style.visibility = 'hidden';" value="<?php echo $mlang_room['btn_close'][$G_lang]; ?>"/>
state: { type: 'value', perms: 'ro' },
guar: { type: 'value', perms: 'ro' },
- widefriend: { type: 'fields', fields: { black: { type: 'value', perms: 'ro' },
+ widefriend: { type: 'fields', fields: { skill: { type: 'value', perms: 'ro' },
+ black: { type: 'value', perms: 'ro' },
test: { type: 'value', perms: 'ro'},
friend: { type: 'value', perms: 'ro'},
bff: { type: 'value', perms: 'ro'}
} },
- narrowfriend: { type: 'fields', fields: { black: { type: 'value', perms: 'ro'},
+ narrowfriend: { type: 'fields', fields: { skill: { type: 'value', perms: 'ro' },
+ black: { type: 'value', perms: 'ro'},
test: { type: 'value', perms: 'ro'},
friend: { type: 'value', perms: 'ro'},
bff: { type: 'value', perms: 'ro'}
skill: { type: 'radio' },
trust: { type: 'radio' }
};
- return (new Fieldify([dobj], fields));
+
+ var ret = new Fieldify([dobj], fields);
+ console.log(ret);
+ return (ret);
}
function info_show(username)
table.info td {
border-top: 1px solid grey;
- padding: 4px;
+ padding: 6px;
width: 25%;
}
+table.info td.triple {
+ border-top: 2px solid #000000;
+}
+
+table.info td.data {
+ background-color: white;
+}
+table.info span {
+ text-align: left;
+ font-style: italic;
+}
table.info table.fiverank {
border-collapse: collapse;
padding: 0px 4px 4px 4px;
}
+table.info td.b-right {
+ border-right: 1px solid grey;
+ }
+
table.info td.noborder {
border-top: 0px;
}
table.info td.le {
- padding-left: 16px;
+ padding-left: 8px;
}
table.info td.ro {
- padding-right: 16px;
+ padding-right: 8px;
}
body.explain h1 {