Index: openacs-4/packages/xowiki/tcl/parameter-page-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/parameter-page-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/xowiki/tcl/parameter-page-procs.tcl 26 Feb 2020 21:15:18 -0000 1.1.2.2 +++ openacs-4/packages/xowiki/tcl/parameter-page-procs.tcl 26 Feb 2020 21:15:51 -0000 1.1.2.3 @@ -1,85 +1,85 @@ ::xo::library doc { - xowiki - procs for working with parameter pages. + xowiki - procs for working with parameter pages. - @creation-date 2020-02-13 - @author Gustaf Neumann + @creation-date 2020-02-13 + @author Gustaf Neumann } namespace eval ::xowiki { - ad_proc require_parameter_page { - -name:required - -package_id:required - -parent_id - {-title "Parameter Page"} - {-instance_attributes ""} - {-form en:Parameter.form} - {-publish_status production} - } { - - Create or up update a parameter page. This is a convenience - method to ease the interaction with parameter pages. - - } { - ::xo::Package require $package_id - - if {![info exists parent_id]} { - set parent_id [::$package_id folder_id] - } + ad_proc require_parameter_page { + -name:required + -package_id:required + -parent_id + {-title "Parameter Page"} + {-instance_attributes ""} + {-form en:Parameter.form} + {-publish_status production} + } { - set item_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id] - if {$item_id == 0} { - # - # We have to create the parameter page new.... - # Get first the parameter form - # - set page [::$package_id get_page_from_item_ref \ - -use_prototype_pages true \ - -use_package_path true \ - -parent_id $parent_id \ - $form] - if {$page eq ""} { - error "cannot instantiate $form" - } + Create or up update a parameter page. This is a convenience + method to ease the interaction with parameter pages. - #ns_log notice FORM=[$page serialize] + } { + ::xo::Package require $package_id - if {[$page publish_status] ne $publish_status} { - ns_log notice "form $form: change publish_status -> $publish_status" - ::xo::db::sql::content_item set_live_revision \ - -revision_id [::$page revision_id] \ - -publish_status $publish_status - } + if {![info exists parent_id]} { + set parent_id [::$package_id folder_id] + } - set instance_vars [list title $title parent_id $parent_id \ - package_id $package_id \ - instance_attributes $instance_attributes] - ad_try { - ns_log notice "form $form: try to create form page $name" - ::$page create_form_page_instance \ - -name $name \ - -package_id $package_id \ - -parent_id $parent_id \ - -nls_language en_US \ - -default_variables $instance_vars - } on error {errorMsg} { - error "cannot create instance named '$name' of form $form: $errorMsg\n$::errorInfo" - } on ok {p} { - ns_log notice "form $form: try to create form page $name DONE, do a save_new" - $p save_new - ns_log notice "form $form: try to create form page $name DONE, do a save_new DONE" - } - } else { - # - # The parameter page exists already. Get the old instance - # attributes, add the new ones and save the page - # - set p [::xowiki::FormPage get_instance_from_db -item_id $item_id] - $p title $title - $p instance_attributes [dict merge [$p instance_attributes] $instance_attributes] - $p save - ns_log notice "form $form: updated parameter page saved." - } + set item_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id] + if {$item_id == 0} { + # + # We have to create the parameter page new.... + # Get first the parameter form + # + set page [::$package_id get_page_from_item_ref \ + -use_prototype_pages true \ + -use_package_path true \ + -parent_id $parent_id \ + $form] + if {$page eq ""} { + error "cannot instantiate $form" + } + + #ns_log notice FORM=[$page serialize] + + if {[$page publish_status] ne $publish_status} { + ns_log notice "form $form: change publish_status -> $publish_status" + ::xo::db::sql::content_item set_live_revision \ + -revision_id [::$page revision_id] \ + -publish_status $publish_status + } + + set instance_vars [list title $title parent_id $parent_id \ + package_id $package_id \ + instance_attributes $instance_attributes] + ad_try { + ns_log notice "form $form: try to create form page $name" + ::$page create_form_page_instance \ + -name $name \ + -package_id $package_id \ + -parent_id $parent_id \ + -nls_language en_US \ + -default_variables $instance_vars + } on error {errorMsg} { + error "cannot create instance named '$name' of form $form: $errorMsg\n$::errorInfo" + } on ok {p} { + ns_log notice "form $form: try to create form page $name DONE, do a save_new" + $p save_new + ns_log notice "form $form: try to create form page $name DONE, do a save_new DONE" + } + } else { + # + # The parameter page exists already. Get the old instance + # attributes, add the new ones and save the page + # + set p [::xowiki::FormPage get_instance_from_db -item_id $item_id] + $p title $title + $p instance_attributes [dict merge [$p instance_attributes] $instance_attributes] + $p save + ns_log notice "form $form: updated parameter page saved." } + } } @@ -89,4 +89,3 @@ # tcl-indent-level: 2 # indent-tabs-mode: nil # End: - 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 -r1.20.2.2 -r1.20.2.3 --- openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 26 Feb 2020 21:18:46 -0000 1.20.2.2 +++ openacs-4/packages/acs-admin/www/apm/packages-install-4.tcl 26 Feb 2020 21:20:11 -0000 1.20.2.3 @@ -7,7 +7,7 @@ @cvs-id $Id$ } { {sql_file:multiple ""} - {mount_packages:multiple ""} + {mount_packages:multiple ""} {mount_path:array ""} } @@ -44,36 +44,36 @@ set package_path [pkg_info_path $pkg_info] if { [catch { - array set version [apm_read_package_info_file $spec_file] + array set version [apm_read_package_info_file $spec_file] } errmsg] } { - ns_write "
  • Unable to install the [pkg_info_key $pkg_info] package because its specification - file is invalid:
    [ns_quotehtml $errmsg]
    " - continue + ns_write "
  • Unable to install the [pkg_info_key $pkg_info] package because its specification + file is invalid:
    [ns_quotehtml $errmsg]
    " + continue } set package_key $version(package.key) if {[apm_package_version_installed_p $package_key $version(name)] } { - #ns_log notice "===== ALREADY installed $package_key" - # Already installed. - continue + #ns_log notice "===== ALREADY installed $package_key" + # Already installed. + continue } set version_files $version(files) set data_model_files [list] # Find the correct data model files for this package. foreach file $sql_files { - if {[lindex $file 2] eq $package_key } { - # Pass on the file path and its type. - lappend data_model_files $file - } + if {[lindex $file 2] eq $package_key } { + # Pass on the file path and its type. + lappend data_model_files $file + } } # Mount path of package if { $package_key in $mount_packages - && [info exists mount_path($package_key)] - && $mount_path($package_key) ne "" + && [info exists mount_path($package_key)] + && $mount_path($package_key) ne "" } { set selected_mount_path $mount_path($package_key) } else { @@ -87,33 +87,33 @@ set enable_p 1 if {[catch { - ns_log notice "===== INSTALL $package_key" - set version_id [apm_package_install \ - -enable=$enable_p \ - -package_path $package_path \ - -callback apm_ns_write_callback \ - -load_data_model \ - -data_model_files $data_model_files \ - -mount_path $selected_mount_path \ - $spec_file] - ns_log notice "===== INSTALL $package_key DONE" + ns_log notice "===== INSTALL $package_key" + set version_id [apm_package_install \ + -enable=$enable_p \ + -package_path $package_path \ + -callback apm_ns_write_callback \ + -load_data_model \ + -data_model_files $data_model_files \ + -mount_path $selected_mount_path \ + $spec_file] + ns_log notice "===== INSTALL $package_key DONE" } errorMsg]} { ns_write "Error: $errorMsg
    \n
    "
    -	ns_write [ns_quotehtml $::errorInfo]
    +        ns_write [ns_quotehtml $::errorInfo]
             ns_write "
    \n" - set version_id 0 + set version_id 0 } if { $version_id == 0 } { # Installation of the package failed and we shouldn't continue with installation # as there might be packages depending on the failed package. Ideally we should # probably check for such dependencies and continue if there are none. ns_write [subst { - - - }] + }] ad_script_abort } @@ -122,14 +122,14 @@ if {$installed_count < 1} { ns_write { - - All packages in this directory have already been installed. - Please return to the index.

    + + All packages in this directory have already been installed. + Please return to the index.

    } } else { ns_write {

    - Done installing packages. -

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

    + Done installing packages. +

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

    Click here to restart the server now.

    } }