Forum OpenACS Q&A: Comfortable way of editing parameters?

Hi,

sorry, I seem to be completely ignorant, but I haven't found a way to edit parameters values (OpenACS 5.0 and 5.1). Did I miss something?
SAP has a nice hierarchical parameter editor. Did somebody try to write something similar? Or something like a bulk-upload facility?

Bests,
Frank

mailto:frank_dot_bergmann_at_project-open_dot_com
http://www.project-open.com/

Collapse
Posted by Lachlan Myers on
Not sure exactly what you are looking for, as I have no knowledge of SAP or what parameters you wish to set.

But OpenACS parameters are available under the admin page for installed packages, and sometimes instances of installed packages. I use the Site Manager to see a full list, and that also shows the parameter link wherever its available.

Bulk upload - There is a file storage package, but I haven't used it. I am familiar with the bulk upload in the photo album which sucks up a directory into the DB. It also has an option for zip/tar archive upload, but I haven't been able to get that working.

Collapse
Posted by Frank Bergmann on
Hi Lachlan,

<blockquote> I use the Site Manager
</blockquote>

thanks a lot for the reply. I just discovered /shared/parameters. It does more or less what I want, only that it's only for a single package.

So I've written a short TCL that gives me the list of all system parameter (one view), with the package_key as a link to /shared/parameters for editing. That's not a bulk upload, but already much more confortable when customizing an entire site. I don't know if somebody wants to put this into the CVS...

Bests,
Frank

---

# /packages/intranet-core/www/admin/parameters/index.tcl
ad_page_contract {
  Home page for parameter administration.
  @author mailto:frank.bergmann@project-open.com
} {
    { return_url {[ad_conn url]} }
}

set user_id [ad_maybe_redirect_for_registration]
set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id]

set page_title "Parameters"
set context_bar [ad_context_bar $page_title]
set context ""

set bgcolor(0) " class=rowodd"
set bgcolor(1) " class=roweven"

# ---------------------------------------------------------------
# Render Module List
# ---------------------------------------------------------------

set sql "
select
        p.package_id,
        p.package_key,
        p.instance_name,
        v.attr_value,
        m.parameter_name
from
        apm_packages p,
        apm_parameters m,
        apm_parameter_values v
where
        p.package_key = m.package_key(+)
        and m.parameter_id = v.parameter_id(+)
order by
        p.package_key
"

set old_package_key ""
set ctr 1
set package_html ""
db_foreach packages $sql {
#    if {![regexp {^intranet} $package_key]} { continue }

    if {![string equal $package_key $old_package_key]} {

        append package_html "
<tr class=rowplain colspan=99><td>&nbsp;</td></tr>
<tr class=roweven>
  <td colspan=2>
    <A HREF=/shared/parameters?[export_url_vars package_id return_url]>$package_key</A\
<blockquote></td>
</blockquote>
  <td>$instance_name</td>
</tr>\n"

        set old_package_key $package_key
        set ctr 0
    }

    if {"" == $parameter_name} { set parameter_name "<i>No parameters</i>" }
    append package_html "
<tr $bgcolor([expr $ctr % 2])>
  <td>&nbsp;&nbsp;&nbsp;</td>
  <td>$parameter_name</td>
  <td>$attr_value</td>
</tr>\n"

    incr ctr
}

set parameter_html "
<table border=0>
<!-- <tr>
  <td class=rowtitle>Package Key</td>
  <td class=rowtitle>Package Name</td>
</tr> -->
$package_html
</table>\n"

Collapse
Posted by Malte Sussdorff on
Frank, thanks a lot for posting this script.

To be put into CVS we would first have to port it to postgres but additionaly make it scale in subsites/multiple package instances (as you do not differentiate between singleton packages and others it is very hard to see where a parameter has been set). If you would be willing to continue down this road it would be very good. In the end it would belong to /acs-admin/parameters (in my opinion, feel free to object).

Collapse
Posted by Frank Bergmann on
Hi Malte, thanks for your "soft" reply. You can tell P/O isn't very integrated into the OpenACS processes...

Unfortunately I don't have a Postgres environment yet. That's something that will change around fall this year probably, so this script will take a few weeks still...

Bests,
Frank

mailto:frank_dot_bergmann_at_project-open_dot_com
http://www.project-open.com/