Needs work
Project:
Workflow-ng
Version:
5.x-2.1
Component:
State Machines
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 May 2008 at 22:40 UTC
Updated:
30 Mar 2009 at 19:58 UTC
I needed to build a view that takes the name of a state as an argument and does not seem to be supported, so I've written a patch to add it.
| Comment | File | Size | Author |
|---|---|---|---|
| states_views.inc_.diff | 1.44 KB | asciikewl |
Comments
Comment #1
aaron commentedthis functionality is essential. tested, and the patch works as advertised.
Comment #2
fagogreat! But doesn't get this double escaped?
+ $where = db_escape_string($arg);
+ $query->add_where("node_state.state = '%s'", $arg);
I think so. Please correct me when I'm wrong.
Comment #3
asciikewl commentedBeing a bit of newbie at views, I modified that from views_node.inc line 503 that reads:
case 'filter':
$where = db_escape_string($arg);
$query->add_where("node.type = '%s'", $where);
break;
So looking at the code it should prob read:
$where = db_escape_string($arg);
$query->add_where("node_state.state = '%s'", $where);
or skip the db_escape_string part. Does add_where do escaping on the 2nd argument?
I'm a bit more worried about the 'link' case just after that as I haven't tested that much. (Not used in the site I'm building).
Comment #4
aaron commentedalthough i'm certain there won't be a namespace issue in this case, shouldn't the function be named something like states_handler_argument_statement?
Comment #5
fagoah, thanks aaron. Yes it should.
@add_where: Yes, as it's inserted via db_query() in %s.
@title: looking at other arguments, you should check_plain that.
Comment #6
mitchell commentedWhere does this patch stand relative to the improvements since made to Rules?
Comment #7
fagoThere won't be a states module for rules - as CCK + actions is the way go. So any possible improvements have to go into workflow-ng only.