I've marked this as a support request as I'm after clarification, this may actually be a bug report.
I have a custom module which I use to create some complex and domain specific work-flows and publishing logic. Re-visioning helps me achieve this task quite well for the most part, however I find that there are occasions that I want to manually change the work-flow status, and sometimes even make new revisions automatically by setting the appropriate properties on the node object and calling node_save().
I find that for this to work however, I need to myself call functions like _handle_edit() and _handle_new() as re-visioning checks for the path of the current page as to whether it should do something.
Is there an explicit reason for doing this rather than checking for properties on the node or the operation as to whether its new or not?
For example, I want to be able to do the following, which I cannot do without adding my own _handle_edit() call in my nodeapi(), which I'm not fond of doing.
$node->revision = TRUE;
$node->revision_moderation = TRUE;
node_save($node);
Just curious as to if there was a reason for this.
Cheers.
Comments
Comment #1
rdeboerI think you might be on to something here, Christian... Need to investigate this a bit more...
Rik
Comment #2
rdeboerModule Grants and Revisioning refactored (versions 6.x-3.4 for both) to support the above.
Various aspects of the state of the node are now available through properties and may be changed accordingly, e.g.
Comment #3
cdale commentedAwesome. I think this is a huge improvement and will certainly help progromatic node creation and triggered workflows. Nice work.
Comment #4
cdale commentedHi,
I've just looked into this a bit more, and it appears that the original issue I was having has still not been addressed. The new properties are great, but it seems that I still cannot manually save a node and trigger revisioning due to the checking of arg() for insert and update operations.
Basically, I'm updating several node properties, and wanting to change the revisioning state all in one go with code as shown in my original post. If I'm not on a path that is node user/edit, node/add or node/[nid]/edit, then the revisioning work done in _handle_new() and _handle_edit() will not get triggered.
Is there any chance this can be changed?
Comment #5
rdeboer@cdale:
There's definitely a chance. I have planned a more extenisive overhaul of both Module Grants and Revisioning and will address your issue as part of that.
Comment #6
simeJust confirming I have the same problem. Be great if the logic in revision_nodeapi would also trigger for a programmatic node_save(); event.
Comment #7
rdeboerAcknowledged. I hope to get this done as part of other stuff I'm working on.
Comment #8
rdeboerJust to give you a heads-up that this is now down and checked-in. There are no calls to
arg()anymore. For some reason the Drupal system no longer generates dev tar-balls for my project pages anymore (it seems I can only create official releases), but if you want to have a look and test it out, feel free to check the latest code out from the CVS repository.Make sure you also check out Module Grants as both modules have been refactored in tandem.
The dependency of Revisioning on module_grants.module has been removed, although you still need to download the Module Grants package, as it contains the much smaller dependency on the submodule Node Tools.
I'll update the docs shortly, explaining the new API functions for both Module Grants and Revisioning, but to make a long story short... what cdale requested in the initial issue text should now work verbatim, with the properties mentioned in #2 also available.
Rik
Footnote:
It's funny, coming from an object-oriented background, you would never manipulate properties directly. It is considered bad form to "break encapsulation". But in PHP, at least the way it is used in Drupal, where there is no encapsulation in the first place, it all makes sense again! Thanks for enlightening me, cdale! Happy programming, let us, the community, know in what context you use Revisioning.
@sime:
revisioning_nodeapi() doesn't trigger a node_save() event, it's the other way around, but I think we talk about pretty much the same thing.
Comment #9
rdeboerReleased as 6.x-3.5.
See the extended doco on the Revisioning project page.