<h2>{i18n}Manage Saved Search Criteria{/i18n}</h2>

<p class="descriptiveText">{i18n}Saved search criteria are criteria that are particular to your location.
For example, you could define criteria that returns all documents in a particular workflow state,
or all documents which are considered "common" within your organisation (leave policy,
newsletters, etc.) based on a category or fieldset value.{/i18n}</p>


<p class="descriptiveText">
{capture assign=options}
<a href="{addQS}action=guiBuilder{/addQS}">{i18n}Advanced Search{/i18n}</a> {i18n}or{/i18n} <a href="{addQS}action=queryBuilder{/addQS}">{i18n}Search Critiera Editor{/i18n}</a>
{/capture}



{i18n arg_options=$options}Create a new saved search using #options#.{/i18n}
</p>


{if $saved}
<h2>{i18n}Existing Saved Search Criteria{/i18n}</h2>

<table class="listing">
<thead>
    <tr>
        <th>{i18n}Name{/i18n}</th>
        <th>{i18n}User{/i18n}</th>
        <th>{i18n}Edit{/i18n}</th>
        <th>{i18n}Delete{/i18n}</th>
        <th colspan=2>{i18n}Share With All{/i18n}</th>
        <th>{i18n}View Results{/i18n}</th>
    </tr>
</thead>
<tbody>
{foreach item=oSearch from=$saved}
    <tr>
        <td>{$oSearch.name|sanitize}</td>
		<td>{if $oSearch.username}{$oSearch.username|sanitize}{else}{i18n}All users{/i18n}{/if}</td>
        <td>{if ($oSearch.editable || $sysadmin)}<a href="{addQS}action=queryBuilder&fSavedSearchId={$oSearch.id}{/addQS}" class="ktAction ktEdit">{i18n}Edit{/i18n}</a>{/if}</td>
        <td>{if ($oSearch.editable || $sysadmin)}<a href="{addQS}action=delete&fSavedSearchId={$oSearch.id}{/addQS}" class="ktAction ktDelete">{i18n}Delete{/i18n}</a>{/if}</td>
		<td> {if !$oSearch.shared}
				<span class="ktAction ktDenied" >{i18n}Not Shared{/i18n}</span>
			{else}
				<span class="ktAction ktAllowed" >{i18n}Shared{/i18n}</span>
			{/if}
		<td>
			{if $sysadmin}
				{if !$oSearch.shared}
					<a href="{addQS}action=share&fSavedSearchId={$oSearch.id}&share=yes{/addQS}" title="{i18n}Share{/i18n}"><img border=0 src="{$rootUrl}/thirdparty/icon-theme/group_add.png"></a>
				{else}
					<a href="{addQS}action=share&fSavedSearchId={$oSearch.id}&share=no{/addQS}" title="{i18n}Don't Share{/i18n}"><img border=0 src="{$rootUrl}/thirdparty/icon-theme/group_delete.png"></a>
				{/if}
			{/if}

        <td>

        <a class="ktAction ktBack" href="{addQS}action=processSaved&fSavedSearchId={$oSearch.id}{/addQS}">{i18n}Run Search{/i18n}</a></td>
    </tr>
{/foreach}
</tbody>
</table>
{else}
<div class="ktInfoMessage"><span>{i18n}No Saved Searches have been defined.{/i18n}</span></div>
{/if}
