Implement hidden permission in profile editor
[platal.git] / templates / profile / deco.tpl
index 4c27f5f..e12b5ad 100644 (file)
@@ -1,6 +1,6 @@
 {**************************************************************************}
 {*                                                                        *}
-{*  Copyright (C) 2003-2011 Polytechnique.org                             *}
+{*  Copyright (C) 2003-2014 Polytechnique.org                             *}
 {*  http://opensource.polytechnique.org/                                  *}
 {*                                                                        *}
 {*  This program is free software; you can redistribute it and/or modify  *}
 {*                                                                        *}
 {**************************************************************************}
 
+{if $isMe || hasPerm('admin') || ($medals|@count eq 0)}
+  {assign var=hidden_medal value=false}
+{elseif hasPerm('directory_hidden') || (($medals_pub neq 'hidden') && ($medals_pub neq 'private'))}
+  {assign var=hidden_medal value=false}
+{elseif hasPerm('directory_private') && ($medals_pub neq 'hidden')}
+  {assign var=hidden_medal value=false}
+{else}
+  {assign var=hidden_medal value=true}
+{/if}
 <table class="bicol">
   <tr>
     <th>
       <div class="flags" style="float: left">
-        <label><input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if} />
+        <label><input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if}{if $hidden_medal} disabled="disabled"{/if} />
         {icon name="flag_green" title="site public"}</label>
       </div>
-      Médailles, Décorations, Prix&hellip;
+      Médailles, Décorations, Prix&hellip;{if $hidden_medal} (masqué){/if}
     </th>
   </tr>
+{if !$hidden_medal}
   <tr>
     <td>
       <div style="clear: both; margin-top: 0.2em" id="medals">
@@ -50,7 +60,7 @@
       {foreach from=$medals item=medal key=id}
       {include file="profile/deco.medal.tpl" medal=$medal id=$id}
       {/foreach}
-      <p class="center">
+      <p class="center" style="clear: both">
         <small>
           Si {if $isMe}ta{else}la{/if} décoration
           ou {if $isMe}ta{else}la{/if} médaille ne figure pas dans la liste,
@@ -59,6 +69,7 @@
       </p>
     </td>
   </tr>
+{/if}
 </table>
 
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+{* vim:set et sw=2 sts=2 sws=2 fenc=utf-8: *}