<h2><img src="{if $config->get("ui/morphEnabled") == '1'}{$rootUrl}/skins/kts_{$config->get("ui/morphTo")}/title_bullet.png{else}{$rootUrl}/resources/graphics/title_bullet.png{/if}"/>{i18n}Transition{/i18n}:<br />{$oTransition->getName()|sanitize}</h2>

<form action="{$smarty.server.PHP_SELF}" method="POST">
<fieldset>
<legend>{i18n}Edit transition properties{/i18n}</legend>

<p class="descriptiveText">{i18n}Select the target state of the transition, and
select the permission, group, and/or role necessary to perform the
transition.  Selecting more than one of permission, group, or role will
require that the user wishing to perform the transition fulfil every
requirement.{/i18n}</p>

<input type="hidden" name="action" value="saveTransition" />
<input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
<input type="hidden" name="fTransitionId" value="{$oTransition->getId()}" />

{foreach item=oWidget from=$edit_fields}
  {$oWidget->render()}
{/foreach}

<div class="form_actions">
<input type="submit" name="submit" value="{i18n}Save{/i18n}" />
</div>
</fieldset>
</form>


<fieldset>
    <legend>{i18n}Transition Triggers{/i18n}</legend>

    <p class="descriptiveText">{i18n}Transition triggers allow you to have special actions automatically
    occur when a transition is performed, and to control who can perform the transition.  Some triggers
    perform <strong>both</strong> of these functions, especially if performing the action requires that
    certain conditions are in place before the action will occur.{/i18n}</p>

    <form method="POST" action="{$smarty.server.PHP_SELF}">

    <input type="hidden" name="action" value="addTrigger" />
    <input type="hidden" name="fWorkflowId" value="{$oWorkflow->getId()}" />
    <input type="hidden" name="fTransitionId" value="{$oTransition->getId()}" />

    {foreach item=oWidget from=$add_trigger_fields}
      {$oWidget->render()}
    {/foreach}

    <div class="form_actions">
        <input type="submit" value="Add Trigger" />
    </div>
    </form>

    <h3>{i18n}Guards{/i18n}</h3>

    <p class="descriptiveText">{i18n}Items which control whether a given user can perform this transition
    on a specific document. <strong>All of these must allow the user to perform the transition.</strong>{/i18n}</p>
    {if empty($aGuardTriggers)}
    <div class="ktInfoMessage"><span>{i18n}Anybody (with the ability to see the document) can perform this transition.{/i18n}</span></div>
    {else}

    <table class="kt_collection narrow" cellspacing="0">
    <thead>
        <tr>
            <th>{i18n}Trigger{/i18n}</th>
            <th>{i18n}Configuration{/i18n}</th>
            <th>{i18n}Edit{/i18n}</th>
            <th>{i18n}Delete{/i18n}</th>
        </tr>
    </thead>
    <tbody>
        {foreach from=$aGuardTriggers item=oTrigger}
         <tr>
             <td>{$oTrigger->getName()}</td>
             <td>{$oTrigger->getConfigDescription()}</td>
             <td>{if $oTrigger->bIsConfigurable}<a class="ktAction ktEdit" href="{addQS}action=editTrigger&fWorkflowId={$oWorkflow->getId()}&fTransitionId={$oTransition->getId()}&fTriggerInstanceId={$oTrigger->getConfigId()}{/addQS}">edit</a>{else}&mdash;{/if}</td>
             <td><a class="ktAction ktDelete" href="{addQS}action=deleteTrigger&fWorkflowId={$oWorkflow->getId()}&fTransitionId={$oTransition->getId()}&fTriggerInstanceId={$oTrigger->getConfigId()}{/addQS}">delete</a></td>
         </tr>
        {/foreach}
    </tbody>
    </table>

    {/if}
    <h3>Actions</h3>

    <p class="descriptiveText">{i18n}Actions which are performed when the document follows the transition.{/i18n}</p>
    {if empty($aActionTriggers)}
    <div class="ktInfoMessage"><span>{i18n}No actions are performed when this transition occurs.{/i18n}</span></div>
    {else}

    <table class="kt_collection narrow" cellspacing="0">
    <thead>
        <tr>
            <th>{i18n}Trigger{/i18n}</th>
            <th>{i18n}Configuration{/i18n}</th>
            <th>{i18n}Edit{/i18n}</th>
            <th>{i18n}Delete{/i18n}</th>
        </tr>
    </thead>
    <tbody>
        {foreach from=$aActionTriggers item=oTrigger}
         <tr>
             <td>{$oTrigger->getName()}</td>
             <td>{$oTrigger->getConfigDescription()}</td>
             <td>{if $oTrigger->bIsConfigurable}<a class="ktAction ktEdit" href="{addQS}action=editTrigger&fWorkflowId={$oWorkflow->getId()}&fTransitionId={$oTransition->getId()}&fTriggerInstanceId={$oTrigger->getConfigId()}{/addQS}">edit</a>{else}&mdash;{/if}</td>
             <td><a class="ktAction ktDelete" href="{addQS}action=deleteTrigger&fWorkflowId={$oWorkflow->getId()}&fTransitionId={$oTransition->getId()}&fTriggerInstanceId={$oTrigger->getConfigId()}{/addQS}">delete</a></td>
         </tr>
        {/foreach}
    </tbody>
    </table>

    {/if}
</fieldset>
