Index: openacs-4/contrib/packages/project-manager/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit.tcl,v diff -u -r1.16.2.1 -r1.16.2.2 --- openacs-4/contrib/packages/project-manager/www/add-edit.tcl 20 May 2004 17:30:05 -0000 1.16.2.1 +++ openacs-4/contrib/packages/project-manager/www/add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.16.2.2 @@ -70,6 +70,18 @@ } +if {[ad_form_new_p -key project_item_id]} { + set logger_project "" + set logger_values "" +} else { + + set logger_project [pm::project::get_logger_project -project_item_id $project_item_id] + set logger_values [logger::project::get_variables -project_id $logger_project] + +} + +ns_log Notice "Logger values: $logger_values" + ad_form -name add_edit \ -form { project_id:key @@ -128,22 +140,28 @@ {options {[db_list_of_lists get_status_codes { }]}} } + {variables:text(multiselect),multiple + {label "Logged variables"} + {options {[logger::ui::variable_options_all]}} + {values {$logger_values}} + {html {size 6}} + } + } - if {[exists_and_not_null project_id]} { if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { ad_form -extend -name add_edit -form { {category_ids:integer(category),multiple {label "Categories"} - {html {size 4}} {value {$project_item_id $package_id}} + {html {size 7}} {value {$project_item_id $package_id}} } } } } else { if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { ad_form -extend -name add_edit -form { - {category_ids:integer(category),multiple {label "Categories"} - {html {size 4}} {value {}} + {category_ids:integer(category),multiple,optional {label "Categories"} + {html {size 7}} {value {}} } } } @@ -177,7 +195,6 @@ -select_query_name project_query \ -on_submit { - set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] @@ -215,16 +232,31 @@ ] set project_item_id [pm::project::get_project_item_id -project_id $project_id] + set logger_project [pm::project::get_logger_project -project_item_id $project_item_id] if {[exists_and_not_null category_ids]} { category::map_object -remove_old -object_id $project_item_id $category_ids } + if {[exists_and_not_null variables]} { + foreach var $variables { + logger::project::map_variable \ + -project_id $logger_project \ + -variable_id $var + } + } else { + # add in the default variable + logger::project::map_variable \ + -project_id $logger_project \ + -variable_id [logger::variable::get_default_variable_id] + } + if {$use_project_customizations_p} { - ad_returnredirect "add-edit-2?[export_url_vars project_item_id project_id]" + # warn of current bug so users can work around it + ad_returnredirect -message "You must submit changes on this page or you will lose any data on this page" "add-edit-2?[export_url_vars project_item_id project_id]" ad_script_abort } else { - ad_returnredirect "one?[export_url_vars project_item_id project_id]" + ad_returnredirect -message "Project: '$project_name' added" "one?[export_url_vars project_item_id project_id]" ad_script_abort } @@ -256,19 +288,30 @@ set project_item_id [pm::project::get_project_item_id \ -project_id $project_id] + + set logger_project [pm::project::get_logger_project -project_item_id $project_item_id] + if {[exists_and_not_null variables]} { + + logger::project::remap_variables -project_id $logger_project -new_variable_list $variables + + } else { + logger::project::remap_variables -project_id $logger_project -new_variable_list [logger::variable::get_default_variable_id] + } + if {[exists_and_not_null category_ids]} { category::map_object -remove_old -object_id $project_item_id $category_ids } } -after_submit { if {$use_project_customizations_p} { - ad_returnredirect "add-edit-2?[export_url_vars project_id old_project_id]" + # warn of current bug so users can work around it + ad_returnredirect -message "You must submit changes on this page or you will lose any data on this page" "add-edit-2?[export_url_vars project_id old_project_id]" pm::project::compute_parent_status $project_item_id ad_script_abort } else { - ad_returnredirect "one?[export_url_vars project_id]" + ad_returnredirect -message "Changes to project saved" "one?[export_url_vars project_id]" pm::project::compute_parent_status $project_item_id ad_script_abort }