Index: openacs-4/packages/logger/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index.adp,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/logger/www/admin/index.adp	18 Sep 2003 20:04:34 -0000	1.11
+++ openacs-4/packages/logger/www/admin/index.adp	4 Jan 2004 17:24:38 -0000	1.12
@@ -5,150 +5,27 @@
 
   <h2 class="logger">Projects</h2>
 
-  <if @projects:rowcount@ ne 0>
-    <% # Project table header %>
+  <listtemplate name="projects"></listtemplate>
+  
+  <p></p>
 
-    <table class="logger_listing" cellpadding="4" cellspacing="1">
-      <tr class="logger_listing_header">
-        <th class="logger_listing_narrow">&nbsp;</th>
-        <th class="logger_listing">Project Name</th>
-        <th class="logger_listing">Active</th>
-        <th class="logger_listing">Project Lead</th>
-        <th class="logger_listing_narrow">Permissions</th>
-        <th class="logger_listing_narrow">Unlink</th>
-        <th class="logger_listing_narrow">&nbsp;</th>
-      </tr>
-
-    <% # Project table rows %>
-    <multiple name="projects">
-      <if @projects.rownum@ odd>
-        <tr class="logger_listing_odd">
-      </if>
-      <else>
-        <tr class="logger_listing_even">
-      </else>
-        <td class="logger_listing_narrow">
-          <a href="@projects.edit_url@" title="Edit project attributes"><img src="/shared/images/Edit16.gif" height="16" width="16" alt="Edit" border="0"></a>
-        </td>
-        <td class="logger_listing">
-          <a href="@projects.display_url@" title="Display project info">@projects.name@</a>
-        </td>
-        <td class="logger_listing"><if @projects.active_p@ eq t>Yes (<a href="@projects.make_inactive_url@" title="Make this project inactive">toggle</a>)</if><else>No (<a href="@projects.make_active_url@" title="Make this project active">toggle</a>)</else> </td>
-        <td class="logger_listing">@projects.project_lead_chunk;noquote@</td>
-        <td class="logger_listing_narrow" align="center">
-          <if @projects.admin_p@>
-            <a href="@projects.permissions_url@" title="Set permissions for this project">Set</a>
-          </if>
-        </td>
-        <td class="logger_listing_narrow">
-          <a href="@projects.unmap_url@">Unlink</a>
-        </td>
-        <td class="logger_listing_narrow">
-          <if @projects.admin_p@>
-            <a href="@projects.delete_url@" title="Delete this project"
-            onclick="return confirm('Are you sure you want to delete project @projects.name@?');"><img src="/shared/images/Delete16.gif" height="16" width="16" alt="Delete" border="0"></a>
-          </if>
-        </td>
-      </tr>  
-    </multiple>
-
-    <% # Close project table %>
-    </table>
-  </if>
-  <else>
-    <!-- No projects -->
-    <span class="no_items_text">There are no projects</span>
-  </else>
-
-  <p>
-    <b>&raquo;</b> <a href="project">Create new project</a>
-  </p>
-
   <if @mappable_projects:rowcount@ gt 0>
     <p>
       Projects not in this logger application instance which can be linked in:
     </p>
-    <table class="logger_listing" cellpadding="4" cellspacing="1">
-      <tr class="logger_listing_header">
-        <th class="logger_listing_narrow">Name</th>
-        <th class="logger_listing_narrow">Link to instance</th>
-      </tr>
+    <listtemplate name="mappable_projects"></listtemplate>
+    <p></p>
 
-      <multiple name="mappable_projects">
-        <if @mappable_projects.rownum@ odd>
-          <tr class="logger_listing_odd">
-        </if>
-        <else>
-          <tr class="logger_listing_even">
-        </else>
-          <td class="logger_listing">
-            @mappable_projects.name@
-          </td>
-          <td class="logger_listing_narrow" align="center">
-            <a href="@mappable_projects.map_url@">Link</a>
-          </td>
-        </tr>
-      </multiple>
-    </table>
-
   </if>  
 
   <h2 class="logger">Variables</h2>
 
