Index: openacs-4/packages/acs-admin/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/index.adp,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/acs-admin/www/index.adp 18 Mar 2009 20:25:36 -0000 1.12
+++ openacs-4/packages/acs-admin/www/index.adp 3 Apr 2010 23:13:47 -0000 1.13
@@ -11,11 +11,7 @@
Site-Wide Package Administration
-
+
Index: openacs-4/packages/acs-admin/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/index.tcl,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/acs-admin/www/index.tcl 13 Apr 2009 23:10:27 -0000 1.13
+++ openacs-4/packages/acs-admin/www/index.tcl 3 Apr 2010 23:13:47 -0000 1.14
@@ -29,10 +29,39 @@
multirow sort subsites path_pretty
}
-db_multirow -extend { admin_url } packages installed_packages {} {
+db_multirow -extend { admin_url global_param_url } packages installed_packages {} {
if { [apm_package_installed_p $package_key] && [file exists "[acs_package_root_dir $package_key]/www/sitewide-admin/"] } {
set admin_url "package/$package_key/"
} else {
+ set admin_url ""
+ }
+ if { [db_string global_params_exist {}] != 0 } {
+ set global_param_url [export_vars -base /shared/parameters {package_key {scope global}}]
+ } else {
+ set global_param_url ""
+ }
+ if { $admin_url eq "" && $global_param_url eq "" } {
continue
}
}
+
+template::list::create \
+ -name packages \
+ -multirow packages \
+ -elements {
+ pretty_name {
+ label "Package"
+ }
+ admin_url {
+ label "Site-Wide Administration"
+ link_html { title "Site-wide Administration" }
+ link_url_col admin_url
+ display_template {#acs-admin.Administration#}
+ }
+ global_param_url {
+ label "Global Parameters"
+ link_html {title "Manage Global Parameters" }
+ link_url_col global_param_url
+ display_template {#acs-admin.Parameters#}
+ }
+ }
Index: openacs-4/packages/acs-admin/www/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/index.xql,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/acs-admin/www/index.xql 13 Apr 2009 23:10:27 -0000 1.4
+++ openacs-4/packages/acs-admin/www/index.xql 3 Apr 2010 23:13:47 -0000 1.5
@@ -18,4 +18,13 @@
+
+
+ select count(*)
+ from apm_parameters
+ where package_key = :package_key
+ and scope = 'global'
+
+
+
Index: openacs-4/packages/acs-subsite/tcl/subsite-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-callback-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/acs-subsite/tcl/subsite-callback-procs.tcl 10 Jan 2007 21:22:06 -0000 1.5
+++ openacs-4/packages/acs-subsite/tcl/subsite-callback-procs.tcl 3 Apr 2010 23:13:47 -0000 1.6
@@ -80,7 +80,7 @@
-parameter:required
-value:required
} {
- Callback for changing the value of a parameter.
+ Callback for changing the value of an instance parameter.
@param package_id The package_id of the package the parameter was changed for.
@param parameter The parameter value.
@@ -89,30 +89,20 @@
@see package::set_value
} -
-ad_proc -public -callback subsite::parameter_changed -impl subsite {
- -package_id:required
+ad_proc -public -callback subsite::global_parameter_changed {
+ -package_key:required
-parameter:required
-value:required
} {
- Implementation of subsite::parameter_changed for subsite itself. This proc will simply set the parameter
+ Callback for changing the value of a global parameter.
- @author Nima Mazloumi (nima.mazloumi@gmx.de)
- @creation-date 2005-08-17
+ @param package_key The package_key of the package the parameter was changed for.
+ @param parameter The parameter value.
+ @param value The new value.
- @param package_id the package_id of the package the parameter was changed for
- @param parameter the parameter name
- @param value the new value
-
@see package::set_value
-} {
- ns_log Debug "subsite::parameter_changed -impl subsite changing $parameter to $value"
+} -
- parameter::set_value \
- -package_id $package_id \
- -parameter $parameter \
- -value $value
-}
-
ad_proc -public -callback subsite::url {
-package_id:required
-object_id:required
Index: openacs-4/packages/acs-subsite/www/shared/parameters.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/parameters.tcl,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/acs-subsite/www/shared/parameters.tcl 4 Jan 2010 22:46:53 -0000 1.18
+++ openacs-4/packages/acs-subsite/www/shared/parameters.tcl 3 Apr 2010 23:13:47 -0000 1.19
@@ -5,37 +5,46 @@
@creation-date 2003-06-13
@cvs-id $Id$
} {
- {package_id {[ad_conn package_id]}}
- {return_url {[ad_conn url]}}
+ package_id:optional,naturalnum
+ package_key:optional
+ {scope "instance"}
+ {return_url:optional "[ad_conn url]?[ad_conn query]"}
{section ""}
}
-permission::require_permission -object_id $package_id -privilege admin
+if { $scope eq "global" } {
+ permission::require_permission \
+ -object_id [acs_lookup_magic_object security_context_root] \
+ -privilege admin
+ db_1row select_pretty_name {}
+ set package_url /acs-admin
+ set page_title "$instance_name Global Parameters"
+ set context [list [list $package_url "Site-Wide Administration"] $page_title]
+} else {
+ if { ![info exists package_id] } {
+ set package_id [ad_conn package_id]
+ }
+ permission::require_permission -object_id $package_id -privilege admin
-db_1row select_instance_name {
- select instance_name, package_key
- from apm_packages
- where package_id = :package_id
-}
+ db_1row select_instance_name {}
-set package_url [site_node::get_url_from_object_id -object_id $package_id]
+ set package_url [site_node::get_url_from_object_id -object_id $package_id]
+ set page_title "$instance_name Instance Parameters"
-set page_title "$instance_name Parameters"
-
-if { $package_url eq [subsite::get_element -element url] } {
- set context [list [list "${package_url}admin/" "Administration"] $page_title]
-} elseif { $package_url ne "" } {
+ if { $package_url eq [subsite::get_element -element url] } {
+ set context [list [list "${package_url}admin/" "Administration"] $page_title]
+ } elseif { $package_url ne "" } {
set context [list [list $package_url $instance_name] [list "${package_url}admin/" "Administration"] $page_title]
-} else {
- set context [list $page_title]
+ } else {
+ set context [list $page_title]
+ }
}
-
-ad_require_permission $package_id admin
-
ad_form -name parameters -export {section} -cancel_url $return_url -form {
- {return_url:text(hidden),optional}
+ {return_url:text(hidden)}
+ {scope:text(hidden)}
{package_id:integer(hidden),optional}
+ {package_key:text(hidden),optional}
}
set display_warning_p 0
@@ -50,21 +59,21 @@
array set sections {}
-db_foreach select_params {} {
+db_foreach select_${scope}_params {} {
if { $section_name eq "" } {
set section_name "main"
- set section_pretty "Main"
+ set section_pretty "Main"
} else {
set section_name [string map {- {_} " " {_}} $section_name]
set section_pretty [string map {_ { }} $section_name]
set section_pretty "[string toupper [string index $section_pretty 0]][string range $section_pretty 1 end]"
}
- if { ![info exists sections($section_name)] } {
- set sec [list "-section" $section_name {legendtext "$section_pretty"}]
- ad_form -extend -name parameters -form [list $sec]
- set sections($section_name) "$section_pretty"
- }
+ if { ![info exists sections($section_name)] } {
+ set sec [list "-section" $section_name {legendtext "$section_pretty"}]
+ ad_form -extend -name parameters -form [list $sec]
+ set sections($section_name) "$section_pretty"
+ }
if { $counter == 0 } {
set focus_elm $parameter_name
@@ -108,10 +117,26 @@
set $name $param($name)
}
} -on_submit {
- db_foreach select_params_set {} {
- if { [info exists $c__parameter_name]} {
- callback subsite::parameter_changed -package_id $package_id -parameter $c__parameter_name -value [set $c__parameter_name]
+ if { $scope eq "instance" } {
+ db_foreach select_instance_params_set {} {
+ if { [info exists $c__parameter_name] } {
+ parameter::set_value \
+ -package_id $package_id \
+ -parameter $c__parameter_name \
+ -value [set $c__parameter_name]
+ callback subsite::parameter_changed -package_id $package_id -parameter $c__parameter_name -value [set $c__parameter_name]
+ }
}
+ } else {
+ db_foreach select_global_params_set {} {
+ if { [info exists $c__parameter_name] } {
+ parameter::set_global_value \
+ -package_key $package_key \
+ -parameter $c__parameter_name \
+ -value [set $c__parameter_name]
+ callback subsite::global_parameter_changed -package_key $package_key -parameter $c__parameter_name -value [set $c__parameter_name]
+ }
+ }
}
} -after_submit {
ad_returnredirect $return_url
Index: openacs-4/packages/acs-subsite/www/shared/parameters.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/parameters.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/www/shared/parameters.xql 24 Feb 2010 01:20:15 -0000 1.2
+++ openacs-4/packages/acs-subsite/www/shared/parameters.xql 3 Apr 2010 23:13:47 -0000 1.3
@@ -2,13 +2,29 @@
+
+
+ select pretty_name as instance_name
+ from apm_package_types
+ where package_key = :package_key
+
+
+
+
+
+ select instance_name, package_key
+ from apm_packages
+ where package_id = :package_id
+
+
+
and section_name=:section
-
+
select p.parameter_name,
coalesce(p.description, 'No Description') as description,
@@ -21,23 +37,58 @@
where v.package_id = :package_id) v
on p.parameter_id = v.parameter_id
where p.package_key = :package_key
+ and p.scope = 'instance'
$section_where_clause
order by section_name, parameter_name
-
+
+ select p.parameter_name,
+ coalesce(p.description, 'No Description') as description,
+ v.attr_value,
+ coalesce(p.section_name, '') as section_name,
+ p.datatype
+ from apm_parameters p left outer join
+ (select v.parameter_id, v.attr_value
+ from apm_parameter_values v
+ where v.package_id is null) v
+ on p.parameter_id = v.parameter_id
+ where p.package_key = :package_key
+ and p.scope = 'global'
+ $section_where_clause
+ order by section_name, parameter_name
+
+
+
+
+
select p.parameter_name as c__parameter_name
from apm_parameters p left outer join
(select v.parameter_id, v.attr_value
from apm_parameter_values v
where v.package_id = :package_id) v
on p.parameter_id = v.parameter_id
where p.package_key = :package_key
+ and p.scope = 'instance'
$section_where_clause
+
+
+ select p.parameter_name as c__parameter_name
+ from apm_parameters p left outer join
+ (select v.parameter_id, v.attr_value
+ from apm_parameter_values v
+ where v.package_id is null) v
+ on p.parameter_id = v.parameter_id
+ where p.package_key = :package_key
+ and p.scope = 'global'
+ $section_where_clause
+
+
+