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.3 -r1.4 --- openacs-4/packages/logger/www/admin/project.tcl 30 Apr 2003 12:21:16 -0000 1.3 +++ openacs-4/packages/logger/www/admin/project.tcl 1 May 2003 14:16:18 -0000 1.4 @@ -9,26 +9,33 @@ } set package_id [ad_conn package_id] +set user_id [ad_conn user_id] -if { ![empty_string_p [ns_set iget [rp_getform] formbutton:done_button]] } { +if { [string equal [form get_action project_form] "done"] } { # User is done editing - redirect back to index page - ad_returnredirect index + ad_returnredirect . ad_script_abort } if { [exists_and_not_null project_id] } { # Initial request in display or edit mode or a submit of the form set page_title "One Project" set ad_form_mode display + set project_exists_p [db_string project_exists_p { + select count(*) + from logger_projects + where project_id = :project_id + }] } else { # Initial request in add mode set page_title "Add a Project" set ad_form_mode edit + set project_exists_p 0 } set context [list $page_title] -set actions_list [list [list Edit "formbuilder::edit"] [list Done done_button]] +set actions_list [list [list Edit "formbuilder::edit"] [list Done done]] ad_form -name project_form \ -cancel_url index \ -mode $ad_form_mode \ @@ -46,30 +53,60 @@ } } -if { [exists_and_not_null project_id] } { +if { $project_exists_p } { # We are in edit or display mode # Display the variables linked to this project set variables_list [list] set variables_text "" db_foreach variables_in_project { select lv.variable_id, - lv.name + lv.name, + lpvm.primary_p from logger_project_var_map lpvm, logger_variables lv where lpvm.variable_id = lv.variable_id and lpvm.project_id = :project_id } { - lappend variables_list "$name" + set variable_link "$name" + if { [string equal $primary_p "f"] } { + append variable_link " \[ unmap | make primary \]" + } else { + append variable_link " (primary)" + } + + lappend variables_list $variable_link } if { [llength $variables_list] != 0 } { - set variables_text [join $variables_list ", "] + set variables_text "
[join $variables_list "
"]
\[add variable\]
" + } + ad_form -extend -name project_form -form { {variables:text(inform) {label Variables}