diogenes update
authorx2000habouzit <x2000habouzit>
Fri, 8 Oct 2004 11:30:10 +0000 (11:30 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 8 Oct 2004 11:30:10 +0000 (11:30 +0000)
include/auto.prepend.inc.php
include/xorg.table-editor.inc.php
templates/table-editor.tpl

index b74a4c1..b229565 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: auto.prepend.inc.php,v 1.24 2004-09-24 14:47:43 x2000habouzit Exp $
+        $Id: auto.prepend.inc.php,v 1.25 2004-10-08 11:30:10 x2000habouzit Exp $
  ***************************************************************************/
 
 function microtime_float() 
@@ -72,11 +72,11 @@ function new_admin_page($tpl_name, $popup=false, $tpl_head="") {
     _new_page(SKINNED, $tpl_name, $tpl_head, AUTH_MDP, $popup, true);
 }
 
-function new_admin_table_editor($table,$idfield) {
+function new_admin_table_editor($table,$idfield,$idedit=false) {
     global $editor;
     new_admin_page('table-editor.tpl');
     require_once('xorg.table-editor.inc.php');
-    $editor = new XOrgAdminTableEditor($table,$idfield);
+    $editor = new XOrgAdminTableEditor($table,$idfield,$idedit);
 }
 
 ?>
index ac86bbd..87f03ce 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: xorg.table-editor.inc.php,v 1.3 2004-08-31 11:16:48 x2000habouzit Exp $
+        $Id: xorg.table-editor.inc.php,v 1.4 2004-10-08 11:30:10 x2000habouzit Exp $
  ***************************************************************************/
 
 require_once('diogenes.table-editor.inc.php');
 
 class XOrgAdminTableEditor extends DiogenesTableEditor {
-    function XOrgTableEditor($table,$idfield) {
-        $this->DiogenesTableEditor($table,$idfield);
+    function XOrgTableEditor($table,$idfield,$editid=false) {
+        $this->DiogenesTableEditor($table,$idfield,$editid);
     }
 
     function assign($var_name, $contenu) {
index da4ff12..c9a7710 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: table-editor.tpl,v 1.8 2004-08-31 11:25:39 x2000habouzit Exp $
+        $Id: table-editor.tpl,v 1.9 2004-10-08 11:30:11 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -28,6 +28,7 @@
 </div>
 
 {if !$doedit}
+{if !$readonly}
 
 {literal}
 <script type="text/javascript">
@@ -49,6 +50,7 @@
   // -->
 </script>
 {/literal}
+{/if}
 
 <form method="post" action="{$smarty.server.PHP_SELF}" id="operations">
   <div>
 
 <table class="bicol">
 <tr>
-  <th>id</th>
+  {if $idsum}<th>id</th>{/if}
   {foreach from=$vars item=myval}
   {if $myval.sum}<th>{$myval.desc}</th>{/if}
   {/foreach}
+  {if !$hideactions}
   <th>action</th>
+  {/if}
 </tr>
+{if !$readonly}
 <tr class="impair">
   <td colspan="{$ncols}"><strong>nouvelle entrée</strong></td>
   <td class="action">
     <a href="javascript:edit('');">create</a>
   </td>
 </tr>
+{/if}
 {foreach from=$rows item=myrow}{assign var="myarr" value=$myrow[2]}
 <tr class="{cycle values="pair,impair"}">
-  <td>{$myrow[1]}</td>
+  {if $idsum}<td>{$myrow[1]}</td>{/if}
 {foreach from=$vars key=mykey item=myval}
 {if $myval.sum}
   <td>
   </td>
 {/if}
 {/foreach}
+  {if !$hideactions}
   <td class="action">
+    {if !$readonly}
     <a href="javascript:edit('{$myrow[1]}');">edit</a>
     <a href="javascript:del('{$myrow[1]}');">delete</a>
-{foreach from=$myrow[3] item=myaction}
+    {/if}
+    {foreach from=$myrow[3] item=myaction}
     {a lnk=$myaction}
-{/foreach}
+    {/foreach}
   </td>
+  {/if}
 </tr>
 {/foreach}
 
       <th colspan="2">
         <input type="hidden" name="action" value="update" />
         {if $id!=''}
-        <input type="hidden" name="{$prefix}id" value="{$id}"/>
         modification de l'entrée 
         {else}
         nouvelle entrée
       </th>
     </tr>
     {foreach from=$vars key=mykey item=myval}
-    {if $mykey != $idfield}
     <tr class="{cycle values="pair,impair"}">
       <td>
         <strong>{$myval.desc}</strong>
         {/if}
       </td>
     </tr>
-    {/if}
     {/foreach}
   </table>