Forums / Developer / Workflow and templates

Workflow and templates

Author Message

Clemens T

Monday 02 June 2008 6:06:56 am

Heya all,

I've got the following setup:

<b>Trigger 1</b>: BEFORE Publish - triggers: Workflow 1

<b>Workflow 1</b>: multiplexer event to 'filter' items of one class - run Workflow 2 on these

<b>Workflow 2</b>:
- do my CustomEventType and then finish the publishing

My CustomEventType is:

    function execute( &$process, &$event )
    {
	$http =& eZHTTPTool::instance();

	if($http->hasPostVariable("done"))
	{
		return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
	} 
	else
	{
	      $requestURI = eZSys::requestURI();
		
              $process->Template = array();
              $process->Template['templateName'] = 'design:workflow_event.tpl';
              $process->Template['templateVars'] = array ( 'event' => $event );
						
	      return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_REPEAT;
	}
    }

Template code:

<form method="post">
<input type="hidden" name="done" />
<input type="submit" name="submit" value="Done with this workflow" />
</form>

The template is loaded fine, but after I hit the button, it returns to the edit form where I can edit the news item again. This probably has something to do with the <form ...> tag.

How can I make sure that submitting the form will not lead to a step back in the workflow, but in a step forward?

Greets,
Clemens

Clemens T

Monday 02 June 2008 8:16:36 am

Got it!

This is not documented or whatever, but my thanks goes to the following thread:http://ez.no/developer/forum/developer/before_publish_event_with_tempaltes

The key is publishing data without publishing new object info via:
<b>HasObjectInput</b> and<b>PublishButton</b>.

My very simple template code now looks like this:

<form method="post" action="{"/content/action/"|ezurl(,'no')}">
	<input type="hidden" name="HasObjectInput" value="0" />
	<input type="hidden" name="done" value="1" />
	<input class="button" type="submit" name="PublishButton" value="Finish" />
</form>

My Execute function:

    function execute( &$process, &$event )
    {
	$http =& eZHTTPTool::instance();

	if($http->hasPostVariable("done"))
	{
		
                //do anything I want to do...				
		return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
	} 
	else
	{
		$requestURI = eZSys::requestURI();
		
              $process->Template = array();
              $process->Template['templateName'] = 'design:workflow_event.tpl';
              $process->Template['templateVars'] = array ( 'event' => $event );
 
						
		return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_REPEAT;
	}
    }

Andrew Duck

Thursday 29 January 2009 5:08:51 am

Is this functionality still available in eZ 4.0.1?

My use case is eZWorkflowEventType::STATUS_FETCH_TEMPLATE_REPEAT to load up the first template which works fine, but then submitting data from this template back to the workflow event for evaluation and further processing does not appear to work.

Is this possible with the content module, content/action?

I have attempted posting data to /content/action with and without HasObjectInput but I end up at the object history page forcing me to create a new draft.

Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck

Kristof Coomans

Friday 30 January 2009 6:36:42 am

Issue reported here by Andrew: http://issues.ez.no/IssueView.php?Id=14371

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

eZ debug

Timing: Jan 18 2025 11:43:17
Script start
Timing: Jan 18 2025 11:43:17
Module start 'content'
Timing: Jan 18 2025 11:43:18
Module end 'content'
Timing: Jan 18 2025 11:43:18
Script end

Main resources:

Total runtime0.7417 sec
Peak memory usage4,096.0000 KB
Database Queries199

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 589.1172180.8438
Module start 'content' 0.00600.6205 769.9609607.0000
Module end 'content' 0.62660.1151 1,376.9609337.3984
Script end 0.7417  1,714.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00460.6155210.0002
Check MTime0.00160.2094210.0001
Mysql Total
Database connection0.00080.104110.0008
Mysqli_queries0.670290.35501990.0034
Looping result0.00180.24691970.0000
Template Total0.711295.920.3556
Template load0.00230.307120.0011
Template processing0.708995.575320.3545
Template load and register function0.00020.026810.0002
states
state_id_array0.00100.134710.0010
state_identifier_array0.00120.166420.0006
Override
Cache load0.00190.2602350.0001
Sytem overhead
Fetch class attribute can translate value0.00130.172340.0003
Fetch class attribute name0.00090.123260.0002
XML
Image XML parsing0.00150.208040.0004
class_abstraction
Instantiating content class attribute0.00000.001560.0000
General
dbfile0.00210.2873350.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs