Forum OpenACS Q&A: list-builder and -bulk_actions url value

I'm familiarizing myself with the list-builder (aka template::list::*) and have run into a snag that I'm hoping someone has worked around. Or, maybe I haven't assimilated enough information yet...

I have setup a bulk_action and bulk_action_export_vars in preparation of deleting several objects simultaneously. The problem is that I need to provide a constant query value which specifies the operation (delete), and the -bulk_actions switch will not allow me to do this.

The target (./client) page is multi-mode. That is, it perfoms all actions (add, edit, delete, list) related to the client object. This page changes its behavior depending on the value of the "op" query var value. For example: client?op=delete&id=nnnn, client?op=list, etc.

client/op=list displays a template::list of all these objects and part of the spec is:

    -bulk_actions {
        "Delete" "client?op=delete" "Delete checked entries"
    } \
    -bulk_action_export_vars {
        id return_url
    }
The resulting bulk delete url is:
    client?return_url=abcde&id=nnnn&id=mmmm&...
Where the "?op=delete" portion of the -bulk_actions url has been stripped and replaced with the -bulk_action_export_vars.

I've tried various permutations and formats for the -bulk_actions url entry without success. It appears that this entry is treated as a simple string (not eval'd) so it will not accept a tcl command that builds the url.

Any suggestions on how to accomplish this?

Randy

Collapse
Posted by Lars Pind on
Randy,

Sorry, that's not supported.

Look at /acs-templating/resources/lists/table.adp.

The way bulk actions works is that the list is wrapped in a form, with the checkboxes sitting in that form. When you click a bulk action, the ListBulkActionClick javascript proc is executed. This changes the 'action' attribute of the form and submits it.

So a good fix in list-builder would be non-trivial.

Possible work-around: Create a client-delete.tcl page, which simply redirects to client?op=delete... Repeat for other operations.

It's not terribly pretty, but a) it gets the job done, and b) it provides for clean upgradeability.

/Lars

Collapse
Posted by Frank Bergmann on
Hi,

I stepped into the same hole. Actually, my calling page uses an "object_type" parameter, so it's not possible to setup redirection pages as Lars proposed.

I believe that there is an _easy_way_ in this case: Including a hidden field in the form with return_url (which is "constant" for all columns) would do the job. However, it would be yet another parameter.

But in general I'm very disappointed with the list-builder. The idea is is nice, but the implementation is so obscure (you don't know what's happening until you check yourself in the source code) that I'm not going to use it much in the future. And I can't recommend to anybody doing so.

Bests,
Frank

Collapse
Posted by Dave Bauer on
Randy,

Interesting.

So your "client' tcl script accepts a parameter for the "op"eration. Why not use a seperate script for each action? That seems alot easier to maintain. I have never run into a problem with bulk actions like this.

Collapse
Posted by Randy O'Meara on
I believe, at least in my case, that creating separate scripts was a workable solution.
Collapse
Posted by Brian Fenton on
Hi folks

I know it's many years later, but I've just come across this issue for the first time. I was wondering if there's a better solution available in 2017?

thanks
Brian