Index: openacs-4/packages/acs-admin/acs-admin.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/acs-admin.info,v diff -u -N -r1.16.2.3 -r1.16.2.4 --- openacs-4/packages/acs-admin/acs-admin.info 9 Dec 2002 14:29:22 -0000 1.16.2.3 +++ openacs-4/packages/acs-admin/acs-admin.info 5 Mar 2003 14:42:59 -0000 1.16.2.4 @@ -7,7 +7,7 @@ t t - + oracle postgresql @@ -18,7 +18,7 @@ OpenACS A UI for administering the OpenACS system. - + Index: openacs-4/packages/acs-admin/www/apm/file-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-add-2.tcl,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/file-add-2.tcl 10 Sep 2002 22:21:59 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,36 +0,0 @@ -ad_page_contract { - Add files to a package. - - @param version_id The identifier for the package. - @param file_index The files to be added. - @param processed_files The paths and types of the files to be added. - @author Jon Salz (jsalz@arsdigita.com) - @creation-date 17 April 2000 - @cvs-id $Id: file-add-2.tcl,v 1.4 2002/09/10 22:21:59 jeffd Exp $ -} { - {version_id:integer} - {file_index:multiple} - processed_files -} - -db_transaction { - foreach index $file_index { - set info [lindex $processed_files $index] - set index_path [lindex $info 0] - set file_type [lindex $info 1] - set db_type [lindex $info 2] - # Do a doubleclick protection check. - if { ![db_string apm_file_add_doubleclick_ck { - select count(*) from apm_package_files - where version_id = :version_id - and path = :index_path - } -default 0] } { - apm_file_add $version_id $index_path $file_type $db_type - } - } - apm_package_install_spec $version_id -} - -db_release_unused_handles -ad_returnredirect "version-files?version_id=$version_id" - Index: openacs-4/packages/acs-admin/www/apm/file-add-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-add-2.xql,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/file-add-2.xql 27 Apr 2001 01:41:12 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ - - - - - - - select count(*) from apm_package_files - where version_id = :version_id - and path = :index_path - - - - - - Index: openacs-4/packages/acs-admin/www/apm/file-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-add.tcl,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/file-add.tcl 10 Sep 2002 22:21:59 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,106 +0,0 @@ -ad_page_contract { - Allows the user to add files to a package. - @param version_id The identifier for the package. - @author Jon Salz (jsalz@arsdigita.com) - @creation-date 17 April 2000 - @cvs-id $Id: file-add.tcl,v 1.4 2002/09/10 22:21:59 jeffd Exp $ -} { - {version_id:integer} - {verbose:integer 0} -} - -apm_version_info $version_id - -doc_body_append "[apm_header -form "method=post action=\"file-add-2\"" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Add Files"] - -[export_form_vars version_id] - -
- -" - -doc_body_flush - -# Obtain a list of all files registered to the package already. -array set registered_files [list] -foreach file [db_list apm_file_paths { - select path from apm_package_files where version_id = :version_id -}] { - set registered_files($file) 1 -} - -db_release_unused_handles - -# processed_files is a list of sublists, each of which contains -# the path of a file and its file type. -set processed_files [list] -set counter 0 -set registered 0 - -foreach file [lsort [ad_find_all_files -check_file_func apm_include_file_p [acs_package_root_dir $package_key]]] { - set relative_path [ad_make_relative_path $file] - - # Now kill "packages" and the package_key from the path. - set components [split $relative_path "/"] - set relative_path [join [lrange $components 2 [llength $components]] "/"] - - if { [info exists registered_files($relative_path)] } { - incr registered - if { $verbose } { - doc_body_append "\n" - } - } else { - set type [apm_guess_file_type $package_key $relative_path] - set db_type [apm_guess_db_type $package_key $relative_path] - doc_body_append "\n" - lappend processed_files [list $relative_path $type $db_type] - } - incr counter -} - -db_release_unused_handles -# Transport the list of files to the next page. -doc_body_append [export_form_vars processed_files] - -if { $counter == 0 } { - doc_body_append "
$relative_path (already registered to this package)
 $relative_path: [apm_pretty_name_for_file_type $type]" - if { ![empty_string_p $db_type] } { - doc_body_append " ([apm_pretty_name_for_db_type $db_type])" - } - doc_body_append "
There are no files in the packages/$package_key directory.
" -} elseif { [llength $processed_files] > 0 } { - doc_body_append " - -
-\[ check all | -uncheck all \] -
- -
- -" -} else { - doc_body_append "
There are no additional files to add to the package." -} - -if { $registered < 1 } { - doc_body_append "

No registered files exist" -} else { - if { $verbose } { - doc_body_append "

$registered registered files hide them" - } else { - doc_body_append "

$registered registered files hidden display them" - } -} - -doc_body_append "

\n[ad_footer]\n" - Index: openacs-4/packages/acs-admin/www/apm/file-add.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-add.xql,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/file-add.xql 27 Apr 2001 01:41:12 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ - - - - - - - select path from apm_package_files where version_id = :version_id - - - - - - Index: openacs-4/packages/acs-admin/www/apm/file-remove.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-remove.tcl,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/file-remove.tcl 10 Sep 2002 22:21:59 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,33 +0,0 @@ -ad_page_contract { - - Removes a file. - - @author Bryan Quinn (bquinn@arsdigita.com) - - @creation-date 17 April 2000 - @param file_id An array of file ids to remove. - @cvs-id $Id: file-remove.tcl,v 1.2 2002/09/10 22:21:59 jeffd Exp $ -} { - {version_id:naturalnum} - {file_id:multiple} -} - -if {![db_0or1row apm_get_version_id " -select distinct version_id -from apm_package_files -where file_id in ([join $file_id ","])"]} { - ad_returnredirect "version-files?version_id=$version_id" - ad_script_abort -} - -db_transaction { - db_dml apm_delete_files "delete from apm_package_files - where file_id in ([join $file_id ","])" - apm_package_install_spec $version_id -} on_error { - ad_return_error "File Removal Error" "The following error was returned when - trying to remove the files:
[ad_quotehtml $errmsg]
" -} - -db_release_unused_handles -ad_returnredirect "version-files?version_id=$version_id" \ No newline at end of file Index: openacs-4/packages/acs-admin/www/apm/file-remove.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-remove.xql,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/file-remove.xql 27 Apr 2001 01:41:12 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,22 +0,0 @@ - - - - - - -select distinct version_id -from apm_package_files -where file_id in ([join $file_id ","]) - - - - - - - delete from apm_package_files - where file_id in ([join $file_id ","]) - - - - - Index: openacs-4/packages/acs-admin/www/apm/file-watch.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/file-watch.tcl,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-admin/www/apm/file-watch.tcl 18 Sep 2002 14:54:45 -0000 1.5 +++ openacs-4/packages/acs-admin/www/apm/file-watch.tcl 5 Mar 2003 14:43:12 -0000 1.5.2.1 @@ -1,49 +1,30 @@ ad_page_contract { Schedules a file to be watched. - - @param file_id The id of the file to watch. @author Jon Salz [jsalz@arsdigita.com] @creation-date 17 April 2000 @cvs-id $Id$ } { - file_id:integer -} -validate { - valid_version_id { - set version_id [apm_version_from_file $file_id] - if {$version_id == 0} { - ad_complain - } - } -} -errors { - valid_version_id {The file you have requested is not registerd.} -} + version_id:integer + paths:multiple +} +apm_version_info $version_id -db_1row apm_get_file_to_watch { - select t.package_key, t.pretty_name, - v.version_name, v.package_key, v.installed_p, - f.path, f.version_id - from apm_package_types t, apm_package_versions v, apm_package_files f - where f.file_id = :file_id - and f.version_id = v.version_id - and v.package_key = t.package_key -} +set count 0 +foreach path $paths { + incr count -# Why did we need all that information? -KS + apm_file_watch "packages/$package_key/$path" -doc_body_append "[apm_header -form "method=post action=\"file-add-2\"" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Watch file"] - -" - -db_1row apm_get_path_from_file_id { - select path from apm_package_files where file_id = :file_id + lappend path_list $path } -apm_file_watch "packages/$package_key/$path" +doc_body_append "[apm_header -form "method=post action=\"file-add-2\"" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Watch file"]" -doc_body_append "Marking the following file to be watched:
  • $path
+doc_body_append "Marking the following files to be watched:
  • [join $path_list "
  • "]
+ Return to the list of files for $pretty_name $version_name
Return to the Package Manager Index: openacs-4/packages/acs-admin/www/apm/file-watch.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-watch.xql,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/file-watch.xql 27 Apr 2001 01:41:12 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,28 +0,0 @@ - - - - - - - select t.package_key, t.pretty_name, - v.version_name, v.package_key, v.installed_p, - f.path, f.version_id - from apm_package_types t, apm_package_versions v, apm_package_files f - where f.file_id = :file_id - and f.version_id = v.version_id - and v.package_key = t.package_key - - - - - - - - - select path from apm_package_files where file_id = :file_id - - - - - - Index: openacs-4/packages/acs-admin/www/apm/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/index.tcl,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/acs-admin/www/apm/index.tcl 29 Aug 2002 09:52:39 -0000 1.6 +++ openacs-4/packages/acs-admin/www/apm/index.tcl 5 Mar 2003 14:43:12 -0000 1.6.2.1 @@ -73,13 +73,19 @@ { maintained "Maintained" "" {[ad_decode $distribution_uri "" "Locally" "Externally"]} } { action "" "" {  [eval { - ns_log Notice "Status for $version_id: [apm_version_load_status $version_id]" - if { $installed_p == "t" && $enabled_p == "t" && \ - [string equal [apm_version_load_status $version_id] "needs_reload"] } { - format "reload" - } else { - format "" - } + + if { $installed_p == "t" && $enabled_p == "t" } { + set watch_all_link "watch all files" + set format_string $watch_all_link + + if {[string equal [apm_version_load_status $version_id] "needs_reload"]} { + set format_string "$watch_all_link | reload changed" + } + } else { + set format_string "" + } + format $format_string + }]  } } } @@ -90,7 +96,10 @@ db_release_unused_handles -doc_body_append "

Packages

$table
+doc_body_append "

Packages

+ +$table +
  • Create a new package.
  • Write new specification files for all installed, locally generated packages Index: openacs-4/packages/acs-admin/www/apm/package-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-add-2.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/acs-admin/www/apm/package-add-2.tcl 10 Sep 2002 22:21:59 -0000 1.3 +++ openacs-4/packages/acs-admin/www/apm/package-add-2.tcl 5 Mar 2003 14:43:12 -0000 1.3.2.1 @@ -11,6 +11,7 @@ { package_type "apm_application"} { initial_install_p "f" } { singleton_p "f" } + { auto_mount "" } package_uri version_name version_uri @@ -89,7 +90,7 @@ summary {Please summarize your package so that users can determine what it is for.} description {Please provide a description of your package so that users can consider using it.} descrption_format {Please indicate if your package is HTML or text.} - package_key_format {The package key should contain only letters, numbers, and hyphens and it must be lowercase.} + package_key_format {The package key should contain only letters, numbers, and hyphens (dashes) and it must be lowercase.} package_id {You must provide an integer key for your package.} version_id {You must provide an integer key for your package version.} } @@ -101,7 +102,7 @@ # Insert the version set version_id [apm_package_install_version -callback apm_dummy_callback -version_id \ $version_id $package_key $version_name $version_uri $summary $description \ - $description_format $vendor $vendor_uri] + $description_format $vendor $vendor_uri $auto_mount] apm_version_enable -callback apm_dummy_callback $version_id apm_package_install_owners -callback apm_dummy_callback \ [apm_package_install_owners_prepare $owner_name $owner_uri] $version_id Index: openacs-4/packages/acs-admin/www/apm/package-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-add.tcl,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-admin/www/apm/package-add.tcl 10 Sep 2002 22:21:59 -0000 1.5 +++ openacs-4/packages/acs-admin/www/apm/package-add.tcl 5 Mar 2003 14:43:12 -0000 1.5.2.1 @@ -107,7 +107,18 @@ such as the ACS Kernel. + Auto-mount URI + + + + + The URI (name) under the main site where the package will automatically be + mounted upon installation. This feature is typically only used by singleton packages. + + + + Pick a canonical URL for your package. This should be a URL where the package can be downloaded. Index: openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl,v diff -u -N -r1.1.1.1.4.1 -r1.1.1.1.4.2 --- openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 22 Jan 2003 18:28:20 -0000 1.1.1.1.4.1 +++ openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 5 Mar 2003 14:43:12 -0000 1.1.1.1.4.2 @@ -25,16 +25,37 @@ doc_body_append [apm_header [list "version-view?version_id=$version_id" "$pretty_name $version_name"] "Delete"] +# Unmount all instances of this package with the Tcl API that invokes before-unmount callbacks +db_foreach all_package_instances { + select site_nodes.node_id + from apm_packages, site_nodes + where apm_packages.package_id = site_nodes.object_id + and apm_packages.package_key = :package_key +} { + set url [site_node::get_url -node_id $node_id] + doc_body_append "Unmounting package instance at url $url
    " + site_node::unmount -node_id $node_id +} + +# Delete the package instances with Tcl API that invokes before-uninstantiate callbacks +db_foreach all_package_instances { + select package_id + from apm_packages + where package_key = :package_key +} { + doc_body_append "Deleting package instance $package_id
    " + apm_package_instance_delete $package_id +} + +# Invoke the before-uninstall Tcl callback before the sql drop scripts +apm_invoke_callback_proc -version_id $version_id -type before-uninstall + if {![empty_string_p $sql_drop_scripts]} { doc_body_append "Now executing drop scripts.
      " - db_foreach drop_file_query " - select path from apm_package_files - where file_id in ([join $sql_drop_scripts \",\"]) - and file_type='data_model_drop' - " { + foreach path $sql_drop_scripts { doc_body_append "
    • "
       	db_source_sql_file -callback apm_doc_body_callback "[acs_package_root_dir $package_key]/$path"
       	doc_body_append "
      " Index: openacs-4/packages/acs-admin/www/apm/package-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-delete.tcl,v diff -u -N -r1.3.4.1 -r1.3.4.2 --- openacs-4/packages/acs-admin/www/apm/package-delete.tcl 22 Jan 2003 18:28:20 -0000 1.3.4.1 +++ openacs-4/packages/acs-admin/www/apm/package-delete.tcl 5 Mar 2003 14:43:12 -0000 1.3.4.2 @@ -14,24 +14,17 @@ set db_type [db_type] -db_foreach apm_package_drop_scripts { - select file_id, path - from apm_package_files - where version_id = :version_id - and file_type = 'data_model_drop' - and (db_type is null or db_type = :db_type) -} { +set file_list "" +foreach file [apm_get_package_files -package_key $package_key -file_types data_model_drop] { append file_list " - - $path + + $file " -} if_no_rows { - set file_list "" -} +} if {![empty_string_p $file_list]} { set file_list " - Please check the drop scripts you want to run. Be aware that this will + We recommend sourcing all of the drop scripts for the package. Be aware that this will erase all data associated with this package from the database. $file_list Index: openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl 18 Sep 2002 11:54:42 -0000 1.5 +++ openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl 5 Mar 2003 14:43:12 -0000 1.5.2.1 @@ -18,23 +18,27 @@ ad_set_client_property -clob t apm pkg_install_list "" ad_set_client_property -clob t apm pkg_enable_list "" -foreach install_key $install { - foreach spec_file $spec_files { - # Find the spec_file that has the install_key - if { [catch { - array set package [apm_read_package_info_file $spec_file] - } errmsg] } { - # Unable to parse specification file. - # If we get here, its because someone hacked the archive the loading process - # which checks the info file and displays an error. - # process - ns_log Error "$spec_file could not be parsed correctly. It is not being installed. - The error: $errmsg" - } - if {![string compare $package(package.key) $install_key]} { - lappend install_spec_files $spec_file - } +foreach spec_file $spec_files { + # Get package info, and find out if this is a package we should install + if { [catch { + array set package [apm_read_package_info_file $spec_file] + } errmsg] } { + # Unable to parse specification file. + # If we get here, its because someone hacked the archive the loading process + # which checks the info file and displays an error. + # process + ns_log Error "$spec_file could not be parsed correctly. It is not being installed. + The error: $errmsg" } + + # Save the package info, we may need it for dependency satisfaction later + lappend pkg_info_list [pkg_info_new $package(package.key) $spec_file \ + $package(provides) $package(requires) ""] + + if { [lsearch -exact $install $package(package.key)] != -1 } { + # This is a package which we should install + lappend install_spec_files $spec_file + } } if {![info exists install_spec_files]} { @@ -44,9 +48,40 @@ } ### Dependency Check -set dependency_results [apm_dependency_check $install_spec_files] +set dependency_results [apm_dependency_check -pkg_info_all $pkg_info_list $install_spec_files] -if { ([lindex $dependency_results 0] == 1) || ![string compare $force_p "t"]} { +if { [lindex $dependency_results 0] == 1 && [llength [lindex $dependency_results 2]] > 0 } { + + set extra_package_keys [lindex $dependency_results 2] + + # Check was good after adding a couple more pacakges + + doc_body_append "[apm_header "Package Installation"] +

      Additional Packages Automatically Added

      + + Some of the packages you were trying to install required other packages to be installed first. + We've added these additional packages needed, and ask you to review the list of packages below. + +
      + [export_form_vars spec_files]

      + +

      +
      + " + + set install [concat $install $extra_package_keys] + set enable [concat $enable $extra_package_keys] + + doc_body_append [apm_package_selection_widget [lindex $dependency_results 1] $install $enable] + + doc_body_append " +
      + + + [ad_footer] + " + +} elseif { ([lindex $dependency_results 0] == 1) || ![string compare $force_p "t"]} { ### Check passed! Initiate install. # We use client properties to pass along this information as it is fairly large. @@ -63,7 +98,7 @@ Some of the packages you are trying to install have unsatisfied dependencies. The packages with unsatisfied dependencies have been deselected. If you wish to install packages that do not pass dependencies, please click the \"force\" option below. -
      +
      • To install a package is to load its data model. @@ -79,10 +114,6 @@ " - set checkbox_count 0 - set counter 0 - set pkg_info_list [list] - set band_colors { white "\#ececec" } doc_body_append [apm_package_selection_widget [lindex $dependency_results 1] $install $enable] Index: openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl,v diff -u -N -r1.4 -r1.4.2.1 --- openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl 18 Sep 2002 15:47:15 -0000 1.4 +++ openacs-4/packages/acs-admin/www/apm/packages-install-3.tcl 5 Mar 2003 14:43:12 -0000 1.4.2.1 @@ -20,7 +20,7 @@ " -set file_list [list] +set sql_file_list [list] set file_count 0 foreach pkg_info $pkg_install_list { @@ -46,9 +46,11 @@ # Find out which script is appropriate to be run. set data_model_in_package 0 set table_rows "" - set data_model_files [apm_data_model_scripts_find -upgrade_from_version_name \ - $initial_version_name -upgrade_to_version_name $final_version_name $package_key $version(files)] - set file_list [concat $file_list $data_model_files] + set data_model_files [apm_data_model_scripts_find \ + -upgrade_from_version_name $initial_version_name \ + -upgrade_to_version_name $final_version_name \ + $package_key] + set sql_file_list [concat $sql_file_list $data_model_files] if {![empty_string_p $data_model_files]} { foreach file $data_model_files { set path [lindex $file 0] @@ -61,6 +63,12 @@ " incr file_count } + + if { [empty_string_p $version(auto-mount)] && [string equal $version(package.type) apm_application] } { + set mount_html " Mount package under the main site at path " + } else { + set mount_html "" + } append body " Select what data files to load for $version(package-name) $final_version_name
        @@ -71,13 +79,15 @@
        $table_rows -
        File Name

        " + + $mount_html +

        " } } -ad_set_client_property -clob t apm sql_file_paths $file_list +ad_set_client_property -clob t apm sql_file_paths $sql_file_list -if {[empty_string_p $file_list]} { +if {[empty_string_p $sql_file_list]} { ad_returnredirect packages-install-4 ad_script_abort } Index: openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl,v diff -u -N -r1.1.1.1 -r1.1.1.1.4.1 --- openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 13 Mar 2001 22:59:26 -0000 1.1.1.1 +++ openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 5 Mar 2003 14:43:12 -0000 1.1.1.1.4.1 @@ -7,6 +7,8 @@ @cvs-id $Id$ } { {sql_file:multiple ""} + {mount_p:multiple ""} + {mount_path:array ""} } set pkg_install_list [ad_get_client_property apm pkg_install_list] @@ -56,27 +58,41 @@ lappend data_model_files $file } } - + + # Mount path of package + if { [lsearch $mount_p $package_key] != -1 && [info exists mount_path($package_key)] && ![empty_string_p $mount_path($package_key)] } { + set selected_mount_path $mount_path($package_key) + } else { + set selected_mount_path "" + } + # Install the packages. ns_log Debug "APM: Installing packages from $install_path." if {$copy_files_p} { set version_id [apm_package_install -install_path $install_path \ -callback apm_ns_write_callback -copy_files -load_data_model \ - -data_model_files $data_model_files $spec_file] + -data_model_files $data_model_files \ + -mount_path $selected_mount_path \ + $spec_file] if {$version_id != 0} { file delete -force $install_path/$package_key } } else { - set version_id [apm_package_install -install_path $install_path \ - -callback apm_ns_write_callback -load_data_model \ - -data_model_files $data_model_files $spec_file] + set enable_p [expr [lsearch -exact $pkg_enable_list $package_key] != -1] + + set version_id [apm_package_install \ + -enable=$enable_p \ + -install_path $install_path \ + -callback apm_ns_write_callback \ + -load_data_model \ + -data_model_files $data_model_files \ + -mount_path $selected_mount_path \ + $spec_file] } - if { ($version_id != 0) && ([lsearch -exact $pkg_enable_list $package_key] != -1) } { - apm_version_enable -callback apm_ns_write_callback $version_id - } + incr installed_count } - + if {$installed_count < 1} { ns_write "

      All packages in this directory have already been installed. @@ -87,9 +103,7 @@ ns_write "

    Done installing packages. -

    -You must restart your server for the newly installed package(s) to be available.

    -Return to the APM.

    +

    You should restart the server now to make installed and upgraded packages available.

    [ad_footer] " } Index: openacs-4/packages/acs-admin/www/apm/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install.tcl,v diff -u -N -r1.12 -r1.12.2.1 --- openacs-4/packages/acs-admin/www/apm/packages-install.tcl 14 Aug 2002 18:51:13 -0000 1.12 +++ openacs-4/packages/acs-admin/www/apm/packages-install.tcl 5 Mar 2003 14:43:12 -0000 1.12.2.1 @@ -6,7 +6,7 @@ @cvs-id $Id$ } { - {checked_by_default_p:boolean 1} + {checked_by_default_p:boolean 0} {install_path [apm_workspace_install_dir]} } @@ -33,16 +33,20 @@ set already_installed_list [list] set not_compatible_list [list] +ns_log Notice "pm debug spec_files $all_spec_files" foreach spec_file $all_spec_files { array set version [apm_read_package_info_file $spec_file] set version_name $version(name) set package_name $version(package-name) set package_key $version(package.key) - if { [db_package_supports_rdbms_p $version(database_support)] } { + if { [apm_package_supports_rdbms_p -package_key $package_key] } { if { [apm_package_registered_p $package_key] } { + # This package is already on the system if { [apm_higher_version_installed_p $package_key $version_name] } { + ns_log Notice "higher version installed of $package_key $version_name" lappend spec_files $spec_file } else { + ns_log Notice "need upgrade of package $package_key $version_name" lappend already_installed_list "Package "$package_name" ($package_key) version $version_name or higher is already installed." } } else { Index: openacs-4/packages/acs-admin/www/apm/version-dependency-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-dependency-add-2.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-admin/www/apm/version-dependency-add-2.tcl 10 Sep 2002 22:21:59 -0000 1.2 +++ openacs-4/packages/acs-admin/www/apm/version-dependency-add-2.tcl 5 Mar 2003 14:43:12 -0000 1.2.2.1 @@ -22,7 +22,7 @@ } default { - ad_return complaint "Dependency Entry Error" "Depenendencies are either interfaces or requirements." + ad_return complaint "Dependency Entry Error" "Depenendencies are either provided or required." } } apm_package_install_spec $version_id Index: openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl 10 Sep 2002 22:21:59 -0000 1.3 +++ openacs-4/packages/acs-admin/www/apm/version-edit-2.tcl 5 Mar 2003 14:43:12 -0000 1.3.2.1 @@ -9,17 +9,18 @@ version_name version_uri summary - description + description:html {description_format ""} { owner_name:multiple} { owner_uri:multiple} vendor vendor_uri + {auto_mount ""} {release_date ""} { upgrade_p 0 } } -validate { version_uri_unique -requires {version_uri} { - if { [db_string apm_version_uri_unique_ck { + if { $upgrade_p && [db_string apm_version_uri_unique_ck { select decode(count(*), 0, 0, 1) from apm_package_versions where version_uri = :version_uri } -default 0] } { @@ -51,11 +52,20 @@ db_transaction { set version_id [apm_version_update $version_id $version_name $version_uri \ - $summary $description $description_format $vendor $vendor_uri $release_date] + $summary $description $description_format $vendor $vendor_uri $auto_mount $release_date] apm_package_install_owners [apm_package_install_owners_prepare $owner_name $owner_uri] $version_id apm_package_install_spec $version_id if {$upgrade_p} { apm_version_upgrade $version_id + + # The package now provides the new version of itself as interface + db_dml update_version_provides {update apm_package_dependencies + set service_version = :version_name + where version_id = :version_id + and service_uri = (select package_key + from apm_package_versions + where version_id = :version_id) + and dependency_type = 'provides'} } } on_error { ad_return_error "Error" " @@ -65,5 +75,4 @@ " } -ad_returnredirect "version-view?version_id=$version_id" - +ad_returnredirect "version-generate-info?version_id=$version_id&write_p=1" Index: openacs-4/packages/acs-admin/www/apm/version-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-edit.tcl,v diff -u -N -r1.4 -r1.4.2.1 --- openacs-4/packages/acs-admin/www/apm/version-edit.tcl 18 Sep 2002 14:54:45 -0000 1.4 +++ openacs-4/packages/acs-admin/www/apm/version-edit.tcl 5 Mar 2003 14:43:12 -0000 1.4.2.1 @@ -10,13 +10,7 @@ {version_id:integer} } -db_1row apm_all_version_info { - select version_id, package_key, package_uri, pretty_name, version_name, version_uri, - summary, description_format, description, release_date, vendor, vendor_uri, - enabled_p, installed_p, tagged_p, imported_p, data_model_loaded_p, activation_date, tarball_length, - deactivation_date, distribution_uri, distribution_date, singleton_p, initial_install_p - from apm_package_version_info where version_id = :version_id -} +db_1row apm_all_version_info {} doc_body_append "[apm_header -form "action=\"version-edit-2\" method=post" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] "Edit a Version"] @@ -83,6 +77,11 @@ + Auto-mount: + + + + To create a new version of the package, type a new version number and update the version URL accordingly. Leave the version name and URL alone to Index: openacs-4/packages/acs-admin/www/apm/version-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-edit.xql,v diff -u -N -r1.2 -r1.2.4.1 --- openacs-4/packages/acs-admin/www/apm/version-edit.xql 9 May 2001 22:32:25 -0000 1.2 +++ openacs-4/packages/acs-admin/www/apm/version-edit.xql 5 Mar 2003 14:43:12 -0000 1.2.4.1 @@ -4,7 +4,7 @@ - select version_id, package_key, package_uri, pretty_name, version_name, version_uri, + select version_id, package_key, package_uri, pretty_name, version_name, version_uri, auto_mount, summary, description_format, description, release_date, vendor, vendor_uri, enabled_p, installed_p, tagged_p, imported_p, data_model_loaded_p, activation_date, tarball_length, deactivation_date, distribution_uri, distribution_date, singleton_p, initial_install_p Index: openacs-4/packages/acs-admin/www/apm/version-files-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-files-oracle.xql,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/version-files-oracle.xql 12 Aug 2001 15:19:37 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ - - - oracle8.1.6 - - - - select f.file_id, f.path, f.file_type, nvl(t.pretty_name, 'Unknown type') file_pretty_name, - f.db_type, nvl(d.pretty_db_name, 'All') as db_pretty_name - from apm_package_files f, apm_package_file_types t, apm_package_db_types d - where f.version_id = :version_id - and f.file_type = t.file_type_key(+) - and f.db_type = d.db_type_key(+) - order by path - - - - Index: openacs-4/packages/acs-admin/www/apm/version-files-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-files-postgresql.xql,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/version-files-postgresql.xql 3 Jul 2002 10:06:16 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ - - - postgresql7.1 - - - - select ftd.file_id, ftd.path, ftd.file_type, coalesce(ftd.pretty_name, 'Unknown type') as file_pretty_name, - ftd.db_type, coalesce(ftd.pretty_db_name, 'All') as db_pretty_name - from ((apm_package_files f left join apm_package_file_types t on (f.file_type = t.file_type_key)) - left join apm_package_db_types d on (f.db_type = d.db_type_key)) ftd - where ftd.version_id = :version_id - order by ftd.path - - - - - Index: openacs-4/packages/acs-admin/www/apm/version-files.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-files.tcl,v diff -u -N -r1.7 -r1.7.2.1 --- openacs-4/packages/acs-admin/www/apm/version-files.tcl 18 Sep 2002 14:54:45 -0000 1.7 +++ openacs-4/packages/acs-admin/www/apm/version-files.tcl 5 Mar 2003 14:43:12 -0000 1.7.2.1 @@ -1,33 +1,19 @@ ad_page_contract { List all the files in a particular version of a package. - @param version_id The package to be processed. - @param remove_files_p Set to 1 if you want to remove all the files. @author Jon Salz [jsalz@arsdigita.com] @creation-date 9 May 2000 @cvs-id $Id$ } { {version_id:integer} - {remove_files_p 0} } -db_1row apm_package_by_version_id { - select pretty_name, version_name, package_key, installed_p, distribution_uri, - tagged_p - from apm_package_version_info where version_id = :version_id -} +apm_version_info $version_id -if { $remove_files_p == 1 } { - # This is really a "remove multiple files" page. - set form "action=\"file-remove\" method=post" - set apm_header_args [list [list "version-files?version_id=$version_id" "Files"] "Remove Files"] -} else { - set form "" - set apm_header_args [list "Files"] -} +set form "" +set apm_header_args [list "Files"] -doc_body_append "[eval [concat [list apm_header -form $form [list "version-view?version_id=$version_id" "$pretty_name $version_name"]] $apm_header_args]] -" +doc_body_append "[eval [concat [list apm_header -form $form [list "version-view?version_id=$version_id" "$pretty_name $version_name"]] $apm_header_args]]" doc_body_append " @@ -40,17 +26,18 @@ set counter 0 doc_body_append "PathFile type - Database supportActions\n" + Database support\n" -db_foreach apm_all_files { - select f.file_id, f.path, f.file_type, nvl(t.pretty_name, 'Unknown type') file_pretty_name, - f.db_type, nvl(d.pretty_db_name, 'All') as db_pretty_name - from apm_package_files f, apm_package_file_types t, apm_package_db_types d - where f.version_id = :version_id - and f.file_type = t.file_type_key(+) - and f.db_type = d.db_type_key(+) - order by path -} { +foreach path [apm_get_package_files -package_key $package_key] { + set file_id "" + set db_type [apm_guess_db_type $package_key $path] + set db_pretty_name $db_type + set file_type [apm_guess_file_type $package_key $path] + if { [empty_string_p $file_type] } { + set file_type "?" + } + set file_pretty_name $file_type + incr counter # Set i to the index of the last component which hasn't changed since the last component @@ -86,10 +73,7 @@ doc_body_append "" doc_body_append " $file_pretty_name $db_pretty_name  " - if { $remove_files_p == 1 } { - # Display a checkbox which the user can check to delete the file. - doc_body_append "" - } else { + if { $installed_p == "t" } { if { $file_type == "tcl_procs" || ($file_type == "query_file" && [db_compatible_rdbms_p $db_type]) } { if { [nsv_exists apm_reload_watch "packages/$package_key/$path"] } { @@ -99,77 +83,56 @@ if {![ad_parameter -package_id [ad_acs_kernel_id] \ PerformanceModeP request-processor 1]} { # Provide a link to watch the procs file. - doc_body_append " watch " + doc_body_append " watch " } else { doc_body_append "" } } } else { doc_body_append "" } - } - # Allow the user to remove the file from the package. - doc_body_append "remove" - } + + } } doc_body_append "\n" incr i } set last_components $components -} else { +} + +if { [string equal $counter 0] } { doc_body_append "This package does not contain any registered files.\n" } -if { $counter > 0 && $remove_files_p == 1 } { - doc_body_append " -[export_form_vars version_id] -" -} - -doc_body_append " - +doc_body_append " " -if { $remove_files_p } { - doc_body_append "\n" -} else { - if { $installed_p == "t" } { - doc_body_append "" - } elseif { [info exists tagged_p] } { - if { $tagged_p == "t" } { - doc_body_append " - " - } +} elseif { [info exists tagged_p] } { + if { $tagged_p == "t" } { + doc_body_append " + " } } doc_body_append [ad_footer] - Index: openacs-4/packages/acs-admin/www/apm/version-files.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/version-files.xql,v diff -u -N --- openacs-4/packages/acs-admin/www/apm/version-files.xql 3 Jul 2002 10:06:16 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ - - - - - - - select pretty_name, version_name, package_key, installed_p, distribution_uri, - tagged_p - from apm_package_version_info where version_id = :version_id - - - - - Index: openacs-4/packages/acs-admin/www/apm/version-reload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-reload.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-admin/www/apm/version-reload.tcl 10 Sep 2002 22:21:59 -0000 1.2 +++ openacs-4/packages/acs-admin/www/apm/version-reload.tcl 5 Mar 2003 14:43:12 -0000 1.2.2.1 @@ -15,6 +15,8 @@ # files in $files. apm_mark_version_for_reload $version_id files +set file_id_list [list] + if { [llength $files] == 0 } { doc_body_append "There are no changed files to reload in this package.

    " } else { @@ -29,7 +31,8 @@ } else { # This file isn't being watched right now - provide a link setting a watch on it. set files_to_watch_p 1 - doc_body_append " (watch this file)" + doc_body_append " (watch this file)" + lappend file_id_list $file_id } doc_body_append "\n" } @@ -40,6 +43,8 @@ doc_body_append "If you know you're going to be modifying one of the above files frequently, select the \"watch this file\" link next to a filename to cause the interpreters to reload the file immediately whenever it is changed.

    + (watch all above files) +

    " } Index: openacs-4/packages/acs-admin/www/apm/version-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-view.tcl,v diff -u -N -r1.4 -r1.4.2.1 --- openacs-4/packages/acs-admin/www/apm/version-view.tcl 10 Sep 2002 22:21:59 -0000 1.4 +++ openacs-4/packages/acs-admin/www/apm/version-view.tcl 5 Mar 2003 14:43:12 -0000 1.4.2.1 @@ -7,18 +7,8 @@ {version_id:integer} } -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, - to_char(release_date, 'Month DD, YYYY') as release_date , vendor, vendor_uri, - 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 -} +db_1row apm_all_version_info {} + db_1row apm_file_count { select count(*) n_files from apm_package_files where version_id = :version_id } @@ -154,6 +144,7 @@ Version:$version_name OpenACS Core:$initial_install_p Singleton:$singleton_p +Auto-mount:$auto_mount Status:$status Data Model:$data_model_status " @@ -213,41 +204,49 @@

    +

    Manage

    + +

    XML .info package specification file

    +

    Disable/Uninstall

      " + if { [info exists can_disable_p] } { - doc_body_append "

    • Disable this version of the package\n" + doc_body_append "

    • Disable this version of the package\n" } if { [info exists can_enable_p] } { - doc_body_append "

    • Enable this version of the package\n" + doc_body_append "

    • Enable this version of the package\n" } doc_body_append "

      " if { $installed_p == "t" } { doc_body_append " -

    • Delete this package from your system. (be very careful!)\n" +
    • Uninstall this package from your system. (be very careful!)\n" } } Index: openacs-4/packages/acs-admin/www/apm/version-view.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-view.xql,v diff -u -N -r1.2 -r1.2.4.1 --- openacs-4/packages/acs-admin/www/apm/version-view.xql 9 May 2001 22:32:25 -0000 1.2 +++ openacs-4/packages/acs-admin/www/apm/version-view.xql 5 Mar 2003 14:43:12 -0000 1.2.4.1 @@ -6,7 +6,7 @@ select version_id, package_key, package_uri, pretty_name, version_name, version_uri, summary, description_format, description, singleton_p, initial_install_p, - to_char(release_date, 'Month DD, YYYY') as release_date , vendor, vendor_uri, + 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,