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 @@
Projects
-
- <% # Project table header %>
+
+
+
-
-
-
- <% # Project table rows %>
-
-
-
-
-
-
-
-
-
- |
-
- @projects.name@
- |
- Yes (toggle)No (toggle) |
- @projects.project_lead_chunk;noquote@ |
-
-
- Set
-
- |
-
- Unlink
- |
-
-
-
-
- |
-
-
-
- <% # Close project table %>
-
-
-
-
- There are no projects
-
-
-
- » Create new project
-
-
Projects not in this logger application instance which can be linked in:
-
-
+
+
-
-
-
-
-
-
-
-
- @mappable_projects.name@
- |
-
- Link
- |
-
-
-
-
Variables
-
-
-
+
+
-
-
-
-
-
-
-
-
-
- |
- @variables.name@ |
- @variables.unit@ |
- YesNo |
-
-
- Set
-
- |
-
-
-
- |
-
-
-
-
-
-
-
- There are no variables
-
-
-
- » Add variable
-
-
Logger Application Instance
-
- » Set permissions for this logger application instance
-
+ Set permissions for this logger application instance
Help
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 {
+
+ }
+ sub_class narrow
+ html { align center }
+ }
+ name {
+ label "Project Name"
+ link_url_col display_url
+ }
+ active_p {
+ label "Active"
+ display_template {
+ Yes (toggle)No (toggle)
+ }
+ 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 {Permissions}
+ 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 {
+
+
+
+ }
+ 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 {
+
+ }
+ sub_class narrow
+ html { align center }
+ }
+ name {
+ label "Variable Name"
+ link_url_col edit_url
+ }
+ unit {
+ label "Unit"
+ }
+ type {
+ label "Additive"
+ display_template {
+ YesNo
+ }
+ }
+ permissions {
+ label "Permissions"
+ link_url_col permissions_url
+ display_template {Permissions}
+ sub_class narrow
+ html { align center }
+ }
+ delete {
+ sub_class narrow
+ display_template {
+
+
+
+ }
+ 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 @@
@page_title;noquote@
@context;noquote@
-
-
-
-
-
- You do not have access to any variables that are not already added to the project
-
-
+
+
+
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 {
+ YesNo
+ }
+ }
+ 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 @@
oracle8.1.6
-
-
- 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'
-
-
-
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)
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 @@
postgresql7.1
-
-
- 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'
-
-
-
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)
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 @@
Variables
-
-
-
-
-
- No variables selected
-
-
+
+
-
-
- » Add variable
-
-
+ Projections
-Projections
-
-
-
-
-
-
-
-
-
-
-
-
- @projections.name@ |
- @projections.start_day@ |
- @projections.end_day@ |
- @projections.variable_name@ |
- @projections.value@ |
- @projections.description@ |
-
-
-
-
- |
-
-
-
-
+
+
-
-
- There are no projections
-
-
-
- » Add projection
-
-
-
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 {
+ YesNo
+ }
+ html { align center }
+ }
+ primary_p {
+ label "Primary"
+ display_template {
+ *
+ set
+ }
+ html { align center }
+ }
+ unmap {
+ label Unmap
+ link_url_col unmap_url
+ display_template {Unmap}
+ }
+ }
+
+
+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 {
+
+
+ }
+ 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 @@
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
}