{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
{$hide_disabled_users = ConfigHelper::checkConfig('rt.hide_disabled_users', ConfigHelper::checkConfig('phpui.helpdesk_hide_disabled_users'))}
<!--// $Id$ //-->
<H1>{$layout.pagetitle}</H1>
<TABLE class="lmsbox">
	<COLSPAN>
		<COL style="width: 1%">
		<COL style="width: 1%">
		<COL style="width: 99%">
	</COLSPAN>
    <THEAD>
	<TR>
	    <TD>
		{icon name="queue"}
	    </TD>
	    <TD class="bold" colspan="2">{$category.name} ({$category.id|string_format:"%04d"})</TD>
	</TR>
    </THEAD>
    <TBODY>
	{if $category.description}
	<TR>
	    <TD>
		{icon name="description"}
	    </TD>
	    <TD class="bold">{trans("Description:")}</TD>
	    <TD>
		<TABLE cellpadding="5">
		    <TR>
			<TD class="fall superlight">
			    {$category.description|replace:"\n":"<BR>"}
			</TD>
		    </TR>
		</TABLE>
	    </TD>
	</TR>
	{/if}
		<tr>
			<td>
				{icon name="helpdesk"}
			</td>
			<td>
				<strong>{trans("<!rt-category>Look:")}</strong>
			</td>
			<td>
				<div class="lms-ui-category-label" style="{$category.style}">
					<strong>{$category.name}</strong>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="user"}
			</td>
			<td>
				<strong>{trans("Users")}</strong>
			</td>
			<td>
				<table class="lmsbox lms-ui-background-cycle">
					<thead>
						<tr>
							<td>
								<strong>{trans("User")}</strong>
							</td>
							<td class="text-center nobr">
								<strong>{trans("Owner")}</strong>
							</td>
						</tr>
					</thead>
					<tbody>
						{foreach $category.owners as $owner}
							{if $owner}
								<tr class="highlight{if empty($users[$owner.id].access)} blend{/if}"
									{if empty($users[$owner.id].access) && $hide_disabled_users} style="display: none;"{/if}>
									<td>
										<a href="?m=userinfo&id={$owner.id}">{$owner.name}</a>
										<input type="hidden" name="category[usernames][{$right.id}]" value="{$right.name}">
									</td>
									<td class="text-center">
										{if $owner.owner > 0}
											{icon name="permissions"}
										{/if}
									</td>
								</tr>
								{if empty($users[$owner.id].access) && $hide_disabled_users}
									<tr style="display: none;">
										<td colspan="2"></td>
									</tr>
								{/if}
							{/if}
						{/foreach}
					</tbody>
				</table>
			</td>
		</tr>
	<TR>
		<TD COLSPAN="3" class="lms-ui-box-buttons">
			{button icon="helpdesk" label="Tickets" onclick="location.href = '?m=rtqueueview&catid={$category.id}';"}
			{button icon="save" label="Edit" onclick="location.href = '?m=rtcategoryedit&id={$category.id}';"}
			{button id="delete-rtcategory" icon="delete" label="Delete" data_name="{$category.name}"
				data_resource_id=$category.id}
		</TD>
	</TR>
	</TBODY>
</TABLE>
<script>

	$(function() {
		$('#delete-rtcategory').click(function () {
			var name = $(this).attr('data-name');
			confirmDialog($t("Are you sure, you want to remove category '$a'?", name), this).done(function () {
				location.href = '?m=rtcategorydel&id=' + $(this).attr('data-resource-id');
			});
			return false;
		});
	});

</script>
{/block}
