This question about Upgrading from TWiki to Foswiki: Answered

WORKFLOWTRANSITION: Form field 'topic' gets incorrect value when included

Hi,

I am trying to migrate our quality management system from a TWiki 4.2.2 installation to foswiki 1.0.5. Changes are controlled by a approval workflow. State of each document is displayed in a header which is a separate topic included (with %INCLUDE(...)%) into each controlled document. This header also includes the state change form generated by WORKFLOWTRANSITION.

When imported to foswiki this does not work anymore and I think it is due to the code of the WORKFLOWTRANSITION form. Foswiki adds a hidden form field named 'topic'. This field, when included, is set to the value of the included topic, not the including topic.

Example: 'ControlledDoc' includes header 'QualityHeader (Web: 'Quality' )

Generated form by %WORKFLOWTRANSITION% in twiki - WORKFLOWTRANSITION in included header topic:

<FORM METHOD=POST ACTION='http://prod01/twiki/bin/view/Quality/ControlledDoc'>
<input type='hidden' name='WORKFLOWSTATE' value='APPROVED'>
<input type='hidden' name='WORKFLOWACTION' value='Revidera'>
<input type='submit' value='Revidera' class="twikiChangeFormButton twikiSubmit" /></FORM>

Generated form by %WORKFLOWTRANSITION% in foswiki - WORKFLOWTRANSITION in included header topic:

<form method="post" action="http://dev01/foswiki/bin/rest/WorkflowPlugin/changeState" enctype="multipart/form-data">
<input type="hidden" name="WORKFLOWSTATE" value="APPROVED" />
<input type="hidden" name="topic" value="Quality.QualityHeader" />
<input type="hidden" name="t" value="1244664266" />
<input type="hidden" name="WORKFLOWACTION" value="Revidera" />
<input type="submit" name=".submit" value="Revidera" class="foswikiChangeFormButton foswikiSubmit"" /></form>

Generated form by %WORKFLOWTRANSITION% in foswiki - WORKFLOWTRANSITION used directly and NOT included ( this works ):

<form method="post" action="http://dev01/foswiki/bin/rest/WorkflowPlugin/changeState" enctype="multipart/form-data">
<input type="hidden" name="WORKFLOWSTATE" value="APPROVED" />
<input type="hidden" name="topic" value="Quality.ControlledDoc" />
<input type="hidden" name="t" value="1244664266" />
<input type="hidden" name="WORKFLOWACTION" value="Revidera" />
<input type="submit" name=".submit" value="Revidera" class="foswikiChangeFormButton foswikiSubmit"" /></form>

Is this a bug or is there a solution for this? I would really like to move forward and migrate to foswiki but before that can happen I have to solve this. Many thanks!

/Lars


Can you circumvent this problem by manually setting the topic parameter to VarINCLUDINGTOPIC and/or VarBASETOPIC and the like?

-- OliverKrueger - 09 Oct 2009


Thank you for your answer. WORKFLOWTRANSITION doesn't support any parameters as far as I know, but you pointed my in the right direction smile

I actually got it to work by a adding the topic parameter to my WORKFLOWTRANSITION call, as well as doing some very small additions to WorkflowPlugin.pm:

sub WORKFLOWTRANSITION {
my ( $session, $attributes, $topic, $web ) = @
;

return '' unless _initTOPIC( $web, $topic );

# New line here (after line 149)!
my $realTopic = $attributes->{'topic'} || $topic;

...

# Changed following in line 168:

CGI::hidden( 'topic', "$web.$topic" ) to CGI::hidden( 'topic', "$web.$realTopic" )

...

}

I've never coded in perl before, so there might be other mays of doing this, but it seams to work. Thoughts?

It would be great if topic parameter support could be added to the WORKFLOWTRANSITION in the code base.

-- LarsHedman - 10 Oct 2009

I havent fully read the code for the current context, but in general the topic url param has a special meaning for foswikis core. Plugins may read this param of course, but should not set it to other values.

You should probably speak to the plugin authors about your patch.

-- OliverKrueger - 10 Oct 2009

QuestionForm edit

Subject Upgrading from TWiki to Foswiki
Extension WorkflowPlugin
Version
Status Answered
Topic revision: r4 - 10 Oct 2009, OliverKrueger
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy