ajout de checkbox dans les table editor pour les champs set unique + flag actif pour...
[platal.git] / templates / table-editor.tpl
index dd6704c..4c6b7d6 100644 (file)
 <h1>{$title}</h1>
 
 {if $list}
-
+<script type="text/javascript">
+       {literal}
+       function redirect(a) {
+               document.location = a;
+       }
+       {/literal}
+</script>
 <table class="bicol">
 <tr>
-  {foreach from=$t->vars item=myval}{if $myval.display}
-    <th>{$myval.desc}</th>
+  {foreach from=$t->vars item=myval key=myvar}{if $myval.display}
+    <th style="cursor:pointer" onclick="redirect('{$t->pl}/sort{if $t->sortfield eq $myvar && !$t->sortdesc}desc{/if}/{$myvar}')">{$myval.desc}{if $t->sortfield eq $myvar}{if $t->sortdesc}{icon name="bullet_arrow_down"}{else}{icon name="bullet_arrow_up"}{/if}{/if}</th>
   {/if}{/foreach}
   {if !$hideactions}
   <th>action</th>
@@ -52,6 +58,8 @@
     {/if}
     {if $myval.Type eq 'timestamp'}
       <span class="smaller">{$myrow.$myfield|date_format:"%x %X"}</span>
+    {elseif $myval.Type eq 'checkbox'}
+      <input type="checkbox" disabled="disabled"{if $myrow.$myfield} checked="checked"{/if}/>
     {else}
       {$myrow.$myfield}
     {/if}
           </select>
         {elseif ($myval.Type eq 'textarea') or ($myval.Type eq 'varchar200')}
           <textarea name="{$myfield}" rows="{if $myval.Type eq 'varchar200'}3{else}10{/if}" cols="70">{$entry.$myfield}</textarea>
+        {elseif ($myval.Type eq 'checkbox')}
+          <input type="checkbox" name="{$myfield}" value="{$myval.Value}"{if $entry.$myfield} checked="checked"{/if}/>
         {else}
           <input type="text" name="{$myfield}" value="{$entry.$myfield}" {if $myval.Size}size="{$myval.Size}" maxlength="{$myval.Maxlength}"{/if}/>
           {if $myval.Type eq 'timestamp'}<em>jj/mm/aaaa hh:mm:ss</em>{/if}
+          {if $myval.Type eq 'date'}<em>jj/mm/aaaa</em>{/if}
           {if $myval.Type eq 'time'}<em>hh:mm:ss</em>{/if}
         {/if}
       </td>