<script language="JavaScript">
<!--
	var me = '{$smarty.server.PHP_SELF}';
	{literal}
		
	function popupOS(id) {
		window.open(me + '?op=edit&use_js=1&os_id='+id, 'ewin', 'dependent=yes,width=350,height=300,scrollbars=1');
	}
	{/literal}
// -->
</script>
<table border="0" width="100%">
  <tr>
    <td valign="top">
      <b>&nbsp;{$page_title}</b> - <a href="{$smarty.server.PHP_SELF}?op=edit&os_id=0" onClick="popupOS(0); return false;">{$STRING.addnew} OS</a>
      <hr size="1">
      <table border="0" cellpadding="2" cellspacing="1" width="100%">
        <tr>
          <th class="{$headers.name.class}"><a href="{$headers.name.url}">Name</a></th>
          <th class="{$headers.regex.class}"><a href="{$headers.regex.url}">Regex</a></th>
          <th class="{$headers.sortorder.class}"><a href="{$headers.sortorder.url}">Sort Order</a></th>
					<th>Delete</th>
        </tr>
        {section name=os loop=$oses}
        <tr{if $smarty.section.os.iteration is even} class="alt"{/if}>
          <td><a href="{$smarty.server.PHP_SELF}?op=edit&os_id={$oses[os].os_id}" onClick="popupOS({$oses[os].os_id}); return false;">{$oses[os].os_name|stripslashes}</a></td>
          <td>&nbsp;{$oses[os].regex}</td>
          <td align="center">{$oses[os].sort_order}</td>
					<td align="center">
						{if not $oses[os].bug_count}
						<a href="{$smarty.server.PHP_SELF}?op=del&os_id={$oses[os].os_id}" onClick="return confirm('Are you sure you want to delete this OS?')">Delete</a>
						{/if}
					</td>
        </tr>
        {/section}
				<tr>
					<td colspan="3" align="center">
						<br>
  					{$first} - {$last} of {$total}
						<br>
						{if $pages ne "1"}[ {$pages} ]{/if}
  					<br>
					</td>
				</tr>
      </table>
			<br>
			<div class="info">
				OSes with a Sort Order = 0 will not be selectable by users
				<br>
				Only those OSes that have no bugs referencing them can be deleted
			</div>
    </td>
	</tr>
</table>