-  <if @variables:rowcount@ ne 0>
-    <table class="logger_listing" cellpadding="4" cellspacing="1">
-      <tr class="logger_listing_header">
-        <th class="logger_listing_narrow">&nbsp;</th>
-        <th class="logger_listing">Name</th>
-        <th class="logger_listing">Unit</th>
-        <th class="logger_listing">Additive</th>
-        <th class="logger_listing_narrow">Permissions</th>
-        <th class="logger_listing_narrow">&nbsp;</th>
-      </tr>
+  <listtemplate name="variables"></listtemplate>
+  <p></p>
 
-    <multiple name="variables">
-      <if @variables.rownum@ odd>
-        <tr class="logger_listing_odd">
-      </if>
-      <else>
-        <tr class="logger_listing_even">
-      </else>
-        <td class="logger_listing_narrow">
-          <a href="@variables.edit_url@" title="Edit variable"><img src="/shared/images/Edit16.gif" height="16" width="16" alt="Edit" border="0"></a>
-        </td>
-        <td class="logger_listing"><a href="@variables.edit_url@">@variables.name@</a></td>
-        <td class="logger_listing">@variables.unit@</td>
-        <td class="logger_listing"><if @variables.type@ eq additive>Yes</if><else>No</else></td>
-        <td class="logger_listing_narrow" align="center">
-          <if @variables.admin_p@>
-            <a href="@variables.permissions_url@">Set</a>
-          </if> 
-        <td class="logger_listing_narrow">
-          <if @variables.admin_p@>
-            <a href="@variables.delete_url@" 
-            onclick="return confirm('Are you sure you want to delete variable @variables.name@?');"
-            title="Delete variable"><img src="/shared/images/Delete16.gif" height="16" width="16" alt="Delete" border="0"></a>
-          </if> 
-        </td>
-      </tr>
-    </multiple>
-
-    </table>    
-  </if>
-  <else>
-    <!-- There are no variables -->
-    <span class="no_items_text">There are no variables</span>
-  </else>
-
-  <p>
-    <b>&raquo;</b> <a href="variable">Add variable</a>
-  </p>
-
   <h2 class="logger">Logger Application Instance</h2>
 
-  <p>
-    <b>&raquo;</b> <a href="@package_permissions_url@">Set permissions for this logger application instance</a>
-  </p>
+  <a href="@package_permissions_url@" class="action">Set permissions for this logger application instance</a>
 
   <h2 class="logger">Help</h2>
 
Index: openacs-4/packages/logger/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/logger/www/admin/index.tcl	7 Nov 2003 17:35:42 -0000	1.8
+++ openacs-4/packages/logger/www/admin/index.tcl	4 Jan 2004 17:24:38 -0000	1.9
@@ -21,6 +21,63 @@
 #
 ###########
 
