Index: openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 14 Sep 2002 13:23:05 -0000 1.11 +++ openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 23 Jan 2003 17:55:24 -0000 1.12 @@ -9,11 +9,17 @@ @cvs-id $Id$ } -ad_proc -private apm_load_xml_packages {} { +ad_proc -private -deprecated apm_load_xml_packages {} { +

+ NOTE: This proc doesn't do anything anymore. +

+ +

Loads XML packages into the running interpreter, if they're not already there. We need to load these packages once per connection, since AOLserver doesn't seem to deal with packages very well. +

} { global ad_conn @@ -91,14 +97,10 @@ Generates an XML-formatted specification for a version of a package. } { - set spec "" - db_1row package_version_select { - select t.package_key, t.package_uri, t.pretty_name, t.pretty_plural, t.package_type, - t.initial_install_p, t.singleton_p, v.* - from apm_package_versions v, apm_package_types t - where v.version_id = :version_id - and v.package_key = t.package_key - } + set spec {} + + db_1row package_version_select {} + apm_log APMDebug "APM: Writing Package Specification for $pretty_name $version_name" append spec " @@ -112,21 +114,12 @@ \n" - db_foreach supported_databases { - select unique db_type - from apm_package_files - where db_type is not null - } { + db_foreach supported_databases {} { append spec " $db_type\n" } append spec " \n" - db_foreach owner_info { - select owner_uri, owner_name - from apm_package_owners - where version_id = :version_id - order by sort_key - } { + db_foreach owner_info {} { append spec " \n" } else { append spec " \n" @@ -173,7 +161,7 @@ append spec "\n \n" apm_log APMDebug "APM: Writing Files." - db_foreach version_path "select path, file_type, db_type from apm_package_files where version_id = :version_id order by path" { + db_foreach version_path {} { append spec " \n" } - append spec " - \n" + append spec " " + append spec "\n \n" + apm_log APMDebug "APM: Writing callbacks" + db_foreach callback_info {} { + append spec " \n" + } + append spec " " + append spec "\n \n" apm_log APMDebug "APM: Writing parameters" - db_foreach parameter_info { - select parameter_name, description, datatype, section_name, default_value, min_n_values, max_n_values - from apm_parameters - where package_key = :package_key - } { + db_foreach parameter_info {} { append spec " files: a list of files in the package, containing elements of the form [list $path $type] +
  • callbacks: an array list of callbacks of the package + on the form [list callback_type1 proc_name1 callback_type2 proc_name2 ...]
  • Element and attribute values directly from the XML specification: package.key, package.url, @@ -430,6 +423,38 @@ } } + # Build a list of package callbacks + array set callback_array {} + + set callbacks_node_list [xml_node_get_children_by_name $version callbacks] + + foreach callbacks_node $callbacks_node_list { + + set callback_node_list [xml_node_get_children_by_name $callbacks_node callback] + foreach callback_node $callback_node_list { + + set type [apm_attribute_value $callback_node type] + set proc [apm_attribute_value $callback_node proc] + + if { [llength [array get callback_array $type]] != 0 } { + # A callback proc of this type already found in the xml file + ns_log Error "package info file $path contains more than one callback proc of type $type" + continue + } + + if { [lsearch -exact [apm_supported_callback_types] $type] < 0 } { + # The callback type is not supported + ns_log Error "package info file $path contains an unsupported callback type $type - ignoring. Valid values are [apm_supported_callback_types]" + continue + } + + set callback_array($type) $proc + } + } + + set properties(callbacks) [array get callback_array] + + # Build a list of the package's owners (if any). set properties(owners) [list]