ad_page_contract { Views information about a package. @author Jon Salz (jsalz@arsdigita.com) @creation-date 17 April 2000 @cvs-id $Id: version-view.tcl,v 1.27 2018/05/09 15:33:28 hectorr Exp $ } { {version_id:naturalnum,optional} {package_key:token,optional} } -validate { version_id_or_package_key { if {[info exists package_key] && ![info exists version_id]} { set version_id [apm_version_id_from_package_key $package_key] if {$version_id eq ""} { ad_complain "No package with package_key '$package_key' is enabled." return } } if {![info exists version_id]} { ad_complain "Specify a valid version_id." } } } db_1row apm_all_version_info { select version_id, package_key, package_uri, pretty_name, version_name, version_uri, summary, description_format, description, singleton_p, initial_install_p, implements_subsite_p, inherit_templates_p, to_char(release_date, 'Month DD, YYYY') as release_date , vendor, vendor_uri, auto_mount, enabled_p, installed_p, tagged_p, imported_p, data_model_loaded_p, to_char(activation_date, 'Month DD, YYYY') as activation_date, tarball_length, distribution_uri, to_char(deactivation_date, 'Month DD, YYYY') as deactivation_date, to_char(distribution_date, 'Month DD, YYYY') as distribution_date from apm_package_version_info where version_id = :version_id } set downloaded_p [ad_decode $version_uri "" 0 1] # Obtain information about the enabled version of the package (if there is one). # We use rownum = 1 in case someone mucks up the database and leaves two package versions # installed and enabled. db_0or1row apm_enabled_version_info {} set installed_version_name_greater_p [expr {[apm_version_names_compare $installed_version_name $version_name] == 1}] db_0or1row apm_data_model_install_version {} if { $vendor eq "" } { set vendor $vendor_uri } foreach field { summary description release_date vendor } { if { [set $field] eq "" } { set $field "-" } } # Later we'll output any items in "prompts" as entries in a bullet list at the # top of the page (these are things that the administrator probably needs to # address ASAP). set prompts [list] if { ![info exists installed_version_id] } { if { !$downloaded_p } { set href [export_vars -base version-generate-info {version_id {write_p 1}}] set status [subst { No version of this package is installed: there is no .info file in the packages/$package_key directory. If you're building the package now, you probably want to generate one. }] } else { set href [export_vars -base version-install {version_id}] set status [subst { No version of this package is installed. You may install this package now. }] } lappend prompts $status } elseif { $installed_version_id == $version_id } { set status "This version of the package is installed" if { $enabled_p == "t" } { append status " and enabled." set can_disable_p 1 } else { append status " but disabled." set can_enable_p 1 } } else { set status [subst { [expr {$installed_version_name_greater_p ? "A newer" : "An older"}] version of this package, version $installed_version_name, is installed and [ad_decode $installed_enabled_p "t" "enabled" "disabled"]. }] if { !$installed_version_name_greater_p } { set href [export_vars -base version-upgrade {version_id}] append body [subst { You may upgrade to this version now. }] } } if { ![info exists data_model_installed_version] } { set data_model_status " No version of the data model for this package has been loaded." } elseif {$data_model_installed_version ne $version_name } { set data_model_status " The data model for version $data_model_installed_version of this package has been loaded." } else { set data_model_status " The data model for this version of this package has been loaded." } if { [file isdirectory "[acs_package_root_dir $package_key]/CVS"] } { set cvs_status "This package is under local CVS control." } else { set cvs_status "This package is not under CVS control." } # Obtain a list of owners, properly hyperlinked. set owners [list] db_foreach apm_all_owners { select owner_uri, owner_name from apm_package_owners where version_id = :version_id } { if { $owner_uri eq "" } { lappend owners $owner_name } else { lappend owners [subst {$owner_name ($owner_uri)}] } } if { [llength $owners] == 0 } { lappend owners "-" } if { [llength $prompts] == 0 } { set prompt_text "" } else { set prompt_text "
Package Name: $pretty_name Version: $version_name OpenACS Core: [ad_decode $initial_install_p "t" "Yes" "No"] Singleton: [ad_decode $singleton_p "t" "Yes" "No"] Implements Subsite: [ad_decode $implements_subsite_p t Yes No] Inherit Templates: [ad_decode $inherit_templates_p t Yes No] Auto-mount: $auto_mount Status: $status }] set supported_databases_list [apm_package_supported_databases $package_key] if { $supported_databases_list eq "" } { set supported_databases "none specified" } else { set supported_databases [join $supported_databases_list ", "] } append body [subst { Data Model: $data_model_status Database Support: $supported_databases CVS: $cvs_status [ad_decode [llength $owners] 1 "Owner" "Owners"]: [join $owners "
"]Package Key: $package_key Summary: $summary Description: $description }] # Dynamic package version attributes array set all_attributes [apm::package_version::attributes::get_spec] array set attributes [apm::package_version::attributes::get \ -version_id $version_id \ -array attributes] foreach attribute_name [array names attributes] { array set attribute $all_attributes($attribute_name) append body [subst { Release Date: $release_date }] } set vendorHTML [ad_decode $vendor_uri "" $vendor [subst {$vendor}]] append body [subst { $attribute(pretty_name): $attributes($attribute_name) Vendor: $vendorHTML Package URL: $package_uri Version URL: $version_uri Distribution File: }] if { $tarball_length ne "" && $tarball_length > 0 } { set href [export_vars -base packages/[file tail $version_uri] {version_id}] append body [subst { [format "%.1f" [expr { $tarball_length / 1024.0 }]]KB }] if { $distribution_uri eq "" } { append body "(generated on this system" if { $distribution_date ne "" } { append body " on $distribution_date" } append body ")" set href [export_vars -base "http://openacs.org/xowf/package-submissions/PackageSubmit.wf" \ {{m create-new} {p.description $summary} {title "[file tail $version_uri]"}}] append body [subst { In order to contribute this package back to the OpenACS community,
}] } else { append body "(downloaded from $distribution_uri" if { $distribution_date ne "" } { append body " on $distribution_date" } append body ")" } } else { append body "None available" if { $installed_p == "t" } { set href [export_vars -base version-generate-tarball {version_id}] append body [subst { (generate one now from the filesystem) }] } } set nr_instances [apm_num_instances $package_key] if {$nr_instances > 0} { set instances [subst { Installed instances of this package: $nr_instances }] } else { set instances "No installed instance of this package\n" } if {$nr_instances == 0 || ($nr_instances > 0 && !$singleton_p)} { set href [export_vars -base package-instance-create { package_key {return_url [ad_return_url]}}] set instance_create [subst {
- download the .apm-file to your file system and
- submit the .apm-file to the package repository of OpenACS.
Create (unmounted) instance of this package }] } else { set instance_create "" } append body [subst {