+
+template::list::create \
+    -name projects \
+    -no_data "No projects in this instance of logger." \
+    -actions {
+        "Create new project" project {}
+    } \
+    -elements {
+        edit {
+            link_url_col edit_url
+            display_template {
+                <img src="/resources/acs-subsite/Edit16.gif" height="16" width="16" alt="Edit" border="0">
+            }
+            sub_class narrow
+            html { align center }
+        }
+        name {
+            label "Project Name"
+            link_url_col display_url
+        }
+        active_p {
+            label "Active"
+            display_template {
+                <if @projects.active_p@ eq t>Yes (<a href="@projects.make_inactive_url@" title="Make this project inactive">toggle</a>)</if><else>No (<a href="@projects.make_active_url@" title="Make this project active">toggle</a>)</else> 
+            }
+            html { align center }
+        }
+        project_lead {
+            label "Project Lead"
+            display_template {@projects.project_lead_chunk;noquote@}
+        }
+        permissions {
+            label "Permissions"
+            link_url_col permissions_url
+            display_template {<if @projects.admin_p@ true>Permissions</if>}
+            sub_class narrow
+            html { align center }
+        }
+        unlink {
+            label "Unlink"
+            link_url_col unmap_url
+            display_template {Unlink}
+            sub_class narrow
+            html { align center }
+        }
+        delete {
+            sub_class narrow
+            display_template {
+                <if @projects.admin_p@>
+                <a href="@projects.delete_url@" title="Delete this project"
+                onclick="return confirm('Are you sure you want to delete project @projects.name@?');"><img src="/shared/images/Delete16.gif" height="16" width="16" alt="Delete" border="0"></a>
+                </if>
+            }            
+            html { align center }
+        }
+    }
+
 db_multirow -extend { 
     edit_url display_url permissions_url delete_url unmap_url project_lead_chunk
     make_active_url make_inactive_url
@@ -43,6 +100,20 @@
 #
 #####
 
+template::list::create \
+    -name "mappable_projects" \
+    -elements {
+        name {
+            label "Project Name"
+        }
+        link {
+            label "Link in"
+            link_url_col map_url
+            html { align center }
+            display_template "Link to instance"
+        }
+    }
+
 if { $user_id != 0 } {
     db_multirow -extend { map_url } mappable_projects select_mappable_projects {} {
         set map_url "project-instance-map?[export_vars { project_id }]"
@@ -58,12 +129,56 @@
 #
 ###########
 
+template::list::create \
+    -name variables \
+    -actions {
+        "Create new variable" variable {}
+    } \
+    -elements {
+        edit {
+            link_url_col edit_url
+            display_template {
+                <img src="/resources/acs-subsite/Edit16.gif" height="16" width="16" alt="Edit" border="0">
+            }
+            sub_class narrow
+            html { align center }
+        }
+        name {
+            label "Variable Name"
+            link_url_col edit_url
+        }
+        unit {
+            label "Unit"
+        }
+        type {
+            label "Additive"
+            display_template {
+                <if @variables.type@ eq additive>Yes</if><else>No</else>
+            }
+        }
+        permissions {
+            label "Permissions"
+            link_url_col permissions_url
+            display_template {<if @variables.admin_p@ true>Permissions</if>}
+            sub_class narrow
+            html { align center }
+        }
+        delete {
+            sub_class narrow
+            display_template {
+                <if @variables.admin_p@>
+                <a href="@variables.delete_url@" title="Delete this variable"
+                onclick="return confirm('Are you sure you want to delete variable @variables.name@?');"><img src="/resources/acs-subsite/Delete16.gif" height="16" width="16" alt="Delete" border="0"></a>
+                </if>
+            }            
+            html { align center }
+        }
+    }
+
 db_multirow -extend { edit_url delete_url permissions_url } variables select_variables {} {
     set edit_url "variable?[export_vars { variable_id {formbutton\:formbuilder\:\:edit Edit} {form\:id variable_form} {form\:mode display}}]"
     set delete_url "variable-delete?[export_vars { variable_id }]"
     set permissions_url "${permissions_uri}?[export_vars {{object_id $variable_id} application_url}]"
 }
 
 set package_permissions_url "${permissions_uri}?[export_vars {{object_id $package_id} application_url}]"
-
-ad_return_template
Index: openacs-4/packages/logger/www/admin/map-variable-to-project.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/map-variable-to-project.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/logger/www/admin/map-variable-to-project.adp	22 May 2003 15:02:07 -0000	1.3
+++ openacs-4/packages/logger/www/admin/map-variable-to-project.adp	4 Jan 2004 17:24:38 -0000	1.4
@@ -2,16 +2,6 @@
 <property name="title">@page_title;noquote@</property>
 <property name="context">@context;noquote@</property>
 
-<if @variables:rowcount@ ne 0>
-  <ul>
-  <multiple name="variables">
-    <li><a href="map-variable-to-project-2?project_id=@project_id@&variable_id=@variables.variable_id@">@variables.name@</a>
-         (@variables.unit@, @variables.type@)</li>
-  </multiple>
-  </ul>
-</if>
-<else>
-  <p>
-    <span class="no_items_text">You do not have access to any variables that are not already added to the project</span>
-  </p>
-</else>
+<p></p>
+<listtemplate name="variables"></listtemplate>
+<p></p>
Index: openacs-4/packages/logger/www/admin/map-variable-to-project.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/map-variable-to-project.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/logger/www/admin/map-variable-to-project.tcl	1 May 2003 14:16:18 -0000	1.2
+++ openacs-4/packages/logger/www/admin/map-variable-to-project.tcl	4 Jan 2004 17:24:38 -0000	1.3
@@ -15,3 +15,29 @@
 
 # List all variables not already mapped to the project
 logger::package::variables_multirow -not_in_project_id $project_id
+
+template::list::create \
+    -name "variables" \
+    -pass_properties { project_id } \
+    -no_data "No variables not already part of this project" \
+    -actions [list "Create new variable" [export_vars -base variable { project_id }] {}] \
+    -elements {
+        name {
+            label "Variable Name"
+        }
+        unit {
+            label "Unit"
+        }
+        type {
+            label "Additive"
+            display_template {
+                <if @variables.type@ eq additive>Yes</if><else>No</else>
+            }
+        }
+        add {
+            sub_class narrow
+            label "Add"
+            display_template "Add"
+            link_url_eval {[export_vars -base map-variable-to-project-2 { project_id variable_id }]}
+        }
+    }
Index: openacs-4/packages/logger/www/admin/project-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project-oracle.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/logger/www/admin/project-oracle.xql	8 May 2003 13:56:04 -0000	1.1
+++ openacs-4/packages/logger/www/admin/project-oracle.xql	4 Jan 2004 17:24:38 -0000	1.2
@@ -3,28 +3,6 @@
 <queryset>
   <rdbms><type>oracle</type><version>8.1.6</version></rdbms>
 
-  <fullquery name="n_can_be_mapped">
-    <querytext>
-        select count(*)
-        from logger_variables lv
-        where (exists (select 1
-                    from logger_project_var_map lpvm,
-                         logger_project_pkg_map lppm
-                    where lv.variable_id = lpvm.variable_id
-                      and lpvm.project_id = lppm.project_id
-                      and lppm.package_id = :package_id
-                   )
-         or lv.package_id = :package_id
-         or lv.package_id is null)
-        and not exists (select 1
-                          from logger_project_var_map lpvm
-                          where lpvm.project_id = :project_id
-                            and lpvm.variable_id = lv.variable_id
-                          )
-        and acs_permission.permission_p(lv.variable_id, :user_id, 'read') = 't'    
-    </querytext>
-  </fullquery>
-
   <fullquery name="select_projections">
     <querytext>
         select lpe.projection_id,
@@ -33,15 +11,16 @@
                lpe.value,
                lpo.name as project_name,
                lv.name as variable_name,
-               to_char(lpe.start_time, 'YYYY-MM-DD') as start_day,
-               to_char(lpe.end_time, 'YYYY-MM-DD') as end_day,
+               to_char(lpe.start_time, 'YYYY-MM-DD') as start_date_ansi,
+               to_char(lpe.end_time, 'YYYY-MM-DD') as end_date_ansi,
                acs_permission.permission_p(lpo.project_id, :user_id, 'admin') as admin_p
         from logger_projections lpe,
              logger_projects lpo,
              logger_variables lv
         where lpe.project_id = :project_id
           and lpe.project_id = lpo.project_id
           and lpe.variable_id = lv.variable_id    
+        order by lpe.start_time, lpe.end_time, lower(lv.name), lower(lpe.name)
     </querytext>
   </fullquery>
 
Index: openacs-4/packages/logger/www/admin/project-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/logger/www/admin/project-postgresql.xql	8 May 2003 13:56:04 -0000	1.1
+++ openacs-4/packages/logger/www/admin/project-postgresql.xql	4 Jan 2004 17:24:38 -0000	1.2
@@ -3,28 +3,6 @@
 <queryset>
   <rdbms><type>postgresql</type><version>7.1</version></rdbms>
 
-  <fullquery name="n_can_be_mapped">
-    <querytext>
-        select count(*)
-        from logger_variables lv
-        where (exists (select 1
-                    from logger_project_var_map lpvm,
-                         logger_project_pkg_map lppm
-                    where lv.variable_id = lpvm.variable_id
-                      and lpvm.project_id = lppm.project_id
-                      and lppm.package_id = :package_id
-                   )
-         or lv.package_id = :package_id
-         or lv.package_id is null)
-        and not exists (select 1
-                          from logger_project_var_map lpvm
-                          where lpvm.project_id = :project_id
-                            and lpvm.variable_id = lv.variable_id
-                          )
-        and acs_permission__permission_p(lv.variable_id, :user_id, 'read') = 't'    
-    </querytext>
-  </fullquery>
-
   <fullquery name="select_projections">
     <querytext>
         select lpe.projection_id,
@@ -33,15 +11,16 @@
                lpe.value,
                lpo.name as project_name,
                lv.name as variable_name,
-               to_char(lpe.start_time, 'YYYY-MM-DD') as start_day,
-               to_char(lpe.end_time, 'YYYY-MM-DD') as end_day,
+               to_char(lpe.start_time, 'YYYY-MM-DD') as start_date_ansi,
+               to_char(lpe.end_time, 'YYYY-MM-DD') as end_date_ansi,
                acs_permission__permission_p(lpo.project_id, :user_id, 'admin') as admin_p
         from logger_projections lpe,
              logger_projects lpo,
              logger_variables lv
         where lpe.project_id = :project_id
           and lpe.project_id = lpo.project_id
           and lpe.variable_id = lv.variable_id    
+        order by lpe.start_time, lpe.end_time, lower(lv.name), lower(lpe.name)
     </querytext>
   </fullquery>
 
Index: openacs-4/packages/logger/www/admin/project.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/logger/www/admin/project.adp	22 May 2003 15:02:07 -0000	1.6
+++ openacs-4/packages/logger/www/admin/project.adp	4 Jan 2004 17:24:38 -0000	1.7
@@ -10,94 +10,11 @@
 <if @project_exists_p@ and @edit_mode_p@ eq 0>
   <h2>Variables</h2>
 
-  <if @variables:rowcount@ gt 0>
-    <table class="logger_listing" cellpadding="3" cellspacing="1">
-      <tr class="logger_listing_header">
-        <th class="logger_listing">Name</th>
-        <th class="logger_listing">Primary</th>
-        <th class="logger_listing">Unmap</th>
-      </tr>
-      <multiple name="variables">
-        <if @variables.rownum@ odd>
-          <tr class="logger_listing_odd">
-        </if>
-        <else>
-          <tr class="logger_listing_even">
-        </else>
-          <td class="logger_listing">
-            <a href="variable?variable_id=@variables.variable_id@">@variables.name@</a>
-          </td>
-          <td class="logger_listing" align="center">
-            <if @variables.primary_p@ true><b>*</b></if>
-            <else><a href="set-primary-variable?variable_id=@variables.variable_id@&project_id=@project_id@">set</a></else>
-          </td>
-          <td class="logger_listing">
-            <if @variables.primary_p@ false>
-              <a href="unmap-variable-from-project?variable_id=@variables.variable_id@&project_id=@project_id@">Unmap</a>
-            </if>
-          </td>
-        </tr>
-      </multiple>
-    </table>
-  </if>
-  <else>
-    <p>
-      <span class="no_items_text">No variables selected</span>
-    </p>
-  </else>
+  <listtemplate name="variables"></listtemplate>
+  <p></p>
 
-  <if @n_can_be_mapped@ gt 0>
-    <p>
-      <b>&raquo;</b> <a href="map-variable-to-project?project_id=@project_id@">Add variable</a>
-    </p>
-  </if>
+  <h2>Projections</h2>
 
-<h2>Projections</h2>
-
-<if @projections:rowcount@ ne 0>
-  <table class="logger_listing" cellpadding="3" cellspacing="1">
-    <tr class="logger_listing_header">
-      <th class="logger_listing">Name</th>
-      <th class="logger_listing">Start day</th>
-      <th class="logger_listing">End day</th>
-      <th class="logger_listing">Variable</th>      
-      <th class="logger_listing">Value</th>
-      <th class="logger_listing">Description</th>
-      <th class="logger_listing_narrow">&nbsp;</th>
-    </tr>
-
-  <multiple name="projections">
-    <if @projections.rownum@ odd>
-      <tr class="logger_listing_odd">
-    </if>
-    <else>
-      <tr class="logger_listing_even">
-    </else>
-      <td class="logger_listing"><a href="projection?projection_id=@projections.projection_id@">@projections.name@</a></td>
-      <td class="logger_listing">@projections.start_day@</td>
-      <td class="logger_listing">@projections.end_day@</td>
-      <td class="logger_listing">@projections.variable_name@</td>
-      <td class="logger_listing">@projections.value@</td>
-      <td class="logger_listing">@projections.description@</td>
-      <td class="logger_listing_narrow">
-        <if @projections.admin_p@>
-          <a href="projection-delete?projection_id=@projections.projection_id@" 
-          onclick="return confirm('Are you sure you want to delete projection @projections.name@?');"
-          title"Delete this projection"><img src="/shared/images/Delete16.gif" width="16" height="16" border="0" alt="Delete"></a>
-        </if> 
-      </td>
-    </tr>
-  </multiple>
-
-  </table>    
+  <listtemplate name="projections"></listtemplate>
+  <p></p>
 </if>
-<else>
-  <!-- There are no projections -->
-  <span class="no_items_text">There are no projections</span>
-</else>
-
-<p>
-  <b>&raquo;</b> <a href="projection?project_id=@project_id@">Add projection</a>
-</p>
-
-</if>
Index: openacs-4/packages/logger/www/admin/project.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/logger/www/admin/project.tcl	27 Sep 2003 22:19:23 -0000	1.12
+++ openacs-4/packages/logger/www/admin/project.tcl	4 Jan 2004 17:24:38 -0000	1.13
@@ -117,6 +117,7 @@
     ad_script_abort
 }
 
+
 if { $project_exists_p } {
     # We are in edit or display mode
 
@@ -126,15 +127,89 @@
     #
     ###########
 
-    db_multirow variables variables_in_project {} 
+    db_multirow -extend { display_url set_primary_url unmap_url } variables variables_in_project {} {
+        set display_url [export_vars -base variable { variable_id }]
+        set set_primary_url [export_vars -base set-primary-variable { variable_id project_id }]
+        set unmap_url [export_vars -base unmap-variable-from-project { variable_id project_id }]
+    }
 
-    set n_can_be_mapped [db_string n_can_be_mapped {}]
-
     ###########
     #
     # Projections
     #
     ###########
 
-    db_multirow projections select_projections {}   
+    db_multirow -extend { display_url start_date_pretty end_date_pretty value_pretty delete_url } projections select_projections {} {
+        set display_url [export_vars -base projection { projection_id }]
+        set start_date_pretty [lc_time_fmt $start_date_ansi "%x"]
+        set end_date_pretty [lc_time_fmt $end_date_ansi "%x"]
+        set value_pretty [lc_numeric $value]
+        set delete_url [export_vars -base projection-delete { projection_id }]
+    }
 }
+
+template::list::create \
+    -name variables \
+    -actions [list "Add variable" [export_vars -base map-variable-to-project { project_id }] {}] \
+    -elements {
+        name {
+            label "Variable Name"
+            link_url_col display_url
+        }
+        unit {
+            label "Unit"
+        }
+        type {
+            label "Additive"
+            display_template {
+                <if @variables.type@ eq additive>Yes</if><else>No</else>
+            }
+            html { align center }
+        }
+        primary_p {
+            label "Primary"
+            display_template {
+                <if @variables.primary_p@ true><b>*</b></if>
+                <else><a href="@variables.set_primary_url@">set</a></else>
+            }
+            html { align center }
+        }
+        unmap {
+            label Unmap
+            link_url_col unmap_url
+            display_template {<if @variables.primary_p@ false>Unmap</if>}
+        }
+    }
+
+
+template::list::create \
+    -name "projections" \
+    -actions [list "Create new projection" [export_vars -base projection { project_id }] {}] \
+    -elements {
+        name {
+            label "Projection Name"
+            link_url_col display_url
+        }
+        start_date_pretty {
+            label "Start"
+        }
+        end_date_pretty {
+            label "End"
+        }
+        variable_name {
+            label "Variable"
+        }
+        value_pretty {
+            label "Value"
+            html { align right }
+        }
+        delete {
+            sub_class narrow
+            display_template {
+                <a href="@projections.delete_url@" title="Delete this projection"
+                onclick="return confirm('Are you sure you want to delete the projection @projections.name@?');"><img src="/resources/acs-subsite/Delete16.gif" height="16" width="16" alt="Delete" border="0"></a>
+                </if>
+            }            
+            html { align center }
+        }
+    }
Index: openacs-4/packages/logger/www/admin/project.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/logger/www/admin/project.xql	8 May 2003 13:56:04 -0000	1.1
+++ openacs-4/packages/logger/www/admin/project.xql	4 Jan 2004 17:24:38 -0000	1.2
@@ -14,7 +14,9 @@
     <querytext>
         select lv.variable_id,
                lv.name,
-               lpvm.primary_p
+               lpvm.primary_p,
+               lv.type,
+               lv.unit
           from logger_project_var_map lpvm,
                logger_variables lv
           where lpvm.variable_id = lv.variable_id
Index: openacs-4/packages/logger/www/admin/variable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/variable.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/logger/www/admin/variable.tcl	9 Nov 2003 22:57:23 -0000	1.6
+++ openacs-4/packages/logger/www/admin/variable.tcl	4 Jan 2004 17:24:38 -0000	1.7
@@ -6,6 +6,7 @@
     @cvs-id $Id$
 } {
     variable_id:optional
+    project_id:optional
 }
 
 set package_id [ad_conn package_id]
@@ -29,7 +30,7 @@
 set context [list $page_title]
 
 set actions_list [list [list Edit "edit"] [list Done done]]
-ad_form -name variable_form -cancel_url index -mode $ad_form_mode -actions $actions_list -form {
+ad_form -name variable_form -cancel_url index -export { project_id } -mode $ad_form_mode -actions $actions_list -form {
     variable_id:key(acs_object_id_seq)
 
     {name:text
@@ -55,17 +56,26 @@
     }
 
 } -new_data {
-    logger::variable::new -variable_id $variable_id \
+    set variable_id [logger::variable::new \
+                         -variable_id $variable_id \
                          -name $name \
                          -unit $unit \
-                         -type $type
+                         -type $type]
+
+    if { [exists_and_not_null project_id] } {
+        logger::project::map_variable \
+            -project_id $project_id \
+            -variable_id $variable_id
+        ad_returnredirect [export_vars -base project { project_id }]
+        ad_script_abort
+    }
 } -edit_data {
-    logger::variable::edit -variable_id $variable_id \
-                         -name $name \
-                         -unit $unit \
-                         -type $type              
+    logger::variable::edit \
+        -variable_id $variable_id \
+        -name $name \
+        -unit $unit \
+        -type $type              
 } -after_submit {
-          
     ad_returnredirect "[ad_conn url]?variable_id=$variable_id"
     ad_script_abort
 }