Commit ab800c33 authored by cvs2svn's avatar cvs2svn

This commit was manufactured by cvs2svn to create tag 'v3-0-0-5-1'.

Sprout from cognovis 2005-04-18 19:21:19 UTC Frank Bergmann  <frank.bergmann@project-open.com> 'Initial Import'
Delete:
    www/apm/packages/index-oracle.xql
    www/apm/packages/index-postgresql.xql
    www/apm/packages/index.vuh
    www/apm/parameter-edit.adp
    www/apm/parameter-edit.tcl
    www/apm/parameter-edit.xql
    www/apm/repository-channel-index.adp
    www/apm/repository-index.adp
    www/apm/version-callback-add-edit.adp
    www/apm/version-callback-add-edit.tcl
    www/apm/version-callback-delete.tcl
    www/apm/version-callback-invoke.adp
    www/apm/version-callback-invoke.tcl
    www/apm/version-callbacks.adp
    www/apm/version-callbacks.tcl
    www/apm/version-dependencies-oracle.xql
    www/apm/version-dependencies-postgresql.xql
    www/apm/version-dependencies.tcl
    www/apm/version-dependencies.xql
    www/apm/version-dependency-add-2.tcl
    www/apm/version-dependency-add-2.xql
    www/apm/version-dependency-add-oracle.xql
    www/apm/version-dependency-add-postgresql.xql
    www/apm/version-dependency-add.tcl
    www/apm/version-dependency-add.xql
    www/apm/version-dependency-remove.tcl
    www/apm/version-disable.tcl
    www/apm/version-edit-2.tcl
    www/apm/version-edit-2.xql
    www/apm/version-edit.tcl
    www/apm/version-edit.xql
    www/apm/version-enable.tcl
    www/apm/version-files.adp
    www/apm/version-files.tcl
    www/apm/version-fs-scan.xql
    www/apm/version-generate-diffs.tcl
    www/apm/version-generate-diffs.xql
    www/apm/version-generate-info.tcl
    www/apm/version-generate-tarball.tcl
    www/apm/version-i18n-export.adp
    www/apm/version-i18n-export.tcl
    www/apm/version-i18n-import.adp
    www/apm/version-i18n-import.tcl
    www/apm/version-i18n-index.adp
    www/apm/version-i18n-index.tcl
    www/apm/version-i18n-process-2.adp
    www/apm/version-i18n-process-2.tcl
    www/apm/version-i18n-process.adp
    www/apm/version-i18n-process.tcl
    www/apm/version-i18n.adp
    www/apm/version-i18n.tcl
    www/apm/version-parameter-values.tcl
    www/apm/version-parameter-values.xql
    www/apm/version-parameters-oracle.xql
    www/apm/version-parameters-postgresql.xql
    www/apm/version-parameters.adp
    www/apm/version-parameters.tcl
    www/apm/version-parameters.xql
    www/apm/version-reload.adp
    www/apm/version-reload.tcl
    www/apm/version-tag.tcl
    www/apm/version-tag.xql
    www/apm/version-upgrade.tcl
    www/apm/version-view-oracle.xql
    www/apm/version-view-postgresql.xql
    www/apm/version-view.adp
    www/apm/version-view.tcl
    www/apm/version-view.xql
    www/apm/write-all-specs.tcl
    www/apm/write-all-specs.xql
    www/auth/authority-delete.tcl
    www/auth/authority-oracle.xql
    www/auth/authority-parameters.adp
    www/auth/authority-parameters.tcl
    www/auth/authority-postgresql.xql
    www/auth/authority-registration-select.tcl
    www/auth/authority-set-enabled-p.tcl
    www/auth/authority-set-sort-order.tcl
    www/auth/authority.adp
    www/auth/authority.tcl
    www/auth/batch-action.adp
    www/auth/batch-action.tcl
    www/auth/batch-document-download.tcl
    www/auth/batch-job-run.adp
    www/auth/batch-job-run.tcl
    www/auth/batch-job.adp
    www/auth/batch-job.tcl
    www/auth/batch-job.xql
    www/auth/index.adp
    www/auth/index.tcl
    www/cache/flush-cache.tcl
    www/cache/flush.tcl
    www/cache/index.adp
    www/cache/index.tcl
    www/cache/one.adp
    www/cache/one.tcl
    www/cache/show-util-memoize.adp
    www/cache/show-util-memoize.tcl
    www/install/index.adp
    www/install/index.tcl
    www/install/install-2.adp
    www/install/install-2.tcl
    www/install/install-3.tcl
    www/install/install-4.adp
    www/install/install-4.tcl
    www/install/install.adp
    www/install/install.tcl
    www/package/index.vuh
    www/test/security-test.tcl
    www/test/signed-cookies-test-2.tcl
    www/test/signed-cookies-test-2.xql
    www/test/signed-cookies-test.tcl
    www/users/become.adp
    www/users/become.tcl
    www/users/complex-search-oracle.xql
    www/users/complex-search-postgresql.xql
    www/users/complex-search.adp
    www/users/complex-search.tcl
    www/users/complex-search.xql
    www/users/index.adp
    www/users/index.tcl
    www/users/index.xql
    www/users/member-state-change-oracle.xql
    www/users/member-state-change-postgresql.xql
    www/users/member-state-change.adp
    www/users/member-state-change.tcl
    www/users/member-state-change.xql
    www/users/modify-admin-privileges-oracle.xql
    www/users/modify-admin-privileges-postgresql.xql
    www/users/modify-admin-privileges.adp
    www/users/modify-admin-privileges.tcl
    www/users/one-oracle.xql
    www/users/one-postgresql.xql
    www/users/one.adp
    www/users/one.tcl
    www/users/one.xql
    www/users/password-reset.tcl
    www/users/password-update.adp
    www/users/password-update.tcl
    www/users/registration-history-oracle.xql
    www/users/registration-history-postgresql.xql
    www/users/registration-history.adp
    www/users/registration-history.tcl
    www/users/search.adp
    www/users/search.tcl
    www/users/search.xql
    www/users/session-history.tcl
    www/users/sessions-one-month.tcl
    www/users/sessions-registered-summary.tcl
    www/users/user-add-2.adp
    www/users/user-add-2.tcl
    www/users/user-add-2.xql
    www/users/user-add-3.adp
    www/users/user-add-3.tcl
    www/users/user-add-3.xql
    www/users/user-add.adp
    www/users/user-add.tcl
