Forum OpenACS Q&A: Problems with resoure-list package

Collapse
Posted by Thomas Rathjen on
I run into serveral problems by testing the resource-list package.My system is openacs-5.0.2-final on aolserver4 with postgres-7.3.4.

When I try to add a resource type I get this error:

[17/Feb/2004:21:49:52][4327.114696][-conn:myserver::4] Error: GET .../resource-list/type-add-edit?
referred by ".../resource-list/types"

    while executing
"list"
    invoked from within
"subst {[list}"
    ("uplevel" body line 1)
    invoked from within
"uplevel [list subst [lindex $extra_arg 1]]"
    (procedure "ad_form" line 330)
    invoked from within
"ad_form -extend -name add_edit -form  [list  [list  categories:text(checkbox),multiple  {label "Auswahl: [set type_short_name]"}  {options [list $opti..."
    ("foreach" body line 10)
    invoked from within
"foreach type [db_list_of_lists get_resource_types { } ] {

    set category_type_id [lindex $type 0]
    set type_short_name  [lindex $type 1]

    se..."
    ("uplevel" body line 88)
    invoked from within
"uplevel {
          ad_page_contract {

    Simple add/edit form for resources

    @author mailto:jade@safe4all.org
    @creation-date 2003-08-27
    @cvs-id $..."
    (procedure "code::tcl::/var/lib/aolserver/myserver/packages/resource-list..." line 2)
    invoked from within
"code::tcl::$__adp_stub"
    invoked from within
"if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init tcl $__adp_stub
..."
    ("uplevel" body line 3)
    invoked from within
"uplevel {

    if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init t..."
    (procedure "adp_prepare" line 2)
    invoked from within
"adp_prepare "
    (procedure "template::adp_parse" line 30)
    invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
    (procedure "adp_parse_ad_conn_file" line 7)
    invoked from within
"$handler"
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
                $handler
            } ad_script_abort val {
                # do nothing
            }"
    invoked from within
"rp_serve_concrete_file [ad_conn file]"
    (procedure "rp_serve_abstract_file" line 60)
    invoked from within
"rp_serve_abstract_file "$root/$path""
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    rp_serve_abstract_file "$root/$path"
    set tcl_url2file([ad_conn url]) [ad_conn file]
    set tcl_url2path_info([ad_conn url]) [ad_conn path_inf..."

The second problem is the error on adding a recoure to the database. I get this error message:

[17/Feb/2004:22:15:02][4327.65541][-conn:com4biz::1] Error: GET .../resource-list/add-edit?
referred by ".../resource-list/"
Form "add_edit" already has a "select_query_name" section
    while executing
"ad_form -extend -name add_edit -select_query_name do_nothing -form $ae_def"
    ("foreach" body line 17)
    invoked from within
"foreach type [db_list_of_lists get_resource_types { }] {

    set category_type_id [lindex $type 0]
    set type_short_name  [lindex $type 1]

    ns_..."
    ("uplevel" body line 131)
    invoked from within
"uplevel {
          ad_page_contract {

    Simple add/edit form for resources

    @author mailto:jade@safe4all.org
    @creation-date 2003-08-27
    @cvs-id $..."
    (procedure "code::tcl::/var/lib/aolserver/com4biz/packages/resource-list..." line 2)
    invoked from within
"code::tcl::$__adp_stub"
    invoked from within
"if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init tcl $__adp_stub
..."
    ("uplevel" body line 3)
    invoked from within
"uplevel {

    if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init t..."
    (procedure "adp_prepare" line 2)
    invoked from within
"adp_prepare "
    (procedure "template::adp_parse" line 30)
    invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
    (procedure "adp_parse_ad_conn_file" line 7)
    invoked from within
"$handler"
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
                $handler
            } ad_script_abort val {
                # do nothing
            }"
    invoked from within
"rp_serve_concrete_file [ad_conn file]"
    (procedure "rp_serve_abstract_file" line 60)
    invoked from within
"rp_serve_abstract_file "$root/$path""
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    rp_serve_abstract_file "$root/$path"
    set tcl_url2file([ad_conn url]) [ad_conn file]
    set tcl_url2path_info([ad_conn url]) [ad_conn path_inf..."

I hope someone can help me to solve these problems.

Collapse
Posted by Jade Rubick on
Thomas, I'm the original developer on this. I'd be happy to help, of course.

I'm not really sure what the problem is. It might be that you're on 5.0.2, and the code was original written for 4.6.3

Perhaps the behavior of ad_form has changed somehow? I'm not certain.

I'm on IRC during most of the day. Perhaps we can walk through it?

Collapse
Posted by Don Baccus on
The first error is an obvious typo:

{[list} is missing a closing right bracket.

The second error appears obvious, too, you apparently have a select_query_name in both your original call to ad_form and the call you use to extend it.  ad_form doesn't like that.

Collapse
Posted by Jade Rubick on
Thanks for clarifying this, Don.

I'm not sure why such obvious bugs would be in there, especially since it is working fine on my site, and the code I checked in is just about identical to what I'm using in production.

I'll update the code in the CVS as soon as I can, and look into this bug.

Probably not today, however. Email me if this is time sensitive, please.

Collapse
Posted by Thomas Rathjen on
Thanks for the answer.
As soon as possible will be ok. 😉
Collapse
Posted by Jade Rubick on
Hi Thomas,

I checked the code I'm using on a 4.6.3 site in to HEAD:

http://cvs.openacs.org/cvs/openacs-4/contrib/packages/resource-list/

I'm not sure this will solve the problem you're having, but I'm hoping it will.

Please let me know if your problems persist, and then I'll delve into fixing it.

Collapse
Posted by Thomas Rathjen on
Hallo Jade,

I have installed the package with the new code, but there are the same error messages as before.

Collapse
Posted by Jade Rubick on
Hi Thomas,

it looks like the bug is here:

        ad_form -extend -name add_edit -form \
            [list \
                [list \
                  categories:text(checkbox),multiple \
                      {label "Select: [set type_short_name]"} \
                      {options [list $options]} \
                      {values $categories} \
                      ] \
                ]

Perhaps the behavior of ad_form has changed in 5.0 (I'm coding on 4.6.3). It looks like the [set type_short_name] section is not working.

This bug does not show up in 4.6.3, but I've changed it to as follows:

        set select_name "Select: $type_short_name"

        ad_form -extend -name add_edit -form \
            [list \
                [list \
                  categories:text(checkbox),multiple \
                      {label $select_name} \
                      {options [list $options]} \
                      {values $categories} \
                      ] \
                ]

I'm not sure that will work.

The resource-list package is in /contrib partially because the admin interface isn't very developed at all. My recommendation, actually, is to put the types in yourself (I put in two: Population and Location). Then the UI works alright.

I also added in a .vuh for resource list, so that links are picked up better by Google (hopefully).

I'm checking in the code soon.