<h2>{i18n arg_rolename=$rolename}Allocate Groups to Role: #rolename#{/i18n}</h2>

{$context->oPage->requireJSResource('thirdpartyjs/OptionTransfer.js')}

<p class="descriptiveText">{i18n}Groups must be allocated to roles to ensure that the workflow transition this role is supposed to support can be acted upon by a user.{/i18n}</p>

<form action="{$smarty.server.PHP_SELF}" method="POST" id="grouproleform" name="grouproleform">
   <input type="hidden" name="action" value="setRoleGroups" />
   <input type="hidden" name="allocation_id" value="{$edit_rolealloc->getId()}" />
   <input type="hidden" name="fFolderId" value="{$context->oFolder->getId()}" />
   <!-- erk. FIXME clean up and remove OptionTransfer.js. -->

   <input type="hidden" name="groupFinal" />


   <fieldset>
      <legend>{i18n}Allocate Groups{/i18n}</legend>
      <p class="descriptiveText">{i18n}Select the groups which should be part of this role.{/i18n}</p>

<table border="0" width="600">
   <thead>
      <tr>
         <th>{i18n}Available Groups{/i18n}</th>
         <th>&nbsp;</th>
         <th>{i18n}Member groups{/i18n}</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td valign="top" width="1%">
           <select name="groupSelect" size="10" multiple="multiple">
               {foreach item=oGroup from=$unused_groups}
               <option value="{$oGroup->getId()}" ondblclick="optGroup.transferRight()">{$oGroup->getName()}</option>
               {/foreach}
           </select>
         </td>
         <td align="center">
            <input name="right" style="width: 60px;" value="&raquo;" onclick="optGroup.transferRight()" type="button"><br /><br />
            <input name="left" style="width: 60px;" value="&laquo;" onclick="optGroup.transferLeft()" type="button">
         </td>
         <td valign="top" width="1%">
            <select name="chosenGroups" size="10" multiple="multiple">
               {foreach item=oGroup from=$role_groups}
               <option value="{$oGroup->getId()}" ondblclick="optGroup.transferRight()">{$oGroup->getName()}</option>
               {/foreach}
            </select>
         </td>
      </tr>
      <tr>
         <td><label for="ug-filter">{i18n}Filter{/i18n}</label>
            <input name="filterUG" id="ug-filter" onkeyup="optGroup.sortSelectMatch(groupSelect, this.value)" onchange="optGroup.sortSelectMatch(groupSelect, this.value)" type="text">
         </td>
         <td>&nbsp;</td>
         <td><label for="og-filter">{i18n}Filter{/i18n}</label>
            <input name="filterOG" id="og-filter" onkeyup="optGroup.sortSelectMatch(chosenGroups, this.value)" onchange="optGroup.sortSelectMatch(chosenGroups, this.value)" type="text">
         </td>
      </tr>
</tbody></table>

      <div class="form_actions">
         <input type="{$input.type}" value="{i18n}save changes{/i18n}" onclick="{$input.onclick}" />
         {capture assign=link}{addQS}fFolderId={$context->oFolder->getId()}{/addQS}{/capture}
         <input type="submit" name="kt_cancel[{$link}]" value="{i18n}Cancel{/i18n}" />
      </div>
   </fieldset>
   </form>
