Index: openacs-4/packages/acs-admin/www/auth/authority-parameters.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/auth/authority-parameters.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-admin/www/auth/authority-parameters.tcl 7 Oct 2003 13:16:15 -0000 1.3 +++ openacs-4/packages/acs-admin/www/auth/authority-parameters.tcl 8 Oct 2003 09:58:01 -0000 1.4 @@ -5,33 +5,40 @@ @author Peter Marklund } { authority_id:integer - column_name } -# Check the column name for validity -if { [lsearch [auth::authority::get_sc_impl_columns] $column_name] == -1 } { - ad_return_error "Invalid column name" "The specified column name \"$column_name\" is invalid. Valid column names are: [auth::authority::get_sc_impl_columns]" -} +auth::authority::get -authority_id $authority_id -array authority +set page_title "Configure" +set authority_url [export_vars -base authority { authority_id }] +set context [list [list "." "Authentication"] [list $authority_url $authority(pretty_name)] $page_title] + + # Get the implementation id and implementation pretty name -db_1row select_impl_id " - select a.$column_name as impl_id, - sci.impl_pretty_name - from auth_authorities a, - acs_sc_impls sci - where a.authority_id = :authority_id - and a.$column_name = sci.impl_id -" +array set parameters [list] +array set parameter_values [list] -auth::authority::get -authority_id $authority_id -array authority +# Each element is a list of impl_ids which have this parameter +array set param_impls [list] -set page_title "Parameter settings for $impl_pretty_name" -set authority_url [export_vars -base authority { {authority_id $authority(authority_id)} }] -set context [list [list "." "Authentication"] [list $authority_url "$authority(pretty_name)"] $page_title] +foreach element_name [auth::authority::get_sc_impl_columns] { + set name_column $element_name + regsub {^.*(_id)$} $element_name {_name} name_column -# Get the parameters that can be configured -array set parameters [auth::driver::get_parameters -impl_id $impl_id] + set impl_params [auth::driver::get_parameters -impl_id $authority($element_name)] + + foreach { param_name dummy } $impl_params { + lappend param_impls($param_name) $authority($element_name) + } + array set parameters $impl_params + + array set parameter_values [auth::driver::get_parameter_values \ + -authority_id $authority_id \ + -impl_id $authority($element_name)] + +} + set has_parameters_p [expr [llength [array names parameters]] > 0] set first_param_name "" @@ -45,18 +52,14 @@ lappend form_widgets [list ${parameter_name}:text,optional [list label $parameter_name] [list help_text $parameters($parameter_name)] {html {size 80}}] } - set hidden_vars {authority_id impl_id column_name} + set hidden_vars {authority_id} ad_form -name parameters \ -cancel_url $authority_url \ -form $form_widgets \ -export $hidden_vars \ -on_request { - array set parameter_values [auth::driver::get_parameter_values \ - -authority_id $authority_id \ - -impl_id $impl_id] - foreach parameter_name [array names parameter_values] { set $parameter_name $parameter_values($parameter_name) } @@ -66,16 +69,17 @@ foreach element_name [template::form::get_elements -no_api parameters] { # Make sure we have a parameter element - if { [lsearch $hidden_vars $element_name] == -1 } { - - auth::driver::set_parameter_value \ - -authority_id $authority_id \ - -impl_id $impl_id \ - -parameter $element_name \ - -value [element get_property parameters $element_name value] + if { [info exists param_impls($element_name)] } { + foreach impl_id $param_impls($element_name) { + auth::driver::set_parameter_value \ + -authority_id $authority_id \ + -impl_id $impl_id \ + -parameter $element_name \ + -value [element get_value parameters $element_name] + } } } - + ad_returnredirect $authority_url ad_script_abort }