Download & Extend

State machine: States as arguments

Project:Workflow-ng
Version:5.x-2.1
Component:State Machines
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

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.

AttachmentSize
states_views.inc_.diff1.44 KB

Comments

#1

Status:needs review» reviewed & tested by the community

this functionality is essential. tested, and the patch works as advertised.

#2

Status:reviewed & tested by the community» needs work

great! 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.

#3

Being 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).

#4

although 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?

#5

ah, 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.

#6

Project:Workflow-ng» Rules
Version:5.x-2.1» 6.x-1.x-dev
Component:State Machines» Rules Engine

Where does this patch stand relative to the improvements since made to Rules?

#7

Project:Rules» Workflow-ng
Version:6.x-1.x-dev» 5.x-2.1
Component:Rules Engine» State Machines

There 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.

nobody click here