Commit 7b3d66d8 authored by Frank Bergmann's avatar Frank Bergmann

- Upgrade to V4.0

parent 9590b4fc
......@@ -2,24 +2,26 @@
<!-- Generated by the OpenACS Package Manager -->
<package key="acs-admin" url="http://openacs.org/repository/apm/packages/acs-admin/" type="apm_service">
<license>GPL V2.0 or any later version</license>
<package-name>Site-Wide Administration</package-name>
<pretty-plural>Site-Wide Administration Services</pretty-plural>
<initial-install-p>t</initial-install-p>
<singleton-p>t</singleton-p>
<version name="5.1.5" url="http://openacs.org/repository/download/apm/acs-admin-5.1.5.apm">
<version name="5.6.0" url="http://openacs.org/repository/download/apm/acs-admin-5.6.0.apm">
<owner url="mailto:dhogaza@pacifier.com">Don Baccus</owner>
<summary>An interface for Site-wide administration of an OpenACS Installation.</summary>
<maturity>3</maturity>
<release-date>2004-02-28</release-date>
<release-date>2010-06-17</release-date>
<vendor url="http://openacs.org">OpenACS</vendor>
<license url="http://www.gnu.org/copyleft/gpl.html">GPL</license>
<maturity>3</maturity>
<description format="text/html">Provides a UI for administering site-wide services
(including package installation, cache, authentication, and user accounts) for an OpenACS system.
</description>
<provides url="acs-admin" version="5.1.4"/>
<requires url="acs-kernel" version="5.0.0"/>
<provides url="acs-admin" version="5.6.0"/>
<requires url="acs-kernel" version="5.6.0"/>
<requires url="acs-mail-lite" version="5.6.0"/>
<callbacks>
</callbacks>
......
<?xml version="1.0" encoding="ISO-8859-1"?>
<message_catalog package_key="acs-admin" package_version="5.1.5" locale="en_US" charset="ISO-8859-1">
<message_catalog package_key="acs-admin" locale="en_US" charset="ISO-8859-1">
<msg key="Account_reg_URL_help_text">URL where users register for a new account.</msg>
<msg key="Account_Registration">Account registration</msg>
......
<?xml version="1.0" encoding="ISO-8859-1"?>
<message_catalog package_key="acs-admin" package_version="5.1.5" locale="es_ES" charset="ISO-8859-1">
<message_catalog package_key="acs-admin" locale="es_ES" charset="ISO-8859-1">
<msg key="Account_reg_URL_help_text">URL donde los usuarios pueden registrarse</msg>
<msg key="Account_Registration">Registro</msg>
......@@ -11,7 +11,7 @@
<msg key="Are_you_sure_you_want_to_delete_authority_authorities_pretty_name">Desea realmente borrar la autoridad %authorities.pretty_name%?</msg>
<msg key="Authentication">Autenticacin</msg>
<msg key="Authority_name">Nombre de la autoridad</msg>
<msg key="Authority_short_name_help_text">Es usado cuando uno se refiere a la autoridad en parametros, etc. Inclusive si necesita cambiar el nombre mostrado arriba, esto deberia mantenerse inalaterado.</msg>
<msg key="Authority_short_name_help_text">Esto se usar al referirse a una autoridad en los parmetros. Aunque necesite cambiar el nombre mostrado arriba, esto no debera ser cambiado.</msg>
<msg key="Batch_sync_enabled">Sincronizacin batch habilitada</msg>
<msg key="Batch_Synchronization">Sincronizacin batch</msg>
<msg key="Change_password_URL">URL para cambiar la contrasea</msg>
......
......@@ -14,7 +14,7 @@ set return_url [ad_pvt_home]
# Get the password and user ID
if ![db_0or1row password "select password from users where user_id=$user_id"] {
if {![db_0or1row password "select password from users where user_id=$user_id"]} {
ad_return_error "Couldn't find user $user_id" "Couldn't find user $user_id."
return
}
......
......@@ -81,12 +81,12 @@ ad_form -extend -name update -form {
}
# If the account was closed, it might be open now
if { [string equal [ad_conn account_status] "closed"] } {
if {[ad_conn account_status] eq "closed"} {
auth::verify_account_status
}
} -after_submit {
if { [empty_string_p $return_url] } {
if { $return_url eq "" } {
set return_url [ad_pvt_home]
set pvt_home_name [ad_pvt_home_name]
set continue_label [_ acs-subsite.Continue_to_your_account]
......
<p><listtemplate name="packages"></listtemplate></p>
<listtemplate name="packages"></listtemplate>
......@@ -16,7 +16,7 @@ db_multirow -extend { url admin_url param_url } packages services_select {} {
if { [file exists "[acs_package_root_dir $package_key]/www/"] } {
catch {
set url [apm_package_url_from_key $package_key]
if { ![empty_string_p $url] && [file exists "[acs_package_root_dir $package_key]/www/admin/"] } {
if { $url ne "" && [file exists "[acs_package_root_dir $package_key]/www/admin/"] } {
set admin_url "${url}admin/"
}
if { [file exists "[acs_package_root_dir $package_key]/www/sitewide-admin/"] } {
......@@ -30,7 +30,7 @@ db_multirow -extend { url admin_url param_url } packages services_select {} {
}
set instance_name [lang::util::localize $instance_name]
if { [empty_string_p $url] && [empty_string_p $admin_url] && [empty_string_p $param_url] } {
if { $url eq "" && $admin_url eq "" && $param_url eq "" } {
continue
}
}
......
......@@ -8,4 +8,3 @@
<li><a href="@acs_core_docs_url@">Documentation</a>
<li><a href="@acs_admin_url@monitor">Active connections</a>
</ul>
<p>
......@@ -22,7 +22,7 @@ ad_proc apm_parameter_section_slider {package_key} {
lappend section_list [list $package_key $package_key [list "where" "section_name is null"]]
foreach section $sections {
incr i
if { ![empty_string_p $section] } {
if { $section ne "" } {
lappend section_list [list "section_$i" $section [list "where" "section_name = '[db_quote $section]'"]]
}
}
......@@ -56,10 +56,14 @@ ad_proc apm_header { { -form "" } args } {
lappend cmd $elem
}
set context_bar [eval $cmd]
# this is rather a hack, but just needed for streaming output
# a more general solution can be provided at some later time...
regsub "#acs-kernel.Main_Site#" $context_bar \
[_ acs-kernel.Main_Site] context_bar
}
set header [ad_header $title ""]
append body "$header\n"
if {![empty_string_p $form]} {
if {$form ne ""} {
append body "<form $form>"
}
......@@ -70,7 +74,7 @@ ad_proc apm_header { { -form "" } args } {
"
}
proc_doc apm_shell_wrap { cmd } { Returns a command string, wrapped it shell-style (with backslashes) in case lines get too long. } {
ad_proc apm_shell_wrap { cmd } { Returns a command string, wrapped it shell-style (with backslashes) in case lines get too long. } {
set out ""
set line_length 0
foreach element $cmd {
......@@ -88,7 +92,6 @@ proc_doc apm_shell_wrap { cmd } { Returns a command string, wrapped it shell-sty
ad_proc -private apm_package_selection_widget {
-install_enable:boolean
{ -update_only_p 0 }
pkg_info_list
{to_install ""}
{to_enable ""}
......@@ -100,12 +103,12 @@ ad_proc -private apm_package_selection_widget {
only the enable checkbox will be displayed, and the resulting page is expected to assume that enable also means install.
} {
if {[empty_string_p $pkg_info_list]} {
if {$pkg_info_list eq ""} {
return ""
}
set checkbox_count 0
set counter 1
set counter 0
set band_colors { white "#ececec" }
set widget "<blockquote><table cellpadding=5 cellspacing=5>
<tr bgcolor=\"\#f8f8f8\"><th>Install</th>[ad_decode $install_enable_p 1 "<th>Enable</th>" ""]<th>Package</th><th>Directory</th><th>Comment</th></tr>
......@@ -113,6 +116,7 @@ ad_proc -private apm_package_selection_widget {
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 package_rel_path [string range $package_path [string length [acs_root_dir]] end]
......@@ -120,12 +124,13 @@ ad_proc -private apm_package_selection_widget {
array set package [apm_read_package_info_file $spec_file]
set version_name $package(name)
ns_log Debug "Selection widget: $package_key, Dependency: [pkg_info_dependency_p $pkg_info]"
if { ![string compare [pkg_info_dependency_p $pkg_info] "t"]} {
append widget " <tr valign=baseline bgcolor=[lindex $band_colors \
[expr { $counter % [llength $band_colors] }]]>"
if { [pkg_info_dependency_p $pkg_info] eq "t" } {
# Dependency passed.
append widget " <tr valign=baseline bgcolor=[lindex $band_colors [expr { $counter % [llength $band_colors] }]]>"
if { $install_enable_p } {
if { ([lsearch -exact $to_install $package_key] != -1) } {
append widget " <td align=center><input type=checkbox checked
......@@ -151,33 +156,29 @@ ad_proc -private apm_package_selection_widget {
append widget "
onclick=\"if (checked) document.forms\[0\].elements\[$checkbox_count\].checked=true\""
}
append widget "></td>
<td>$package(package-name) $package(name)</td>
<td>$package_rel_path</td>
<td><font color=green>Dependencies satisfied.</font></td>
</tr> "
} elseif { ![string compare [pkg_info_dependency_p $pkg_info] "f"] } {
# Dependency failed.
append widget " <tr valign=baseline bgcolor=[lindex $band_colors [expr { $counter % [llength $band_colors] }]]>"
} elseif { [pkg_info_dependency_p $pkg_info] eq "f" } {
#Dependency failed.
if { $install_enable_p } {
append widget " <td align=center><input type=checkbox name=install value=\"$package_key\"
onclick=\"if (!checked) document.forms\[0\].elements\[$checkbox_count+1\].checked=false\"></td>"
}
append widget "
<td align=center><input type=checkbox name=enable value=\"$package_key\" "
if { $install_enable_p } {
append widget "onclick=\"if (checked) document.forms\[0\].elements\[$checkbox_count\].checked=true\""
}
append widget "></td>
<td>$package(package-name) $package(name)</td>
<td>$package_rel_path</td><td><font color=red>
<td>$package_rel_path</td>
<td><font color=red>
"
foreach comment [pkg_info_comment $pkg_info] {
append widget "$comment<br>"
......@@ -187,29 +188,24 @@ ad_proc -private apm_package_selection_widget {
</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 } {
set comment "New install."
# Skip this if it's update only
if {$update_only_p} { continue }
} elseif {$higher_version_p == 1 } {
set comment "Upgrade."
} elseif {$higher_version_p == 0} {
set comment "Package version already installed."
} else {
set comment "Installing older version of package."
}
} else {
set higher_version_p 2
}
if {$higher_version_p == 2 } {
set comment "New install."
} elseif {$higher_version_p == 1 } {
set comment "Upgrade."
} elseif {$higher_version_p == 0} {
set comment "Package version already installed."
} else {
set comment "Installing older version of package."
}
append widget " <tr valign=baseline bgcolor=[lindex $band_colors [expr { $counter % [llength $band_colors] }]]>"
append widget " <tr valign=baseline bgcolor=[lindex $band_colors [expr { $counter % [llength $band_colors] }]]>"
if { ([lsearch -exact $to_install $package_key] != -1) } {
set install_checked "checked"
......@@ -239,9 +235,6 @@ ad_proc -private apm_package_selection_widget {
</tr>"
}
incr checkbox_count 2
incr counter
}
append widget "</table></blockquote>"
return $widget
......@@ -407,7 +400,7 @@ ad_proc -private apm_build_repository {
foreach { cur_work_dir cur_cvs_root cur_module } $checkout_list {
cd $cur_work_dir
if { ![string equal $channel_tag($channel) HEAD] } {
if { $channel_tag($channel) ne "HEAD" } {
ns_log Debug "Repository: Checking out $cur_module from CVS:"
catch { exec $cvs_command -d $cur_cvs_root -z3 co -r $channel_tag($channel) $cur_module } output
ns_log Debug "Repository: [llength $output] files"
......@@ -490,11 +483,16 @@ ad_proc -private apm_build_repository {
# The path to the 'packages' directory in the checkout
set packages_root_path [eval file join [lrange [file split $spec_file] 0 end-2]]
lappend cmd -C $packages_root_path
set tmp_filename [ns_tmpnam]
lappend cmd --files-from $tmp_filename -C $packages_root_path
set fp [open $tmp_filename w]
foreach file $files {
lappend cmd $package_key/$file
puts $fp $package_key/$file
}
close $fp
lappend cmd "|" [apm_gzip_cmd] -c ">" $apm_file
ns_log Notice "Executing: [ad_quotehtml $cmd]"
eval $cmd
......
......@@ -12,8 +12,7 @@ ad_page_contract {
#----------------------------------------------------------------------
set cvs_command "cvs"
set cvs_root ":pserver:anonymous@openacs.org:/cvsroot"
set dotlrn_cvs_root ":pserver:anonymous@dotlrn.openacs.org:/dotlrn-cvsroot"
set cvs_root ":pserver:anonymous@cvs.openacs.org:/cvsroot"
set work_dir "[acs_root_dir]/repository-builder/"
......@@ -27,10 +26,10 @@ set index_template "/packages/acs-admin/www/apm/repository-index"
# from these packages
#set exclude_package_list { cms cms-news-demo glossary site-wide-search spam library }
set exclude_package_list {}
set head_channel "5-1"
set head_channel "5-3"
# Set this to 1 to only checkout sample packages -- useful for debugging and testing
set debug_p 1
set debug_p 0
#----------------------------------------------------------------------
# Prepare output
......@@ -49,8 +48,8 @@ ns_write <ul>
file mkdir $work_dir
cd $work_dir
catch { exec $cvs_command -d $cvs_root -z3 co openacs-4/readme.txt }
catch { exec $cvs_command -d $cvs_root -z3 co openacs-4/readme.txt }
catch { exec $cvs_command -d $cvs_root -z3 log -h openacs-4/readme.txt } output
set lines [split $output \n]
......@@ -108,8 +107,6 @@ foreach channel [lsort -decreasing [array names channel_tag]] {
# Wipe and re-create the checkout directory
file delete -force "${work_dir}openacs-4"
file delete -force "${work_dir}dotlrn"
file mkdir -force "${work_dir}dotlrn/packages"
# Prepare channel directory
set channel_dir "${work_dir}repository/${channel}/"
......@@ -129,13 +126,12 @@ foreach channel [lsort -decreasing [array names channel_tag]] {
# Full list for real use
set checkout_list [list \
$work_dir $cvs_root openacs-4/packages \
$work_dir $cvs_root openacs-4/contrib/packages \
${work_dir}dotlrn/packages/ $dotlrn_cvs_root dotlrn-core]
$work_dir $cvs_root openacs-4/contrib/packages]
}
foreach { cur_work_dir cur_cvs_root cur_module } $checkout_list {
cd $cur_work_dir
if { ![string equal $channel_tag($channel) HEAD] } {
if { $channel_tag($channel) ne "HEAD" } {
ns_write "<li>Checking out $cur_module from CVS:"
catch { exec $cvs_command -d $cur_cvs_root -z3 co -r $channel_tag($channel) $cur_module } output
ns_write " [llength $output] files\n"
......@@ -153,17 +149,18 @@ foreach channel [lsort -decreasing [array names channel_tag]] {
template::multirow create packages \
package_path package_key version pretty_name \
package_type summary description \
release_date vendor_url vendor
release_date vendor_url vendor \
license_url license maturity maturity_text
foreach packages_dir \
[list "${work_dir}openacs-4/packages" \
"${work_dir}openacs-4/contrib/packages" \
"${work_dir}dotlrn/packages"] {
"${work_dir}openacs-4/contrib/packages"] {
foreach spec_file [lsort [apm_scan_packages $packages_dir]] {
set package_path [eval file join [lrange [file split $spec_file] 0 end-1]]
set package_key [lindex [file split $spec_file] end-1]
set version_id [apm_version_id_from_package_key $package_key]
if { [lsearch -exact $exclude_package_list $package_key] != -1 } {
ns_write "Package $package_key is on list of packages to exclude - skipping"
......@@ -195,13 +192,21 @@ foreach channel [lsort -decreasing [array names channel_tag]] {
append manifest { } {<description format="} [ad_quotehtml $version(description.format)] {">}
append manifest [ad_quotehtml $version(description)] {</description>} \n
append manifest { } {<release-date>} [ad_quotehtml $version(release-date)] {</release-date>} \n
append manifest { } {<maturity>} [ad_quotehtml $version(maturity)] {</maturity>} \n
append manifest { } {<license url="} [ad_quotehtml $version(license_url)] {">}
append manifest [ad_quotehtml $version(license)] {</license>} \n
append manifest { } {<vendor url="} [ad_quotehtml $version(vendor.url)] {">}
append manifest [ad_quotehtml $version(vendor)] {</vendor>} \n
append manifest [apm::package_version::attributes::generate_xml \
-version_id $version_id \
-indentation { }]
template::multirow append packages \
$package_path $package_key $version(name) $version(package-name) \
$version(package.type) $version(summary) $version(description) \
$version(release-date) $version(vendor.url) $version(vendor)
$version(release-date) $version(vendor.url) $version(vendor) \
$version(license_url) $version(license) $version(maturity) [apm::package_version::attributes::maturity_int_to_text $version(maturity)]
set apm_file "${channel_dir}${version(package.key)}-${version(name)}.apm"
......@@ -219,13 +224,17 @@ foreach channel [lsort -decreasing [array names channel_tag]] {
# The path to the 'packages' directory in the checkout
set packages_root_path [eval file join [lrange [file split $spec_file] 0 end-2]]
lappend cmd -C $packages_root_path
set tmp_filename [ns_tmpnam]
lappend cmd --files-from $tmp_filename -C $packages_root_path
set fp [open $tmp_filename w]
foreach file $files {
lappend cmd $package_key/$file
puts $fp $package_key/$file
}
close $fp
lappend cmd "|" [apm_gzip_cmd] -c ">" $apm_file
ns_log Notice "Executing: [ad_quotehtml $cmd]"
#ns_log Notice "Executing: [ad_quotehtml $cmd]"
eval $cmd
}
......@@ -297,5 +306,3 @@ if { [file exists $repository_dirname] } {
file rename $work_repository_dirname $repository_dirname
ns_write "</ul> <h2>DONE</h2>\n"
......@@ -33,7 +33,7 @@ foreach version_id $install {
set ul_p 0
foreach file [apm_version_file_list -type data_model_create $version_id] {
foreach file [apm_get_package_files -package_key $package_key -file_type data_model_create] {
if { [string match *-drop.sql [file tail $file]] } {
continue
}
......@@ -50,7 +50,7 @@ foreach version_id $install {
ns_write "</pre></blockquote>\n"
}
foreach file [apm_version_file_list -type java_code $version_id] {
foreach file [apm_get_package_files -package_key $package_key -file_type java_code] {
if { !$ul_p } {
ns_write "<ul>\n"
set ul_p 1
......
......@@ -37,7 +37,7 @@ db_foreach all_packages_owned_by_email "
global vc_file_props
if { [regexp {[a-zA-Z]} $vc_file_props(status)] } {
set status "$vc_file_props(status)"
if { ![string compare $status "Up-to-date"] } {
if { $status eq "Up-to-date" } {
# It's up to date; don't print anything out.
continue
}
......
......@@ -53,7 +53,7 @@ set missing_text "<strong>No packages match criteria.</strong>"
append body "<center><table><tr><td>[ad_dimensional $dimensional_list]</td></tr></table></center>"
set use_watches_p [expr ! [ad_parameter -package_id [ad_acs_kernel_id] PerformanceModeP request-processor 1]]
set use_watches_p [expr {![parameter::get -package_id [ad_acs_kernel_id] -parameter PerformanceModeP -default 1]}]
set table_def {
{ package_key "Key" "" "<td><a href=\"[export_vars -base version-view { version_id }]\">$package_key</a></td>" }
......@@ -61,8 +61,8 @@ set table_def {
{ version_name "Ver." "" "" }
{
status "Status" "" {<td align=center>&nbsp;&nbsp;[eval {
if { $installed_p == "t" } {
if { $enabled_p == "t" } {
if { $installed_p eq "t" } {
if { $enabled_p eq "t" } {
set status "Enabled"
} else {
set status "Disabled"
......@@ -82,8 +82,8 @@ set table_def {
set file_link_list [list]
lappend file_link_list "<a href=\"version-files?version_id=$version_id\">view files</a>"
if { $installed_p == "t" && $enabled_p == "t" } {
if { ! [ad_parameter -package_id [ad_acs_kernel_id] PerformanceModeP request-processor 1] } {
if { $installed_p eq "t" && $enabled_p eq "t" } {
if {![parameter::get -package_id [ad_acs_kernel_id] -parameter PerformanceModeP -default 1]} {
lappend file_link_list "<a href=\"package-watch?package_key=$package_key\">watch all files</a>"
}
......@@ -137,9 +137,9 @@ if { $use_watches_p } {
set watch_files [nsv_array names apm_reload_watch]
if { [llength $watch_files] > 0 } {
append body "<h3>Watches</h3><ul>
<li><a href=\"file-watch-cancel\">Stop watching all files</a></li><br />"
<li><a href=\"file-watch-cancel\">Stop watching all files</a></li><br>"
foreach file [lsort $watch_files] {
if { [string compare $file "."] } {
if {$file ne "." } {
append body "<li>$file (<a href=\"file-watch-cancel?watch_file=[ns_urlencode $file]\">stop watching this file</a>)\n"
}
}
......
......@@ -11,6 +11,8 @@ ad_page_contract {
{ package_type "apm_application"}
{ initial_install_p "f" }
{ singleton_p "f" }
{ implements_subsite_p f }
{ inherit_templates_p t }
{ auto_mount "" }
package_uri
version_name
......@@ -25,6 +27,8 @@ ad_page_contract {
{ vendor [db_null] }
{ vendor_uri [db_null] }
{ install_p 0 }
{implements_subsite_p "f"}
{inherit_templates_p "f"}
} -validate {
package_key_format -requires {package_key} {
if { [regexp {[^a-z0-9-]} $package_key] } {
......@@ -95,15 +99,24 @@ is already registerd to another package."
version_id {You must provide an integer key for your package version.}
}
# XXXJCD: this should be in the UI, along with license etc.
set attributes(maturity) 0
db_transaction {
# Register the package.
apm_package_register $package_key $pretty_name $pretty_plural $package_uri \
$package_type $initial_install_p $singleton_p
$package_type $initial_install_p $singleton_p $implements_subsite_p \
$inherit_templates_p
# 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 $auto_mount]
set version_id [apm_package_install_version \
-callback apm_dummy_callback \
-version_id $version_id \
-array attributes \
$package_key $version_name $version_uri $summary $description \
$description_format $vendor $vendor_uri $auto_mount]
apm_version_enable -callback apm_dummy_callback $version_id
apm_build_one_package_relationships $package_key
apm_build_subsite_packages_list
apm_package_install_owners -callback apm_dummy_callback \
[apm_package_install_owners_prepare $owner_name $owner_uri] $version_id
......
......@@ -6,7 +6,7 @@ ad_page_contract {
} {
}
set user_id [ad_verify_and_get_user_id]
set user_id [ad_conn user_id]
db_1row apm_get_name {
select first_names || ' ' || last_name user_name, email from cc_users where user_id = :user_id
......@@ -20,7 +20,7 @@ doc_body_append "[apm_header -form "action=package-add-2 method=post" "Add a New
[export_form_vars package_id version_id]
<script language=javascript>
<script type=\"text/javascript\">
function updateURLs() {
// Update the package and version URL, if the package key and/or version name change.
var form = document.forms\[0\];
......@@ -31,7 +31,7 @@ function updateURLs() {
}
</script>
<script language=javascript>
<script type=\"text/javascript\">
function checkMailto(element) {
// If it looks like an email address without a mailto: (contains an @ but
// no colon) then prepend 'mailto:'.
......@@ -106,6 +106,14 @@ can have at most one instance; attempts to create more instances of the singleto
created instance. Singleton packages are appropriate for services that should not have multiple instances,
such as the ACS Kernel.
</tr>
<tr>
<th align=right nowrap>Implements Subsite?</th>
<td><input type=checkbox name=implements_subsite_p value=t> Does your package implement subsite semantics? Your package may do so by extending acs-subsite or by providing the means to mount applications, generate navigation tools, specify master templates, and manage community-oriented features such as user groups and roles.
</tr>
<tr>
<th align=right nowrap>Inherit Templates?</th>
<td><input type=checkbox name=inherit_templates_p value=t> Do you want your package to inherit templates from packages it extends? If true, the request processor will first try to map a URL corresponding to a mounted instance of your package to one of its templates, and if no match is found, will search extended packages. If false, only templates in your package will be mapped to URLs.
</tr>
<tr>
<th align=right nowrap>Auto-mount URI</th>
<td><input name=auto_mount size=30></td>
......
......@@ -25,13 +25,9 @@ apm_version_info $version_id
doc_body_append [apm_header "Delete"]
db_transaction {
apm_package_delete -sql_drop_scripts $sql_drop_scripts -remove_files=0 -callback apm_doc_body_callback $package_key
} on_error {
if {[apm_package_registered_p $package_key] } {
doc_body_append "The database returned the following error
message <pre><blockquote>[ad_quotehtml $errmsg]</blockquote></pre>"
}
if { [catch {apm_package_delete -sql_drop_scripts $sql_drop_scripts -remove_files=0 -callback apm_doc_body_callback $package_key} errmsg] } {
doc_body_append "We encountered the following error when deleting package \"$package_key\":
<pre><blockquote>[ad_quotehtml $errmsg]</blockquote></pre>"
}
doc_body_append "
......
......@@ -33,7 +33,7 @@ The following packages depend on package <code>$package_key</code> that you are
<p>
<code>
[join $dependent_packages_list "<br />"]
[join $dependent_packages_list "<br>"]
</code>
</p>
"
......@@ -47,7 +47,7 @@ set initial_install_p [db_string initial_install_p {
where package_key = :package_key
}]
if { [string equal $initial_install_p "t"] } {
if {$initial_install_p eq "t"} {
set kernel_deletion_warning "
<p>
You are about to delete package <code>$package_key</code> which is part of the <b>OpenACS core</b>
......@@ -57,7 +57,7 @@ if { [string equal $initial_install_p "t"] } {
set kernel_deletion_warning ""
}
if { ![empty_string_p $dependency_warning_text] || ![empty_string_p $kernel_deletion_warning] } {
if { $dependency_warning_text ne "" || $kernel_deletion_warning ne "" } {
set warning_text "
<p>
<b><font color=\"red\">WARNING</font></b>
......@@ -83,7 +83,7 @@ foreach file [apm_get_package_files -package_key $package_key -file_types data_m
</tr>"
}
if {![empty_string_p $file_list]} {
if {$file_list ne ""} {
set file_list "
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.
......
......@@ -13,8 +13,8 @@ ad_page_contract {
} -validate {
url_xor_file_path {
if {([empty_string_p $url] && [empty_string_p $file_path]) ||
(![empty_string_p $url] && ![empty_string_p $file_path]) } {
if {($url eq "" && $file_path eq "") ||
($url ne "" && $file_path ne "") } {
ad_complain
}
}
......@@ -30,9 +30,9 @@ if {$delete} {
ad_return_top_of_page "[apm_header -form "package-load" [list "package-load" "Load a New Package"] "View Package Contents"]
"
if {[empty_string_p $file_path]} {
if {$file_path eq ""} {
if {[string range $url 0 6] == "http://"} {
if {[string range $url 0 6] eq "http://"} {
set url [string range $url 7 end]
}
......@@ -68,14 +68,14 @@ if {[empty_string_p $file_path]} {
}
ns_log Debug "APM: Loading $file_path"
# If file_path ends in .apm, then load the single package.
if { ![string compare [string range $file_path [expr [string length $file_path] -3] end] "apm"] } {
if { ![string compare [string range $file_path [expr {[string length $file_path] -3}] end] "apm"] } {
apm_load_apm_file -callback apm_ns_write_callback $file_path
} else {
# See if this is a directory.
if { [file isdirectory $file_path] } {
#Find all the .APM and load them.
set apm_file_list [glob -nocomplain "$file_path/*.apm"]
if {[empty_string_p $apm_file_list]} {
if {$apm_file_list eq ""} {
ns_write "The directory specified, <code>$file_path</code>, does not contain any APM files. Please <a href=\"package-load\">try again</a>.[ad_footer]"
return
} else {
......
......@@ -11,7 +11,6 @@ ad_page_contract {
{force_p "f"}
}
# Install and enable are sets of keys; need to turn them back into spec files.
set spec_files [ad_get_client_property apm spec_files]
......@@ -22,69 +21,6 @@ set install $enable
ad_set_client_property -clob t apm pkg_install_list ""
ad_set_client_property -clob t apm pkg_enable_list ""
if {"" == $spec_files} {
### Get all the spec files
# If a package is in the apm_workspace dir then we assume that that is the package that
# should be installed and we ignore any such package in the packages dir.
# TODO: make sure that it's a later version than that in the packages dir?
set packages_root_dir "[acs_root_dir]/packages"
set packages_spec_files [apm_scan_packages $packages_root_dir]
set workspace_spec_files [apm_scan_packages [apm_workspace_install_dir]]
set workspace_filenames [list]
foreach spec_path $workspace_spec_files {
lappend workspace_filenames [file tail $spec_path]
}
set all_spec_files $workspace_spec_files
foreach spec_path $packages_spec_files {
set spec_filename [file tail $spec_path]
if { [lsearch -exact $workspace_filenames $spec_filename] == -1 } {
lappend all_spec_files $spec_path
}
}
# Determine which spec files are new installs; install all of the new items.
set spec_files [list]
set already_installed_list [list]
set not_compatible_list [list]
foreach spec_file $all_spec_files {
ns_log Notice "packages-install-2: spec_file=$spec_file"
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 { [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 &quot;$package_name&quot; ($package_key) version $version_name or higher is already installed."
}
} else {
lappend spec_files $spec_file
}
} else {
lappend not_compatible_list "Package &quot;$package_name&quot; ($package_key) doesn't support [db_type]."
}
}
}
set ttt {
ad_return_complaint 1 "
<pre>
enable=$enable
install=$install
spec_files=[join $spec_files "\n\t"]
</pre>
"
}
foreach spec_file $spec_files {
# Get package info, and find out if this is a package we should install
if { [catch {
......@@ -100,7 +36,7 @@ foreach spec_file $spec_files {
# 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) ""]
$package(embeds) $package(extends) $package(provides) $package(requires) ""]
if { [lsearch -exact $install $package(package.key)] != -1 } {
# This is a package which we should install
......@@ -121,7 +57,7 @@ if { [lindex $dependency_results 0] == 1 && [llength [lindex $dependency_results
set extra_package_keys [lindex $dependency_results 2]
# Check was good after adding a couple more pacakges
# Check was good after adding a couple more packages
doc_body_append "[apm_header "Package Installation"]
<h2>Additional Packages Automatically Added</h2><p>
......@@ -148,7 +84,7 @@ if { [lindex $dependency_results 0] == 1 && [llength [lindex $dependency_results
[ad_footer]
"
} elseif { ([lindex $dependency_results 0] == 1) || ![string compare $force_p "t"]} {
} elseif { ([lindex $dependency_results 0] == 1) || $force_p eq "t" } {
### Check passed! Initiate install.
# We use client properties to pass along this information as it is fairly large.
......
......@@ -55,7 +55,7 @@ foreach pkg_info $pkg_install_list {
set sql_file_list [concat $sql_file_list $data_model_files]
if {![empty_string_p $data_model_files]} {
if {$data_model_files ne ""} {
foreach file $data_model_files {
set path [lindex $file 0]
set file_type [lindex $file 1]
......@@ -68,7 +68,7 @@ foreach pkg_info $pkg_install_list {
}
if { [empty_string_p $version(auto-mount)] && [string equal $version(package.type) apm_application] } {
set mount_html "<input type=\"checkbox\" name=\"mount_p\" value=\"$version(package.key)\" /> Mount package under the main site at path <input type=\"text\" name=\"mount_path.$version(package.key)\" value=\"$version(package.key)\" />"
set mount_html "<input type=\"checkbox\" name=\"mount_p\" value=\"$version(package.key)\" checked> Mount package under the main site at path <input type=\"text\" name=\"mount_path.$version(package.key)\" value=\"$version(package.key)\">"
} else {
set mount_html ""
}
......@@ -90,7 +90,7 @@ foreach pkg_info $pkg_install_list {
ad_set_client_property -clob t apm sql_file_paths $sql_file_list
if {[empty_string_p $sql_file_list]} {
if {$sql_file_list eq ""} {
ad_returnredirect packages-install-4
ad_script_abort
}
......
......@@ -53,14 +53,14 @@ foreach pkg_info $pkg_install_list {
set data_model_files [list]
# Find the correct data model files for this package.
foreach file $sql_files {
if {![string compare [lindex $file 2] $package_key]} {
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 { [lsearch $mount_p $package_key] != -1 && [info exists mount_path($package_key)] && ![empty_string_p $mount_path($package_key)] } {
if { [lsearch $mount_p $package_key] != -1 && [info exists mount_path($package_key)] && $mount_path($package_key) ne "" } {
set selected_mount_path $mount_path($package_key)
} else {
set selected_mount_path ""
......@@ -69,7 +69,7 @@ foreach pkg_info $pkg_install_list {
# Install the packages.
ns_log Debug "APM: Installing package at $package_path."
set enable_p [expr [lsearch -exact $pkg_enable_list $package_key] != -1]
set enable_p [expr {[lsearch -exact $pkg_enable_list $package_key] != -1}]
set version_id [apm_package_install \
-enable=$enable_p \
......@@ -107,9 +107,3 @@ Done installing packages.
[ad_footer]
"
}
# Remove all permission related entries in the system cache
# Catch the call, becaus we are calling ]po[ from OpenACS.
catch { im_permission_flush }
......@@ -7,7 +7,6 @@ ad_page_contract {
} {
{checked_by_default_p:boolean 0}
{update_only_p 0}
}
ad_return_top_of_page "[apm_header "Package Installation"]
......@@ -67,7 +66,7 @@ apm_log APMDebug $spec_files
ns_write "Done.<p>
"
if { [empty_string_p $spec_files] } {
if { $spec_files eq "" } {
# No spec files to work with.
ns_write "
<h2>No New Packages to Install</h2><p>
......@@ -84,14 +83,14 @@ if { [empty_string_p $spec_files] } {
ns_write "
<script language=javascript>
<script type=\"text/javascript\">
function uncheckAll() {
for (var i = 0; i < [expr [llength $spec_files] ]; ++i)
for (var i = 0; i < [expr {[llength $spec_files] }]; ++i)
document.forms\[0\].elements\[i\].checked = false;
this.href='';
}
function checkAll() {
for (var i = 0; i < [expr [llength $spec_files] ]; ++i)
for (var i = 0; i < [expr {[llength $spec_files] }]; ++i)
document.forms\[0\].elements\[i\].checked = true;
this.href='';
}
......@@ -121,18 +120,18 @@ function checkAll() {
} else {
apm_log APMDebug "APM: Adding $package(package.key) to list for installation."
lappend pkg_info_list [pkg_info_new $package(package.key) $spec_file \
$package(provides) $package(requires) ""]
$package(embeds) $package(extends) $package(provides) $package(requires) ""]
lappend pkg_key_list $package(package.key)
}
}
if { $checked_by_default_p } {
set widget [apm_package_selection_widget -update_only_p $update_only_p $pkg_info_list $pkg_key_list $pkg_key_list]
set widget [apm_package_selection_widget $pkg_info_list $pkg_key_list $pkg_key_list]
} else {
set widget [apm_package_selection_widget -update_only_p $update_only_p $pkg_info_list]
set widget [apm_package_selection_widget $pkg_info_list]
}
if {[empty_string_p $widget]} {
if {$widget eq ""} {
ns_write "There are no new packages available.<p>
[ad_footer]"
ad_script_abort
......@@ -144,7 +143,7 @@ function checkAll() {
</form>
"
if {![empty_string_p $errors]} {
if {$errors ne ""} {
ns_write "The following errors were generated
<ul>
$errors
......
......@@ -12,12 +12,13 @@ ad_page_contract {
section_name
description:notnull,nohtml
datatype:notnull
scope:notnull
{default_value [db_null]}
{min_n_values:integer 1}
{max_n_values:integer 1}
} -validate {
datatype_type_ck {
if {$datatype != "number" && $datatype != "string"} {
if {$datatype != "number" && $datatype != "string" && $datatype != "text"} {
ad_complain
}
}
......@@ -32,11 +33,11 @@ ad_page_contract {
}
}
} -errors {
datatype_type_ck {The datatype must be either a number or a string.}
datatype_type_ck {The datatype must be either a number or a string or text.}
}
db_transaction {
apm_parameter_register -parameter_id $parameter_id $parameter_name $description $package_key \
apm_parameter_register -parameter_id $parameter_id -scope $scope $parameter_name $description $package_key \
$default_value $datatype $section_name $min_n_values $max_n_values
apm_package_install_spec $version_id
} on_error {
......@@ -52,7 +53,7 @@ db_transaction {
# LARS hack
set sections [lindex [lindex [apm_parameter_section_slider $package_key] 0] 3]
foreach section $sections {
if { [string equal $section_name [lindex $section 1]] } {
if {$section_name eq [lindex $section 1]} {
set section_name [lindex $section 0]
break
}
......
......@@ -10,10 +10,11 @@ ad_page_contract {
set user_id [ad_get_user_id]
set parameter_id [db_nextval acs_object_id_seq]
db_1row apm_get_name {
select package_key, pretty_name, version_name, acs_object_id_seq.nextval as parameter_id
from apm_package_version_info
where version_id = :version_id
select package_key, pretty_name, version_name
from apm_package_version_info
where version_id = :version_id
}
db_release_unused_handles
......@@ -29,7 +30,7 @@ append body "
<tr>
<td></td>
<td>A parameter can be used to store information that is specific to a package but that needs to
be easily configurable and customized on a package instance basis. The name should be a brief
be easily configurable and customized. The name should be a brief
plain text string that identifies the parameter.
</td>
</tr>
......@@ -63,6 +64,19 @@ to indicate which parameters pertain to security.
</td>
</tr>
<tr>
<td></td>
<td>Please indicate if the parameter is of \"global\" (has one system-wide value) or \"instance\" (a vlue for each package instance) scope.<br>
</td>
</tr>
<tr>
<th align=right nowrap>Scope:</th>
<td><select name=scope>
[ad_generic_optionlist {instance global} {instance global}]
</select>
</td>
</tr>
<tr>
<td></td>
......@@ -72,7 +86,7 @@ to indicate which parameters pertain to security.
<tr>
<th align=right nowrap>Type:</th>
<td><select name=datatype>
[ad_generic_optionlist {number string} {number string}]
[ad_generic_optionlist {number string textarea} {number string text}]
</select>
</td>
</tr>
......
......@@ -10,8 +10,6 @@ ad_page_contract {
version_id:naturalnum,notnull
}
apm_parameter_unregister $parameter_id
db_1row apm_package_by_version_id {
select pretty_name, version_name, package_key
from apm_package_version_info
......@@ -21,10 +19,37 @@ db_1row apm_package_by_version_id {
# LARS hack
set sections [lindex [lindex [apm_parameter_section_slider $package_key] 0] 3]
foreach section $sections {
if { [string equal $section_name [lindex $section 1]] } {
if {$section_name eq [lindex $section 1]} {
set section_name [lindex $section 0]
break
}
}
ad_returnredirect [export_vars -base "version-parameters" { version_id section_name }]
set return_url [export_vars -base "version-parameters" { version_id section_name }]
ad_form -name del -form {
parameter_id:key
{confirm_p:text(hidden)}
{version_id:text(hidden)}
{section_name:text(hidden)}
{pretty_name:text(inform) {label "Package"}}
{parameter_name:text(inform) {label "Parameter"}}
} -edit_request {
set confirm_p 1
set parameter_name [db_string get_parameter_name {
select parameter_name
from apm_parameters
where parameter_id = :parameter_id
}]
} -edit_data {
#here's where we actually do the delete.
apm_parameter_unregister $parameter_id
} -after_submit {
ad_returnredirect $return_url
ad_script_abort
} -cancel_url $return_url
set page_title "Confirm Deletion"
set context [list [list "." "Package Manager"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] [list [export_vars -base version-parameters { version_id section_name }] "Parameters"] $page_title]
ad_return_template
......@@ -17,12 +17,12 @@ ad_page_contract {
{max_n_values:integer 1}
} -validate {
datatype_type_ck {
if {$datatype != "number" && $datatype != "string"} {
if {$datatype != "number" && $datatype != "string" && $datatype != "text"} {
ad_complain
}
}
} -errors {
datatype_type_ck {The datatype must be either a number or a string.}
datatype_type_ck {The datatype must be either a number or a string or text.}
}
db_transaction {
......@@ -41,7 +41,7 @@ The database returned the following error:<p>
# LARS hack
set sections [lindex [lindex [apm_parameter_section_slider $package_key] 0] 3]
foreach section $sections {
if { [string equal $section_name [lindex $section 1]] } {
if {$section_name eq [lindex $section 1]} {
set section_name [lindex $section 0]
break
}
......
......@@ -9,7 +9,7 @@ ad_page_contract {
}
set user_id [ad_verify_and_get_user_id]
set user_id [ad_conn user_id]
db_1row param_info {
select parameter_name, datatype, description, default_value, min_n_values, max_n_values, parameter_id,
......@@ -80,7 +80,7 @@ to indicate which parameters pertain to security.
<tr>
<th align=right nowrap>Type:</th>
<td><select name=datatype>
[ad_generic_optionlist {number string} {number string} $datatype]
[ad_generic_optionlist {number string "textarea"} {number string text} $datatype]
</select>
</td>
</tr>
......
......@@ -5,15 +5,24 @@ designated compatible with your OpenACS kernel will be shown.</p>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>Package</th>
<th>Status</th>
<th>Description</th>
<th>Release</th>
</tr>
<multiple name="packages">
<tr>
<td style="border-color:gray; text-align:center" valign="center" ><b>@packages.pretty_name@</b></td>
<td style="border-color:gray"><b>@packages.summary@</b><br>@packages.description;noquote@</td>
<td style="border-color:gray">@packages.package_key@ @packages.version@
<br> released @packages.release_date@ by @packages.vendor@</small></td>
<td style="border-color:gray; text-align:center" valign="center" >
<b>@packages.pretty_name@</b>
</td>
<td>
@packages.maturity@: @packages.maturity_text@<br>
<a href="@packages.license_url@">@packages.license@</a>
</td>
<td style="border-color:gray">
<b>@packages.summary@</b>
<br>@packages.description;noquote@
<br><small>@packages.package_key@ @packages.version@ released @packages.release_date@ by @packages.vendor@</small>
</td>
</tr>
</multiple>
</table>
......@@ -15,7 +15,7 @@ db_1row package_version_info "select pretty_name, version_name from apm_package_
set return_url "version-callbacks?[export_vars { version_id }]"
# Set default values for type and proc name
if { [empty_string_p $type] } {
if { $type eq "" } {
# We are in add mode
set edit_mode_p 0
set unused_types [apm_unused_callback_types -version_id $version_id]
......
......@@ -9,13 +9,13 @@ ad_page_contract {
db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id"
set page_title "Tcl Callbacks"
set context [list [list "." "Package Manager"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] $page_title]
set page_title "\#acs-admin.Tcl_Callbacks\#"
set context [list [list "." "\#acs-admin.Package_Manager\#"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] $page_title]
set unused_callback_types [apm_unused_callback_types -version_id $version_id]
if { [llength $unused_callback_types] > 0 } {
set actions [list "Add callback" [export_vars -base "version-callback-add-edit" { version_id }]]
set actions [list "\#acs-admin.Add_callback\#" [export_vars -base "version-callback-add-edit" { version_id }]]
} else {
set actions [list]
}
......@@ -33,19 +33,19 @@ template::list::create \
<img src="/resources/acs-subsite/Edit16.gif" width="16" height="16" border="0">
}
link_url_eval {[export_vars -base "version-callback-add-edit" { version_id type }]}
link_html { title "Edit callback" }
link_html { title "\#acs-admin.Edit_callback\#" }
}
type {
label "Type"
label "\#acs-admin.Type\#"
}
proc {
label "Tcl Proc"
label "\#acs-admin.Tcl_Proc\#"
}
invoke {
label "Invoke"
display_template {<if @callbacks.type@ in "before-install" "after-install" "before-uninstall" "after-uninstall">Invoke</if><else><i style="color: gray;">N/A</i></else>}
label "\#acs-admin.Invoke\#"
display_template {<if @callbacks.type@ in "before-install" "after-install" "before-uninstall" "after-uninstall">\#acs-admin.Invoke\#</if><else><i style="color: gray;">N/A</i></else>}
link_url_eval {[ad_decode [lsearch { before-install after-install before-uninstall after-uninstall } $type] -1 {} [export_vars -base "version-callback-invoke" { version_id type }]]}
link_html { title "Invoke this callback proc now. Be careful!" }
link_html { title "\#acs-admin.Invoke_this_callback_proc_now_Be_careful\#" }
html { align center }
}
delete {
......@@ -55,7 +55,7 @@ template::list::create \
<img src="/resources/acs-subsite/Delete16.gif" width="16" height="16" border="0">
}
link_url_eval {[export_vars -base "version-callback-delete" { version_id type }]}
link_html { title "Delete callback" }
link_html { title "\#acs-admin.Delete_callback\#" }
}
}
......
......@@ -26,14 +26,16 @@
</fullquery>
<fullquery name="apm_specific_version_dependencies">
<querytext>
select t.pretty_name dep_pretty_name, v.version_name dep_version_name, v.version_id dep_version_id
from apm_package_versions v, apm_package_dependencies d, apm_package_types t
where d.service_uri = :service_uri
and d.dependency_type = :other_dependency_type_prep
and d.version_id = v.version_id
and t.package_key = v.package_key
and apm_package_version.sortable_version_name(d.service_version) $sign apm_package_version.sortable_version_name(:service_version)
<querytext>
select t.pretty_name dep_pretty_name, v.version_name dep_version_name,
v.version_id dep_version_id, d.dependency_type as dep_type
from apm_package_versions v, apm_package_dependencies d, apm_package_types t
where d.service_uri = :service_uri
and d.dependency_type = in ($other_dependency_in)
and d.version_id = v.version_id
and t.package_key = v.package_key
and apm_package_version.sortable_version_name(d.service_version)
$sign apm_package_version.sortable_version_name(:service_version)
</querytext>
</fullquery>
......
......@@ -28,10 +28,10 @@
<fullquery name="apm_specific_version_dependencies">
<querytext>
select t.pretty_name as dep_pretty_name, v.version_name as dep_version_name,
v.version_id as dep_version_id
v.version_id as dep_version_id, d.dependency_type as dep_type
from apm_package_versions v, apm_package_dependencies d, apm_package_types t
where d.service_uri = :service_uri
and d.dependency_type = :other_dependency_type_prep
and d.dependency_type in ($other_dependency_in)
and d.version_id = v.version_id
and t.package_key = v.package_key
and apm_package_version__sortable_version_name(d.service_version) $sign
......
......@@ -7,29 +7,28 @@ ad_page_contract {
{version_id:integer}
}
db_1row apm_package_info_by_version_id {
select package_key, pretty_name, version_name, installed_p
from apm_package_version_info
where version_id = :version_id
}
db_1row apm_package_info_by_version_id {}
doc_body_append "[apm_header [list "version-view?version_id=$version_id" "$pretty_name $version_name"] "Dependencies"]
"
foreach dependency_type { provide require } {
set other_dependency_type [ad_decode $dependency_type "provide" "require" "provide"]
doc_body_append "<h3>Services [string totitle $dependency_type]d</h3><ul>\n"
foreach dependency_type { provide require extend embed } {
set dependency_type_prep "${dependency_type}s"
db_foreach apm_all_dependencies {
select dependency_id, service_uri, service_version
from apm_package_dependencies
where version_id = :version_id
and dependency_type = :dependency_type_prep
order by service_uri
} {
doc_body_append "<li>[string totitle $dependency_type]s service $service_uri, version $service_version (<a href=\"version-dependency-remove?[export_url_vars dependency_id version_id dependency_type]\">remove</a>)\n"
if { [string index $dependency_type end] eq "e" } {
set dependency_type_prep_2 ${dependency_type}d
} else {
set dependency_type_prep_2 ${dependency_type}ed
}
doc_body_append "<h3>Services [string totitle $dependency_type_prep_2]</h3><ul>\n"
db_foreach apm_all_dependencies {} {
doc_body_append "<li>[string totitle $dependency_type_prep] service $service_uri, version $service_version"
if { $dependency_type ne "provide" } {
doc_body_append "(<a href=\"version-dependency-remove?[export_url_vars package_key dependency_id version_id dependency_type]\">remove</a>)\n"
}
# If this package provides a service, show a list of all packages that require it,
# or vice versa. If this package provides a service, show other packages requiring
......@@ -39,20 +38,19 @@ foreach dependency_type { provide require } {
set sign [ad_decode $dependency_type "provide" "<=" ">="]
set counter 0
set other_dependency_type_prep "${other_dependency_type}s"
db_foreach apm_specific_version_dependencies "
select t.pretty_name dep_pretty_name, v.version_name dep_version_name, v.version_id dep_version_id
from apm_package_versions v, apm_package_dependencies d, apm_package_types t
where d.service_uri = :service_uri
and d.dependency_type = :other_dependency_type_prep
and d.version_id = v.version_id
and t.package_key = v.package_key
and apm_package_version.sortable_version_name(d.service_version) $sign apm_package_version.sortable_version_name(:service_version)" {
incr counter
set other_dependency_in [ad_decode $dependency_type "provide" "'requires','extends','embeds'" "'provides'"]
db_foreach apm_specific_version_dependencies {} {
incr counter
if { $counter == 1 } {
doc_body_append "<ul>\n"
}
doc_body_append "<li>[string totitle $other_dependency_type]d by <a href=\"version-view?version_id=$dep_version_id\">$dep_pretty_name, version $dep_version_name</a>\n"
switch $dep_type {
provides { set dep_d provided }
requires { set dep_d required }
extends { set dep_d extended }
embeds { set dep_d embeds }
}
doc_body_append "<li>[string totitle $dep_d] by <a href=\"version-view?version_id=$dep_version_id\">$dep_pretty_name, version $dep_version_name</a>\n"
}
if { $counter != 0 } {
doc_body_append "</ul>\n"
......@@ -60,8 +58,8 @@ and apm_package_version.sortable_version_name(d.service_version) $sign apm_packa
} else {
doc_body_append "<li>This package does not $dependency_type any services.\n"
}
if { $installed_p == "t" } {
doc_body_append "<li><a href=\"version-dependency-add?[export_url_vars version_id dependency_type]\">Add a service ${dependency_type}d by this package</a>\n"
if { $installed_p eq "t" && $dependency_type ne "provide"} {
doc_body_append "<li><a href=\"version-dependency-add?[export_url_vars version_id dependency_type]\">Add a service $dependency_type_prep_2 by this package</a>\n"
}
doc_body_append "</ul>\n"
}
......
......@@ -7,25 +7,39 @@ ad_page_contract {
{dependency_id:naturalnum}
{version_id:integer}
dependency_type
service_uri
service_version
service:notnull
our_package_key:notnull
}
set service [split $service ";"]
set package_key [lindex $service 0]
set version_name [lindex $service 1]
apm_package_install_spec $version_id
db_transaction {
switch $dependency_type {
require {
apm_dependency_add -dependency_id $dependency_id $version_id $service_uri $service_version
apm_dependency_add -dependency_id $dependency_id ${dependency_type}s $version_id $package_key $version_name
apm_build_one_package_relationships $our_package_key
}
extend {
apm_dependency_add -dependency_id $dependency_id ${dependency_type}s $version_id $package_key $version_name
apm_build_one_package_relationships $our_package_key
apm_copy_inherited_params $our_package_key [list $package_key $version_name]
}
provide {
apm_interface_add -interface_id $dependency_id $version_id $service_uri $service_version
embed {
apm_dependency_add -dependency_id $dependency_id ${dependency_type}s $version_id $package_key $version_name
apm_build_one_package_relationships $our_package_key
apm_copy_inherited_params $our_package_key [list $package_key $version_name]
}
default {
ad_return_complaint 1 "Entry error: Depenendencies are either provided or required."
ad_return_complaint 1 "Entry error: Allowable dependencies are required, extends and embeds."
}
}
apm_package_install_spec $version_id
} on_error {
if { ![db_string apm_dependency_doubleclick_check {
select count(*) from apm_package_dependencies
......
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="apm_all_service_uri">
<fullquery name="apm_packages">
<querytext>
select distinct service_uri, service_version
from apm_package_dependencies
order by service_uri, apm_package_version.sortable_version_name(service_version)
select package_key, version_name
from apm_package_versions
where enabled_p = 't'
and installed_p = 't'
and package_key <> :package_key
order by package_key, apm_package_version.sortable_version_name(version_name)
</querytext>
</fullquery>
......
......@@ -2,13 +2,15 @@
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="apm_all_service_uri">
<fullquery name="apm_packages">
<querytext>
select distinct service_uri, service_version,
apm_package_version__sortable_version_name(service_version)
from apm_package_dependencies
order by service_uri, apm_package_version__sortable_version_name(service_version)
select package_key, version_name,
apm_package_version__sortable_version_name(version_name)
from apm_package_versions
where enabled_p
and installed_p
and package_key <> :package_key
order by package_key, apm_package_version__sortable_version_name(version_name)
</querytext>
</fullquery>
......
......@@ -8,66 +8,29 @@ ad_page_contract {
dependency_type
}
db_1row apm_package_info_by_version_id_and_package {
select p.package_key, p.package_uri,
p.pretty_name, v.version_name
from apm_package_types p, apm_package_versions v
where v.version_id = :version_id
and v.package_key = p.package_key
}
db_1row apm_package_info_by_version_id_and_package {}
set dependency_id [db_nextval acs_object_id_seq]
doc_body_append "[apm_header -form "action=version-dependency-add-2" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-dependencies?version_id=$version_id" "Dependencies"] "Add a Dependency"]
[export_form_vars version_id dependency_type dependency_id]
<script language=javascript>
// Invoked when the user selects a service from the select list.
function selectService(which) {
// Select the radio button next to the list of services.
var form = document.forms\[0\];
form.which\[0\].checked = 1;
// Fill in the text fields according to the service selected (the URL
// is before the semicolon; the version number is after it)
value = which.options\[which.selectedIndex\].value;
semi = value.indexOf(';');
form.service_uri.value = value.substring(0, semi);
form.service_version.value = value.substring(semi + 1);
}
</script>
<blockquote>
<table cellspacing=0 cellpadding=0>
<tr><td><input type=radio name=which value=service>&nbsp;</td><td>$pretty_name ${dependency_type}s the following service:</td></tr>
[export_vars -form {version_id dependency_type dependency_id {our_package_key $package_key}}]
<tr><td></td><td>
<select name=service_select size=8 onChange=\"selectService(this)\">
$pretty_name ${dependency_type}s the following service:
<p>
<select name=service size=8>
"
db_foreach apm_all_service_uri {
select distinct service_uri, service_version
from apm_package_dependencies
order by service_uri, apm_package_version.sortable_version_name(service_version)
} {
doc_body_append "<option value=\"$service_uri;$service_version\">$service_uri, version $service_version\n"
db_foreach apm_packages {} {
doc_body_append "<option value=\"$package_key;$version_name\">$package_key, version $version_name\n"
}
db_release_unused_handles
doc_body_append "</select>
</td></tr>
<tr><td><input type=radio name=which value=other>&nbsp;</td><td>$pretty_name ${dependency_type}s the following other service:</td></tr>
<tr><td></td><td><input name=service_uri size=60 onFocus=\"form.which\[1\].checked = 1\">, version <input name=service_version size=10 onFocus=\"form.which\[1\].checked = 1\"></td></tr>
</table>
</blockquote>
<center>
doc_body_append "</select>
<br>
<input type=submit value=\"Add Dependency\">
</center>
[ad_footer]
"
......
......@@ -7,16 +7,19 @@ ad_page_contract {
{version_id:integer}
{dependency_id:integer}
dependency_type:notnull
package_key:notnull
}
db_transaction {
switch $dependency_type {
provide {
apm_dependency_remove $dependency_id
}
require {
apm_interface_remove $dependency_id
provide - require {
apm_dependency_remove $dependency_id
}
embed - extend {
apm_unregister_disinherited_params $package_key $dependency_id
apm_dependency_remove $dependency_id
apm_build_one_package_relationships $package_key
}
default {
......
......@@ -20,6 +20,25 @@ ad_page_contract {
{ upgrade_p 0 }
}
# Validate dynamic package version attributes
# Also put all dynamic attributes in an array
array set all_attributes [apm::package_version::attributes::get_spec]
foreach attribute_name [array names all_attributes] {
array set attribute $all_attributes($attribute_name)
set attribute_value [ns_set iget [rp_getform] $attribute_name]
if { [info exists attribute(validation_proc)] } {
set attribute_error [eval $attribute(validation_proc) $attribute_value]
if { $attribute_error ne "" } {
ad_return_complaint 1 $attribute_error
}
}
set dynamic_attributes($attribute_name) $attribute_value
}
if {![regexp {^[0-9]+((\.[0-9]+)+((d|a|b|)[0-9]*)?)$} $version_name match]} {
ad_return_complaint 1 "The version name has invalid characters"
ad_script_abort
......@@ -27,15 +46,15 @@ if {![regexp {^[0-9]+((\.[0-9]+)+((d|a|b|)[0-9]*)?)$} $version_name match]} {
# Figure out if we're changing version
db_1row old_version_info {}
set version_changed_p [expr ![string equal $version_name $old_version_name]]
set version_changed_p [expr {$version_name ne $old_version_name }]
if { [string equal $old_version_name $version_name] } {
if {$old_version_name eq $version_name} {
# The version name didn't change, so don't attempt to upgrade
set upgrade_p 0
}
# The user has to update the URL if he changes the name.
if { $version_changed_p && [string equal $version_uri $old_version_uri] } {
if { $version_changed_p && $version_uri eq $old_version_uri } {
ad_return_complaint 1 {You have changed the version number but not the version URL. When creating
a package for a new version, you must select a new URL for the version.}
}
......@@ -48,7 +67,7 @@ if { $upgrade_p && [db_string apm_version_uri_unique_ck {
}
db_transaction {
set version_id [apm_version_update $version_id $version_name $version_uri \
set version_id [apm_version_update -array dynamic_attributes $version_id $version_name $version_uri \
$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
......
......@@ -26,7 +26,7 @@ if { $version_name_index >= 0 } {
set version_uri_suffix [string range $version_uri [expr { $version_name_index + [string length $version_name] }] end]
doc_body_append "
<script language=javascript>
<script type=\"text/javascript\">
function updateVersionURL() {
var form = document.forms\[0\];
form.version_uri.value = '$version_uri_prefix' + form.version_name.value + '$version_uri_suffix';
......@@ -39,7 +39,7 @@ function updateVersionURL() {
}
doc_body_append "
<script language=javascript>
<script type=\"text/javascript\">
function checkMailto(element) {
// If it looks like an email address without a mailto: (contains an @ but
// no colon) then prepend 'mailto:'.
......@@ -68,17 +68,27 @@ function checkMailto(element) {
<tr>
<th align=right nowrap>OpenACS Core:</th>
<td>$initial_install_p</td>
<td>[ad_decode $initial_install_p t Yes No]</td>
</tr>
<tr>
<th align=right nowrap>Singleton:</th>
<td>$singleton_p</td>
<td>[ad_decode $singleton_p t Yes No]</td>
</tr>
<tr>
<th align=right nowrap>Implements Subsite:</th>
<td>[ad_decode $implements_subsite_p t Yes No]</td>
</tr>
<tr>
<th align=right nowrap>Inherit Templates:</th>
<td>[ad_decode $inherit_templates_p t Yes No]</td>
</tr>
<tr>
<th align=right nowrap>Auto-mount:</th>
<td><input name=auto_mount size=30 value=\"$auto_mount\" /></td>
<td><input name=auto_mount size=30 value=\"$auto_mount\"></td>
</tr>
<tr>
......@@ -115,6 +125,31 @@ This description is <select name=description_format>
</tr>
"
# 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 all_attributes] {
array set attribute $all_attributes($attribute_name)
if { [info exists attributes($attribute_name)] } {
# Attribute is already in db
set attribute_value $attributes($attribute_name)
} else {
# The attribute is not in the db yet
set attribute_value [apm::package_version::attributes::default_value $attribute_name]
}
doc_body_append "
<tr>
<th align=right nowrap>${attribute(pretty_name)}:</th>
<td><input name=\"$attribute_name\" size=\"30\" value=\"$attribute_value\">
</td>
</tr>
"
}
# Build a list of owners. Ensure that there are at least two.
set owners [db_list_of_lists apm_all_owners {
select owner_name, owner_uri from apm_package_owners where version_id = :version_id
......
......@@ -4,10 +4,12 @@
<fullquery name="apm_all_version_info">
<querytext>
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
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, implements_subsite_p, inherit_templates_p
from apm_package_version_info where version_id = :version_id
</querytext>
......
......@@ -33,7 +33,7 @@ foreach path [apm_get_package_files -package_key $package_key] {
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] } {
if { $file_type eq "" } {
set file_type "?"
}
set file_pretty_name $file_type
......@@ -44,7 +44,7 @@ foreach path [apm_get_package_files -package_key $package_key] {
# we wrote out.
set components [split $path "/"]
for { set i 0 } { $i < [llength $components] - 1 && $i < [llength $last_components] - 1 } { incr i } {
if { [string compare [lindex $components $i] [lindex $last_components $i]] } {
if {[lindex $components $i] ne [lindex $last_components $i] } {
break
}
}
......@@ -55,7 +55,7 @@ foreach path [apm_get_package_files -package_key $package_key] {
for { set j 0 } { $j < $i } { incr j } {
append body "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
}
if { $installed_p == "f" || [file exists "[acs_package_root_dir $package_key]/$path"] || $i < [llength $components] - 1} {
if { $installed_p eq "f" || [file exists "[acs_package_root_dir $package_key]/$path"] || $i < [llength $components] - 1} {
# Either we're not looking at an installed package, or the file still exists,
# so don't use <strike> when writing the name.
append body [lindex $components $i]
......@@ -74,15 +74,15 @@ foreach path [apm_get_package_files -package_key $package_key] {
append body "<td width=40>&nbsp;</td><td>$file_pretty_name</td><td width=40>&nbsp</td><td>$db_pretty_name</td>
<td width=40>&nbsp;</td>"
if { $installed_p == "t" } {
if { $installed_p eq "t" } {
set server_rel_path "packages/$package_key/$path"
if { [apm_file_watchable_p $server_rel_path] } {
if { [nsv_exists apm_reload_watch $server_rel_path] } {
# This procs file is already being watched.
append body "<td>&nbsp;being watched&nbsp;</td>"
} else {
if {![ad_parameter -package_id [ad_acs_kernel_id] \
PerformanceModeP request-processor 1]} {
if {![parameter::get -package_id [ad_acs_kernel_id] \
-parameter PerformanceModeP -default 1]} {
# Provide a link to watch the procs file.
append body "<td>&nbsp;<a href=\"file-watch?[export_vars -url {version_id {paths $path} return_url}]\">watch</a>&nbsp;</td>"
} else {
......@@ -101,7 +101,7 @@ foreach path [apm_get_package_files -package_key $package_key] {
set last_components $components
}
if { [string equal $counter 0] } {
if {$counter eq "0"} {
append body "<tr><td>This package does not contain any registered files.</td></tr>\n"
}
......@@ -109,19 +109,19 @@ append body "</table>
</blockquote>
"
if { $installed_p == "t" } {
if { $installed_p eq "t" } {
append body "<ul>
<li><a href=\"package-watch?[export_vars -url {package_key return_url}]\">watch all files</a></li>
<li><a href=\"package-watch-cancel?[export_vars -url {package_key return_url}]\">cancel all watches</a></li>"
if { [empty_string_p $distribution_uri] } {
if { $distribution_uri eq "" } {
append body "
<p>
<!--li><a href=\"version-tag?version_id=$version_id\">Create a CVS tag for this version in each file</a-->"
}
if {$tagged_p == "t"} {
if {$tagged_p eq "t"} {
append body "
<li><a href=\"archive/[file tail $version_uri]?version_id=$version_id\">Download a tarball from the package archive</a>"
}
......@@ -129,7 +129,7 @@ if { $installed_p == "t" } {
append body "</ul>"
} elseif { [info exists tagged_p] } {
if { $tagged_p == "t" } {
if { $tagged_p eq "t" } {
append body "<ul>
<li><a href=\"archive/[file tail $version_uri]?version_id=$version_id\">Download a tarball from the package archive</a>
</ul>
......
......@@ -12,13 +12,11 @@ ad_page_contract {
{context_p 1}
}
db_1row apm_package_by_version_id {
select package_name, version_name, package_id from apm_package_version_info where version_id = :version_id
}
db_1row apm_package_by_version_id {}
set analyze_dir [ns_mktemp "[acs_root_dir]/apm-workspace/diffs-XXXXXX"]
doc_body_append "[apm_header "Create Diffs for $package_name $version_name"]
doc_body_append "[apm_header "Create Diffs for $pretty_name $version_name"]
<ul><li>Extracting the archive into $analyze_dir...<li>
"
......@@ -33,7 +31,7 @@ set no_changes [list]
global errorCode
foreach file [apm_version_file_list $version_id] {
foreach file [apm_get_package_files -package_key $package_key] {
if { ![file isfile "[acs_root_dir]/$file"] } {
doc_body_append "<h3>$file</h3>\n<blockquote>This file has been locally added.</blockquote>\n"
continue
......
......@@ -4,7 +4,7 @@
<fullquery name="apm_package_by_version_id">
<querytext>
select package_name, version_name, package_id from apm_package_version_info where version_id = :version_id
select package_key, pretty_name, version_name from apm_package_version_info where version_id = :version_id
</querytext>
</fullquery>
......
......@@ -71,18 +71,18 @@ if { $replace_text_p } {
set text_replacement_list [lindex $adp_text_result_list 0]
set text_untouched_list [lindex $adp_text_result_list 1]
append processing_html_result "<b>Replaced [llength $text_replacement_list] texts</b>: <br />"
append processing_html_result "<b>Replaced [llength $text_replacement_list] texts</b>: <br>"
foreach text_replacement $text_replacement_list {
append processing_html_result "replaced text \"[lindex $text_replacement 1]\" using key [lindex $text_replacement 0] <br />"
append processing_html_result "replaced text \"[lindex $text_replacement 1]\" using key [lindex $text_replacement 0] <br>"
}
if { [llength $text_untouched_list] > 0 } {
append processing_html_result "<br /> [llength $text_untouched_list] pieces of text were left untouched. Please take note of these texts and do any necessary translations by manually inserting <#message_key text#> tags in the adp file (the message keys should contain only letters and underscores). At a later stage you can then run the action \"Replace tags with text and insert into catalog\" on the file. The texts to consider for translation are: <br />"
append processing_html_result "<br> [llength $text_untouched_list] pieces of text were left untouched. Please take note of these texts and do any necessary translations by manually inserting <#message_key text#> tags in the adp file (the message keys should contain only letters and underscores). At a later stage you can then run the action \"Replace tags with text and insert into catalog\" on the file. The texts to consider for translation are: <br>"
} else {
append processing_html_result "<br /> [llength $text_untouched_list] pieces of text were left untouched."
append processing_html_result "<br> [llength $text_untouched_list] pieces of text were left untouched."
}
foreach untouched_text $text_untouched_list {
append processing_html_result "\"$untouched_text\" <br />"
append processing_html_result "\"$untouched_text\" <br>"
}
}
......@@ -104,7 +104,7 @@ if { $replace_tags_p } {
append processing_html_result "<h3>Message tag replacements for $file</h3>"
set number_of_replacements [lang::util::replace_temporary_tags_with_lookups $file]
set total_number_of_replacements [expr $total_number_of_replacements + $number_of_replacements]
set total_number_of_replacements [expr {$total_number_of_replacements + $number_of_replacements}]
append processing_html_result "Did $number_of_replacements replacements, see the log file for details"
}
......
......@@ -10,7 +10,7 @@
<form action="version-i18n-process-2">
@hidden_form_vars;noquote@
<input type="hidden" name="number_of_keys" value="@replacements:rowcount@" />
<input type="hidden" name="number_of_keys" value="@replacements:rowcount@">
<table border="1">
<tr>
......@@ -23,14 +23,14 @@
<tr>
<td>@replacements.text;noquote@</td>
<td><input type="checkbox" name="replace_p.@replacements.rownum@" value="1" checked="1"> Yes</td>
<td><input type="text" name="message_keys.@replacements.rownum@" value="@replacements.key@" /></td>
<td><input type="text" name="message_keys.@replacements.rownum@" value="@replacements.key@"></td>
</tr>
</multiple>
</table>
<p>
<input type="submit" name="process_button" value="Process ADP" />
<input type="submit" name="skip_button" value="Skip ADP" />
<input type="submit" name="process_button" value="Process ADP">
<input type="submit" name="skip_button" value="Skip ADP">
</p>
</form>
......
......@@ -62,7 +62,7 @@ foreach file [lsort [ad_find_all_files [acs_package_root_dir $package_key]]] {
set add_file_p 1
# If we are showing adp:s and we are only showing adp:s with texts to translate, check if
# this file has any texts
if { [string equal $file_type "adp"] && $only_text_p } {
if { $file_type eq "adp" && $only_text_p } {
if { $number_of_text_snippets == "0" } {
set add_file_p 0
}
......@@ -95,14 +95,13 @@ element create file_list_form files \
-values $adp_preselect_list
set action_label "Action to take on files"
if { [string equal $file_type adp] } {
if {$file_type eq "adp"} {
element create file_list_form file_action \
-datatype text \
-widget checkbox \
-label $action_label \
-options {{{Find human language text and replace with <# ... #> tags} replace_text} {{Replace <# ... #> tags with #...# keys and insert message into catalog} replace_tags}} \
-values {replace_text} \
-section action_section
} else {
# TCL files or SQL files
element create file_list_form tcl_action_inform \
......
......@@ -29,7 +29,7 @@ where version_id = :version_id
order by element_name
} {
if $first_iteration {
if {$first_iteration} {
doc_body_append "
<tr>
<th>Parameter</th>
......
......@@ -24,6 +24,7 @@ set dimensional_list [apm_parameter_section_slider $package_key]
set table_def [list \
[list parameter_name "Parameter"] \
[list datatype "Type"] \
[list scope "Scope"] \
[list description "Description" {} {<td>[ad_quotehtml $description]</td>}]]
#DRB: sql_clauses must not contain RDBMS-specific query clauses.
......@@ -49,23 +50,23 @@ append body "
<blockquote>
"
if { ![empty_string_p $dimensional_list] } {
if { $dimensional_list ne "" } {
append body "[ad_dimensional $dimensional_list]<p>"
}
# LARS hack
set sections [lindex [lindex $dimensional_list 0] 3]
foreach section $sections {
if { [string equal $section_name [lindex $section 0]] } {
if {$section_name eq [lindex $section 0]} {
set section_name [lindex $section 1]
break
}
}
set parent_package_keys [lrange [apm_one_package_inherit_order $package_key] 0 end-1]
append body "[ad_table -Torderby $orderby \
-bind [ad_tcl_vars_to_ns_set version_id package_key] \
-bind [ad_tcl_vars_to_ns_set version_id package_key parent_package_keys] \
-Textra_vars {version_id} \
-Tmissing_text "No parameters registered in this section." \
parameter_table "" $table_def]
......
......@@ -11,5 +11,21 @@
</querytext>
</fullquery>
<fullquery name="parameter_table">
<querytext>
select ap.parameter_name, coalesce(ap.description, 'No Description') as description,
ap.datatype, ap.default_value, ap.parameter_id, ap.scope,
coalesce(ap.section_name, 'No Section') as section_name
from apm_parameters ap
where package_key = :package_key
and not exists (select 1
from apm_parameters ap2
where ap.parameter_name = ap2.parameter_name
and ap2.package_key in ('[join $parent_package_keys ',']'))
$sql_clauses
</querytext>
</fullquery>
</queryset>
......@@ -9,19 +9,14 @@ ad_page_contract {
{version_id:integer}
}
db_1row apm_package_by_version_id {
select package_name, version_name, package_id
from apm_package_version_info where version_id = :version_id
}
db_1row apm_package_by_version_id {}
if { $installed_p == "f" } {
if { $installed_p eq "f" } {
ad_return_complaint 1 "<li>The selected version is not installed"
return
}
set files [db_list apm_all_paths {
select path from apm_package_files where version_id = :version_id order by path
}]
set files [db_list apm_all_paths {}]
if { [llength $files] == 0 } {
ad_return_complaint 1 "<li>No files in this packages"
......@@ -36,14 +31,13 @@ set version_tag [apm_package_version_release_tag $package_key $version_name]
# Path to the CVS executable
set cvs [ad_parameter CvsPath vc]
doc_body_append "[apm_header [list "version-view?version_id=$version_id" "$package_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Tag"]
set cvs [parameter::get -package_id [ad_acs_kernel_id] -parameter CvsPath]
<p> We're going to write the CVS tag <code>$version_tag</code> into
doc_body_append [apm_header [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Tag"] \
"<p> We're going to write the CVS tag <code>$version_tag</code> into
the repository for each file in this package. This will let you
retrieve the exact set of revisions that make up
$package_name $version_name in the future. You can repeat
$pretty_name $version_name in the future. You can repeat
this operation as often as you want, to tag new files for example.
<p>Here goes:
......@@ -121,18 +115,10 @@ if {$bad_file_count} {
this page or run the tagging operation again. This package won't
be archivable until the tagging is completed with no errors."
db_dml apm_all_files_untag {
update apm_package_versions
set tagged_p = 'f'
where version_id = :version_id
}
db_dml apm_all_files_untag {}
} else {
doc_body_append "<p>All files were tagged successfully."
db_dml apm_all_files_tag {
update apm_package_versions
set tagged_p = 't'
where version_id = :version_id
}
db_dml apm_all_files_tag {}
}
doc_body_append "
......
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_package_by_version_id">
<querytext>
select package_name, version_name, package_id
from apm_package_version_info where version_id = :version_id
<fullquery name="apm_package_by_version_id">
<querytext>
select pretty_name, version_name
from apm_package_version_info
where version_id = :version_id
</querytext>
</fullquery>
</querytext>
</fullquery>
<fullquery name="apm_all_paths">
<querytext>
......
......@@ -35,7 +35,7 @@ db_0or1row apm_data_model_install_version {
where rownum = 1
}
if { [empty_string_p $vendor] } {
if { $vendor eq "" } {
set vendor $vendor_uri
}
foreach field { summary description release_date vendor } {
......@@ -60,7 +60,7 @@ want to <a href=\"version-generate-info?version_id=$version_id&write_p=1\">gener
lappend prompts $status
} elseif { $installed_version_id == $version_id } {
set status "This version of the package is installed"
if { $enabled_p == "t" } {
if { $enabled_p eq "t" } {
append status " and enabled."
set can_disable_p 1
} else {
......@@ -77,7 +77,7 @@ version $installed_version_name, is installed and [ad_decode $installed_enabled_
if { ![info exists data_model_installed_version] } {
set data_model_status " No version of the data model for this package has been loaded."
} elseif { [string compare $data_model_installed_version $version_name] } {
} 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 {
......@@ -96,7 +96,7 @@ set owners [list]
db_foreach apm_all_owners {
select owner_uri, owner_name from apm_package_owners where version_id = :version_id
} {
if { [empty_string_p $owner_uri] } {
if { $owner_uri eq "" } {
lappend owners $owner_name
} else {
lappend owners "$owner_name (<a href=\"$owner_uri\">$owner_uri</a>)"
......@@ -130,13 +130,15 @@ $prompt_text
<tr valign=baseline><th align=left>Version:</th><td>$version_name</td></tr>
<tr valign=baseline><th align=left>OpenACS Core:</th><td>[ad_decode $initial_install_p "t" "Yes" "No"]</td></tr>
<tr valign=baseline><th align=left>Singleton:</th><td>[ad_decode $singleton_p "t" "Yes" "No"]</td></tr>
<tr valign=baseline><th align=left>Implements Subsite:</th><td>[ad_decode $implements_subsite_p t Yes No]</td></tr>
<tr valign=baseline><th align=left>Inherit Templates:</th><td>[ad_decode $inherit_templates_p t Yes No]</td></tr>
<tr valign=baseline><th align=left>Auto-mount:</th><td>$auto_mount</td></tr>
<tr valign=baseline><th align=left>Status:</th><td>$status</td></tr>
<tr valign=baseline><th align=left>Data Model:</th><td>$data_model_status</td></th></tr>
"
set supported_databases_list [apm_package_supported_databases $package_key]
if { [empty_string_p $supported_databases_list] } {
if { $supported_databases_list eq "" } {
set supported_databases "none specified"
} else {
set supported_databases [join $supported_databases_list ", "]
......@@ -152,30 +154,43 @@ append body "
<tr valign=baseline><th align=left>Package Key:</th><td>$package_key</td></th></tr>
<tr valign=baseline><th align=left>Summary:</th><td>$summary</td></tr>
<tr valign=baseline><th align=left>Description:</th><td>$description</td></tr>
<tr valign=baseline><th align=left>Release Date:</th><td>$release_date</td></tr>
<tr valign=baseline><th align=left>Release Date:</th><td>$release_date</td></tr>"
# 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 "<tr valign=baseline><th align=left>$attribute(pretty_name)</th><td>$attributes($attribute_name)</td></tr>"
}
append body "
<tr valign=baseline><th align=left>Vendor:</th><td>[ad_decode $vendor_uri "" $vendor "<a href=\"$vendor_uri\">$vendor</a>"]</td></tr>
<tr valign=baseline><th align=left>Package URL:</th><td><a href=\"$package_uri\">$package_uri</a></td></th></tr>
<tr valign=baseline><th align=left>Version URL:</th><td><a href=\"$version_uri\">$version_uri</a></td></th></tr>
<tr valign=baseline><th align=left>Distribution File:</th><td>"
if { ![empty_string_p $tarball_length] && $tarball_length > 0 } {
if { $tarball_length ne "" && $tarball_length > 0 } {
append body "<a href=\"packages/[file tail $version_uri]?version_id=$version_id\">[format "%.1f" [expr { $tarball_length / 1024.0 }]]KB</a> "
if { [empty_string_p $distribution_uri] } {
if { $distribution_uri eq "" } {
append body "(generated on this system"
if { ![empty_string_p $distribution_date] } {
if { $distribution_date ne "" } {
append body " on $distribution_date"
}
append body ")"
} else {
append body "(downloaded from $distribution_uri"
if { ![empty_string_p $distribution_date] } {
if { $distribution_date ne "" } {
append body " on $distribution_date"
}
append body ")"
}
} else {
append body "None available"
if { $installed_p == "t" } {
if { $installed_p eq "t" } {
append body " (<a href=\"version-generate-tarball?version_id=$version_id\">generate one now</a> from the filesystem)"
}
}
......@@ -211,15 +226,15 @@ append body "
"
if { ![info exists installed_version_id] || $installed_version_id == $version_id && \
[empty_string_p $distribution_uri] } {
$distribution_uri eq "" } {
# As long as there isn't a different installed version, and this package is being
# generated locally, allow the user to write a specification file for this version
# of the package.
append body "<li><a href=\"version-generate-info?[export_vars { version_id }]&write_p=1\">Write an XML package specification to the <tt>packages/$package_key/$package_key.info</tt> file</a>\n"
}
if { $installed_p == "t" } {
if { [empty_string_p $distribution_uri] } {
if { $installed_p eq "t" } {
if { $distribution_uri eq "" } {
# The distribution tarball was either (a) never generated, or (b) generated on this
# system. Allow the user to make a tarball based on files in the filesystem.
append body "<p><li><a href=\"version-generate-tarball?[export_vars { version_id }]\">Generate a distribution file for this package from the filesystem</a>\n"
......@@ -236,7 +251,7 @@ if { $installed_p == "t" } {
append body "<p>"
if { $installed_p == "t" } {
if { $installed_p eq "t" } {
append body "
<li><a href=\"package-delete?[export_vars { version_id }]\">Uninstall this package from your system.</a> (be very careful!)\n"
......
......@@ -6,6 +6,7 @@
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,
......
......@@ -20,7 +20,7 @@ db_foreach apm_get_all_packages {
and v.package_key = t.package_key
order by upper(pretty_name)
} {
if { [empty_string_p $distribution_uri] } {
if { $distribution_uri eq "" } {
ns_log Debug "Generating package specificaiton for $package_key"
ns_write "<li>$pretty_name $version_name... "
if { [catch {
......
......@@ -8,7 +8,7 @@ ad_page_contract {
}
# Cannot delete local authority
if { [string equal $authority_id [auth::authority::local]] } {
if {$authority_id eq [auth::authority::local]} {
ad_return_error "Cannot delete local authority" "The system requires the local authority to operate."
}
......
......@@ -9,7 +9,7 @@ ad_page_contract {
# Check that the authority has a register implementation
auth::authority::get -authority_id $authority_id -array authority
if { [empty_string_p $authority(register_impl_id)] } {
if { $authority(register_impl_id) eq "" } {
ad_return_error "No register driver" "The authority $authority(pretty_name) does not have a register driver and cannot register users"
}
......
......@@ -12,7 +12,7 @@ ad_page_contract {
# Make sure we are not shutting out all site-wide-admins from the system
set allowed_p 1
if { [string equal $enabled_p "f"] && ![auth::can_admin_system_without_authority_p -authority_id $authority_id]} {
if { $enabled_p eq "f" && ![auth::can_admin_system_without_authority_p -authority_id $authority_id]} {
set allowed_p 0
}
......
......@@ -16,7 +16,7 @@ db_1row select_sort_order {
where authority_id = :authority_id
}
if { $direction == "up" } {
if { $direction eq "up" } {
db_transaction {
# Increase next authority's sort_order by one
......@@ -36,7 +36,7 @@ if { $direction == "up" } {
}
}
} elseif { $direction == "down"} {
} elseif { $direction eq "down"} {
db_transaction {
# Decrease previous authority's sort_order by one
......
......@@ -27,84 +27,90 @@ set form_widgets_full {
authority_id:key(acs_object_id_seq)
{-section "gen" {legendtext \#acs-admin.General\#}}
{pretty_name:text
{html {size 50}}
{label "Name"}
{section "General"}
{label "\#acs-admin.Name\#"}
}
{short_name:text,optional
{html {size 50}}
{label "Short Name"}
{label "\#acs-admin.Short_Name\#"}
{mode {[ad_decode $local_authority_p 1 "display" ""]}}
{help_text "This is used when referring to the authority in parameters etc. Even if you need to change the display name above, this should stay unchanged."}
{help_text "[_ acs-admin.Authority_short_name_help_text]"}
}
{enabled_p:text(radio)
{label "Enabled"}
{options {{Yes t} {No f}}}
{label "\#acs-admin.Enabled\#"}
{options {{[_ acs-admin.Yes] t} {[_ acs-admin.No] f}}}
}
{help_contact_text:richtext,optional
{html {cols 60 rows 13}}
{label "Help contact text"}
{help_text "Contact information (phone, email, etc.) to be displayed as a last resort when people are having problems with an authority."}
{label "\#acs-admin.Help_contact_text\#"}
{help_text "[_ acs-admin.Help_contact_help_text]"}
}
{-section "auth" {legendtext \#acs-admin.Authentication\#}}
{auth_impl_id:integer(select),optional
{label "Authentication"}
{section "Authentication"}
{label "\#acs-admin.Authentication\#"}
{options {[acs_sc::impl::get_options -empty_label "--Disabled--" -contract_name auth_authentication]}}
}
{-section "pwmngt" {legendtext \#acs-admin.Password_Management\#}}
{pwd_impl_id:integer(select),optional
{label "Password management"}
{section "Password Management"}
{label "\#acs-admin.Password_Management\#"}
{options {[acs_sc::impl::get_options -empty_label "--Disabled--" -contract_name auth_password]}}
}
{forgotten_pwd_url:text,optional
{html {size 50}}
{label "Recover password URL"}
{help_text "Instead of a password management driver, you may provide a URL to which users are sent when they need help recovering their password. Any username in this url must be on the syntax foo={username} and {username} will be replaced with the real username."}
{label "\#acs-admin.Recover_password_URL\#"}
{help_text "[_ acs-admin.Recover_password_URL_help_text]"}
}
{change_pwd_url:text,optional
{html {size 50}}
{label "Change password URL"}
{help_text "Instead of a password management driver, you may provide a URL to which users are sent when they want to change their password. Any username in this url must be on the syntax foo={username} and {username} will be replaced with the real username."}
{label "\#acs-admin.Change_password_URL\#"}
{help_text "[_ acs-admin.Change_password_URL_help_text]"}
}
{-section "accreg" {legendtext \#acs-admin.Account_Registration\#}}
{register_impl_id:integer(select),optional
{label "Account registration"}
{section "Account Registration"}
{label "\#acs-admin.Account_Registration\#"}
{options {[acs_sc::impl::get_options -empty_label "--Disabled--" -contract_name auth_registration]}}
}
{register_url:text,optional
{html {size 50}}
{label "Account registration URL"}
{help_text "URL where users register for a new account."}
{label "\#acs-admin.Account_registration_URL\#"}
{help_text "[_ acs-admin.Account_reg_URL_help_text]"}
}
{-section "ondemsyn" {legendtext \#acs-admin.On-Demand_Sync\#}}
{user_info_impl_id:integer(select),optional
{label "User Info"}
{section "On-Demand Sync"}
{label "\#acs-admin.User_Info\#"}
{options {[acs_sc::impl::get_options -empty_label "--Disabled--" -contract_name auth_user_info]}}
{help_text "The implementation for getting user information from the authority in real-time"}
{help_text "[_ acs-admin.User_Info_help_text]"}
}
{-section "batchsyn" {legendtext \#acs-admin.Batch_Synchronization\#}}
{batch_sync_enabled_p:text(radio)
{label "Batch sync enabled"}
{options {{Yes t} {No f}}}
{section {Batch Synchronization}}
{label "\#acs-admin.Batch_sync_enabled\#"}
{options {{[_ acs-admin.Yes] t} {[_ acs-admin.No] f}}}
}
{get_doc_impl_id:integer(select),optional
{label "GetDocument implementation"}
{label "\#acs-admin.GetDocument_implementation\#"}
{options {[acs_sc::impl::get_options -empty_label "--Disabled--" -contract_name auth_sync_retrieve]}}
}
{process_doc_impl_id:integer(select),optional
{label "ProcessDocument implementation"}
{label "\#acs-admin.ProcessDocument_implementation\#"}
{options {[acs_sc::impl::get_options -empty_label "--Disabled--" -contract_name auth_sync_process]}}
}
}
......@@ -112,7 +118,7 @@ set form_widgets_full {
# For the local authority we allow only limited editing
# Is this the local authority?
set local_authority_p 0
if { $authority_exists_p && [string equal $authority_id [auth::authority::local]] } {
if { $authority_exists_p && $authority_id eq [auth::authority::local] } {
set local_authority_p 1
}
......@@ -162,7 +168,7 @@ ad_form -name authority \
# Set the value of the help_contact_text element - both contents and format attributes
set help_contact_text [template::util::richtext::create]
set help_contact_text [template::util::richtext::set_property contents $help_contact_text $element_array(help_contact_text)]
if { [empty_string_p $element_array(help_contact_text_format)] } {
if { $element_array(help_contact_text_format) eq "" } {
set element_array(help_contact_text_format) "text/enhanced"
}
set help_contact_text [template::util::richtext::set_property format $help_contact_text $element_array(help_contact_text_format)]
......@@ -190,7 +196,7 @@ ad_form -name authority \
} -edit_data {
foreach var_name [template::form::get_elements -no_api authority] {
if { ![string equal $var_name "authority_id"] } {
if { $var_name ne "authority_id" } {
set element_array($var_name) [set $var_name]
}
}
......@@ -218,38 +224,38 @@ list::create \
-key job_id \
-elements {
start_time_pretty {
label "Start time"
label "\#acs-admin.Start_time\#"
link_url_eval {$job_url}
}
end_time_pretty {
label "End time"
label "\#acs-admin.End_time\#"
}
run_time {
label "Run time"
label "\#acs-admin.Run_time\#"
html { align right }
}
num_actions {
label "Actions"
label "\#acs-admin.Actions\#"
html { align right }
}
num_problems {
label "Problems"
label "\#acs-admin.Problems\#"
html { align right }
}
actions_per_minute {
label "Actions/Minute"
label "\#acs-admin.Actions_Minute\#"
html { align right }
}
short_message {
label "Message"
label "\#acs-admin.Message\#"
}
interactive_pretty {
label "Interactive"
label "\#acs-admin.Interactive\#"
html { align center }
}
}
set display_batch_history_p [expr $authority_exists_p && [string equal $ad_form_mode "display"]]
set display_batch_history_p [expr {$authority_exists_p && $ad_form_mode eq "display"}]
if { $display_batch_history_p } {
db_multirow -extend {
......@@ -272,7 +278,7 @@ if { $display_batch_history_p } {
set actions_per_minute {}
if { $run_time_seconds > 0 && $num_actions > 0 } {
set actions_per_minute [expr round(60.0 * $num_actions / $run_time_seconds)]
set actions_per_minute [expr {round(60.0 * $num_actions / $run_time_seconds)}]
}
set run_time [util::interval_pretty -seconds $run_time_seconds]
}
......
......@@ -48,11 +48,11 @@ ad_form -name batch_action_form \
# Prettify certain elements
if { [regexp {_p$} $element_name] } {
set $element_name [ad_decode $batch_action($element_name) "t" "Yes" "No"]
} elseif { [string equal $element_name "user_id"] && ![empty_string_p $batch_action($element_name)] } {
} elseif { $element_name eq "user_id" && $batch_action($element_name) ne "" } {
if { [catch {set $element_name [acs_community_member_link -user_id $batch_action($element_name)]}] } {
set $element_name $batch_action($element_name)
}
} elseif { [string equal $element_name "element_messages"] && ![empty_string_p $batch_action($element_name)] } {
} elseif { $element_name eq "element_messages" && $batch_action($element_name) ne "" } {
array set messages_array $batch_action($element_name)
append $element_name "<ul>"
foreach message_name [array names messages_array] {
......
......@@ -11,9 +11,9 @@ ad_page_contract {
auth::sync::job::get -job_id $job_id -array batch_job
set page_title "One batch job"
set page_title "\#acs-admin.One_batch_job\#"
set context [list \
[list "." "Authentication"] \
[list "." "[_ acs-admin.Authentication]"] \
[list [export_vars -base authority { {authority_id $batch_job(authority_id)} }] "$batch_job(authority_pretty_name)"] $page_title]
ad_form \
......@@ -22,57 +22,57 @@ ad_form \
-display_buttons {} \
-form {
{authority_pretty_name:text(inform)
{label "Authority name"}
{label "\#acs-admin.Authority_name\#"}
}
{job_start_time:text(inform)
{label "Start time"}
{label "\#acs-admin.Start_time\#"}
}
{job_end_time:text(inform)
{label "End time"}
{label "\#acs-admin.End_time\#"}
}
{run_time_seconds:text(inform)
{label "Running time"}
{after_html " seconds"}
{label "\#acs-admin.Running_time\#"}
{after_html " [_ acs-admin.seconds]"}
}
{interactive_p:text(inform)
{label "Interactive"}
{label "\#acs-admin.Interactive\#"}
}
{snapshot_p:text(inform)
{label "Snapshot"}
{label "\#acs-admin.Snapshot\#"}
}
{message:text(inform)
{label "Message"}
{label "\#acs-admin.Message"}
}
{creation_user:text(inform)
{label "Creation user"}
{label "\#acs-admin.Creation_user\#"}
}
{doc_start_time:text(inform)
{label "Document start time"}
{label "\#acs-admin.Document_start_time\#"}
}
{doc_end_time:text(inform)
{label "Document end time"}
{label "\#acs-admin.Document_end_time\#"}
}
{doc_status:text(inform)
{label "Document status"}
{label "\#acs-admin.Document_status\#"}
}
{doc_message:text(inform)
{label "Document message"}
{label "\#acs-admin.Document_message\#"}
}
{document_download:text(inform)
{label "Document"}
{label "\#acs-admin.Document\#"}
}
{num_actions:text(inform)
{label "Number of actions"}
{label "\#acs-admin.Number_of_actions\#"}
}
{num_problems:text(inform)
{label "Number of problems"}
{label "\#acs-admin.Number_of_problems\#"}
}
} -on_request {
foreach element_name [array names batch_job] {
# Make certain columns pretty for display
if { [regexp {_p$} $element_name] } {
set $element_name [ad_decode $batch_job($element_name) "t" "Yes" "No"]
} elseif { [string equal $element_name "creation_user"] && ![empty_string_p $batch_job($element_name)] } {
} elseif { $element_name eq "creation_user" && $batch_job($element_name) ne "" } {
set $element_name [acs_community_member_link -user_id $batch_job($element_name)]
} else {
set $element_name [ad_quotehtml $batch_job($element_name)]
......@@ -82,7 +82,7 @@ ad_form \
set job_start_time [lc_time_fmt $batch_job(job_start_time) "%x %X"]
set job_end_time [lc_time_fmt $batch_job(job_end_time) "%x %X"]
set document_download "<a href=\"[export_vars -base batch-document-download { job_id }]\">download</a>"
set document_download "<a href=\"[export_vars -base batch-document-download { job_id }]\">[_ acs-admin.download]</a>"
}
list::create \
......@@ -93,37 +93,37 @@ list::create \
-page_query_name pagination \
-elements {
entry_time_pretty {
label "Timestamp"
label "\#acs-admin.Timestamp\#"
link_url_eval {$entry_url}
link_html { title "View log entry" }
link_html { title "\#acs-admin.View_log_entry\#" }
}
operation {
label "Operation"
label "\#acs-admin.Operation\#"
}
username {
label "Username"
label "\#acs-admin.Username\#"
link_url_col user_url
}
success_p {
label "Success"
label "\#acs-admin.Success\#"
display_template {
<if @batch_actions.success_p@ eq "t">
<font color="green">Yes</font>
<font color="green">\#acs-admin.Yes\#</font>
</if>
<else>
<font color="red">No</font>
<font color="red">\#acs-admin.No\#</font>
</else>
}
}
short_message {
label "Message"
label "\#acs-admin.Message\#"
}
} -filters {
job_id {
hide_p 1
}
success_p {
label "Success"
label "\#acs-admin.Success\#"
values {
{ Success t }
{ Failure f }
......@@ -153,7 +153,7 @@ db_multirow -extend { entry_url short_message entry_time_pretty user_url } batch
set entry_url [export_vars -base batch-action { entry_id }]
# Use message and element_messages to display one short message in the table
if { ![empty_string_p $message] } {
if { $message ne "" } {
set short_message $message
} elseif { [llength $element_messages] == 2 } {
# Only one element message - use it
......@@ -166,7 +166,7 @@ db_multirow -extend { entry_url short_message entry_time_pretty user_url } batch
}
set short_message [string_truncate -len 75 -- $short_message]
if { $user_exists_p && ![empty_string_p $user_id] } {
if { $user_exists_p && $user_id ne "" } {
set user_url [acs_community_member_admin_url -user_id $user_id]
} else {
set user_url {}
......
......@@ -2,17 +2,16 @@
<property name="context">@context;noquote@</property>
<property name="title">@page_title;noquote@</property>
<h2>Authorities</h2>
<h1>Authorities</h1>
<listtemplate name="authorities"></listtemplate>
<p>
<b>&raquo;</b> <a href="authority">Create new authority</a>
</p>
<p>
<b>&raquo;</b> <a href="@parameter_url@">Edit parameters</a>
</p>
<div class="action-list" style="padding-top: 1em;">
<ul>
<li><a href="authority" class="button">Create new authority</a></li>
<li><a href="@parameter_url@" class="button">Edit parameters</a></li>
</ul>
</div>
<p style="margin-top: 4px; margin-bottom: 2px; color: #666666; font-family: tahoma,verdana,arial,helvetica,sans-serif; font-size: 75%;">
[*] The drop down menu of authorities on the login page will be sorted accordingly.
......
......@@ -17,55 +17,55 @@ list::create \
edit {
label ""
display_template {
<img src="/shared/images/Edit16.gif" height="16" width="16" alt="Edit" border="0">
<img src="/shared/images/Edit16.gif" height="16" width="16" alt="Edit" style="border: 0">
}
link_url_eval {[export_vars -base authority { authority_id {ad_form_mode edit}}]}
link_html {title "Edit this authority"}
sub_class narrow
}
pretty_name {
label "Name"
label "\#acs-admin.Name\#"
link_url_eval {[export_vars -base authority { authority_id }]}
}
enabled {
label "Enabled"
label "\#acs-admin.Enabled\#"
html { align center }
display_template {
<if @authorities.enabled_p@ true>
<a href="@authorities.enabled_p_url@" title="Disable this authority"><img src="/shared/images/checkboxchecked" height="13" width="13" border="0" style="background-color: white;"></a>
<a href="@authorities.enabled_p_url@" title="\#acs-admin.Disable_this_authority\#"><img src="/shared/images/checkboxchecked" alt="enabled" height="13" width="13" style="background-color: white; border: 0;"></a>
</if>
<else>
<a href="@authorities.enabled_p_url@" title="Enable this authority"><img src="/shared/images/checkbox" height="13" width="13" border="0" style="background-color: white;"></a>
<a href="@authorities.enabled_p_url@" title="\#acs-admin.Enable_this_authority\#"><img src="/shared/images/checkbox" height="13" width="13" style="background-color: white; border: 0;" alt="disabled"></a>
</else>
}
}
move {
label "Order*"
label "\#acs-admin.Order\#"
html { align center }
display_template {
<if @authorities.sort_order@ ne @authorities.highest_sort_order@>
<a href="@authorities.sort_order_url_up@" title="Move this authority up"><img src="/resources/acs-subsite/arrow-up.gif" border="0" width="15" height="15"></a>
<a href="@authorities.sort_order_url_up@" title="\#acs-admin.Move_this_authority_up\#"><img src="/resources/acs-subsite/arrow-up.gif" style="border: 0" width="15" height="15" alt="up"></a>
</if>
<else><img src="/resources/acs-subsite/spacer.gif" width="15" height="15"></else>
<else><img src="/resources/acs-subsite/spacer.gif" width="15" height="15" alt=""></else>
<if @authorities.sort_order@ ne @authorities.lowest_sort_order@>
<a href="@authorities.sort_order_url_down@" title="Move this authority down"><img src="/resources/acs-subsite/arrow-down.gif" border="0" width="15" height="15"></a>
<a href="@authorities.sort_order_url_down@" title="\#acs-admin.Move_this_authority_down\#"><img src="/resources/acs-subsite/arrow-down.gif" style="border: 0" width="15" height="15" alt="down"></a>
</if>
<else><img src="/resources/acs-subsite/spacer.gif" width="15" height="15"></else>
<else><img src="/resources/acs-subsite/spacer.gif" width="15" height="15" alt=""></else>
}
}
registration {
label "Registration"
label "\#acs-admin.Registration\#"
html { align center }
display_template {
<switch @authorities.registration_status@>
<case value="selected">
<img src="/resources/acs-subsite/radiochecked.gif" height="13" width="13" border="0">
<img src="/resources/acs-subsite/radiochecked.gif" height="13" width="13" style="border: 0" alt="checked">
</case>
<case value="can_select">
<a href="@authorities.registration_url@"
title="Make this the authority for registering new users"
onclick="return confirm('You are changing all user registrations to be in authority @authorities.pretty_name@');">
<img src="/resources/acs-subsite/radio.gif" height="13" width="13" border="0" style="background-color: white;">
title="\#acs-admin.Make_this_the_authority_for_registering_new_users\#"
onclick="return confirm('\#acs-admin.You_are_changing_all_user_registrations_to_be_in_authority_authorities_pretty_name\#');">
<img src="/resources/acs-subsite/radio.gif" height="13" width="13" style="background-color: white; border: 0;" alt="unchecked">
</a>
</case>
<case value="cannot_select">
......@@ -75,13 +75,13 @@ list::create \
}
}
auth_impl {
label "Authentication"
label "\#acs-admin.Authentication\#"
}
pwd_impl {
label "Password"
label "\#acs-admin.Password\#"
}
reg_impl {
label "Registration"
label "\#acs-admin.Registration\#"
}
delete {
label ""
......@@ -89,8 +89,8 @@ list::create \
<if @authorities.short_name@ ne local>
<a href="@authorities.delete_url@"
title="Delete this authority"
onclick="return confirm('Are you sure you want to delete authority @authorities.pretty_name@?');">
<img src="/shared/images/Delete16.gif" height="16" width="16" alt="Delete" border="0">
onclick="return confirm('\#acs-admin.Are_you_sure_you_want_to_delete_authority_authorities_pretty_name\#');">
<img src="/shared/images/Delete16.gif" height="16" width="16" alt="\#acs-admin.Delete\#" style="border:0">
</a>
</if>
}
......@@ -128,10 +128,10 @@ db_multirow -extend {
set sort_order_url_up "authority-set-sort-order?[export_vars { authority_id {direction up} }]"
set sort_order_url_down "authority-set-sort-order?[export_vars { authority_id {direction down} }]"
if { [string equal $authority_id $register_authority_id] } {
if {$authority_id eq $register_authority_id} {
# The authority is selected as register authority
set registration_status "selected"
} elseif { ![empty_string_p $reg_impl] } {
} elseif { $reg_impl ne "" } {
# The authority can be selected as register authority
set registration_status "can_select"
set registration_url [export_vars -base authority-registration-select { authority_id }]
......
ad_page_contract {
Flush one or more values from util_memoize's cache
} {
{suffix "util_memoize"}
suffix
{return_url "."}
}
foreach name [ns_cache names $suffix] {
ns_cache flush $suffix $name
if {$suffix eq "util_memoize"} {
foreach name [ns_cache names util_memoize] {
ns_cache flush util_memoize $name
}
} else {
#ns_return 200 text/html $suffix
if {[catch { util_memoize_flush_cache $suffix } errmsg]} {
ns_return 200 text/html "Cannot flush the cache for $suffix suffix."
}
}
ad_returnredirect $return_url
......@@ -25,7 +25,7 @@ if {[catch {set pair [ns_cache get util_memoize $key]} errmsg]} {
}
}
if {![info exists value] || [string equal "" $value]} {
if {![info exists value] || "" eq $value} {
ad_return_complaint 1 "Could not retrieve"
}
}
......
......@@ -8,21 +8,23 @@ set context [list [list "../developer" "Developer's Administration"] $page_title
template::multirow create caches name entries size max flushed hit_rate
foreach cache [lsort -dictionary [ns_cache_names]] {
if {[regexp {(.*)} $cache match suffix] || [string equal $cache "util_memoize"]} {
if {![info exists suffix] || [string equal "" $suffix]} {
if {[regexp {util_memoize_(.*)} $cache match suffix] \
|| $cache eq "util_memoize"} {
if {![info exists suffix] || "" eq $suffix} {
set name "util_memoize"
set match "util_memoize"
} else {
set name $suffix
}
set pair [ns_cache_size $match]
set size [format "%.2f MB" [expr [lindex $pair 1] / 1048576.0]]
set max [format "%.2f MB" [expr [lindex $pair 0] / 1048576.0]]
set size [format "%.2f MB" [expr {[lindex $pair 1] / 1048576.0}]]
set max [format "%.2f MB" [expr {[lindex $pair 0] / 1048576.0}]]
ns_cache_stats $match stats_array
set entries $stats_array(entries)
set flushed $stats_array(flushed)
set hit_rate $stats_array(hitrate)
template::multirow append caches $name $entries $size $max $flushed $hit_rate
template::multirow append caches $name $entries $size $max \
$flushed $hit_rate
}
set match ""
set suffix ""
......
......@@ -25,7 +25,7 @@ if {[catch {set pair [ns_cache get util_memoize $key]} errmsg]} {
}
}
}
if {![info exists value] || [string equal "" $value]} {
if {![info exists value] || "" eq $value} {
set value "<i>could not retrieve</i>"
set time "?"
}
......
......@@ -35,7 +35,7 @@
</else>
<tr bgcolor="@bg@">
<td valign=top>@matches.key@</td>
<td valign=top>@matches.value@</td>
<td valign=top>@matches.value;noquote@</td>
<td valign=middle rowspan=2>
<form action=one method=post>
<input type=hidden name=key value="@matches.full_key@">
......
......@@ -2,15 +2,14 @@ ad_page_contract {
Lists memoized data and gives options to view data or flush data
} {
{pattern_type "contain"}
{cache_name "util_memoize"}
{pattern ""}
pattern
{full "f"}
}
set page_title "Search"
set context [list [list "../developer" "Developer's Administration"] [list "." "Cache Control"] $page_title]
set cached_names [ns_cache names $cache_name]
set cached_names [ns_cache names util_memoize]
# ns_log notice "ep_flush_list_cache found [llength $cached_names] names cached"
template::multirow create matches key value value_size full_key date raw_date
......@@ -19,12 +18,11 @@ foreach name $cached_names {
if {[regexp -nocase -- $pattern $name match]} {
set key [ad_quotehtml $name]
set safe_key [ad_quotehtml $name]
if {[catch {set pair [ns_cache get $cache_name $name]} errmsg]} {
if {[catch {set pair [ns_cache get util_memoize $name]} errmsg]} {
continue
}
set raw_date [lindex $pair 0]
set date ""
catch {set date [clock format $raw_date -format "%d %b %H:%M:%S"]}
set date [clock format $raw_date -format "%d %b %H:%M:%S"]
set value [ad_quotehtml [lindex $pair 1]]
set value_size [string length $value]
if {$full} {
......@@ -34,7 +32,7 @@ foreach name $cached_names {
template::multirow append matches [string range $key 0 200] \
[string range $value 0 200] $value_size $safe_key \
$date $raw_date
}
}
}
}
......@@ -10,7 +10,7 @@
instance_name
from site_nodes s, apm_packages p
where s.object_id = p.package_id
and p.package_key = 'acs-subsite'
and p.package_key in ($package_keys)
</querytext>
</fullquery>
......
......@@ -10,7 +10,7 @@
instance_name
from site_nodes s, apm_packages p
where s.object_id = p.package_id
and p.package_key = 'acs-subsite'
and p.package_key in ($package_keys)
</querytext>
</fullquery>
......
......@@ -5,29 +5,30 @@
<a href="developer" class="button">Developer's Admin</a>
</div>
<h3>Core Administration</h3>
<h1>Core Administration</h1>
<include src="/packages/acs-admin/lib/site-wide-services">
<if @packages:rowcount@ gt 0>
<h3>Site-Wide Package Administration</h3>
<ul>
<multiple name="packages">
<li><a href="@packages.admin_url@/\">@packages.pretty_name@</a></li>
</multiple>
</ul>
<h1>Site-Wide Package Administration</h1>
<listtemplate name="packages"></listtemplate>
</if>
<if @too_many_subsites_p@ gt 0>
<h1>Subsite Administration</h1>
<p>Too many subsites to display: @subsite_number@</p>
</if>
<else>
<if @subsites:rowcount@ gt 0>
<h3>Subsite Administration</h3>
<h1>Subsite Administration</h1>
<ul>
<multiple name="subsites">
<li><a href="@subsites.admin_url@">@subsites.path_pretty@</a></li>
</multiple>
</ul>
</if>
</else>
<h3>Service Administration</h3>
<h1>Service Administration</h1>
<include src="/packages/acs-admin/lib/service-parameters">
......@@ -6,27 +6,63 @@ ad_page_contract {
}
set page_title [ad_conn instance_name]
set package_keys '[join [subsite::package_keys] ',']'
set subsite_number [db_string count_subsites {}]
if {$subsite_number > 100} {
set too_many_subsites_p 1
} else {
set too_many_subsites_p 0
db_multirow -extend { admin_url path_pretty } subsites subsite_admin_urls {} {
set admin_url "${node_url}admin/"
set path_pretty $instance_name
array set node [site_node::get -node_id $node_id]
set parent_id $node(parent_id)
while { ![empty_string_p $parent_id] } {
array unset node
array set node [site_node::get -node_id $parent_id]
set path_pretty "$node(instance_name) > $path_pretty"
set parent_id $node(parent_id)
db_multirow -extend { admin_url path_pretty } subsites subsite_admin_urls {} {
set admin_url "${node_url}admin/"
set path_pretty $instance_name
array set node [site_node::get -node_id $node_id]
set parent_id $node(parent_id)
while { $parent_id ne "" } {
array unset node
array set node [site_node::get -node_id $parent_id]
set path_pretty "$node(instance_name) > $path_pretty"
set parent_id $node(parent_id)
}
}
multirow sort subsites path_pretty
}
multirow sort subsites path_pretty
db_multirow -extend { admin_url } packages installed_packages {} {
db_multirow -extend { admin_url global_param_url } packages installed_packages {} {
if { [apm_package_installed_p $package_key] && [file exists "[acs_package_root_dir $package_key]/www/sitewide-admin/"] } {
set admin_url "package/$package_key/"
} else {
set admin_url ""
}
if { [catch {db_1row global_params_exist {}} errmsg] ||
$global_params == 0 } {
set global_param_url ""
} else {
set global_param_url [export_vars -base /shared/parameters {package_key {scope global}}]
}
if { $admin_url eq "" && $global_param_url eq "" } {
continue
}
}
template::list::create \
-name packages \
-multirow packages \
-elements {
pretty_name {
label "Package"
}
admin_url {
label "Site-Wide Administration"
link_html { title "Site-wide Administration" }
link_url_col admin_url
display_template {<if @packages.admin_url@ not nil>#acs-admin.Administration#</if>}
}
global_param_url {
label "Global Parameters"
link_html {title "Manage Global Parameters" }
link_url_col global_param_url
display_template {<if @packages.global_param_url@ not nil>#acs-admin.Parameters#</if>}
}
}
<?xml version="1.0"?>
<queryset>
<fullquery name="count_subsites">
<querytext>
select count(*)
from apm_packages
where package_key in ($package_keys)
</querytext>
</fullquery>
<fullquery name="installed_packages">
<querytext>
select package_key,
......@@ -10,4 +18,13 @@
</querytext>
</fullquery>
<fullquery name="global_params_exist">
<querytext>
select count(*) as global_params
from apm_parameters
where package_key = :package_key
and scope = 'global'
</querytext>
</fullquery>
</queryset>
......@@ -2,13 +2,14 @@
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<h1>@page_title@</h1>
<table style="border: 1px solid gray" border="1" cellspacing="0" cellpadding="3">
<tr>
<th>From Repository</th>
<th>Local Files</th>
</tr>
<tr>
<td>Download and install/upgrade automatically from <a href="http://openacs.org/repository">OpenACS.org repository</a>
<td>Download and install/upgrade automatically from <a href="http://openacs.org/repository/">OpenACS.org repository</a>
</td>
<td>
Install/upgrade from local files. Use this if your site has custom code or is in a local CVS repository. <a href="/doc/upgrade.html">Help</a>
......@@ -32,7 +33,7 @@
<h2>Installed Packages</h2>
<p><listfilters name="packages" style="inline-filters"></listfilters></p>
<listfilters name="packages" style="inline-filters"></listfilters>
<p><listtemplate name="packages"></listtemplate></p>
<listtemplate name="packages"></listtemplate>
......@@ -20,11 +20,11 @@
<p> Please click the link below to begin installation. </p>
</else>
<p><listtemplate name="install"></listtemplate></p>
<listtemplate name="install"></listtemplate>
<if @continue_url@ not nil>
<p>
<b>&raquo;</b> <a href="@continue_url@">Install above <if @install:rowcount@ eq 1>package</if><else>packages</else></a>
&raquo; <a href="@continue_url@">Install above <if @install:rowcount@ eq 1>package</if><else>packages</else></a>
</p>
</if>
<if @problems_p@ true>
......
......@@ -37,7 +37,7 @@ switch $result(status) {
}
}
if { ![empty_string_p $repository_url] } {
if { $repository_url ne "" } {
set parent_page_title "Install From OpenACS Repository"
} else {
set parent_page_title "Install From Local File System"
......@@ -63,7 +63,7 @@ array set failed $result(failed)
multirow create install package_key version_name package_name comment extra_p
foreach key $result(packages) {
set extra_p [expr [lsearch $package_key $key] == -1]
set extra_p [expr {[lsearch $package_key $key] == -1}]
if { $extra_p } {
set extras_p 1
}
......
......@@ -56,7 +56,7 @@ foreach package_key $install {
if { [exists_and_not_null version(download_url)] } {
set spec_file [apm_load_apm_file -url $version(download_url)]
if { [empty_string_p $spec_file] } {
if { $spec_file eq "" } {
ns_log Error "Error downloading package $package_key from $version(download_url). Installing package failed."
set success_p 0
continue
......
......@@ -5,10 +5,12 @@ ad_page_contract {
{success_p 0}
}
if { ![empty_string_p $repository_url] } {
if { $repository_url ne "" } {
set parent_page_title "Install From OpenACS Repository"
set parent_page_url [export_vars -base install {repository_url}]
} else {
set parent_page_title "Install From Local File System"
set parent_page_url [export_vars -base install]
}
if { $success_p } {
......@@ -17,5 +19,5 @@ if { $success_p } {
set page_title "Installation Failed"
}
set context [list [list "." "Install Software"] [list "install" $parent_page_title] $page_title]
set context [list [list "." "Install Software"] [list $parent_page_url $parent_page_title] $page_title]
......@@ -7,10 +7,10 @@ ad_page_contract {
}
if { ![empty_string_p $repository_url] } {
set page_title "Install From OpenACS Repository"
if { $repository_url ne "" } {
set page_title "Install or Upgrade From OpenACS Repository"
} else {
set page_title "Install From Local File System"
set page_title "Install or Upgrade From Local File System"
}
set context [list [list "." "Install Software"] $page_title]
......@@ -36,7 +36,10 @@ foreach package_key [array names repository] {
set package_key $version(package.key)
# If in upgrade mode, only add to list if it's an upgrade
if { !$upgrade_p || [string equal $version(install_type) upgrade] } {
if { !$upgrade_p || $version(install_type) eq "upgrade" } {
if {![exists_and_not_null version(maturity)]} {
set version(maturity) ""
}
set package([string toupper $version(package-name)]) \
[list \
$version(package.key) \
......@@ -44,7 +47,8 @@ foreach package_key [array names repository] {
$version(name) \
$version(package.type) \
$version(install_type) \
$version(summary)]
$version(summary) \
$version(maturity)]
}
}
}
......@@ -57,16 +61,28 @@ foreach package_key [array names repository] {
#####
# Sort the list alphabetically (in case package_name and package_key doesn't sort the same)
multirow create packages package_key package_name version_name package_type install_type summary
multirow create packages package_key package_name version_name package_type install_type summary maturity
if {[catch {set maturity_label [apm::package_version::attributes::get_pretty_name maturity]} errmsg]} {
set maturity_label "Maturity"
}
foreach name [lsort -ascii [array names package]] {
set row $package($name)
if {[info procs apm::package_version::attributes::maturity_int_to_text] != 0} {
set maturity_text "[apm::package_version::attributes::maturity_int_to_text [lindex $row 6]]"
} else {
set maturity_text ""
}
multirow append packages \
[lindex $row 0] \
[lindex $row 1] \
[lindex $row 2] \
[lindex $row 3] \
[lindex $row 4] \
[lindex $row 5]
[lindex $row 5] \
$maturity_text
}
multirow extend packages install_url
......@@ -81,7 +97,7 @@ template::list::create \
-multirow packages \
-key package_key \
-bulk_actions {
"Install checked applications" "install-2" "Install checked applications"
"Install or upgrade checked applications" "install-2" "Install or upgrade checked applications"
} \
-bulk_action_export_vars {
repository_url
......@@ -90,11 +106,14 @@ template::list::create \
package_name {
label "Package"
link_url_col install_url
link_html { title "Install this package" }
link_html { title "Install or upgrade this package" }
}
summary {
label "Summary"
}
maturity {
label "$maturity_label"
}
version_name {
label "Version"
}
......
......@@ -13,9 +13,10 @@
<p>
Here's what uptime has to say about the box:
</p>
<pre>@uptime_output@</pre>
<h3>Connections</h3>
<code>@uptime_output@</code>
<p><listtemplate name="connections"></listtemplate></p>
<h2>Connections</h2>
<listtemplate name="connections"></listtemplate>
......@@ -2,6 +2,6 @@
<property name=title>Sent: @sent_subject;noquote@</property>
@sent_message@
<br /><br />
<br><br>
You may <a href="@return_url@">return</a>.
......@@ -23,13 +23,13 @@ ad_page_contract {
return_url:onevalue
}
if [catch {ns_sendmail $email $email_from $subject $message} errmsg] {
ad_return_error $error_subject "$error_message:
<blockquote><pre>[ad_quotehtml $errmsg]</pre></blockquote>"
if {[catch {acs_mail_lite::send -send_immediately -to_addr $email -from_addr $email_from -subject $subject -body $message} errmsg]} {
ad_return_error $error_subject "<p>$error_message</p>
<div><code>[ad_quotehtml $errmsg]</code></div>"
ad_script_abort
}
if { $show_sent_message_p != "t" } {
if { $show_sent_message_p ne "t" } {
# Do not show any message. Just go to return url
ad_returnredirect $return_url
ad_script_abort
......
......@@ -2,31 +2,15 @@
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<h3>The server has been shut down</h3>
<p> Normally, it should come back up by itself after a minute or so. </p>
<br>&nbsp;<br>
<p> The server has been shut down. Normally, it should come back up by itself after a minute or so. </p>
<if @windows_p@>
<font color=red><b>
On Windows, if @po;noquote@ doesn't start automatically, as it should:
</b></font>
<br>&nbsp;<br>Either:<br>
<ul>
<li>Please restart your computer.<br>
@po;noquote@ should start automatically.
</ul>
<br>
Or:
<ul>
<li>Go to All Programs -&gt; @po;noquote@
<li>Execute "Start @po;noquote@".<br>
On Windows Vista and higher you need to right-click <br>
"Start @po;noquote@" and choose "Run as Administrator".
</ul>
<br>&nbsp;<br>
</if>
<p> If not, please check your server error log, or contact your system administrator. </p>
<p> If @po;noquote@ still doesn't start, please check your server error log
or contact your system administrator. </p>
<p>
Please wait for your server to get back up, then ...
</p>
<p>
<b>&raquo;</b> <a href="/acs-admin/">Return to site-wide administration</a><br>
<b>&raquo;</b> <a href="/acs-admin/apm">Go to package manager</a>
</p>
......@@ -8,12 +8,10 @@ ad_page_contract {
}
set page_title "Restarting Server"
set context [list $page_title]
set po "&#93;project-open&#91;"
# Check for Windows platform
global tcl_platform
set windows_p [string match $tcl_platform(platform) "windows"]
# We do this as a schedule proc, so the server will have time to serve the page
ad_schedule_proc -thread t -once t 2 ns_shutdown
......@@ -10,7 +10,7 @@ ns_write "<li>Set client property..."
set result [ad_get_client_property test MyName]
if { [string compare $result MyValue] == 0 } {
if { $result eq "MyValue" } {
ns_write "<li>Success: Client property successfully retrieved..."
} else {
ns_write "<li>Failure: Client property was incorrectly retrieved, expected MyValue, instead got $result..."
......
......@@ -98,7 +98,7 @@ set token_value_db [db_string get_token_value {
where token_id = :token_id
}]
if { [string compare $token_value $token_value_db] == 0 } {
if { $token_value eq $token_value_db } {
ns_write "<li>Success: sec_get_token test 1 passed."
} else {
ns_write "<li>Failure: sec_get_token test 1 failed."
......@@ -107,7 +107,7 @@ if { [string compare $token_value $token_value_db] == 0 } {
# do the same thing again to test the caching of tcl_
set token_value [sec_get_token $token_id]
if { [string compare $token_value $token_value_db] == 0 } {
if { $token_value eq $token_value_db } {
ns_write "<li>Success: sec_get_token test 2
passed."
} else {
......
......@@ -66,7 +66,7 @@ set exception_text ""
set context [list [list "index" "Users"] "Complex search"]
if { ![info exists target] || [empty_string_p $target] } {
if { ![info exists target] || $target eq "" } {
incr exception_count
append exception_text "<li>Target was not specified. This shouldn't have
happened, please contact the
......@@ -80,7 +80,7 @@ if { $exception_count != 00 } {
}
if {[string equal $combine_method "any"]} {
if {$combine_method eq "any"} {
set where_conjunction "or"
} else {
set where_conjunction "and"
......@@ -231,7 +231,7 @@ db_foreach user_search_admin $query {
set user_search:[set rowcount](export_vars) [export_url_vars user_id_from_search first_names_from_search last_name_from_search email_from_search]
set user_search:[set rowcount](member_state) $member_state
if { $member_state != "approved" } {
if { $member_state ne "approved" } {
set user_search:[set rowcount](user_finite_state_links) [join [ad_registration_finite_state_machine_admin_links $member_state $email_verified_p $user_id_from_search "complex-search?[export_url_vars email last_name keyword target passthrough limit_users_in_group_id only_authorized_p]"] " | "]
} else {
set user_search:[set rowcount](user_finite_state_links) ""
......
......@@ -8,15 +8,17 @@
<p>
<FORM METHOD=get ACTION=search>
<input type="hidden" name="target" value="one" />
<input type="hidden" name="only_authorized_p" value="0" />
<li>Quick search: <input type="text" size="15" name="keyword" />
<input type="submit" value="Find User" />
<input type="hidden" name="target" value="one">
<input type="hidden" name="only_authorized_p" value="0">
<li>Quick search: <input type="text" size="15" name="keyword">
<input type="submit" value="Find User">
</FORM>
</p>
<li><a href="complex-search?target=one&only_authorized_p=0&only_needs_approval_p=1">Find all users needing approval</a></li>
<li><a href="bouncing-users">Find all bouncing users</a></li>
<li><a href="user-add">Add a user</a></li>
<li><a href="/members/user-batch-add">Add a batch of users</a></li>
<li><a href="/admin/manage-email-privacy">#acs-subsite.manage_users_email#</a></li>
<form method='get' action='complex-search'>
<input type='hidden' name='target' value="one">
......
......@@ -69,7 +69,7 @@ switch $email_verified_p {
}
}
if [empty_string_p $action] {
if {$action eq ""} {
ad_return_complaint 1 "Not valid action: You have not changed the user in any way"
return
}
......@@ -92,12 +92,14 @@ if {[catch {
<pre>$errmsg</pre>"
}
set admin_user_id [ad_verify_and_get_user_id]
callback acs_admin::member_state_change -member_state $member_state -user_id $user_id
set admin_user_id [ad_conn user_id]
set email_from [db_string admin_email "select email from parties where party_id = :admin_user_id"]
set subject "$action"
set message $email_message
if [empty_string_p $return_url] {
if {$return_url eq ""} {
set return_url "/acs-admin/users/one?[export_url_vars user_id]"
} else {
ad_returnredirect $return_url
......
......@@ -14,8 +14,8 @@
These accounts will be merged and the <u>good and final account</u> will be:
<p/>
<img border=2 width="80" height="80" src="@to_img_src@" alt="Portrait of @to_user_id@" />
<br/>
<img style="border:2" width="80" height="80" src="@to_img_src@" alt="Portrait of @to_user_id@">
<br>
<span style="font-size:14pt;">@to_first_names@ @to_last_name@ (@to_email@)</span>
<p/>
......@@ -27,7 +27,7 @@
<table>
<tr>
<td>
<input type=radio name=merge_p value=1 />
<input type=radio name=merge_p value=1>
</td>
<td>
Yes, I'm sure that I don't need the account @from_email@ anymore!.
......
......@@ -14,14 +14,14 @@ ad_page_contract {
if_diff_authority {
set from_authority_id [db_string gettoa "select authority_id from cc_users where user_id = :from_user_id"]
set to_authority_id [db_string getfroma "select authority_id from cc_users where user_id = :to_user_id"]
if { ![string equal $from_authority_id $to_authority_id] } {
if { $from_authority_id ne $to_authority_id } {
ad_complain "Merge only works for users from the same authority"
}
}
}
if { [string equal $merge_action "0"] } {
if {$merge_action eq "0"} {
set tempid $from_user_id
set from_user_id $to_user_id
set to_user_id $tempid
......
......@@ -14,14 +14,14 @@ ad_page_contract {
if_diff_authority {
set from_authority_id [db_string gettoa "select authority_id from cc_users where user_id = :from_user_id"]
set to_authority_id [db_string getfroma "select authority_id from cc_users where user_id = :to_user_id"]
if { ![string equal $from_authority_id $to_authority_id] } {
if { $from_authority_id ne $to_authority_id } {
ad_complain "Merge only works for users of the same authority"
}
}
if_the_logged_in_user_is_crazy {
# Just for security reasons...
set current_user_id [ad_conn user_id]
if { [string equal $current_user_id $to_user_id] || [string equal $current_user_id $from_user_id] } {
if { $current_user_id eq $to_user_id || $current_user_id eq $from_user_id } {
ad_complain "You can't merge yourself"
}
}
......
<master>
<property name="title">Merge account system</property>
<property name="context">@context;noquote@</property>
<property name="header_stuff">
<link rel="stylesheet" type="text/css" href="/resources/acs-admin/um-more-info.css" media="all">
</property>
<h2>User Account Merge</h2>
This is the user acccount merge wizard. You selected these accounts to merge:
......@@ -20,7 +18,7 @@
<center>
<b>ACCOUNT ONE</b>
<p/>
<img border="2" width="80" height="80" src="@one_img_src@" alt="Portrait of @user_id@" />
<img style="border:2" width="80" height="80" src="@one_img_src@" alt="Portrait of @user_id@">
<h3>General Information of user one (<b>@one_email@</b>):</h3>
</center>
<ul>
......@@ -113,25 +111,25 @@
<center>
<b>Which is the good account?</b>
<p/>
<input type="radio" name="merge_action" value="0" />
<img src="/resources/acs-admin/left.gif" alt="left one" />
<input type="radio" name="merge_action" value="0">
<img src="/resources/acs-admin/left.gif" alt="left one">
</center>
</td>
</tr>
<tr>
<td>
<center>
<input type="radio" name="merge_action" value="1" />
<input type="radio" name="merge_action" value="1">
<img src="/resources/acs-admin/right.gif" alt="right one">
</center>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="from_user_id" value="@user_id@" />
<input type="hidden" name="to_user_id" value="@user_id_from_search@" />
<input type="hidden" name="from_user_id" value="@user_id@">
<input type="hidden" name="to_user_id" value="@user_id_from_search@">
<center>
<input type="submit" value="Continue"/>
<input type="submit" value="Continue">
</center>
</td>
</tr>
......@@ -149,7 +147,7 @@
<center>
<b>ACCOUNT TWO</b>
<p/>
<img border="2" width="80" height="80" src="@two_img_src@" alt="Portrait of @user_id_from_search@" />
<img style="border:2" width="80" height="80" src="@two_img_src@" alt="Portrait of @user_id_from_search@">
<h3>General Information of user two (<b>@two_email@</b>):</h3>
</center>
<ul>
......
......@@ -15,7 +15,7 @@ ad_page_contract { #
if_the_logged_in_user_is_crazy {
# Just for security reasons...
set current_user_id [ad_conn user_id]
if { [string equal $current_user_id $user_id] || [string equal $current_user_id $user_id_from_search] } {
if { $current_user_id eq $user_id || $current_user_id eq $user_id_from_search } {
ad_complain "You can't merge yourself"
}
}
......@@ -39,7 +39,7 @@ db_multirow -extend {one_item_object_url} one_user_contributions one_user_contri
}
set user_id_one_items [callback merge::MergeShowUserInfo -user_id $user_id ]
if { ![empty_string_p $user_id_one_items] } {
if { $user_id_one_items ne "" } {
set user_id_one_items_html "<ul><li><b>Packages User Information </b><ul>"
foreach pkg_list $user_id_one_items {
append user_id_one_items_html "<li><i>[lindex $pkg_list 0]</i><ul>"
......@@ -70,7 +70,7 @@ db_multirow -extend {two_item_object_url} two_user_contributions two_user_contri
}
set user_id_two_items [callback merge::MergeShowUserInfo -user_id $user_id_from_search ]
if { ![empty_string_p $user_id_two_items] } {
if { $user_id_two_items ne "" } {
set user_id_two_items_html "<ul><li><b>Packages User Information </b><ul>"
foreach pkg_list $user_id_two_items {
append user_id_two_items_html "<li><i>[lindex $pkg_list 0]</i><ul>"
......@@ -85,3 +85,6 @@ if { ![empty_string_p $user_id_two_items] } {
set user_id_two_items_html ""
}
template::head::add_css \
-href "/resources/acs-admin/um-more-info.css" \
-media all
......@@ -16,12 +16,12 @@ set return_url "/acs-admin/users/one?user_id=$user_id"
set context [list [list "./" "Users"] "Modify privileges"]
if ![info exists confirmed_p] {
if {![info exists confirmed_p]} {
set confirmed_p 0
}
if $confirmed_p {
if [string equal grant $action] {
if {$confirmed_p} {
if {"grant" eq $action} {
permission::grant -object_id [acs_magic_object "security_context_root"] -party_id $user_id -privilege "admin"
} else {
permission::revoke -object_id [acs_magic_object "security_context_root"] -party_id $user_id -privilege "admin"
......
......@@ -27,7 +27,8 @@
Deleting or banning this user may mean you will be unable to administrate the site.
</p>
</if>
<p>Member state: <b>@user_info.member_state@</b> - change member state: @user_finite_state_links;noquote@</p>
<p>Member state: <b>@user_info.member_state@</b> - change member state: @user_finite_state_links;noquote@<br>
Delete user: <a href="@delete_user_url@">temporarily</a>, <a href="@delete_user_permanent_url@">permanently</a></p>
</if>
<else>
<p>Member state: <b>@user_info.member_state@</b> <i>(cannot change state for yourself)</i></p>
......@@ -77,6 +78,17 @@ above.
<li><a href="modify-admin-privileges?user_id=@user_id@&action=grant">Grant site-wide administration privileges</a></li>
</else>
<li>Merge this user with:
<form method=get action=search>
<input type="hidden" name="target" value="merge">
<input type="hidden" name="limit_to_user_id" value="@user_id@">
<input type="hidden" name="from_user_id" value="@user_id@">
<input type="hidden" name="only_authorized_p" value="0">
<input type="text" size="15" name="keyword">
<input type="submit" value="Find User">
</form>
</li>
<if @password_reset_url@ not nil>
<li><a href="@password_reset_url@">Reset this user's password</a></li>
</if>
......
......@@ -22,6 +22,9 @@ set user_info(by_ip_url) [export_vars -base "complex-search" { { target one } {
set return_url [ad_return_url]
set delete_user_url [export_vars -base delete-user { user_id return_url {permanent f}}]
set delete_user_permanent_url [export_vars -base delete-user { user_id return_url {permanent t}}]
#
# RBM: Check if the requested user is a site-wide admin and warn the
# viewer in that case (so that a ban/deletion can be avoided).
......@@ -86,11 +89,11 @@ db_multirow all_group_membership all_group_membership "
order by lower(groups.group_name)"
if { [auth::password::can_reset_p -authority_id $user_info(authority_id)] } {
set password_reset_url [export_vars -base "password-reset" { user_id { return_url [ad_return_url] } }]
set password_update_url [export_vars -base "password-update" { user_id { return_url [ad_return_url] } }]
set password_reset_url [export_vars -base "password-reset" { user_id return_url }]
set password_update_url [export_vars -base "password-update" { user_id return_url }]
}
set portrait_manage_url [export_vars -base /user/portrait/ { user_id { return_url [ad_return_url] } }]
set portrait_manage_url [export_vars -base /user/portrait/ { user_id return_url }]
ad_return_template
......@@ -105,7 +108,7 @@ ad_return_template
# set contact_info [ad_user_contact_info $user_id "site_admin"]
# if ![empty_string_p $contact_info] {
# if {$contact_info ne ""} {
# append whole_page "<h3>Contact Info</h3>\n\n$contact_info\n
# <ul>
# <li><a href=contact-edit?[export_url_vars user_id]>Edit contact information</a>
......@@ -117,24 +120,24 @@ ad_return_template
# </ul>"
# }
# if [db_table_exists users_demographics] {
# if [db_0or1row user_demographics "select
# if {[db_table_exists users_demographics]} {
# if {[db_0or1row user_demographics "select
# ud.*,
# u.first_names as referring_user_first_names,
# u.last_name as referring_user_last_name
# from users_demographics ud, users u
# where ud.user_id = $user_id
# and ud.referred_by = u.user_id(+)"] {
# and ud.referred_by = u.user_id(+)"]} {
# # the table exists and there is a row for this user
# set demographic_items ""
# for {set i 0} {$i<[ns_set size $selection]} {incr i} {
# set varname [ns_set key $selection $i]
# set varvalue [ns_set value $selection $i]
# if { $varname != "user_id" && ![empty_string_p $varvalue] } {
# if { $varname ne "user_id" && $varvalue ne "" } {
# append demographic_items "<li>$varname: $varvalue\n"
# }
# }
# if ![empty_string_p $demographic_items] {
# if {$demographic_items ne ""} {
# append whole_page "<h3>Demographics</h3>\n\n<ul>$demographic_items</ul>\n"
# }
......@@ -150,7 +153,7 @@ ad_return_template
# append category_items "<LI>$category\n"
# }
# if ![empty_string_p $category_items] {
# if {$category_items ne ""} {
# append whole_page "<H3>Interests</H3>\n\n<ul>\n\n$category_items\n\n</ul>"
# }
# }
......
......@@ -13,6 +13,8 @@ ad_page_contract {
@param target URL to return to
@param passthrough Form variables to pass along from caller
@param limit_to_users_in_group_id Limits search to users in the specified group id. This can be a comma separated list to allow searches within multiple groups. (optional)
@param limit_to_user_id. This is useful is you don't want to show a list of user_ids. This could be a comma separated list. (optional)
@param from_user_id is used if you want to merge the user_id with user_id_from_search (optional)
@author Jin Choi (jsc@arsdigita.com)
} {
......@@ -23,6 +25,8 @@ ad_page_contract {
{passthrough ""}
{limit_users_in_group_id ""}
{only_authorized_p:integer 1}
{limit_to_user_id ""}
{from_user_id ""}
} -properties {
group_name:onevalue
search_type:onevalue
......@@ -41,27 +45,27 @@ set exception_text ""
set context [list [list "./" "Users"] "Search"]
if [info exists keyword] {
if {[info exists keyword]} {
# this is an administrator
if { [empty_string_p $keyword] } {
if { $keyword eq "" } {
incr exception_count
append exception_text "<li>You forgot to type a search string!\n"
}
} else {
# from one of the user pages
if { (![info exists email] || [empty_string_p $email]) && \
(![info exists last_name] || [empty_string_p $last_name]) } {
if { (![info exists email] || $email eq "") && \
(![info exists last_name] || $last_name eq "") } {
incr exception_count
append exception_text "<li>You must specify either an email address or last name to search for.\n"
}
if { [info exists email] && [info exists last_name] && \
![empty_string_p $email] && ![empty_string_p $last_name] } {
$email ne "" && $last_name ne "" } {
incr exception_count
append exception_text "<li>You can only specify either email or last name, not both.\n"
}
if { ![info exists target] || [empty_string_p $target] } {
if { ![info exists target] || $target eq "" } {
incr exception_count
append exception_text "<li>Target was not specified. This shouldn't have happened,
please contact the <a href=\"mailto:[ad_host_administrator]\">administrator</a>
......@@ -82,7 +86,7 @@ if { [info exists keyword] } {
set search_type "keyword"
set sql_keyword "%[string tolower $keyword]%"
lappend where_clause "(email like :sql_keyword or lower(first_names || ' ' || last_name) like :sql_keyword)"
} elseif { [info exists email] && ![empty_string_p $email] } {
} elseif { [info exists email] && $email ne "" } {
set search_type "email"
set sql_email "%[string tolower $email]%"
lappend where_clause "email like :sql_email"
......@@ -102,6 +106,11 @@ if { ![info exists passthrough] } {
set passthrough_parameters "[export_entire_form_as_url_vars $passthrough]"
}
if { [exists_and_not_null limit_to_user_id ] } {
set limit_to_user_id [join $limit_to_user_id ","]
lappend where_clause "cc_users.user_id not in ($limit_to_user_id)"
}
if { [exists_and_not_null limit_to_users_in_group_id] } {
set query "select distinct first_names, last_name, email, member_state, email_verified_p, cu.user_id
from cc_users cu, group_member_map gm, membership_rels mr
......@@ -132,14 +141,19 @@ db_foreach user_search_admin $query {
set last_name_from_search $last_name
set email_from_search $email
set user_search:[set rowcount](user_id) $user_id
if { $from_user_id eq "" } {
set user_search:[set rowcount](user_id) $user_id
} else {
set user_search:[set rowcount](user_id) $from_user_id
}
set user_search:[set rowcount](first_names) $first_names
set user_search:[set rowcount](last_name) $last_name
set user_search:[set rowcount](email) $email
set user_search:[set rowcount](export_vars) [export_url_vars user_id_from_search first_names_from_search last_name_from_search email_from_search]
set user_search:[set rowcount](member_state) $member_state
if { $member_state != "approved" } {
if { $member_state ne "approved" } {
set user_search:[set rowcount](user_finite_state_links) [join [ad_registration_finite_state_machine_admin_links $member_state $email_verified_p $user_id_from_search "search?[export_url_vars email last_name keyword target passthrough limit_users_in_group_id only_authorized_p]"] " | "]
} else {
set user_search:[set rowcount](user_finite_state_links) ""
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment