<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}View Permissions for{/i18n}:<br />{$context->oFolder->getName()|sanitize}</h2>

<p class="descriptiveText">{i18n}This page shows the permissions that apply to
this specific folder.  Only the roles or groups which have permissions
assigned are shown.{/i18n}</p>

{if $edit}
{i18n}Manage security{/i18n}: <a href="{addQS context=$context}action=edit{/addQS}">{i18n}Edit permissions{/i18n}</a>
| <a href="{addQS context=$context}action=resolved_users{/addQS}">{i18n}View resolved permissions for user{/i18n}</a>
{else}
{i18n}Manage security{/i18n}: <a href="{addQS context=$context}action=resolved_users{/addQS}">{i18n}View resolved permissions for user{/i18n}</a>
{/if}


{if $iFolderId != 1}
<p>
<div class="ktInfoMessage">
{ if $inherited }
<span>{i18n arg_permission_source=$inherited|sanitize}This folder <strong>inherits</strong> its permissions from #permission_source#.{/i18n}
{if $inheritable}
<a class="ktActionLink ktDelete"
   kt:deleteMessage="{i18n}Are you sure you wish to override the permissions?{/i18n}"
   href="{addQS}action=edit&fFolderId={$oFolder->getId()}&override=1{/addQS}">{i18n}Override permissions{/i18n}</a>
{/if}
</span>
{ else }
<p>{i18n}This folder defines its own permissions.{/i18n}</p>
{ /if }
</div>
</p>
{ /if }

{if (empty($roles) && empty($groups) && empty($users)) }
<div class="ktInfoMessage"><span>{i18n}No roles, groups, or users have been defined or have permissions.{/i18n}</span></div>
{else}

<table class="kt_collection narrow" cellspacing="0" cellpadding="0" border="0">
<thead>
<tr>
<th width="40%">{i18n}Role or Group{/i18n}</th>
{ foreach item=oPerm from=$permissions }
<th title="{$oPerm->getName()}" class="centered">{$oPerm->getHumanName()}</th>
{ /foreach }
</tr>
</thead>
<tbody>

{ foreach item=oRole from=$roles }
<td><span class="descriptiveText">{i18n}Role{/i18n}:</span> {$oRole->getName()}</td>
  { assign var=iRoleId value=$oRole->getId() }
  { foreach item=oPerm from=$permissions }
    { assign var=iPermId value=$oPerm->getId() }
    { assign var=bHasPerm value=$aMapPermissionRole[$iPermId][$iRoleId] }

{ if $bHasPerm }
<td class="centered"><span class="ktAction ktInline ktAllowed">{i18n}Allowed{/i18n}</span></td>
{ else }
<td class="centered"><span class="ktAction ktInline ktDenied">{i18n}Denied{/i18n}</span></td>
{ /if }
  { /foreach }
</tr>
{ /foreach }


{ foreach item=oGroup from=$groups }
<td><span class="descriptiveText">{i18n}Group{/i18n}:</span> {$oGroup->getName()}</td>
  { assign var=iGroupId value=$oGroup->getId() }
  { foreach item=oPerm from=$permissions }
    { assign var=iPermId value=$oPerm->getId() }
    { assign var=bHasPerm value=$aMapPermissionGroup[$iPermId][$iGroupId] }

{ if $bHasPerm }
<td class="centered"><span class="ktAction ktInline ktAllowed">{i18n}Allowed{/i18n}</span></td>
{ else }
<td class="centered"><span class="ktAction ktInline ktDenied">{i18n}Denied{/i18n}</span></td>
{ /if }

  { /foreach }
</tr>
{ /foreach }


{ foreach item=oUser from=$users }
<tr>
<td><span class="descriptiveText">{i18n}User: {/i18n}</span> {$oUser->getName()}</td>
  { assign var=iUserId value=$oUser->getId() }
  { foreach item=oPerm from=$permissions }
    { assign var=iPermId value=$oPerm->getId() }
    { assign var=bHasPerm value=$aMapPermissionUser[$iPermId][$iUserId] }

{ if $edit}
{ if $bHasPerm }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][group][]"
value="{$iGroupId}" checked="true"></td>
{ else }
<td class="centered"><input type="checkbox" name="foo[{$iPermId}][group][]"
value="{$iGroupId}"></td>
{ /if }
{else}
{ if $bHasPerm }
<td class="centered"><span class="ktAction ktInline ktAllowed">{i18n}Allowed{/i18n}</span></td>
{ else }
<td class="centered"><span class="ktAction ktInline ktDenied">{i18n}Denied{/i18n}</span></td>
{ /if }
{/if}


  { /foreach }
</tr>
{ /foreach }

</tbody>
</table>
{ /if }

{ if (!empty($conditions)) }
<h3>{i18n}Dynamic Conditions{/i18n}</h3>
<table class="kt_collection" cellpadding="0" cellspacing="0">
<thead>
<tr>
  <th class="title">{i18n}Group{/i18n}</th>
  <th class="title">{i18n}Condition{/i18n}</th>
{foreach from=$permissions item=oPerm}
  <th  class="title" title="{$oPerm->getName()}" class="centered">{$oPerm->getHumanName()}</th>
{/foreach}
</tr>
</thead>
<tbody>
{foreach from=$conditions item=aInfo}
<tr>
  <td>{$aInfo.group}</td>
  <td>{$aInfo.name}</td>
{foreach from=$permissions item=oPerm}
  {assign var=perm_id value=$oPerm->getId()}
  { if $aInfo.perms.$perm_id }
    <td class="centered"><span class="ktAction ktInline ktAllowed">{i18n}Allowed{/i18n}</span></td>
    { else }
    <td class="centered"><span class="ktAction ktInline ktDenied">{i18n}Denied{/i18n}</span></td>
  { /if }
{/foreach}
</tr>
{/foreach}

</tbody>
</table>
{/if}



