info: hide part of the info when target user is unknown or blacklisted
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Tue, 15 Dec 2015 10:07:50 +0000 (11:07 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Tue, 15 Dec 2015 10:07:50 +0000 (11:07 +0100)
TODO.txt
web/index.php
web/info.js

index 3751b46..1a94fbb 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -5,8 +5,8 @@
  ------+
    DONE - Not sequence of 3 same chars
    DONE   . check server side with test
-   <release>
    - Global vars checker
+   <release>
    - usermgmt: add user delete
    DONE - 10002 message when already clicked
    DONE - trim spaces in apprentice form
@@ -24,7 +24,8 @@
      DONE - remove entry when set unknown
      DONE - enhance info interface
        DONE . SQL to show current evaluation
-       . disable parts of interface
+       DONE . disable parts of interface
+       . add title to items
      <release>
      - minisplash at end of the match
      - differentiate table authorization
index b67b0a4..0a6d9ff 100644 (file)
@@ -1401,14 +1401,19 @@ type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chi
 <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>
+<td class="le data triple"><input type="radio" name="friend" class="friend_id" value="black"
+    onclick="info_onlyifknown_isvisible();">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>
+<td class="le info-opt data"><input type="radio" name="friend" class="friend_id" value="unknown"
+    onclick="info_onlyifknown_isvisible();">Sconosciuto</td>
+<td class="le info-opt data"><input type="radio" name="friend" class="friend_id" value="test"
+    onclick="info_onlyifknown_isvisible();">In prova</td>
+<td class="ri info-opt data"><input type="radio" name="friend" class="friend_id" value="friend"
+    onclick="info_onlyifknown_isvisible();">Amico</td>
+<td class="ri info-opt data"><input type="radio" name="friend" class="friend_id" value="bff"
+    onclick="info_onlyifknown_isvisible();">Amico fidato</td>
 </tr>
-<tr><td class="le"><b>Bravura:</b></td>
+<tr class="onlyifknown_id"><td class="le"><b>Bravura:</b></td>
 <td class="data">
     <table class="fiverank" style="margin: auto;">
        <tr><td class="c1t">1</td>
index ec13833..bf63b9c 100644 (file)
@@ -52,7 +52,6 @@ function info_fld(dobj)
                  };
 
     var ret = new Fieldify([dobj], fields);
-    console.log(ret);
     return (ret);
  }
 
@@ -66,6 +65,7 @@ function info_show(username)
     if (info_in.ret == 0) {
         info = info_fld($('info'));
         info.json2dom(info_in);
+        info_onlyifknown_isvisible();
         info.visible(true);
         }
     else {
@@ -109,3 +109,25 @@ function info_save()
         alert(ret);
     }
 }
+function info_onlyifknown_isvisible()
+{
+    var vis = 'inherit';
+    var arr = $('info').getElementsByClassName('friend_id');
+    var obj = null;
+
+    for (var k = 0 ; k < arr.length ; k++) {
+        if (arr[k].checked == true) {
+            obj = arr[k];
+            break;
+        }
+    }
+    if (obj == null) {
+        return false;
+    }
+
+    if (obj.value == 'black' || obj.value == 'unknown') {
+        vis = 'hidden';
+    }
+    $('info').getElementsByClassName('onlyifknown_id')[0].style.visibility = vis;
+    return true;
+}