Index: openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 23 Apr 2003 06:08:37 -0000 1.4.2.1 +++ openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 2 Jul 2003 19:51:28 -0000 1.4.2.2 @@ -12,24 +12,24 @@ Build a dynamic section dimensional slider. } { set sections [db_list apm_parameter_sections { - select distinct(section_name) - from apm_parameters - where package_key = :package_key + select distinct(section_name) + from apm_parameters + where package_key = :package_key }] if { [llength $sections] > 1 } { - set i 0 - lappend section_list [list $package_key $package_key [list "where" "section_name is null"]] - foreach section $sections { - incr i - if { ![empty_string_p $section] } { - lappend section_list [list "section_$i" $section [list "where" "section_name = '[db_quote $section]'"]] - } - } - lappend section_list [list all "All" [list] ] - return [list [list section_name "Section:" $package_key $section_list]] + set i 0 + lappend section_list [list $package_key $package_key [list "where" "section_name is null"]] + foreach section $sections { + incr i + if { ![empty_string_p $section] } { + lappend section_list [list "section_$i" $section [list "where" "section_name = '[db_quote $section]'"]] + } + } + lappend section_list [list all "All" [list] ] + return [list [list section_name "Section:" $package_key $section_list]] } else { - return "" + return "" } } @@ -46,17 +46,17 @@ set apm_url "/acs-admin/apm" if { [llength $args] == 0 } { - set title $apm_title + set title $apm_title set context_bar [ad_context_bar $title] } else { - set title [lindex $args end] + set title [lindex $args end] set context [concat [list [list $apm_url $apm_title]] $args] set context_bar [eval ad_context_bar $context] } set header [ad_header $title ""] append body "$header\n" if {![empty_string_p $form]} { - append body "
" + append body "" } return "$body\n @@ -70,132 +70,160 @@ set out "" set line_length 0 foreach element $cmd { - if { $line_length + [string length $element] > 72 } { - append out "\\\n " - set line_length 4 - } - append out "$element " - incr line_length [expr { [string length $element] + 1 }] + if { $line_length + [string length $element] > 72 } { + append out "\\\n " + set line_length 4 + } + append out "$element " + incr line_length [expr { [string length $element] + 1 }] } append out "\n" } -ad_proc -private apm_package_selection_widget {pkg_info_list {to_install ""} {to_enable ""}} { +ad_proc -private apm_package_selection_widget { + -install_enable:boolean + pkg_info_list + {to_install ""} + {to_enable ""} +} { Provides a widget for selecting packages. Displays dependency information if available. + + @param intall_enable Set this flag if you want separate install and enable checkboxes to be displayed. If you don't set it, + only the enable checkbox will be displayed, and the resulting page is expected to assume that enable also means install. } { if {[empty_string_p $pkg_info_list]} { - return "" + return "" } set checkbox_count 0 set counter 0 set band_colors { white "#ececec" } set widget "
- +[ad_decode $install_enable_p 1 "" ""] " foreach pkg_info $pkg_info_list { - - incr counter - set package_key [pkg_info_key $pkg_info] - set spec_file [pkg_info_spec $pkg_info] - array set package [apm_read_package_info_file $spec_file] - set version_name $package(name) - ns_log Debug "Selection widget: $package_key, Dependency: [pkg_info_dependency_p $pkg_info]" + + incr counter + set package_key [pkg_info_key $pkg_info] + set spec_file [pkg_info_spec $pkg_info] + array set package [apm_read_package_info_file $spec_file] + set version_name $package(name) + ns_log Debug "Selection widget: $package_key, Dependency: [pkg_info_dependency_p $pkg_info]" - append widget " " - if { ![string compare [pkg_info_dependency_p $pkg_info] "t"]} { - # Dependency passed. - if { ([lsearch -exact $to_install $package_key] != -1) } { - append widget " " - } else { - append widget " " - } - if { [lsearch -exact $to_enable $package_key] != -1 } { - append widget " - - - - - " - } elseif { ![string compare [pkg_info_dependency_p $pkg_info] "f"] } { - #Dependency failed. - append widget " " - append widget " - - - + append widget " " + if { ![string compare [pkg_info_dependency_p $pkg_info] "t"]} { + # Dependency passed. + + if { $install_enable_p } { + if { ([lsearch -exact $to_install $package_key] != -1) } { + append widget " " + } else { + append widget " " + } + } + if { [lsearch -exact $to_enable $package_key] != -1 } { + append widget " + + + + + " + } elseif { ![string compare [pkg_info_dependency_p $pkg_info] "f"] } { + #Dependency failed. + if { $install_enable_p } { + append widget " " + } + append widget " + + + - - " - } else { - # No dependency information. - # See if the install is already installed with a higher version number. - if {[apm_package_registered_p $package_key]} { - set higher_version_p [apm_higher_version_installed_p $package_key $version_name] - } else { - set higher_version_p 2 - } - if {$higher_version_p == 2 } { - set comment "New install." - } elseif {$higher_version_p == 1 } { - set comment "Upgrade." - } elseif {$higher_version_p == 0} { - set comment "Package version already installed." - } else { - set comment "Installing older version of package." - } - - append widget " " + " + foreach comment [pkg_info_comment $pkg_info] { + append widget "$comment
" + } + append widget " + + + " + } else { + # No dependency information. + # See if the install is already installed with a higher version number. + if {[apm_package_registered_p $package_key]} { + set higher_version_p [apm_higher_version_installed_p $package_key $version_name] + } else { + set higher_version_p 2 + } + if {$higher_version_p == 2 } { + set comment "New install." + } elseif {$higher_version_p == 1 } { + set comment "Upgrade." + } elseif {$higher_version_p == 0} { + set comment "Package version already installed." + } else { + set comment "Installing older version of package." + } + + append widget " " - if { ([lsearch -exact $to_install $package_key] != -1) } { + if { ([lsearch -exact $to_install $package_key] != -1) } { set install_checked "checked" } else { set install_checked "" } - if { ([lsearch -exact $to_enable $package_key] != -1) } { + if { ([lsearch -exact $to_enable $package_key] != -1) } { set enable_checked "checked" } else { set enable_checked "" } - append widget " - - + if { $install_enable_p } { + append widget " + " + } else { + append widget " + " + } + + append widget " + - - " - } - incr checkbox_count 2 + + " + } + incr checkbox_count 2 } append widget "
InstallEnablePackageDirectoryComment
InstallEnablePackageDirectoryComment
$package(package-name) $package(name)/packages/$package(package.key)/Dependencies satisfied.
$package(package-name) $package(name)/packages/$package(package.key)/
$package(package-name) $package(name)/packages/$package(package.key)/Dependencies satisfied.
$package(package-name) $package(name)/packages/$package(package.key)/ - " - foreach comment [pkg_info_comment $pkg_info] { - append widget "$comment
" - } - append widget " -
$package(package-name) $package(name)$package(package-name) $package(name) /packages/$package(package.key)/$comment
$comment
" return $widget