parent 021887b3
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="apm_archive_exist_p">
<querytext>
select count(*)
from cr_revisions
where revision_id = (select content_item.get_latest_revision(item_id)
from apm_package_versions
where version_id = :version_id)
</querytext>
</fullquery>
<fullquery name="apm_archive_serve">
<querytext>
select '[cr_fs_path]' || filename as content,
'[set storage_type file]' as storage_type
from cr_revisions
where revision_id = (select content_item.get_latest_revision(item_id)
from apm_package_versions
where version_id = $version_id)
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="apm_archive_exist_p">
<querytext>
select count(*)
from cr_revisions
where revision_id = (select content_item__get_latest_revision(item_id)
from apm_package_versions
where version_id = :version_id)
</querytext>
</fullquery>
<fullquery name="apm_archive_serve">
<querytext>
select '[cr_fs_path]' || r.content as content, i.storage_type
from cr_revisions r, cr_items i
where r.item_id = i.item_id
and r.revision_id = (select content_item__get_latest_revision(item_id)
from apm_package_versions
where version_id = :version_id)
</querytext>
</fullquery>
</queryset>
ad_page_contract {
This page serves .APM tarballs of packages.
Modified to serve tarballs from content repository (Openacs - DanW)
@author Bryan Quinn (bquinn@arsdigita.com)
@creation-date 29 September 2000
@cvs-id $Id$
} {
version_id:naturalnum,notnull
}
if { [db_string apm_archive_exist_p {
select count(*)
from cr_revisions
where revision_id = (select content_item.get_latest_revision(item_id)
from apm_package_versions
where version_id = :version_id)
} -default 0] } {
set file [ns_tmpnam]
db_blob_get_file apm_archive_serve "
select content
from cr_revisions
where revision_id = (select content_item.get_latest_revision(item_id)
from apm_package_versions
where version_id = :version_id)
" -file $file
db_release_unused_handles
ns_returnfile 200 application/octet-stream $file
} else {
ad_return_complaint "No Archive Available" "There is no APM archive for the version you requested."
}
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
@body;noquote@
ad_page_contract {
Adds a parameter to a version.
@author Todd Nightingale [tnight@arsdigita.com]
@creation-date 17 April 2000
@cvs-id $Id$
} {
parameter_id:notnull,naturalnum
version_id:notnull,naturalnum
}
set user_id [ad_verify_and_get_user_id]
db_1row param_info {
select parameter_name, datatype, description, default_value, min_n_values, max_n_values, parameter_id,
section_name, default_value
from apm_parameters
where parameter_id = :parameter_id
}
db_1row apm_get_name {
select pretty_name, version_name, package_key
from apm_package_version_info
where version_id = :version_id
}
db_release_unused_handles
set page_title "Edit Parameter"
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 }] "Parameters"] $page_title]
append body "
<form action=\"parameter-edit-2\" method=\"post\">
<blockquote>
<table>
[export_form_vars package_key parameter_id version_id]
<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
plain text string that identifies the parameter.
</td>
</tr>
<tr>
<th align=right nowrap>Parameter Name:</th>
<td><input name=parameter_name size=50 value=\"[ad_quotehtml $parameter_name]\"></td>
</tr>
<tr>
<td></td>
<td>Type a description of your parameter.
</tr>
<tr valign=top>
<th align=right><br>Description:</th>
<td><textarea name=description cols=60 rows=8>[ad_quotehtml $description]</textarea>
</td>
</tr>
<tr>
<td></td>
<td>You may enter a section name to identify the parameter. For example, the ACS Kernel has a \"security\" section
to indicate which parameters pertain to security.
</tr>
<tr valign=top>
<th align=right><br>Section Name:</th>
<td><input name=section_name value=\"[ad_quotehtml $section_name]\" size=50><br>
</td>
</tr>
<tr>
<td></td>
<td>Please indicate what type of parameter it is.
</tr>
<tr>
<th align=right nowrap>Type:</th>
<td><select name=datatype>
[ad_generic_optionlist {number string} {number string} $datatype]
</select>
</td>
</tr>
<tr>
<td></td>
<td>The default setting will be the parameter value that applies to any package instance that does
not set its own value.
</td>
</tr>
<tr>
<th align=right nowrap>Default:</th>
<td><input name=default_value size=50 value=\"[ad_quotehtml $default_value]\"></td>
</tr>
<tr><th colspan=2><input type=submit value=\"Edit Parameter\"></th>
</tr>
</table>
</blockquote>
</form>
[ad_footer]
"
<?xml version="1.0"?>
<queryset>
<fullquery name="param_info">
<querytext>
select parameter_name, datatype, description, default_value, min_n_values, max_n_values, parameter_id,
section_name, default_value
from apm_parameters
where parameter_id = :parameter_id
</querytext>
</fullquery>
<fullquery name="apm_get_name">
<querytext>
select pretty_name, version_name, package_key
from apm_package_version_info
where version_id = :version_id
</querytext>
</fullquery>
</queryset>
<h2>OpenACS @channel@ Core and compatibile packages</h2>
<p>Packages can be installed with the OpenACS Automated Installer on
your OpenACS site at <code>/acs-admin/install</code>. Only packages
designated compatible with your OpenACS kernel will be shown.</p>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>Package</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>
</tr>
</multiple>
</table>
<h2>OpenACS Package Repository</h2>
<p> Available channels. </p>
<ul>
<multiple name="channels">
<li><a href="@channels.name@/">@channels.name@</a></li>
</multiple>
</ul>
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<formtemplate id="callback"></formtemplate>
ad_page_contract {
Page for editing and adding callbacks. If type is provided we are in edit
mode.
@author Peter Marklund
@creation-date 28 January 2003
@cvs-id $Id$
} {
version_id:integer,notnull
{type ""}
}
db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id"
set return_url "version-callbacks?[export_vars { version_id }]"
# Set default values for type and proc name
if { [empty_string_p $type] } {
# We are in add mode
set edit_mode_p 0
set unused_types [apm_unused_callback_types -version_id $version_id]
set type_options [list]
foreach unused_type $unused_types {
lappend type_options [list $unused_type $unused_type]
}
set type_value [lindex $type_options 0]
set proc_value ""
set page_title "Add Tcl Callback"
} else {
# We are in edit mode
set edit_mode_p 1
set type_options [list [list $type $type]]
set type_value $type
set proc_value [apm_get_callback_proc -type $type -version_id $version_id]
set page_title "Edit Tcl Callback"
}
set context [list [list "." "Package Manager"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] [list $return_url "Tcl Callbacks"] $page_title]
set type_label "Tcl procedure name"
ad_form -name callback -cancel_url $return_url -form {
{version_id:integer(hidden)
{value $version_id}
}
{return_url:text(hidden)
{value $return_url}
}
{edit_mode_p:text(hidden)
{value $edit_mode_p}
}
{type:text(select)
{label "Type"}
{options {$type_options}}
{value $type_value}
}
{proc:text
{label $type_label}
{html {size 40 maxlength 300}}
{value $proc_value}
}
} -validate {
{proc
{ ![empty_string_p [info procs ::${proc}]] }
{The specified procedure name does not exist. Is the -procs.tcl file loaded?}
}
{proc
{ [apm_callback_has_valid_args -type $type -proc_name $proc] }
{The callback proc $proc must be defined with ad_proc [ad_decode [apm_arg_names_for_callback_type -type $type] "" "and should take no arguments" "and have the following required switches: [apm_arg_names_for_callback_type -type $type]"]}
}
} -on_submit {
apm_set_callback_proc -type $type -version_id $version_id $proc
apm_package_install_spec $version_id
ad_returnredirect $return_url
ad_script_abort
}
if { $edit_mode_p } {
element set_properties callback type -mode display
}
ad_return_template
ad_page_contract {
@author Peter Marklund
@creation-date 28 January 2003
@cvs-id $Id$
} {
version_id:integer,notnull
type:notnull
}
set package_key [apm_package_key_from_version_id $version_id]
apm_remove_callback_proc -type $type -package_key $package_key
ad_returnredirect "version-callbacks?version_id=$version_id"
\ No newline at end of file
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<if @result@ not nil>
<h2>Output</h2>
<blockquote><pre>
@result@
</pre></blockquote>
</if>
<else>
The callback has been invoked.
</else>
<p>
<b>&raquo;</b> <a href="@return_url@">Go back</a>
</p>
ad_page_contract {
Invoke a callback.
@author Lars Pind (lars@collaboraid.biz)
@creation-date 11 September 2003
@cvs-id $Id$
} {
version_id:integer,notnull
type:notnull
}
db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id"
set return_url "version-callbacks?[export_vars { version_id }]"
# Set default values for type and proc name
set proc_value [apm_get_callback_proc -type $type -version_id $version_id]
set page_title "Invoke Tcl Callback"
set context [list \
[list "." "Package Manager"] \
[list [export_vars -base "version-view" { version_id }] "$pretty_name $version_name"] \
[list $return_url "Tcl Callbacks"] $page_title]
if { [catch $proc_value result] } {
global errorInfo
ns_log Error "Error invoking callback $proc_value: $result\n$errorInfo"
}
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<p><listtemplate name="callbacks"></listtemplate></p>
<h3>Help</h3>
<p>
Below is the list of available callbacks and the parameters they will be called with. Note that the parameters are sent as named parameters.
</p>
<p>
For install, uninstall, and upgrade, the before/after part of the
name refers to before or after the database create/upgrade/drop
scripts have been run. For mounting and instantiating, well, that should be fairly obvious.
</p>
<p>
For the upgrade callbacks, you should definitely check out the proc <a
href="/api-doc/proc-view?proc=apm%5fupgrade%5flogic">apm_upgrade_logic</a>,
which makes it very easy to handle the logic of which things to
process depending on which version you're upgrading from and to.
</p>
<table cellspacing="1" cellpadding="4" bgcolor="#999999">
<tr bgcolor="white">
<th>Callback</th>
<th>Parameters</th>
</tr>
<tr bgcolor="white">
<td>
before-install
</td>
<td>
</td>
</tr>
<tr bgcolor="white">
<td>
after-install
</td>
<td>
</td>
</tr>
<tr bgcolor="white">
<td>
before-upgrade
</td>
<td>
-from_version_name
-to_version_name
</td>
</tr>
<tr bgcolor="white">
<td>
after-upgrade
</td>
<td>
-from_version_name
-to_version_name
</td>
</tr>
<tr bgcolor="white">
<td>
before-uninstall
</td>
<td>
</td>
</tr>
<tr bgcolor="white">
<td>
after-instantiate
</td>
<td>
-package_id
</td>
</tr>
<tr bgcolor="white">
<td>
before-uninstantiate
</td>
<td>
-package_id
</td>
</tr>
<tr bgcolor="white">
<td>
after-mount
</td>
<td>
-package_id
-node_id
</td>
</tr>
<tr bgcolor="white">
<td>
before-unmount
</td>
<td>
-package_id
-node_id
</td>
</tr>
</table>
ad_page_contract {
@author Peter Marklund
@creation-date 28 January 2003
@cvs-id $Id$
} {
version_id:integer,notnull
}
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 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 }]]
} else {
set actions [list]
}
template::list::create \
-name callbacks \
-multirow callbacks \
-actions $actions \
-elements {
edit {
label {}
sub_class narrow
display_template {
<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" }
}
type {
label "Type"
}
proc {
label "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>}
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!" }
html { align center }
}
delete {
label {}
sub_class narrow
display_template {
<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" }
}
}
db_multirow callbacks get_all_callbacks {
select version_id,
type,
proc
from apm_package_callbacks
where version_id = :version_id
order by type
}
ad_return_template
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="apm_package_info_by_version_id">
<querytext>
select package_key, pretty_name, version_name, installed_p
from apm_package_version_info
where version_id = :version_id
</querytext>
</fullquery>
<fullquery name="apm_all_dependencies">
<querytext>
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
</querytext>
</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>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="apm_package_info_by_version_id">
<querytext>
select package_key, pretty_name, version_name, installed_p
from apm_package_version_info
where version_id = :version_id
</querytext>
</fullquery>
<fullquery name="apm_all_dependencies">
<querytext>
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
</querytext>
</fullquery>
<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
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>
</fullquery>
</queryset>
ad_page_contract {
Views dependency information about a version.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 17 April 2000
@cvs-id $Id$
} {
{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
}
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"
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 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
# a *lower* version of the service; if it requires one, show packages providing
# a *higher* version.
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
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"
}
if { $counter != 0 } {
doc_body_append "</ul>\n"
}
} 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"
}
doc_body_append "</ul>\n"
}
db_release_unused_handles
doc_body_append "
</ul>
[ad_footer]
"
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_package_info_by_version_id">
<querytext>
select package_key, pretty_name, version_name, installed_p
from apm_package_version_info
where version_id = :version_id
</querytext>
</fullquery>
<fullquery name="apm_all_dependencies">
<querytext>
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
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Adds a dependency to a version of a package.
@author Bryan Quinn
@creation-date 17 April 2000
@cvs-id $Id$
} {
{dependency_id:naturalnum}
{version_id:integer}
dependency_type
service_uri
service_version
}
db_transaction {
switch $dependency_type {
require {
apm_dependency_add -dependency_id $dependency_id $version_id $service_uri $service_version
}
provide {
apm_interface_add -interface_id $dependency_id $version_id $service_uri $service_version
}
default {
ad_return_complaint 1 "Entry error: Depenendencies are either provided or required."
}
}
apm_package_install_spec $version_id
} on_error {
if { ![db_string apm_dependency_doubleclick_check {
select count(*) from apm_package_dependencies
where dependency_id = :dependency_id
} -default 0] } {
ad_return_complaint 1 "The database returned the following error:
<blockquote><pre>[ad_quotehtml $errmsg]</pre></blockquote>"
}
}
ad_returnredirect "version-dependencies?[export_url_vars version_id]"
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_dependency_doubleclick_check">
<querytext>
select count(*) from apm_package_dependencies
where dependency_id = :dependency_id
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="apm_all_service_uri">
<querytext>
select distinct service_uri, service_version
from apm_package_dependencies
order by service_uri, apm_package_version.sortable_version_name(service_version)
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="apm_all_service_uri">
<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)
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Adds a dependency to a version of a package.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 17 April 2000
@cvs-id $Id$
} {
{version_id:integer}
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
}
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>
<tr><td></td><td>
<select name=service_select size=8 onChange=\"selectService(this)\">
"
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_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>
<input type=submit value=\"Add Dependency\">
</center>
[ad_footer]
"
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_package_info_by_version_id_and_package">
<querytext>
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
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Adds a dependency to a version of a package.
@author Jon Salz (jsalz@arsdigita.com)
@creation-date 17 April 2000
@cvs-id $Id$
} {
{version_id:integer}
{dependency_id:integer}
dependency_type:notnull
}
db_transaction {
switch $dependency_type {
provide {
apm_dependency_remove $dependency_id
}
require {
apm_interface_remove $dependency_id
}
default {
ad_return complaint 1 "Dependency Entry Error: Depenendencies are either interfaces or requirements."
}
}
apm_package_install_spec $version_id
} on_error {
ad_return_complaint 1 "Database Error: The database returned the following error:
<blockquote><pre>[ad_quotehtml $errmsg]</pre></blockquote>"
}
ad_returnredirect "version-dependencies?[export_url_vars version_id]"
ad_page_contract {
Disables a version of a package.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 17 April 2000
@cvs-id $Id$
} {
version_id:integer
}
apm_version_disable -callback apm_dummy_callback $version_id
ad_returnredirect "version-view?version_id=$version_id"
ad_page_contract {
Edit a package version
@author Bryan Quinn (bquinn@arsdigita.com)
@creation-date 17 April 2000
@cvs-id $Id$
} {
version_id:naturalnum,notnull
version_name
version_uri
summary
description:html
{description_format ""}
{ owner_name:multiple}
{ owner_uri:multiple}
vendor
vendor_uri
{auto_mount ""}
{release_date ""}
{ upgrade_p 0 }
}
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
}
# Figure out if we're changing version
db_1row old_version_info {}
set version_changed_p [expr ![string equal $version_name $old_version_name]]
if { [string equal $old_version_name $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] } {
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.}
}
if { $upgrade_p && [db_string apm_version_uri_unique_ck {
select decode(count(*), 0, 0, 1) from apm_package_versions
where version_uri = :version_uri
} -default 0] } {
ad_return_complaint 1 "A version with the URL $version_uri already exists."
}
db_transaction {
set version_id [apm_version_update $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
if {$upgrade_p} {
apm_version_upgrade $version_id
# The package now provides the new version of itself as interface
db_dml update_version_provides {update apm_package_dependencies
set service_version = :version_name
where version_id = :version_id
and service_uri = (select package_key
from apm_package_versions
where version_id = :version_id)
and dependency_type = 'provides'}
}
} on_error {
ad_return_error "Error" "
I was unable to update your version for the following reason:
<blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>
"
}
ad_returnredirect "version-generate-info?version_id=$version_id&write_p=1"
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_version_uri_unique_ck">
<querytext>
select case when count(*) = 0 then 0 else 1 end from apm_package_versions
where version_uri = :version_uri
</querytext>
</fullquery>
<fullquery name="old_version_info">
<querytext>
select version_name as old_version_name, version_uri as old_version_uri
from apm_package_versions
where version_id = $version_id
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Edits information for a version of a package.
@param version_id The id of the package to process.
@author Jon Salz (jsalz@arsdigita.com)
@author Bryan Quinn (bquinn@arsdigita.com)
@creation-date 9 May 2000
@cvs-id $Id$
} {
{version_id:integer}
}
db_1row apm_all_version_info {}
doc_body_append "[apm_header -form "action=\"version-edit-2\" method=post" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] "Edit a Version"]
"
# If the version name is incorporated into the version URL (it will almost always be!)
# then generate some JavaScript to automatically update the version URL when the
# version name changes.
set version_name_index [string first $version_name $version_uri]
if { $version_name_index >= 0 } {
set version_uri_prefix [string range $version_uri 0 [expr { $version_name_index - 1 }]]
set version_uri_suffix [string range $version_uri [expr { $version_name_index + [string length $version_name] }] end]
doc_body_append "
<script language=javascript>
function updateVersionURL() {
var form = document.forms\[0\];
form.version_uri.value = '$version_uri_prefix' + form.version_name.value + '$version_uri_suffix';
}
</script>
"
set version_name_on_change "onChange=\"updateVersionURL()\""
} else {
set version_name_on_change ""
}
doc_body_append "
<script language=javascript>
function checkMailto(element) {
// If it looks like an email address without a mailto: (contains an @ but
// no colon) then prepend 'mailto:'.
if (element.value.indexOf('@') >= 0 && element.value.indexOf(':') < 0)
element.value = 'mailto:' + element.value;
}
</script>
[export_form_vars version_id release_date]
<table>
<tr>
<th align=right nowrap>Package Key:</th>
<td><tt>$package_key</tt></td>
</tr>
<tr>
<th align=right nowrap>Package URL:</th>
<td>$package_uri</td>
</tr>
<tr>
<th align=right nowrap>Package Name:</th>
<td>$pretty_name</td>
</tr>
<tr>
<th align=right nowrap>OpenACS Core:</th>
<td>$initial_install_p</td>
</tr>
<tr>
<th align=right nowrap>Singleton:</th>
<td>$singleton_p</td>
</tr>
<tr>
<th align=right nowrap>Auto-mount:</th>
<td><input name=auto_mount size=30 value=\"$auto_mount\" /></td>
</tr>
<tr>
<td></td>
<td>To create a new version of the package, type a new version number and
update the version URL accordingly. Leave the version name and URL alone to
edit the information regarding existing version of the package.</td>
</tr>
<tr>
<th align=right nowrap>Version:</th>
<td><input name=version_name size=10 value=\"$version_name\" $version_name_on_change>
</td>
</tr>
<tr>
<th align=right nowrap>Version URL:</th>
<td><input name=version_uri size=60 value=\"$version_uri\"></td>
</tr>
<tr valign=top>
<th align=right><br>Summary:</th>
<td><textarea name=summary cols=60 rows=2 wrap=soft>[ns_quotehtml $summary]</textarea></td>
</tr>
<tr valign=top>
<th align=right><br>Description:</th>
<td><textarea name=description cols=60 rows=5 wrap=soft>[ns_quotehtml $description]</textarea><br>
This description is <select name=description_format>
<option value=text/html [ad_decode $description_format "text/plain" "" "selected"]>HTML-formatted.
<option value=text/plain [ad_decode $description_format "text/plain" "selected" ""]>plain text.
</select>
</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
}]
if { [llength $owners] == 0 } {
set owners [list [list "" ""]]
}
# Add an extra one, so an arbitrary number of owners can be assigned to the package.
lappend owners [list "" ""]
set counter 0
foreach owner_info $owners {
set owner_name [lindex $owner_info 0]
set owner_uri [lindex $owner_info 1]
incr counter
if { $counter <= 3 } {
set prompt "[lindex { "" Primary Secondary Tertiary } $counter] Owner"
} else {
set prompt "Owner #$counter"
}
doc_body_append "
<tr>
<th align=right nowrap>$prompt:</th>
<td><input name=owner_name size=30 value=\"$owner_name\"></td>
</tr>
<tr>
<th align=right nowrap>$prompt URL:</th>
<td><input name=owner_uri size=30 value=\"$owner_uri\" onChange=\"checkMailto(this)\"></td>
</tr>
"
}
doc_body_append "
<tr>
<th align=right nowrap>Vendor:</th>
<td><input name=vendor size=30 value=\"$vendor\"></td>
</tr>
<tr>
<th align=right nowrap>Vendor URL:</th>
<td><input name=vendor_uri size=60 value=\"$vendor_uri\"></td>
</tr>
"
doc_body_append "
<tr>
<td></td>
<td>
<table><tr valign=baseline><td><input type=checkbox name=upgrade_p value=1 checked></td><td>
Upgrade the local package $pretty_name to this version and supersede older versions.
</td></tr></table>
</td>
</tr>
<tr>
<td colspan=2 align=center><br>
<input type=submit value=\"Save Information\">
</td>
</tr>
</table>
</form>
[ad_footer]
"
<?xml version="1.0"?>
<queryset>
<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
from apm_package_version_info where version_id = :version_id
</querytext>
</fullquery>
<fullquery name="apm_all_owners">
<querytext>
select owner_name, owner_uri from apm_package_owners where version_id = :version_id
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Enables a version of the package.
@param version_id The package to be processed.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 9 May 2000
@cvs-id $Id$
} {
{version_id:integer}
}
apm_version_enable -callback apm_dummy_callback $version_id
ad_returnredirect "version-view?version_id=$version_id"
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
@body;noquote@
ad_page_contract {
List all the files in a particular version of a package.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 9 May 2000
@cvs-id $Id$
} {
{version_id:integer}
}
apm_version_info $version_id
set return_url "[ad_conn url]?[ad_conn query]"
set page_title "Files"
set context [list [list "../developer" "Developer's Administration"] [list "/acs-admin/apm/" "Package Manager"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] $page_title]
append body "
<blockquote>
<table cellspacing=0 cellpadding=0>
"
doc_body_flush
set last_components [list]
set counter 0
append body "<tr><th align=left>Path</th><th width=40></th><th align=left>File type</th><th width=40></th>
<th align=left>Database support</th><th width=40></th></tr>\n"
foreach path [apm_get_package_files -package_key $package_key] {
set file_id ""
set db_type [apm_guess_db_type $package_key $path]
set db_pretty_name $db_type
set file_type [apm_guess_file_type $package_key $path]
if { [empty_string_p $file_type] } {
set file_type "?"
}
set file_pretty_name $file_type
incr counter
# Set i to the index of the last component which hasn't changed since the last component
# 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]] } {
break
}
}
# For every changed component (at least the file name), write a row in the table.
while { $i < [llength $components] } {
append body "<tr><td>"
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} {
# 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]
} else {
# This is an installed package, and a file has been removed from the filesystem.
# Use <strike> to indicate that the file has been deleted.
append body "<strike>[lindex $components $i]</strike>"
if { $i == [llength $components] - 1 } {
lappend stricken_files $file_id
}
}
if { $i < [llength $components] - 1 } {
append body "/</td>"
} else {
append body "</td>"
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" } {
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]} {
# 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 {
append body "<td></td>"
}
}
} else {
append body "<td></td>"
}
}
}
append body "</tr>\n"
incr i
}
set last_components $components
}
if { [string equal $counter 0] } {
append body "<tr><td>This package does not contain any registered files.</td></tr>\n"
}
append body "</table>
</blockquote>
"
if { $installed_p == "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] } {
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"} {
append body "
<li><a href=\"archive/[file tail $version_uri]?version_id=$version_id\">Download a tarball from the package archive</a>"
}
append body "</ul>"
} elseif { [info exists tagged_p] } {
if { $tagged_p == "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>
"
}
}
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_package_info">
<querytext>
select p.package_key, p.package_url, v.package_name, v.version_name, v.package_id
from apm_packages p, apm_package_versions v
where v.version_id = :version_id
and v.package_id = p.package_id
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Generates diffs for a version of a package.
@param version_id The package to be processed.
@param context_p Set to 0 if you don't want the diffs to be listed with context.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 9 May 2000
@cvs-id $Id$
} {
{version_id:integer}
{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
}
set analyze_dir [ns_mktemp "[acs_root_dir]/apm-workspace/diffs-XXXXXX"]
doc_body_append "[apm_header "Create Diffs for $package_name $version_name"]
<ul><li>Extracting the archive into $analyze_dir...<li>
"
doc_body_flush
apm_extract_tarball $version_id $analyze_dir
doc_body_append "Analyzing files...</ul>\n"
doc_body_flush
set no_changes [list]
global errorCode
foreach file [apm_version_file_list $version_id] {
if { ![file isfile "[acs_root_dir]/$file"] } {
doc_body_append "<h3>$file</h3>\n<blockquote>This file has been locally added.</blockquote>\n"
continue
}
if { ![file isfile "$analyze_dir/$file"] } {
doc_body_append "<h3>$file</h3>\n<blockquote>This file has been locally removed.</blockquote>\n"
continue
}
set cmd [list exec /usr/bin/diff]
if { $context_p } {
lappend cmd "-c"
}
lappend cmd "[acs_root_dir]/$file" $analyze_dir/$file
set errno [catch $cmd diffs]
if { $errno == 0 } {
lappend no_changes $file
} else {
set status [lindex $errorCode 2]
if { $status == 1 } {
regsub {child process exited abnormally$} $diffs "" diffs
doc_body_append "<h3>$file</h3>\n<blockquote><pre>[ns_quotehtml $diffs]</pre></blockquote>\n"
} else {
doc_body_append "<h3>$file</h3>\n<blockquote><pre>$diffs</pre></blockquote>\n"
}
}
doc_body_flush
}
if { [llength $no_changes] > 0 } {
doc_body_append "<h3>No changes to:</h3><ul><li>[join $no_changes "\n<li>"]</ul>\n"
}
doc_body_append [ad_footer]
<?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
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Generates a package spec.
@param version_id The package to be processed.
@param write_p Set to 1 if you want the specification file written to disk.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 9 May 2000
@cvs-id $Id$
} {
{version_id:integer}
{write_p 0}
}
if { $write_p } {
if { [catch { apm_package_install_spec $version_id } error] } {
ad_return_error "Error" "Unable to create the specification file:
<blockquote><pre>$error</pre></blockquote>
"
return
}
ad_returnredirect "version-view?version_id=$version_id"
ad_script_abort
} else {
ns_return 200 text/plain [apm_generate_package_spec $version_id]
}
ad_page_contract {
Generates a tarball for a package into its distribution_tarball field.
@param version_id The package version to be processed.
@author Bryan Quinn (bquinn@arsdigita.com)
@creation-date 9 May 2000
@cvs-id $Id$
} {
{version_id:integer}
}
db_transaction {
apm_generate_tarball $version_id
} on_error {
ad_return_complaint 1 "APM Generation Error: The database returned the following error message:
<pre>
<blockquote>
[ad_quotehtml $errmsg]
</blockquote>
</pre>
"
}
ad_returnredirect "version-view?version_id=$version_id"
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<p>
Export complete.
</p>
<p>
Catalog files are stored in the directory <b>@catalog_dir@</b>.
</p>
<p>
<b>&raquo;</b> <a href="@return_url@">Return</a>
</p>
ad_page_contract {
Export messages from the database to xml catalog files.
@author Peter Marklund (peter@collaboraid.biz)
@creation-date 23 October 2002
@cvs-id $Id$
} {
version_id:integer
{return_url {[export_vars -base "version-i18n-index" { version_id }]}}
}
db_1row package_version_info {
select package_key, pretty_name, version_name
from apm_package_version_info
where version_id = :version_id
}
set page_title "Export Messages"
set context [list \
[list "/acs-admin/apm/" "Package Manager"] \
[list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] \
[list [export_vars -base "version-i18n-index" { version_id }] "Internationalization"] $page_title]
set catalog_dir [lang::catalog::package_catalog_dir $package_key]
lang::catalog::export -package_key [apm_package_key_from_version_id $version_id]
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<p>
Import complete.
</p>
<p>
Catalog files have been loaded from the directory <b>@catalog_dir@</b>.
</p>
<p>
<b>&raquo;</b> <a href="@return_url@">Return</a>
</p>
ad_page_contract {
Import messages from catalog files to the database. Will overwrite texts in the database.
@author Peter Marklund (peter@collaboraid.biz)
@creation-date 23 October 2002
@cvs-id $Id$
} {
version_id:integer,notnull
{return_url {[export_vars -base "version-i18n-index" { version_id }]}}
}
db_1row package_version_info {
select package_key, pretty_name, version_name
from apm_package_version_info
where version_id = :version_id
}
set page_title "Import Messages"
set context [list \
[list "/acs-admin/apm/" "Package Manager"] \
[list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] \
[list [export_vars -base "version-i18n-index" { version_id }] "Internationalization"] $page_title]
set catalog_dir [lang::catalog::package_catalog_dir $package_key]
lang::catalog::import -package_key $package_key
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<h3>Import/Export Messages</h3>
<p>
<b>&raquo;</b> <a href="@export_url@"><b>Export</b>
messages from the database to catalog files</a>
</p>
<p>
<b>&raquo;</b> <a
href="@import_url@"><b>Import</b>
messages from catalog files to the database</a>
</p>
<h3>Localize Package</h3>
<p>
<b>&raquo;</b> <a href="@localize_url@">Localize messages in this package</a>
</p>
<h3>Internationalize Package</h3>
<p>
<b>&raquo;</b>
<a href="version-i18n?version_id=@version_id@"><b>Convert</b> ADP,
Tcl, and SQL files to using the message catalog</a>.
</p>
<if @num_cat_files@ gt 0>
<h3>Convert Message Catalog to New Format</h3>
<p>
<b>&raquo;</b>
<a
href="version-i18n-import?version_id=@version_id@&format=tcl"><b>Import</b>
old Tcl-based catalog files (.cat files) into the
database</a>. This will allow you to export them back out in the
new format. (NB! Overwrites texts in the database)
</p>
</if>
ad_page_contract {
Manage Internationalization for a certain package version.
@author Peter Marklund (peter@collaboraid.biz)
@creation-date 23 October 2002
@cvs-id $Id$
} {
version_id:integer,notnull
} -properties {
page_title
context_bar
num_cat_files
}
db_1row package_version_info {
select package_key, pretty_name, version_name
from apm_package_version_info
where version_id = :version_id
}
set page_title "Internationalization"
set context [list [list "/acs-admin/apm/" "Package Manager"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] $page_title]
set num_cat_files [llength [glob -nocomplain "[acs_package_root_dir $package_key]/catalog/*.cat"]]
set localize_url [export_vars -base "[apm_package_url_from_key "acs-lang"]admin/message-list" { package_key {locale {[ad_conn locale]}}}]
set import_url [export_vars -base "/acs-lang/admin/import-messages" { package_key {return_url {[ad_return_url]}} }]
set export_url [export_vars -base "/acs-lang/admin/export-messages" { package_key {return_url {[ad_return_url]}} }]
<master>
<property name="title">@page_title;noquote@</property>
<property name="context_bar">@context_bar;noquote@</property>
@processing_html_result;noquote@
<p>
<b>=&gt;</b> <a href="@proceed_url@">@proceed_label;noquote@</a>
</p>
ad_page_contract {
Internationalize a certain adp or tcl file.
@author Peter Marklund (peter@collaboraid.biz)
@creation-date 8 October 2002
@cvs-id $Id$
} {
version_id:integer,notnull
{files:multiple,notnull}
{file_action:multiple}
{number_of_keys:integer,notnull ""}
{replace_p:array ""}
{message_keys:array ""}
skip_button:optional
}
if { [info exists skip_button] } {
# The user wants to skip the file so remove it from the file and redirect
# to processing the next one
set remaining_files [lrange $files 1 end]
if { [llength $remaining_files] > 0 } {
ad_returnredirect "version-i18n-process?[export_vars -url {version_id {files:multiple $remaining_files} file_action:multiple}]"
} else {
ad_returnredirect "version-i18n?[export_vars -url {version_id}]"
}
ad_script_abort
}
# Create the message key list
# The list is needed since replace_adp_tags_with_message_tags proc below takes a list of
# keys to do replacements with where an empty key means no replacement.
set message_key_list [list]
for { set counter 1 } { $counter <= $number_of_keys } { incr counter } {
if { [info exists replace_p($counter)] } {
if { [exists_and_not_null message_keys($counter)] } {
lappend message_key_list $message_keys($counter)
} else {
ad_return_complaint 1 "<li>Message key number $counter is empty. Cannot replace text with empty key</li>"
ad_script_abort
}
} else {
# Empty string indicates no replacement
lappend message_key_list ""
}
}
set next_file [lindex $files 0]
set page_title "Internationalizing file $next_file"
set context_bar [ad_context_bar $page_title]
# Figure out which actions to take on the selected adp:s
set replace_text_p [ad_decode [lsearch -exact $file_action replace_text] "-1" "0" "1"]
set replace_tags_p [ad_decode [lsearch -exact $file_action replace_tags] "-1" "0" "1"]
# We need either or both of the actions to be selected
if { (! $replace_text_p) && (! $replace_tags_p) } {
ad_return_complaint 1 "Invalid HTML Parameters: you must choose an action to take on selected adp files, either replace_text or replace_tags or both."
ad_script_abort
}
# Do text replacement
if { $replace_text_p } {
# Process the next file in the list
set text_file $next_file
set number_of_processed_files 1
ns_log Notice "Replacing text in file $text_file with message tags"
append processing_html_result "<h3>Text replacements for $text_file</h3>"
set adp_text_result_list [lang::util::replace_adp_text_with_message_tags "[acs_root_dir]/$text_file" write $message_key_list]
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 />"
foreach text_replacement $text_replacement_list {
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 />"
} else {
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 />"
}
}
# Do tag replacement
set total_number_of_replacements "0"
if { $replace_tags_p } {
if { $replace_text_p } {
# We are also replacing text, so only process one adp file
set tags_files $next_file
set number_of_processed_files 1
} else {
# We are only doing tag replacement, so process all files
set tags_files $files
set number_of_processed_files [llength $files]
}
foreach file $tags_files {
ns_log Notice "Replacing tags in file $file with keys and doing insertion into message catalog"
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]
append processing_html_result "Did $number_of_replacements replacements, see the log file for details"
}
}
# Remove the processed file from the file list.
set files [lrange $files $number_of_processed_files end]
# The proceed link will be to the next adp file if there is one and back to the I18N page
# if we're done
set proceed_url_export_vars [export_vars -url {version_id files:multiple file_action:multiple}]
if { [llength $files] > 0 } {
# There are no more files to process so present a link back to the i18n page for this version
set proceed_url "version-i18n-process?${proceed_url_export_vars}"
set proceed_label "<b>Process next adp file</b>"
} else {
# There are more files to process. This means we are doing text replacements
# so present a link back to the page for choosing keys for the next adp file
set proceed_url "version-i18n?${proceed_url_export_vars}"
set proceed_label "Return to the I18N page for this package"
# If we are done with message tag replacement, that means we have added new messages
# so reload the cache
if { $replace_tags_p && $total_number_of_replacements > 0 } {
lang::message::cache
}
}
ad_return_template
<master>
<property name="title">@page_title;noquote@</property>
<property name="context_bar">@context_bar;noquote@</property>
<p>
<b>Current File:</b> @file@
</p>
<blockquote>
<form action="version-i18n-process-2">
@hidden_form_vars;noquote@
<input type="hidden" name="number_of_keys" value="@replacements:rowcount@" />
<table border="1">
<tr>
<th>Text to Replace</th>
<th>Do Replacement</th>
<th>Message key to use</th>
</tr>
<multiple name="replacements">
<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>
</tr>
</multiple>
</table>
<p>
<input type="submit" name="process_button" value="Process ADP" />
<input type="submit" name="skip_button" value="Skip ADP" />
</p>
</form>
</blockquote>
<h3>Instructions</h3>
<p>
Choose which message replacements to do in this file. Rather than keeping the default message key,
try to come up with a descriptive one that says something about the semantics or context of the message.
The text that is actually
replaced is bold and highlighted with a yellow background in the
"Text to Replace" column.
</p>
ad_page_contract {
Internationalize a certain adp file (the next one in the list). Give the user the possibility to
determine which texts should be substituted and which keys should be used.
@author Peter Marklund (peter@collaboraid.biz)
@creation-date 8 October 2002
@cvs-id $Id$
} {
version_id:integer,notnull
{files:multiple}
{file_action:multiple}
}
db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id"
set page_title "Internationalization of $pretty_name $version_name"
set context_bar [ad_context_bar $page_title]
# Figure out which actions to take on the selected adp:s
set replace_text_p [ad_decode [lsearch -exact $file_action replace_text] "-1" "0" "1"]
set replace_tags_p [ad_decode [lsearch -exact $file_action replace_tags] "-1" "0" "1"]
# If no texts should be replaced we need not give the user a choice of keys to use and
# can go straight to the processing
set redirect_url "version-i18n-process-2?[export_vars -url {version_id files:multiple file_action:multiple}]"
if { ! $replace_text_p } {
ad_returnredirect $redirect_url
ad_script_abort
}
# Process one adp at a time interactively
set file [lindex $files 0]
set full_file_name "[acs_root_dir]/$file"
set adp_report_list [lang::util::replace_adp_text_with_message_tags "[acs_root_dir]/$file" report]
set adp_replace_list [lindex $adp_report_list 0]
set adp_no_replace_list [lindex $adp_report_list 1]
if { [llength $adp_replace_list] == 0 } {
# There are no replacements to choose keys for so go straight to the processing result page
ad_returnredirect $redirect_url
ad_script_abort
}
multirow create replacements key text
foreach key_pair $adp_replace_list {
multirow append replacements [lindex $key_pair 0] [lindex $key_pair 1]
}
set hidden_form_vars [export_vars -form {version_id files:multiple file_action:multiple}]
ad_return_template
<master>
<property name="title">@page_title;noquote@</property>
<property name="context_bar">@context_bar;noquote@</property>
<p align="center">
@file_type_filter;noquote@
</p>
<p align="center">
@pre_select_filter;noquote@ | @status_filter;noquote@ (<a href="#file-status">?</a>)
</p>
<formtemplate id="file_list_form"></formtemplate>
<a href="/doc/i18n.html">Developer's Guide to i18n</a>
\ No newline at end of file
ad_page_contract {
A form to help semi-automate the conversion of tcl and adp files from using literal
text strings to using the message catalog.
@author Peter Marklund (peter@collaboraid.biz)
@creation-date 8 October 2002
@cvs-id $Id$
} {
version_id:integer,notnull
{pre_select_files_p "1"}
{show_status_p "0"}
{only_text_p "0"}
{file_type adp}
}
db_1row package_version_info "select pretty_name, version_name from apm_package_version_info where version_id = :version_id"
set page_title "Message catalog lookups for adp and tcl files of $pretty_name $version_name"
set context_bar [ad_context_bar $page_title]
set file_option_list [list]
set adp_preselect_list [list]
set package_key [apm_package_key_from_version_id $version_id]
foreach file [lsort [ad_find_all_files [acs_package_root_dir $package_key]]] {
set file_regexp ".${file_type}\$"
if { [regexp $file_regexp $file match] } {
set relative_path [ad_make_relative_path $file]
# Get statistics on number of message tags
if { $show_status_p || $only_text_p } {
set file_id [open $file r]
set file_contents [read $file_id]
set number_of_message_tags [llength [lang::util::get_temporary_tags_indices $file_contents]]
switch -- $file_type {
adp {
set number_of_message_keys [llength [lang::util::get_hash_indices $file_contents]]
set adp_text_result_list [lang::util::replace_adp_text_with_message_tags $file report]
set number_of_text_snippets [llength [lindex $adp_text_result_list 0]]
set status_string "$number_of_text_snippets texts, $number_of_message_tags tags, $number_of_message_keys keys"
}
tcl {
set status_string "$number_of_message_tags tags"
}
sql {
set number_of_message_keys [llength [lang::util::get_hash_indices $file_contents]]
set status_string "$number_of_message_tags tags, $number_of_message_keys keys"
}
}
close $file_id
} else {
set status_string ""
}
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 { $number_of_text_snippets == "0" } {
set add_file_p 0
}
}
# Checkbox label in first element and value in second
if { $add_file_p } {
lappend file_option_list [list "$relative_path $status_string" $relative_path]
}
if { $pre_select_files_p } {
lappend adp_preselect_list $relative_path
}
}
}
form create file_list_form -action [ad_decode $file_type adp "version-i18n-process" "version-i18n-process-2"]
element create file_list_form version_id \
-datatype integer \
-widget hidden \
-value $version_id
element create file_list_form files \
-datatype text \
-widget checkbox \
-label "ADP Templates" \
-options $file_option_list \
-values $adp_preselect_list
set action_label "Action to take on files"
if { [string equal $file_type 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 \
-datatype text \
-widget inform \
-label $action_label \
-value "Replace tags with keys and insert into catalog"
# We need to export the file action
element create file_list_form file_action \
-datatype text \
-widget hidden \
-value replace_tags
}
if { $pre_select_files_p } {
set pre_select_filter "<a href=\"version-i18n?[export_vars -url -override {{pre_select_files_p 0}} {version_id file_type show_status_p only_text_p}]\">Unselect all checkboxes</a>"
} else {
set pre_select_filter "<a href=\"version-i18n?[export_vars -url -override {{pre_select_files_p 1}} {version_id file_type show_status_p only_text_p}]\">Select all checkboxes</a>"
}
if { $show_status_p } {
set status_filter "<a href=\"version-i18n?[export_vars -url -override {{show_status_p 0}} {version_id file_type pre_select_files_p only_text_p}]\">Hide I18N status of files</a>"
} else {
set status_filter "<a href=\"version-i18n?[export_vars -url -override {{show_status_p 1}} {version_id file_type pre_select_files_p only_text_p}]\">Show I18N status of files</a>"
}
switch -- $file_type {
adp {
if { $only_text_p } {
set text_only_filter "<a href=\"version-i18n?[export_vars -url -override {{only_text_p 0}} {pre_select_files_p version_id file_type show_status_p}]\">all adp files</a> | only adp files with translatable text"
} else {
set text_only_filter "<b>all adp files</b> | <a href=\"version-i18n?[export_vars -url -override {{only_text_p 1}} {pre_select_files_p version_id file_type show_status_p}]\">only apd files with translatable text</a>"
}
set file_type_filter "<b>Show adp files</b>: $text_only_filter | <a href=\"version-i18n?[export_vars -url -override {{file_type tcl}} {version_id pre_select_files_p show_status_p only_text_p}]\">Show tcl files</a> | <a href=\"version-i18n?[export_vars -url -override {{file_type sql}} {version_id pre_select_files_p show_status_p only_text_p}]\">Show sql files</a>"
}
tcl {
set file_type_filter "<a href=\"version-i18n?[export_vars -url -override {{file_type adp}} {version_id pre_select_files_p show_status_p only_text_p}]\">Show adp files</a> | <b>Show tcl files</b> | <a href=\"version-i18n?[export_vars -url -override {{file_type sql}} {version_id pre_select_files_p show_status_p only_text_p}]\">Show sql files</a>"
}
sql {
set file_type_filter "<a href=\"version-i18n?[export_vars -url -override {{file_type adp}} {version_id pre_select_files_p show_status_p only_text_p}]\">Show adp files</a> | <a href=\"version-i18n?[export_vars -url -override {{file_type tcl}} {version_id pre_select_files_p show_status_p only_text_p}]\">Show tcl files</a> | <b>Show sql files</b>"
}
}
ad_return_template
ad_page_contract {
Display the values of all parameters associated with a versionList all the files in a particular version of a package.
@param version_id The package to be processed.
@author kevin@caltech.edu
@creation-date 17 May 2000
@cvs-id $Id$
} {
{ 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
}
doc_body_append [apm_header [list "version-view?version_id=$version_id" "$package_name $version_name"] "Parameter Values"]
doc_body_append "
<table>
"
set first_iteration 1
db_foreach apm_all_elements {
select element_id, element_name, description
from ad_parameter_elements
where version_id = :version_id
order by element_name
} {
if $first_iteration {
doc_body_append "
<tr>
<th>Parameter</th>
<th>Description</th>
<th>Value</th>
</tr>
"
}
set first_iteration 0
doc_body_append "
<tr>
<td valign=top><a href=parameter-value?element_id=$element_id>[ns_quotehtml $element_name]</a></td>
<td valign=top>$description</td>
<td valign=top>"
doc_body_append [join [map ns_quotehtml [db_list apm_value {
select value from ad_parameter_values where element_id = :element_id
}]] "<br>"]
doc_body_append "</td>
</tr>
"
}
doc_body_append "
</table>
[ad_footer]"
<?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
</querytext>
</fullquery>
<fullquery name="apm_all_elements">
<querytext>
select element_id, element_name, description
from ad_parameter_elements
where version_id = :version_id
order by element_name
</querytext>
</fullquery>
<fullquery name="apm_value">
<querytext>
select value from ad_parameter_values where element_id = :element_id
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="parameter_table">
<querytext>
select parameter_name, nvl(description, 'No Description') description, datatype,
default_value, parameter_id, nvl(section_name, 'No Section') section_name
from apm_parameters
where package_key = :package_key
$sql_clauses
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="parameter_table">
<querytext>
select parameter_name, coalesce(description, 'No Description') as description, datatype,
default_value, parameter_id, coalesce(section_name, 'No Section') as section_name
from apm_parameters
where package_key = :package_key
$sql_clauses
</querytext>
</fullquery>
</queryset>
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
@body;noquote@
ad_page_contract {
List all the files in a particular version of a package.
@param version_id The package to be processed.
@author tnight@arsdigita.com
@author Bryan Quinn (bquinn@arsdigita.com)
@creation-date 12 September 2000
@cvs-id $Id$
} {
{orderby ""}
{version_id:integer}
{section_name ""}
}
db_1row apm_package_by_version_id {
select pretty_name, version_name, package_key
from apm_package_version_info
where version_id = :version_id
}
set dimensional_list [apm_parameter_section_slider $package_key]
set table_def [list \
[list parameter_name "Parameter"] \
[list datatype "Type"] \
[list description "Description" {} {<td>[ad_quotehtml $description]</td>}]]
#DRB: sql_clauses must not contain RDBMS-specific query clauses.
set sql_clauses ""
if { [exists_and_not_null dimensional_list] } {
lappend table_def [list section_name "Section:"]
append sql_clauses [ad_dimensional_sql $dimensional_list]
}
lappend table_def [list parameter_id "Actions" no_sort \
{<td>\[<font size=-1>
<a href=parameter-delete?[export_url_vars parameter_id version_id section_name]>delete</a> |
<a href=parameter-edit?[export_url_vars version_id parameter_id]>edit</a></font>\]
</td>}]
append sql_clauses [ad_order_by_from_sort_spec $orderby $table_def]
set page_title "Parameters"
set context [list [list "." "Package Manager"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] $page_title]
append body "
<blockquote>
"
if { ![empty_string_p $dimensional_list] } {
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]] } {
set section_name [lindex $section 1]
break
}
}
append body "[ad_table -Torderby $orderby \
-bind [ad_tcl_vars_to_ns_set version_id package_key] \
-Textra_vars {version_id} \
-Tmissing_text "No parameters registered in this section." \
parameter_table "" $table_def]
<br><a href=parameter-add?[export_url_vars version_id section_name]>Add a new parameter</a>
</blockquote>
"
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_package_by_version_id">
<querytext>
select pretty_name, version_name, package_key
from apm_package_version_info
where version_id = :version_id
</querytext>
</fullquery>
</queryset>
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
@body;noquote@
ad_page_contract {
Marks all changed -procs.tcl files in a version for reloading.
@param version_id The package to be processed.
@author Jon Salz [jsalz@arsdigita.com]
@creation-date 9 May 2000
@cvs-id $Id$
} {
{version_id:integer}
{return_url "index"}
}
apm_version_info $version_id
set page_title "Reload $pretty_name"
set context [list [list "../developer" "Developer's Administration"] [list "/acs-admin/apm/" "Package Manager"] [list [export_vars -base version-view { version_id }] "$pretty_name $version_name"] $page_title]
# files in $files.
apm_mark_version_for_reload $version_id files
set files_to_watch [list]
if { [llength $files] == 0 } {
append body "There are no changed files to reload in this package.<p>"
} else {
append body "Marked the following file[ad_decode [llength $files] 1 "" "s"] for reloading:<ul>\n"
foreach file $files {
append body "<li>$file"
if { [nsv_exists apm_reload_watch $file] } {
append body " (currently being watched)"
} else {
# This file isn't being watched right now - provide a link setting a watch on it.
set files_to_watch_p 1
# Remove the two first elements of the path, namely packages/package-key/
set local_path [eval [concat file join [lrange [file split $file] 2 end]]]
append body " (<a href=\"file-watch?[export_vars { version_id { paths $local_path } }]\">watch this file</a>)"
lappend files_to_watch $local_path
}
append body "\n"
}
append body "</ul>\n"
}
if { [info exists files_to_watch_p] } {
append body "If you know you're going to be modifying one of the above files frequently,
select the \"watch this file\" link next to a filename to cause the interpreters to
reload the file immediately whenever it is changed.<p>
<ul class=\"action-links\">
<li><a href=\"file-watch?[export_vars { version_id { paths:multiple $files_to_watch } }]\">Watch all above files</a></li>"
} else {
append body "<ul class=\"action-links\">"
}
append body "
<li><a href=\"$return_url\">Return</a></li>
</ul>"
ad_page_contract {
Tag each file in a package as part of a particular package version.
@param version_id The package to be processed.
@author ron@arsdigita.com
@creation-date 9 May 2000
@cvs-id $Id$
} {
{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
}
if { $installed_p == "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
}]
if { [llength $files] == 0 } {
ad_return_complaint 1 "<li>No files in this packages"
return
}
# Create a legal CVS tag to mark the files by substituting -'s for all
# of the .'s in the version_name. The other rules for a legal version
# name are compatible with CVS.
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"]
<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
this operation as often as you want, to tag new files for example.
<p>Here goes:
<blockquote>
<pre>
"
# Check for the existence of CVS/Root as a basic check that each file is
# under version control. No error handling yet.
set bad_file_count 0
set files_to_add [list]
set files_to_commit [list]
foreach path $files {
global vc_file_props
vc_parse_cvs_status [apm_fetch_cached_vc_status "packages/$package_key/$path"]
switch $vc_file_props(status) {
"Up-to-date" {
set full_path [acs_package_root_dir $package_key]/$path
exec $cvs tag -F $version_tag $full_path
set status "T $path"
}
"Locally Modified" {
incr bad_file_count
lappend files_to_commit $path
set status "M $path (Locally Modified)"
}
default {
incr bad_file_count
lappend files_to_add $path
set status "I $path (No CVS Information)"
}
}
doc_body_append "$status\n"
doc_body_flush
}
doc_body_append "
</pre>
</blockquote>
"
# Update the versions table to indicate whether or not this version
# was successfully tagged.
if {$bad_file_count} {
doc_body_append "<p> Some of your files could not be tagged."
if { [llength $files_to_commit] } {
doc_body_append "
<p> The following have local modifications that have not yet been committed.
To commit them use:
<blockquote><pre>cd [acs_package_root_dir $package_key]\n"
apm_write_shell_wrap [concat [list cvs commit] $files_to_commit]
doc_body_append "</pre></blockquote>"
}
if { [llength $files_to_add] } {
doc_body_append "
<p>The following have not been added to the CVS repository. To add them use:
<blockquote><pre>ad [acs_package_root_dir $package_key]\n"
apm_write_shell_wrap [concat [list cvs add] $files_to_add]
doc_body_append "</pre></blockquote>"
}
doc_body_append "<p> After correcting the above problems you can reload
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
}
} 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
}
}
doc_body_append "
<p>
<a href=version-files?version_id=$version_id>Return to the Package Manager.</a>
[ad_footer]
"
<?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
</querytext>
</fullquery>
<fullquery name="apm_all_paths">
<querytext>
select path from apm_package_files where version_id = :version_id order by path
</querytext>
</fullquery>
<fullquery name="apm_all_files_untag">
<querytext>
update apm_package_versions
set tagged_p = 'f'
where version_id = :version_id
</querytext>
</fullquery>
<fullquery name="apm_all_files_tag">
<querytext>
update apm_package_versions
set tagged_p = 't'
where version_id = :version_id
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Upgrades an older version of a package to one that a newer version that is locally
maintained.
@author Bryan Quinn (bquinn@arsdigita.com)
@creation-date Thu Oct 12 17:45:38 2000
@cvs-id $Id$
} {
version_id
}
apm_version_info $version_id
# Disable all previous versions of this packae.
apm_version_upgrade $version_id
# Instruct user to run SQL upgrade scripts.
doc_body_append "[apm_header "Upgrading to $pretty_name $version_name"]
<p>
$pretty_name $version_name has been enabled. Please run any necessary
SQL upgrade scripts to finish updating the data model and restart
the server.
[ad_footer]
"
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="apm_enabled_version_info">
<querytext>
select version_id as installed_version_id, version_name as installed_version_name,
enabled_p as installed_enabled_p,
apm_package_version.version_name_greater(version_name, :version_name) as version_name_greater
from apm_package_versions
where package_key = :package_key
and installed_p = 't'
and rownum = 1
</querytext>
</fullquery>
<fullquery name="apm_data_model_install_version">
<querytext>
select data_model_installed_version from (
select version_name as data_model_installed_version
from apm_package_versions
where package_key = :package_key
and data_model_loaded_p = 't'
order by apm_package_version.sortable_version_name(version_name) desc
)
where rownum = 1
</querytext>
</fullquery>
</queryset>
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="apm_enabled_version_info">
<querytext>
select version_id as installed_version_id, version_name as installed_version_name,
enabled_p as installed_enabled_p,
apm_package_version__version_name_greater(version_name, :version_name) as version_name_greater
from apm_package_versions
where package_key = :package_key
and installed_p = 't'
limit 1
</querytext>
</fullquery>
<fullquery name="apm_data_model_install_version">
<querytext>
select data_model_installed_version from (
select version_name as data_model_installed_version
from apm_package_versions
where package_key = :package_key
and data_model_loaded_p = 't'
order by apm_package_version__sortable_version_name(version_name) desc
) as bad_postgres_needs_this
limit 1
</querytext>
</fullquery>
</queryset>
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
@body;noquote@
ad_page_contract {
Views information about a package.
@author Jon Salz (jsalz@arsdigita.com)
@creation-date 17 April 2000
@cvs-id $Id$
} {
{version_id:integer}
}
db_1row apm_all_version_info {}
set downloaded_p [ad_decode $version_uri "" 0 1]
# Obtain information about the enabled version of the package (if there is one).
# We use rownum = 1 in case someone mucks up the database and leaves two package versions
# installed and enabled.
db_0or1row apm_enabled_version_info {
select version_id as installed_version_id, version_name as installed_version_name,
enabled_p as installed_enabled_p,
apm_package_version.version_name_greater(version_name, :version_name) as version_name_greater
from apm_package_versions
where package_key = :package_key
and installed_p = 't'
and rownum = 1
}
db_0or1row apm_data_model_install_version {
select data_model_installed_version from (
select version_name as data_model_installed_version
from apm_package_versions
where package_key = :package_key
and data_model_loaded_p = 't'
order by apm_package_version.sortable_version_name(version_name) desc
)
where rownum = 1
}
if { [empty_string_p $vendor] } {
set vendor $vendor_uri
}
foreach field { summary description release_date vendor } {
if { [empty_string_p [set $field]] } {
set $field "-"
}
}
# Later we'll output any items in "prompts" as entries in a bullet list at the
# top of the page (these are things that the administrator probably needs to
# address ASAP).
set prompts [list]
if { ![info exists installed_version_id] } {
if { !$downloaded_p } {
set status "No version of this package is installed: there is no <tt>.info</tt> file in the
<tt>packages/$package_key</tt> directory. If you're building the package now, you probably
want to <a href=\"version-generate-info?version_id=$version_id&write_p=1\">generate one</a>."
} else {
set status "No version of this package is installed. You may <a href=\"version-install\?version_id=$version_id\">install this package now</a>."
}
lappend prompts $status
} elseif { $installed_version_id == $version_id } {
set status "This version of the package is installed"
if { $enabled_p == "t" } {
append status " and enabled."
set can_disable_p 1
} else {
append status " but disabled."
set can_enable_p 1
}
} else {
set status "[ad_decode $version_name_greater -1 "An older" "A newer"] version of this package,
version $installed_version_name, is installed and [ad_decode $installed_enabled_p "t" "enabled" "disabled"]."
if { $version_name_greater < 0 } {
append body " You may <a href=\"version-upgrade?version_id=$version_id\">upgrade to this version now</a>."
}
}
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] } {
set data_model_status " The data model for version $data_model_installed_version of this package has been
loaded."
} else {
set data_model_status " The data model for this version of this package has been loaded."
}
if { [file isdirectory "[acs_package_root_dir $package_key]/CVS"] } {
set cvs_status "This package is under local CVS control."
} else {
set cvs_status "This package is not under CVS control."
}
# Obtain a list of owners, properly hyperlinked.
set owners [list]
db_foreach apm_all_owners {
select owner_uri, owner_name from apm_package_owners where version_id = :version_id
} {
if { [empty_string_p $owner_uri] } {
lappend owners $owner_name
} else {
lappend owners "$owner_name (<a href=\"$owner_uri\">$owner_uri</a>)"
}
}
if { [llength $owners] == 0 } {
lappend owners "-"
}
if { [llength $prompts] == 0 } {
set prompt_text ""
} else {
set prompt_text "<ul><li>[join $prompts "\n<li>"]</ul>"
}
db_release_unused_handles
set page_title "$pretty_name $version_name"
set context [list [list "../developer" "Developer's Administration"] [list "/acs-admin/apm/" "Package Manager"] $page_title]
append body "
$prompt_text
<h3>Package Information</h3>
<blockquote>
<table>
<tr valign=baseline><th align=left>Package Name:</th><td>$pretty_name</td></th></tr>
<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>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] } {
set supported_databases "none specified"
} else {
set supported_databases [join $supported_databases_list ", "]
}
append body "
<tr valign=baseline><th align=left>Database Support:</th><td>$supported_databases</td></th></tr>
"
append body "
<tr valign=baseline><th align=left>CVS:</th><td>$cvs_status</td></tr>
<tr valign=baseline><th align=left>[ad_decode [llength $owners] 1 "Owner" "Owners"]:</th><td>[join $owners "<br>"]</td></th></tr>
<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>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 } {
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] } {
append body "(generated on this system"
if { ![empty_string_p $distribution_date] } {
append body " on $distribution_date"
}
append body ")"
} else {
append body "(downloaded from $distribution_uri"
if { ![empty_string_p $distribution_date] } {
append body " on $distribution_date"
}
append body ")"
}
} else {
append body "None available"
if { $installed_p == "t" } {
append body " (<a href=\"version-generate-tarball?version_id=$version_id\">generate one now</a> from the filesystem)"
}
}
append body "
</td></tr>
</table>
"
append body "
</blockquote>
<ul>
<li><a href=\"version-edit?[export_vars { version_id }]\">Edit above information</a> (Also use this to create a new version)
</ul>
<h4>Manage</h4>
<ul>
<li><a href=\"version-files?[export_vars { version_id }]\">Files</a>
<li><a href=\"version-dependencies?[export_vars { version_id }]\">Dependencies and Provides</a>
<li><a href=\"version-parameters?[export_vars { version_id }]\">Parameters</a>
<li><a href=\"version-callbacks?[export_vars { version_id }]\">Tcl Callbacks (install, instantiate, mount)</a>
<li><a href=\"version-i18n-index?[export_vars { version_id }]\">Internationalization</a>
</ul>
<h4>Reload</h4>
<ul>
<li><a href=\"[export_vars -base version-reload { version_id {return_url [ad_return_url]}}]\">Reload this package</a>
<li><a href=\"[export_vars -base package-watch { package_key {return_url [ad_return_url]}}]\">Watch all files in package</a>
</ul>
<h4>XML .info package specification file</h4>
<ul>
<li><a href=\"version-generate-info?[export_vars { version_id }]\">Display an XML package specification file for this version</a>
"
if { ![info exists installed_version_id] || $installed_version_id == $version_id && \
[empty_string_p $distribution_uri] } {
# 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] } {
# 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"
}
append body "</ul><h4>Disable/Uninstall</h4><ul>"
if { [info exists can_disable_p] } {
append body "<p><li><a href=\"version-disable?[export_vars { version_id }]\">Disable this version of the package</a>\n"
}
if { [info exists can_enable_p] } {
append body "<p><li><a href=\"version-enable?[export_vars { version_id }]\">Enable this version of the package</a>\n"
}
append body "<p>"
if { $installed_p == "t" } {
append body "
<li><a href=\"package-delete?[export_vars { version_id }]\">Uninstall this package from your system.</a> (be very careful!)\n"
}
}
append body "
</ul>
"
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_all_version_info">
<querytext>
select version_id, package_key, package_uri, pretty_name, version_name, version_uri,
summary, description_format, description, singleton_p, initial_install_p,
to_char(release_date, 'Month DD, YYYY') as release_date , vendor, vendor_uri, auto_mount,
enabled_p, installed_p, tagged_p, imported_p, data_model_loaded_p,
to_char(activation_date, 'Month DD, YYYY') as activation_date,
tarball_length, distribution_uri,
to_char(deactivation_date, 'Month DD, YYYY') as deactivation_date,
to_char(distribution_date, 'Month DD, YYYY') as distribution_date
from apm_package_version_info
where version_id = :version_id
</querytext>
</fullquery>
<fullquery name="supported_databases">
<querytext>
select pretty_db_name
from apm_package_db_types
where exists (select 1
from apm_package_files
where version_id = :version_id
and db_type = db_type_key)
</querytext>
</fullquery>
<fullquery name="apm_all_owners">
<querytext>
select owner_uri, owner_name from apm_package_owners where version_id = :version_id
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Generates package specs for every enabled version.
@author Jon Salz (jsalz@arsdigita.com)
@creation-date 17 April 2000
@cvs-id $Id$
} {
}
ad_return_top_of_page "[apm_header "Generate Package Specifications"]
Regenerating all package specifications for locally maintained packages.
<ul>
"
db_foreach apm_get_all_packages {
select version_id, version_name, pretty_name, distribution_uri, v.package_key
from apm_package_versions v, apm_package_types t
where installed_p = 't'
and v.package_key = t.package_key
order by upper(pretty_name)
} {
if { [empty_string_p $distribution_uri] } {
ns_log Debug "Generating package specificaiton for $package_key"
ns_write "<li>$pretty_name $version_name... "
if { [catch {
apm_package_install_spec $version_id
} error] } {
ns_write "error: $error\n"
} else {
ns_write "done.\n"
}
} else {
ns_write "<li>$pretty_name $version_name was not generated locally.\n"
}
}
db_release_unused_handles
ns_write "</ul>
<a href=\"./\">Return to the Package Manager</a>
[ad_footer]"
<?xml version="1.0"?>
<queryset>
<fullquery name="apm_get_all_packages">
<querytext>
select version_id, version_name, pretty_name, distribution_uri, v.package_key
from apm_package_versions v, apm_package_types t
where installed_p = 't'
and v.package_key = t.package_key
order by upper(pretty_name)
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Script that deletes an authority.
@author Peter Marklund
@creation-date 2003-09-08
} {
authority_id:integer
}
# Cannot delete local authority
if { [string equal $authority_id [auth::authority::local]] } {
ad_return_error "Cannot delete local authority" "The system requires the local authority to operate."
}
if { [auth::can_admin_system_without_authority_p -authority_id $authority_id] } {
auth::authority::delete -authority_id $authority_id
ad_returnredirect "."
} else {
ad_return_error "Cannot delete authority" "Deleting this authority would mean that all site-wide administrator users are shut out from the system, meaning the system could no longer be adminstered."
}
<?xml version="1.0"?>
<queryset>
<rdbms><type>oracle</type><version>8.1.6</version></rdbms>
<fullquery name="select_batch_jobs">
<querytext>
select job_id,
to_char(job_start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time_ansi,
to_char(job_end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time_ansi,
snapshot_p,
(select count(e1.entry_id)
from auth_batch_job_entries e1
where e1.job_id = auth_batch_jobs.job_id) as num_actions,
(select count(e2.entry_id)
from auth_batch_job_entries e2
where e2.job_id = auth_batch_jobs.job_id
and e2.success_p = 'f') as num_problems,
interactive_p,
message,
round((nvl(job_end_time, sysdate) - job_start_time) * 24*60*60) as run_time_seconds
from auth_batch_jobs
where authority_id = :authority_id
order by start_time_ansi
</querytext>
</fullquery>
</queryset>
<master>
<property name="context">@context;noquote@</property>
<property name="title">@page_title;noquote@</property>
<property name="focus">parameters.@first_param_name;noquote@</property>
<if @has_parameters_p@>
<formtemplate id="parameters"></formtemplate>
</if>
<else>
The selected driver implementation has no parameters to configure.
</else>
ad_page_contract {
Set parameters for the service contract implementation of an authority
(for example authentication or password management).
@author Peter Marklund
} {
authority_id:integer
}
auth::authority::get -authority_id $authority_id -array authority
set page_title "Configure"
set authority_url [export_vars -base authority { authority_id }]
set context [list [list "." "Authentication"] [list $authority_url $authority(pretty_name)] $page_title]
# Get the implementation id and implementation pretty name
array set parameters [list]
array set parameter_values [list]
# Each element is a list of impl_ids which have this parameter
array set param_impls [list]
foreach element_name [auth::authority::get_sc_impl_columns] {
set name_column $element_name
regsub {^.*(_id)$} $element_name {_name} name_column
set impl_params [auth::driver::get_parameters -impl_id $authority($element_name)]
foreach { param_name dummy } $impl_params {
lappend param_impls($param_name) $authority($element_name)
}
array set parameters $impl_params
array set parameter_values [auth::driver::get_parameter_values \
-authority_id $authority_id \
-impl_id $authority($element_name)]
}
set has_parameters_p [expr [llength [array names parameters]] > 0]
set first_param_name ""
if { $has_parameters_p } {
# Set focus on first param name
set first_param_name [lindex [array names parameters] 0]
set form_widgets [list]
foreach parameter_name [array names parameters] {
lappend form_widgets [list ${parameter_name}:text,optional [list label $parameter_name] [list help_text $parameters($parameter_name)] {html {size 80}}]
}
set hidden_vars {authority_id}
ad_form -name parameters \
-cancel_url $authority_url \
-form $form_widgets \
-export $hidden_vars \
-on_request {
foreach parameter_name [array names parameter_values] {
set $parameter_name $parameter_values($parameter_name)
}
} -on_submit {
foreach element_name [template::form::get_elements -no_api parameters] {
# Make sure we have a parameter element
if { [info exists param_impls($element_name)] } {
foreach impl_id $param_impls($element_name) {
auth::driver::set_parameter_value \
-authority_id $authority_id \
-impl_id $impl_id \
-parameter $element_name \
-value [element get_value parameters $element_name]
}
}
}
ad_returnredirect $authority_url
ad_script_abort
}
}
<?xml version="1.0"?>
<queryset>
<rdbms><type>postgresql</type><version>7.1</version></rdbms>
<fullquery name="select_batch_jobs">
<querytext>
select job_id,
to_char(job_start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time_ansi,
to_char(job_end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time_ansi,
snapshot_p,
(select count(e1.entry_id)
from auth_batch_job_entries e1
where e1.job_id = auth_batch_jobs.job_id) as num_actions,
(select count(e2.entry_id)
from auth_batch_job_entries e2
where e2.job_id = auth_batch_jobs.job_id
and e2.success_p = 'f') as num_problems,
interactive_p,
message,
trunc(extract(epoch from (coalesce(job_end_time, current_timestamp) - job_start_time))) as run_time_seconds
from auth_batch_jobs
where authority_id = :authority_id
order by start_time_ansi
</querytext>
</fullquery>
</queryset>
ad_page_contract {
Select a certain authority to be used to register
users.
@author Peter Marklund
} {
authority_id:integer
}
# 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)] } {
ad_return_error "No register driver" "The authority $authority(pretty_name) does not have a register driver and cannot register users"
}
parameter::set_value -package_id [apm_package_id_from_key acs-authentication] -parameter RegisterAuthority -value $authority(short_name)
ad_returnredirect [export_vars -base "." { authority_id }]
\ No newline at end of file
ad_page_contract {
Toggles enabled_p of authority
@author Simon Carstensen (simon@collaboraid.biz)
@creation-date 2003-09-09
} {
authority_id
enabled_p:boolean
}
# 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]} {
set allowed_p 0
}
if { $allowed_p } {
db_dml set_enabled_p { update auth_authorities set enabled_p = :enabled_p where authority_id = :authority_id }
ad_returnredirect .
ad_script_abort
} else {
ad_return_error "Cannot disable authority" "Disabling this authority would mean that all site-wide administrator users are shut out from the system, meaning the system could no longer be adminstered."
}
ad_page_contract {
Move authorities up/down to control sort order
@author Simon Carstensen (simon@collaboraid.biz)
@creation-date 2003-09-09
@cvs-id $Id$
} {
authority_id:integer
direction
}
# Get the authority's sort_order
db_1row select_sort_order {
select sort_order
from auth_authorities
where authority_id = :authority_id
}
if { $direction == "up" } {
db_transaction {
# Increase next authority's sort_order by one
db_dml move_next_authority_down {
update auth_authorities
set sort_order = :sort_order
where sort_order = (select max(sort_order)
from auth_authorities
where sort_order < :sort_order)
}
# Decrease authority's sort_order by one
db_dml move_authority_up {
update auth_authorities
set sort_order = :sort_order - 1
where authority_id = :authority_id
}
}
} elseif { $direction == "down"} {
db_transaction {
# Decrease previous authority's sort_order by one
db_dml move_prev_authority_up {
update auth_authorities
set sort_order = :sort_order
where sort_order = (select min(sort_order)
from auth_authorities
where sort_order > :sort_order)
}
# Increase authority's sort_order by one
db_dml move_authority_down {
update auth_authorities
set sort_order = :sort_order + 1
where authority_id = :authority_id;
}
}
}
ad_returnredirect .
ad_script_abort
<master>
<property name="context">@context;noquote@</property>
<property name="title">@page_title;noquote@</property>
<property name="focus">authority.pretty_name</property>
<if @configure_url@ not nil>
<p>
<b>&raquo;</b> <a href="@configure_url@">Configure drivers for this authority</a>
</p>
</if>
<formtemplate id="authority"></formtemplate>
<if @configure_url@ not nil>
<p>
<b>&raquo;</b> <a href="@configure_url@">Configure drivers for this authority</a>
</p>
</if>
<p>
<b>&raquo;</b> <a href="@show_users_url@">Show users in this authority</a> (@num_users@ users)
</p>
<if @display_batch_history_p@ true>
<h2>Batch Jobs</h2>
<if @batch_sync_run_url@ not nil>
<p>
<b>&raquo;</b> <a href="@batch_sync_run_url@" onclick="return confirm('Are you sure you want to run a batch job to sync the user database now?');">Run new batch job now</a>
</p>
</if>
<p><listtemplate name="batch_jobs"></listtemplate></p>
</if>
This diff is collapsed.
<master>
<property name="context">@context;noquote@</property>
<property name="title">@page_title;noquote@</property>
<formtemplate id="batch_action_form"></formtemplate>
ad_page_contract {
Display all information about a certain batch import operation.
@author Peter marklund (peter@collaboraid.biz)
@creation-date 2003-09-10
} {
entry_id:integer
}
auth::sync::job::get_entry -entry_id $entry_id -array batch_action
auth::sync::job::get -job_id $batch_action(job_id) -array batch_job
set page_title "One batch action"
set context [list [list "." "Authentication"] \
[list [export_vars -base authority { {authority_id $batch_action(authority_id)} }] \
"$batch_job(authority_pretty_name)"] \
[list [export_vars -base batch-job {{job_id $batch_action(job_id)}}] "One batch job"] \
$page_title]
ad_form -name batch_action_form \
-mode display \
-display_buttons {} \
-form {
{entry_time:text(inform)
{label "Timestamp"}
}
{operation:text(inform)
{label "Action type"}
}
{username:text(inform)
{label "Username"}
}
{user_id:text(inform)
{label "User"}
}
{success_p:text(inform)
{label "Success"}
}
{message:text(inform)
{label "Message"}
}
{element_messages:text(inform)
{label "Element messages"}
}
} -on_request {
foreach element_name [array names batch_action] {
# 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)] } {
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)] } {
array set messages_array $batch_action($element_name)
append $element_name "<ul>"
foreach message_name [array names messages_array] {
append $element_name "<li>$message_name - $messages_array($message_name)</li>"
}
append $element_name "</ul>"
} else {
set $element_name $batch_action($element_name)
}
}
}
ad_page_contract {
Download a whole batch xml document.
@author Peter Marklund
} {
job_id:integer
}
set document [db_string select_document {
select document
from auth_batch_jobs
where job_id = :job_id
}]
ns_return 200 text/plain $document
<master>
<property name="context">@context;noquote@</property>
<property name="title">@page_title;noquote@</property>
<p> Batch sync completed. </p>
<p>
<b>&raquo;</b> <a href="@job_url@">View job results</a>
</p>
ad_page_contract {
Manually runs a batch synchronization.
@author Peter Marklund
@creation-date 2003-09-11
} {
authority_id:integer
}
auth::authority::get -authority_id $authority_id -array authority
set page_title "Run batch job"
set authority_page_url [export_vars -base authority { {authority_id $authority(authority_id)} }]
set context [list [list "." "Authentication"] [list $authority_page_url "$authority(pretty_name)"] $page_title]
set job_id [auth::authority::batch_sync -authority_id $authority_id]
set job_url [export_vars -base batch-job { job_id }]
<master>
<property name="context">@context;noquote@</property>
<property name="title">@page_title;noquote@</property>
<p>
<formtemplate id="batch_job_form"></formtemplate>
</p>
<p>
<listfilters name="batch_actions" style="inline-filters"></listfilters>
</p>
<p>
<listtemplate name="batch_actions"></listtemplate>
</p>
ad_page_contract {
Page displaying info about a single batch job.
@author Peter Marklund
@creation-date 2003-09-09
} {
job_id
page:optional
success_p:boolean,optional
}
auth::sync::job::get -job_id $job_id -array batch_job
set page_title "One batch job"
set context [list \
[list "." "Authentication"] \
[list [export_vars -base authority { {authority_id $batch_job(authority_id)} }] "$batch_job(authority_pretty_name)"] $page_title]
ad_form \
-name batch_job_form \
-mode display \
-display_buttons {} \
-form {
{authority_pretty_name:text(inform)
{label "Authority name"}
}
{job_start_time:text(inform)
{label "Start time"}
}
{job_end_time:text(inform)
{label "End time"}
}
{run_time_seconds:text(inform)
{label "Running time"}
{after_html " seconds"}
}
{interactive_p:text(inform)
{label "Interactive"}
}
{snapshot_p:text(inform)
{label "Snapshot"}
}
{message:text(inform)
{label "Message"}
}
{creation_user:text(inform)
{label "Creation user"}
}
{doc_start_time:text(inform)
{label "Document start time"}
}
{doc_end_time:text(inform)
{label "Document end time"}
}
{doc_status:text(inform)
{label "Document status"}
}
{doc_message:text(inform)
{label "Document message"}
}
{document_download:text(inform)
{label "Document"}
}
{num_actions:text(inform)
{label "Number of actions"}
}
{num_problems:text(inform)
{label "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)] } {
set $element_name [acs_community_member_link -user_id $batch_job($element_name)]
} else {
set $element_name [ad_quotehtml $batch_job($element_name)]
}
}
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>"
}
list::create \
-name batch_actions \
-multirow batch_actions \
-key entry_id \
-page_size 100 \
-page_query_name pagination \
-elements {
entry_time_pretty {
label "Timestamp"
link_url_eval {$entry_url}
link_html { title "View log entry" }
}
operation {
label "Operation"
}
username {
label "Username"
link_url_col user_url
}
success_p {
label "Success"
display_template {
<if @batch_actions.success_p@ eq "t">
<font color="green">Yes</font>
</if>
<else>
<font color="red">No</font>
</else>
}
}
short_message {
label "Message"
}
} -filters {
job_id {
hide_p 1
}
success_p {
label "Success"
values {
{ Success t }
{ Failure f }
}
where_clause {
success_p = :success_p
}
default_value f
}
}
db_multirow -extend { entry_url short_message entry_time_pretty user_url } batch_actions select_batch_actions "
select entry_id,
to_char(entry_time, 'YYYY-MM-DD HH24:MI:SS') as entry_time_ansi,
operation,
username,
user_id,
success_p,
message,
element_messages,
(select count(*) from users u2 where u2.user_id = user_id) as user_exists_p
from auth_batch_job_entries
where [template::list::page_where_clause -name batch_actions]
[template::list::filter_where_clauses -and -name batch_actions]
order by entry_id
" {
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] } {
set short_message $message
} elseif { [llength $element_messages] == 2 } {
# Only one element message - use it
set short_message $element_messages
} elseif { [llength $element_messages] > 0 } {
# Several element messages
set short_message "Problems with elements"
} else {
set short_message ""
}
set short_message [string_truncate -len 75 -- $short_message]
if { $user_exists_p && ![empty_string_p $user_id] } {
set user_url [acs_community_member_admin_url -user_id $user_id]
} else {
set user_url {}
}
set entry_time_pretty [lc_time_fmt $entry_time_ansi "%x %X"]
}
<?xml version="1.0"?>
<queryset>
<fullquery name="pagination">
<querytext>
select entry_id
from auth_batch_job_entries
where job_id = :job_id
[template::list::filter_where_clauses -and -name batch_actions]
order by entry_id
</querytext>
</fullquery>
</queryset>
<master>
<property name="context">@context;noquote@</property>
<property name="title">@page_title;noquote@</property>
<h2>Authorities</h2>
<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>
<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.
</p>
ad_page_contract {
Index page for External Authentication listing
available authorities.
@author Peter Marklund
@creation-date 2003-09-08
}
set page_title "Authentication"
set context [list $page_title]
list::create \
-name "authorities" \
-multirow "authorities" \
-key authority_id \
-elements {
edit {
label ""
display_template {
<img src="/shared/images/Edit16.gif" height="16" width="16" alt="Edit" 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"
link_url_eval {[export_vars -base authority { authority_id }]}
}
enabled {
label "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>
</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>
</else>
}
}
move {
label "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>
</if>
<else><img src="/resources/acs-subsite/spacer.gif" width="15" height="15"></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>
</if>
<else><img src="/resources/acs-subsite/spacer.gif" width="15" height="15"></else>
}
}
registration {
label "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">
</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;">
</a>
</case>
<case value="cannot_select">
<span style="color: gray;">N/A</span>
</case>
</switch>
}
}
auth_impl {
label "Authentication"
}
pwd_impl {
label "Password"
}
reg_impl {
label "Registration"
}
delete {
label ""
display_template {
<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">
</a>
</if>
}
sub_class narrow
}
}
# The authority currently selected for registering users
set register_authority_id [auth::get_register_authority]
db_multirow -extend {
enabled_p_url
sort_order_url_up
sort_order_url_down
delete_url
registration_url
registration_status
} authorities authorities_select {
select authority_id,
short_name,
pretty_name,
enabled_p,
sort_order,
(select max(sort_order) from auth_authorities) as lowest_sort_order,
(select min(sort_order) from auth_authorities) as highest_sort_order,
(select impl_pretty_name from acs_sc_impls where impl_id = auth_impl_id) as auth_impl,
(select impl_pretty_name from acs_sc_impls where impl_id = pwd_impl_id) as pwd_impl,
(select impl_pretty_name from acs_sc_impls where impl_id = register_impl_id) as reg_impl
from auth_authorities
order by sort_order
} {
set toggle_enabled_p [ad_decode $enabled_p "t" "f" "t"]
set enabled_p_url "authority-set-enabled-p?[export_vars { authority_id {enabled_p $toggle_enabled_p} }]"
set delete_url [export_vars -base authority-delete { authority_id }]
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] } {
# The authority is selected as register authority
set registration_status "selected"
} elseif { ![empty_string_p $reg_impl] } {
# The authority can be selected as register authority
set registration_status "can_select"
set registration_url [export_vars -base authority-registration-select { authority_id }]
} else {
# This authority has no account creation driver
set registration_status "cannot_select"
}
}
set auth_package_id [apm_package_id_from_key "acs-authentication"]
set parameter_url [export_vars -base /shared/parameters { { package_id $auth_package_id } { return_url [ad_return_url] } }]
ad_page_contract {
Flush one or more values from util_memoize's cache
} {
suffix
{return_url "."}
}
if [string equal $suffix "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
ad_page_contract {
Flush one or more values from util_memoize's cache
} {
type
pattern
raw_date
key:allhtml
{return_url "show-util-memoize?pattern=$pattern"}
}
if {[catch {set pair [ns_cache get util_memoize $key]} errmsg]} {
# backup plan, find it again because the key doesn't always
# pass through cleanly
set cached_names [ns_cache names util_memoize]
foreach name $cached_names {
if {[regexp -nocase -- $pattern $name match]} {
set pair [ns_cache get util_memoize $name]
set raw_time [lindex $pair 0]
if {$raw_time == $raw_date} {
set value [ad_quotehtml [lindex $pair 1]]
set time [clock format $raw_time]
set key $name
break
}
}
}
if {![info exists value] || [string equal "" $value]} {
ad_return_complaint 1 "Could not retrieve"
}
}
ns_cache flush util_memoize $key
ad_returnredirect $return_url
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<h4>util_memoize caches</h4>
<blockquote>
<table cellpadding=3>
<tr bgcolor="#eeeeee">
<th>Name</th>
<th>Entries</th>
<th>Flushed</th>
<th>Hit Rate</th>
<th>Size</th>
<th>Max Size</th>
<th>&nbsp;</th>
</tr>
<multiple name="caches">
<if @caches.rownum@ odd>
<tr bgcolor="#eef8f8">
</if>
<else>
<tr bgcolor="#f8f8ee">
</else>
<td><b>@caches.name@</b></td>
<td align=right>@caches.entries@</td>
<td align=right>@caches.flushed@</td>
<td align=right>@caches.hit_rate@%</td>
<td align=right>@caches.size@</td>
<td align=right>@caches.max@</td>
<td align=center>&nbsp;
<a href="flush-cache?suffix=@caches.name@">flush</a>&nbsp;
</td>
</tr>
</multiple>
</table>
<form action="show-util-memoize" method=get>
Show names that contain
<%
#<input name="pattern_type" type="radio" value="start">start with
#<input name="pattern_type" type="radio" value="contain">contain
%>
<input name="pattern" type="text" value="">
<input type="submit" value="Search">
</form>
<blockquote>
<font color="#994444">Notes:
<ul>
<li>This currently only searches the primary "util_memoize" cache
</ul>
</font>
</blockquote>
</blockquote>
ad_page_contract {
} {
}
set page_title "Cache Control"
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 {util_memoize_(.*)} $cache match suffix] \
|| [string equal $cache "util_memoize"]} {
if {![info exists suffix] || [string equal "" $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]]
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
}
set match ""
set suffix ""
}
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<form action="flush" method="post">
<input type="hidden" name="type" value="one">
<input type="hidden" name="pattern" value="@pattern@">
<input type="hidden" name="raw_date" value="@raw_date@">
<input type="hidden" name="key" value="@safe_key@">
Cached value at @time@.
<input type="submit" value="Flush">
</form>
<hr>
<b>Key:</b>
<blockquote>
<pre>@key;noquote@</pre>
</blockquote>
<hr>
<b>Value:</b>
<blockquote>
@value;noquote@
</blockquote>
ad_page_contract {
Show the contents of one cached entry
} {
key:allhtml
pattern
raw_date
}
set page_title "One Entry"
set context [list [list "../developer" "Developer's Administration"] [list "." "Cache Control"] $page_title]
if {[catch {set pair [ns_cache get util_memoize $key]} errmsg]} {
# backup plan, find it again because the key doesn't always
# pass through cleanly
set cached_names [ns_cache names util_memoize]
foreach name $cached_names {
if {[regexp -nocase -- $pattern $name match]} {
set pair [ns_cache get util_memoize $name]
set raw_time [lindex $pair 0]
if {$raw_time == $raw_date} {
set value [ad_quotehtml [lindex $pair 1]]
set time [clock format $raw_time]
set key $name
break
}
}
}
if {![info exists value] || [string equal "" $value]} {
set value "<i>could not retrieve</i>"
set time "?"
}
} else {
set value [ad_quotehtml [lindex $pair 1]]
set time [clock format [lindex $pair 0]]
}
set safe_key [ad_quotehtml $key]
regsub -all -nocase -- $pattern $key \
"<font color=\"#990000\"><b>$pattern</b></font>" key
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
Search for <b><code>@pattern@</code></b>:
<if @matches:rowcount@ not nil and @matches:rowcount@ gt 0>
@matches:rowcount@ matches found.<p></p>
<if @full@ eq "f">
Only the first 200 chars of key and value are shown.
<a href="show-util-memoize?full=t&pattern=@pattern@">View
full results.</a>
</if>
<else>
Full strings for key and value shown.
<a href="show-util-memoize?full=f&pattern=@pattern@">View
short results.</a>
</else>
<table border="0" cellpadding="5" cellspacing="1">
<tr bgcolor="#eeeeee">
<th>key</th>
<!--<th>time</th>
<th>value<br>size</th>-->
<th>value</th>
<th>&nbsp;</th>
</tr>
<multiple name="matches">
<if @matches.rownum@ odd>
<% set bg "#eef8f8" %>
</if>
<else>
<% set bg "#f8f8ee" %>
</else>
<tr bgcolor="@bg@">
<td valign=top>@matches.key@</td>
<td valign=top>@matches.value@</td>
<td valign=middle rowspan=2>
<form action=one method=post>
<input type=hidden name=key value="@matches.full_key@">
<input type=hidden name="raw_date" value="@matches.raw_date@">
<input type=hidden name=pattern value="@pattern@">
<input type=submit value="Show">
</form>
</td>
</tr>
<tr bgcolor="@bg@">
<td align="right" colspan="2">
<font color="#666666">
Cached @matches.date@ - @matches.value_size@ bytes
</font>
</td>
</tr>
</multiple>
</table>
<p><!--
<a href="flush?type=all&pattern=@pattern@">Flush all of these
from the cache</a>-->
</if>
<else>
<i>no matches found</i>
</else>
ad_page_contract {
Lists memoized data and gives options to view data or flush data
} {
{pattern_type "contain"}
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 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
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 util_memoize $name]} errmsg]} {
continue
}
set raw_date [lindex $pair 0]
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} {
template::multirow append matches $key $value $value_size \
$safe_key $date $raw_date
} else {
template::multirow append matches [string range $key 0 200] \
[string range $value 0 200] $value_size $safe_key \
$date $raw_date
}
}
}
<master>
<property name="title">@page_title;noquote@</property>
<property name="context">@context;noquote@</property>
<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>
<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>
</td>
</tr>
<tr>
<td>
<a href="@remote_install_url@">Install from Repository</a>
</td>
<td><a href="@local_install_url@">Install from Local</a></td>
</tr>
<tr>
<td>
<a href="@remote_upgrade_url@">Upgrade from Repository</a>
</td>
<td>
<a href="@local_upgrade_url@">Upgrade from Local</a>
</td>
</tr>
</table>
<h2>Installed Packages</h2>
<p><listfilters name="packages" style="inline-filters"></listfilters></p>
<p><listtemplate name="packages"></listtemplate></p>
ad_page_contract {
Package installation.
} {
package_type:optional
}
set page_title "Install Software"
set context [list $page_title]
template::list::create \
-name packages \
-multirow packages \
-elements {
pretty_name {
label "Package"
}
version_name {
label "Version"
}
package_type_pretty {
label "Type"
hide_p 1
}
} -filters {
package_type {
label "Type"
default_value apm_application
where_clause {
t.package_type = :package_type
}
values {
{Application apm_application}
{Service apm_service}
}
}
}
db_multirow -extend { package_type_pretty } packages packages "
select v.version_id,
v.package_key,
t.pretty_name,
t.package_type,
v.version_name
from apm_package_versions v,
apm_package_types t
where t.package_key = v.package_key
and v.enabled_p = 't'
and v.installed_p = 't'
[template::list::filter_where_clauses -and -name "packages"]
order by t.package_type, t.pretty_name
" {
set package_type_pretty [string totitle [lindex [split $package_type "_"] 1]]
}
set local_install_url [export_vars -base "install" { { package_type apm_application } }]
set local_service_install_url [export_vars -base "install" { { package_type apm_service } }]
set local_upgrade_url [export_vars -base "install" { { upgrade_p 1 } }]
set repository_url "http://openacs.org/repository/[apm_get_repository_channel]/"
set remote_install_url [export_vars -base "install" { repository_url { package_type apm_application } }]
set remote_service_install_url [export_vars -base "install" { { package_type apm_service } repository_url }]
set remote_upgrade_url [export_vars -base "install" { { upgrade_p 1 } repository_url }]
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.
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.
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.
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.
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.
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