Implement hidden permission in profile editor
[platal.git] / templates / profile / deco.tpl
index 05bc59a..e12b5ad 100644 (file)
@@ -1,6 +1,6 @@
 {**************************************************************************}
 {*                                                                        *}
-{*  Copyright (C) 2003-2009 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">
         <select name="medal_sel" onchange="updateMedal()">
-          <option value=''></option>
+          <option value=''>&nbsp;</option>
           {foreach from=$medal_list key=type item=list}
-          <optgroup label="{$trad[$type]}&hellip;">
+          <optgroup label="{$fullType[$type]}&hellip;">
             {foreach from=$list item=m}
             <option value="{$m.id}">{$m.text}</option>
             {/foreach}
       {foreach from=$medals item=medal key=id}
       {include file="profile/deco.medal.tpl" medal=$medal id=$id}
       {/foreach}
-      <div class="center"><small>Si ta décoration ou ta médaille ne figure pas dans la liste,
-      <a href="mailto:support@{#globals.mail.domain#}">contacte-nous</a>.</small></div>
+      <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,
+          <a href="mailto:support@{#globals.mail.domain#}">contacte-nous</a>.
+        </small>
+      </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: *}