<h2>{i18n arg_field_name=$field_name}Manage Lookups for  "#field_name#"{/i18n}</h2>

<fieldset>
<legend>{i18n}Manage Lookups{/i18n}</legend>

<p class="descriptiveText">{i18n}Over time, the lookup values which make sense will 
change and evolve as your organisation does. You may thus need to change the lookup
values associated with a given field.  There are a number of different states 
that are possible for a given lookup{/i18n}:</p>

<ul class="descriptiveText">
    <li>{i18n}<strong>Enabled</strong>, which means that users cannot specify this
    as an option when editing or creating documents.{/i18n}</li>
    <li>{i18n}<strong>Sticky</strong>, which is used if you have some external
    plugin controlling this lookup set.  This will then tell that plugin not to
    remove the "sticky" value, even if it no longer available in the remote source.{/i18n}</li>    
    <li>{i18n}<strong>Deleted</strong>, which completely removes the selected items 
    from the lookup. Note that this may not be possible if some other aspect of the system
    depends on a particular lookup.{/i18n}</li>        
</ul>
<form method="POST" action="{$smarty.server.PHP_SELF}">

{foreach from=$args item=v key=k}
  <input type="hidden" name="{$k}" value="{$v}" />
{/foreach}

<table class="kt_collection narrow" cellspacing="0">
    <thead>
        <tr>
            <th>&nbsp;</th>
            <th>{i18n}Lookup Value{/i18n}</th>
            <th class="centered">{i18n}Enabled{/i18n}</th>            
            <th class="centered">{i18n}Sticky{/i18n}</th>                        
        </tr>
    </thead>
    <tbody>
      {foreach from=$lookups item=oLookup}
        <tr>
            <td><input type="checkbox" name="metadata[]" value="{$oLookup->getId()}" /></td>
            <td>{$oLookup->getName()}</td>
            <td class="centered">{if (!$oLookup->getDisabled())}<span class="ktAction ktAllowed">{i18n}Yes{/i18n}</span>{else}<span class="ktAction ktDenied">{i18n}No{/i18n}</span>{/if}</td>
            <td class="centered">{if ($oLookup->getIsStuck())}<span>{i18n}Yes{/i18n}</span>{else}&nbsp;{/if}</td>
        </tr>
      {/foreach}
    </tbody>
</table>

<div class="form_actions">
<input type="submit" name="submit[toggleenabled]" value="{i18n}Toggle enabled state{/i18n}" />
<input type="submit" name="submit[togglestickiness]" value="{i18n}Toggle stickiness{/i18n}" />
<input type="submit" name="submit[remove]" value="{i18n}Delete{/i18n}" />
<a class="form_cancel" href="{addQS context=$context}fieldset_action=managefield{/addQS}">{i18n}Cancel{/i18n}</a>
</div>

</fieldset>
</form>
