apm_package_selection_widget (private)

 apm_package_selection_widget pkg_info_list [ to_install ] \
    [ operation ] [ form ]

Defined in packages/acs-admin/tcl/apm-admin-procs.tcl

Provides a widget for selecting packages. Displays dependency information if available.

Parameters:
pkg_info_list (required)
list of package infos for all packages to be listed
to_install (optional)
list of package_keys to install
operation (optional, defaults to "all")
filter for added operations (all, upgrade, install)
form (optional, defaults to "pkgsForm")

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-admin/www/apm/packages-install-2.tcl packages/acs-admin/ www/apm/packages-install-2.tcl apm_package_selection_widget apm_package_selection_widget packages/acs-admin/www/apm/packages-install-2.tcl->apm_package_selection_widget packages/acs-admin/www/apm/packages-install.tcl packages/acs-admin/ www/apm/packages-install.tcl packages/acs-admin/www/apm/packages-install.tcl->apm_package_selection_widget _ _ (public) apm_package_selection_widget->_ apm_higher_version_installed_p apm_higher_version_installed_p (public) apm_package_selection_widget->apm_higher_version_installed_p apm_package_registered_p apm_package_registered_p (public) apm_package_selection_widget->apm_package_registered_p apm_read_package_info_file apm_read_package_info_file (public) apm_package_selection_widget->apm_read_package_info_file pkg_info_comment pkg_info_comment (public) apm_package_selection_widget->pkg_info_comment

Testcases:
No testcase defined.
Source code:
    if {$pkg_info_list eq ""} {
        return ""
    }

    set counter 0
    if {[llength $to_install] > 0} {
        set label [dict get {install Install upgrade Upgrade all Install/Update} $operation]
    } else {
        set label [subst {
            <input type="checkbox" name="_dummy" id="bulkaction-control" title="[_ acs-templating.lt_Checkuncheck_all_rows]">
        }]
        template::add_event_listener  -id bulkaction-control  -preventdefault=false  -script [subst {acs_ListCheckAll('$form', this.checked);}]
    }

    set widget [subst {
        <blockquote><table class='list-table' cellpadding='3' cellspacing='5' summary="Available Packages">
        <tr class='list-header'><th>$label</th><th>Package</th><th>Package Key</th><th>Comment</th></tr>
    }]

    foreach pkg_info $pkg_info_list {

        incr counter
        set package_key [pkg_info_key $pkg_info]
        set package_path [pkg_info_path $pkg_info]
        set spec_file [pkg_info_spec $pkg_info]
        set package [apm_read_package_info_file $spec_file]
        set package_name [dict get $package package-name]
        set version_name [dict get $package name]
        set id $form-$package_key
        ns_log Debug "Selection widget: $package_key, Dependency: [pkg_info_dependency_p $pkg_info]"

        if { [pkg_info_dependency_p $pkg_info] == "t" } {
            #
            # Dependency passed.
            #
            set checked [expr { $package_key in $to_install ? "checked " : "" }]
            append widget [subst {
                <tr class='[expr {$counter % 2 ? "odd" : "even"}]'>
                <td align='center'><input type='checkbox' $checked name='package_key' value='$package_key' id='$id'></td>
                <td>$package_name $version_name</td>
                <td>$package_key</td>
                <td><span style='color:green'>Dependencies satisfied.</span></td>
                </tr>
            }]
        } elseif { [pkg_info_dependency_p $pkg_info] == "f" } {
            #
            # Dependency failed.
            #
            append widget [subst {
                <tr class='[expr {$counter % 2 ? "odd" : "even"}]'>
                <td align='center'><input type='checkbox' name='package_key' value='$package_key' id='$id'></td>
                <td>$package_name $version_name</td>
                <td>$package_key</td>
                <td><span style='color:red'>
            }]
            foreach comment [pkg_info_comment $pkg_info] {
                append widget "$comment<br>"
            }
            append widget  </span></td>  </tr>
        } 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 } {
                if {$operation eq "upgrade"} {
                    incr counter -1
                    continue
                }
                set comment "New install."
            } elseif {$higher_version_p == 1 } {
                if {$operation eq "install"} {
                    incr counter -1
                    continue
                }
                set comment "Upgrade."
            } elseif {$higher_version_p == 0} {
                set comment "Package version already installed."
            } else {
                set comment "Installing older version of package."
            }

            set install_checked [expr {$package_key in $to_install ? "checked" : ""}]
            append widget [subst {
                <tr class='[expr {$counter % 2 ? "odd" : "even"}]'>
                <td align='center'><input type='checkbox' $install_checked name='package_key' value='$package_key' id='$id'></td>
                <td>$package_name $version_name</td>
                <td>$package_key</td>
                <td>$comment</td>
                </tr>
            }]
        }
    }
    if {$counter == 0} {
        set widget ""
    } else {
        append widget {</table></blockquote>}
    }
    return $widget
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-admin/tcl/apm-admin-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: