{#
/**
 * WebsiteBaker CMS AdminTool: addonMonitor
 *
 * Template for the display of languages 
 * 
 * 
 * @platform    CMS WebsiteBaker 2.8.x
 * @package     addonMonitor
 * @author      Christian M. Stefan (Stefek)
 * @copyright   Christian M. Stefan
 * @license     http://www.gnu.org/licenses/gpl-2.0.html
 */
#}
{#
{{ dump() }}
#}
<table style="width:100%;" cellpadding="3" cellspacing="0"  class="select_types">
	<tr>
		<td>
			<fieldset>
				<legend>Filter by Addon Name</legend>
				<input class="filterinput" name="filter" id="filter_titles" value="" maxlength="30" size="30" type="text">
				<input class="clearbtn" id="clear_titles" type="submit" value="clear"/>
			</fieldset>
		</td>		
		<td>
			<fieldset>
				<legend>Filter by Author</legend>
				<input class="filterinput" name="filter" id="filter_authors" value="" maxlength="30" size="30" type="text">
				<input class="clearbtn" id="clear_authors" type="submit" value="clear"/>
			</fieldset>
		</td>
	</tr>
</table>
<table style="width:100%;" border="0" cellpadding="3" cellspacing="0" id="htmlgrid" class="amDashboard">	
	<thead>	
		<tr>
			<th></th>
			<th class="sort"><span>Language</span></th>
			<th>Version</th>
			<th></th>
			<th>Author</th>
			<th class="sort"><span>active</span></th>
		</tr>
	</thead>
	<tbody>
	{%for addon in addons %}
		{# in the next line we set a TWIG variable for "status" #}
		{% set status = (addon.active == 'Y') ? 'active_1' : 'inactive' %}		
		<tr id="addons_{{ addon.addon_id }}" class="{{ status }} row_tool">
			<td class="addon_icon">	
				<div>
					{% if addon.icon %}
					<img src="{{ addon.icon }}" alt="{{ function }}" title="{{ function }}" width="16" />				
					{% endif %}
					<br />{{ addon.directory }}
				</div>
			</td>
			<td class="addon_name">{{ addon.name }}</td>
			<td class="addon_version">{{ addon.version }}</td>	
			<td class="addon_author"></td>
			<td class="addon_author">
				<ul class="authors">
				{% for author in addon.author|split(', ') %}
					<li>{{ author }}</li>
				{% endfor %}
				</ul>
			</td>
			<td class="addon_active">					
				{% if addon.active_pages|length > 0 %}						
					<ul class="using_sections">					
					
					{% if addon.directory == constant('DEFAULT_LANGUAGE') %}	
						<li>Default Language</li>
					{% else %}
						<li title="this language is in use on {{ addon.active_pages|length }} Pages">{{ addon.active_pages|length }}x</li>
						{% for pID in addon.active_pages %}					
							<li title="PageID: {{ pID }}"><a href="{{ constant('WB_URL') }}/{{ constant('ADMIN_DIRECTORY') }}/pages/settings.php?page_id={{ pID }}" target="_blank">{{ pID }}</a></li>
						{% endfor %}
					{% endif %}				
					
					</ul>
				{% else %}
					<ul class="using_sections_null">
						<li title="this language is not used on any page">0x</li>
					</ul>
				{% endif %}
			</td>		
		</tr>
	{% endfor %}
	</tbody>
	<tfoot>
		<tr>
			<td colspan="6">
				<b>Installed Languages:</b> {{ addons|length }} 
			</td>
		</tr>
	</tfoot>
</table>