Commit 6382406eb07fb278fdfbb369c38b83d7e1ad9e4f

Authored by Brad Shuttleworth
1 parent 92059a21

fix for KTS-1199


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5753 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/KTWorkflowTriggers.inc.php
... ... @@ -71,12 +71,18 @@ class PermissionGuardTrigger extends KTWorkflowTrigger {
71 71 $aPermissions = KTPermission::getList();
72 72 $aKeyPermissions = array();
73 73 foreach ($aPermissions as $oPermission) { $aKeyPermissions[$oPermission->getName()] = $oPermission; }
  74 +
  75 + $current_perms = array();
  76 + foreach ($this->aConfig['perms'] as $sPermName) {
  77 + $current_perms[$sPermName] = true;
  78 + }
74 79  
75 80 $oTemplating =& KTTemplating::getSingleton();
76 81 $oTemplate = $oTemplating->loadTemplate("ktcore/workflowtriggers/permissions");
77 82 $aTemplateData = array(
78 83 "context" => $this,
79 84 "perms" => $aKeyPermissions,
  85 + 'current_perms' => $current_perms,
80 86 'args' => $args,
81 87 );
82 88 return $oTemplate->render($aTemplateData);
... ... @@ -369,7 +375,7 @@ class ConditionGuardTrigger extends KTWorkflowTrigger {
369 375 $aTemplateData = array(
370 376 "context" => $this,
371 377 "conditions" => $aKeyedConditions,
372   - "current_group" => KTUtil::arrayGet($this->aConfig, 'group_id'),
  378 + "current_condition" => KTUtil::arrayGet($this->aConfig, 'condition_id'),
373 379 'args' => $args,
374 380 );
375 381 return $oTemplate->render($aTemplateData);
... ...
templates/ktcore/workflowtriggers/condition.smarty
... ... @@ -14,7 +14,7 @@
14 14 {* FIXME keep old selection *}
15 15  
16 16 {foreach from=$conditions item=sConditionName key=iConditionId}
17   - <input type="radio" name="condition_id" value="{$iConditionId}" /> {i18n}{$sConditionName}{/i18n} <br />
  17 + <input type="radio" name="condition_id" value="{$iConditionId}" {if ($iConditionId == $current_condition)}checked="true"{/if} /> {i18n}{$sConditionName}{/i18n} <br />
18 18 {/foreach}
19 19  
20 20 <div class="form_action">
... ...
templates/ktcore/workflowtriggers/group.smarty
... ... @@ -14,7 +14,7 @@
14 14 {* FIXME keep old selection *}
15 15  
16 16 {foreach from=$groups item=sGroupName key=iGroupId}
17   - <input type="radio" name="group_id" value="{$iGroupId}" /> {i18n}{$sGroupName}{/i18n} <br />
  17 + <input type="radio" name="group_id" value="{$iGroupId}" {if ($iGroupId == $current_group)}checked="true"{/if} /> {i18n}{$sGroupName}{/i18n} <br />
18 18 {/foreach}
19 19  
20 20 <div class="form_action">
... ...
templates/ktcore/workflowtriggers/permissions.smarty
... ... @@ -12,15 +12,12 @@
12 12 <p class="descriptiveText">{i18n}Specify which permissions the user will require in order to perform this transition. Note that
13 13 the user will be required to have <strong>all</strong> these permissions.{/i18n}</p>
14 14  
15   -{* FIXME keep old selection *}
16   -
17   -{foreach from=$perms item=oPerm}
18   - <input type="checkbox" name="trigger_perms[{$oPerm->getName()}]" /> {i18n}{$oPerm->getHumanName()}{/i18n} <br />
  15 +{foreach from=$perms item=oPerm key=sPermName}
  16 + <input type="checkbox" name="trigger_perms[{$sPermName}]" {if ($current_perms.$sPermName)}checked="true"{/if}/> {i18n}{$oPerm->getHumanName()}{/i18n} <br />
19 17 {/foreach}
20 18  
21 19 <div class="form_action">
22 20 <input type="submit" value="{i18n}Save Trigger{/i18n}" />
23   - {* FIXME how do I cancel again? *}
24 21 </div>
25 22 </fieldset>
26 23 </form>
27 24 \ No newline at end of file
... ...
templates/ktcore/workflowtriggers/roles.smarty
... ... @@ -14,7 +14,7 @@
14 14 {* FIXME keep old selection *}
15 15  
16 16 {foreach from=$roles item=sRoleName key=iRoleId}
17   - <input type="radio" name="role_id" value="{$iRoleId}" /> {i18n}{$sRoleName}{/i18n} <br />
  17 + <input type="radio" name="role_id" value="{$iRoleId}" {if ($iRoleId == $current_role)}checked="true"{/if} /> {i18n}{$sRoleName}{/i18n} <br />
18 18 {/foreach}
19 19  
20 20 <div class="form_action">
... ...