small wishes and fixes
[mir.git] / templates / admin / FUNCTIONS.template
index 0d09621..c890d53 100755 (executable)
@@ -1,10 +1,14 @@
 <comment>creates a full table incl. edit/delete entry.id</comment>
-<function ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>
+<function ListTable(contentlist, data_keys, aHeaders, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>
+  <assign nrColumns="1">
+  <list aHeaders as h>
+    <assign nrColumns=utility.increment(nrColumns)>
+  </list>
 
 <table cellspacing="2" border="0">
   
-  <tr>
-    <list column_head_texts as indexVariable>
+  <tr class="${column_head_CSS}">
+    <list aHeaders as indexVariable>
       <td class="${column_head_CSS}">
         <b>${indexVariable}</b> 
       </td>
@@ -38,7 +42,7 @@
   
   
   <tr>    
-    <td colspan="${column_nr}" class="table-foot">
+    <td colspan="${nrColumns}" class="table-foot">
       ${data.count} ${lang("records")} / ${lang("show_from_to", data.from, data.to)}
     </td>
   </tr>
 </function>
 
 <assign TABLE_HEAD_CLASS          "table-head">
-<assign TABLE_FOOT_CLASS          "table-head">
+<assign TABLE_FOOT_CLASS          "table-foot">
 <assign LIST_ROW_CLASS             "listrow1">
 <assign LIST_ROW_CLASS_ALTERNATIVE "listrow2">
 
 <function EntityTable(anEntityList, aDataKeys, aHeaders, aFrom, aTo, aCount, aShowDelete, aShowEdit, aModuleName)>
+  <assign nrColumns="0">
+  <list aHeaders as h>
+    <assign nrColumns=utility.increment(nrColumns)>
+  </list>
+  <if aShowDelete == "1" || aShowEdit == "1" >
+    <assign nrColumns=utility.increment(nrColumns)>
+  </if>
+
   <table cellspacing="2" border="0">
     <tr>
       <list aHeaders as i>
     
     
     <tr>    
-      <td colspan="${column_nr}" class="${TABLE_HEAD_CLASS}">
+      <td colspan="${nrColumns}" class="${TABLE_FOOT_CLASS}">
         ${aCount} ${lang("records")} / ${lang("show_from_to", aFrom, aTo)}
       </td>
     </tr>