{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">
	<COLGROUP>
		<COL style="1%;">
		<COL style="1%;">
		<COL style="98%;">
	</COLGROUP>
    <THEAD>
	<TR>
	    <TD>
		{icon name="queue"}
	    </TD>
	    <TD class="bold" colspan="2">{$queue.name} ({$queue.id|string_format:"%04d"})</TD>
	</TR>
    </THEAD>
    <TBODY>
	{if $queue.email}
	<TR>
	    <TD>
		{icon name="mail"}
	    </TD>
	    <TD class="bold">{trans("E-mail:")}</TD>
	    <TD>{$queue.email}</TD>
	</TR>
	{/if}
	{if $queue.description}
	<TR>
	    <TD>
		{icon name="description"}
	    </TD>
	    <TD class="bold">
			{trans("Description:")}
		</TD>
	    <TD>
		<TABLE cellpadding="5">
		    <TR>
			<TD class="fall superlight">
			    {$queue.description|replace:"\n":"<BR>"}
			</TD>
		    </TR>
		</TABLE>
	    </TD>
	</TR>
	{/if}
	<TR>
		<TD>
			{icon name="verifier"}
		</TD>
		<TD class="bold">{trans("<!rt>Verifier:")}</TD>
		<TD>
		{if $queue.verifierid}
			<a href="?m=userinfo&id={$queue.verifier.id}">{$queue.verifier.name}</a>
		{else}
			{trans("None")}
		{/if}
		</TD>
	</TR>
	{if !empty($queue.categories)}
		<TR>
			<TD>
				{icon name="queue"}
			</TD>
			<TD class="bold nobr">
				{trans("Default categories:")}
			</TD>
			<TD>
				<FIELDSET>
					{foreach $queue.categories as $category}{if !$category@first}, {/if}<a href="?m=rtqueueview&catid={$category.categoryid}">{$category.name}</a>{/foreach}
				</FIELDSET>
			</TD>
		</TR>
	{/if}
	{if !empty($queue.uiconfigsection)}
		<tr>
			<td>
				{icon name="configuration"}
			</td>
			<td class="nobr">
				<strong>{trans("<!rt>Configuration section")}</strong>
			</td>
			<td>
				{$queue.uiconfigsection}
			</td>
		</tr>
	{/if}
	<TR>
	    <TD>
		{icon name="user"}
	    </TD>
	    <TD class="bold">{trans("Privileges:")}</TD>
	    <TD>
			<table class="lmsbox lms-ui-background-cycle">
				<colgroup>
					<col style="width: {100-count($_RT_RIGHTS)}%;">
					{foreach $_RT_RIGHTS as $label}
						<col style="width: 1%;">
					{/foreach}
				</colgroup>
				<thead>
					<tr>
						<td>
							<strong>{trans("User")}</strong>
						</td>
						{foreach $_RT_RIGHTS as $label}
							<td class="text-center nobr">
								<strong>{$label}</strong>
							</td>
						{/foreach}
					</tr>
				</thead>
				<tbody>
					{foreach $queue.rights as $right}
						{if $right.rights}
							<tr class="highlight{if empty($right.access)} blend{/if}"
								{if empty($right.access) && $hide_disabled_users} style="display: none;"{/if}>
								<td>
									<a href="?m=userinfo&id={$right.id}">{$right.name}</a>
									<input type="hidden" name="queue[usernames][{$right.id}]" value="{$right.name}">
								</td>
								{foreach $_RT_RIGHTS as $rightvalue => $label}
									<td class="text-center">
										{if ($right.rights & $rightvalue) == $rightvalue}{icon name="permissions"}{/if}
									</td>
								{/foreach}
							</tr>
							{if empty($right.access) && $hide_disabled_users}
								<tr style="display: none;">
									<td colspan="2"></td>
								</tr>
							{/if}
						{/if}
					{/foreach}
				</tbody>
			</table>
	    </TD>
	</TR>
	{if $queue.newticketsubject}
	<TR>
		<TD>
			{icon name="mail"}
		</TD>
		<TD class="bold nobr">{trans("New ticket customer notification subject")}</TD>
		<TD>
			{$queue.newticketsubject|replace:"\n":"<BR>"}
		</TD>
	</TR>
	{/if}
	{if $queue.newticketbody}
	<TR>
		<TD>
			{icon name="edit"}
		</TD>
		<TD class="bold nobr">{trans("New ticket customer notification body")}</TD>
		<TD>
			<TABLE width="100%" cellpadding="5">
				<TR>
					<TD class="fall superlight">
						{$queue.newticketbody|replace:"\n":"<BR>"}
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	{/if}
	{if $queue.newmessagesubject}
	<TR>
		<TD>
			{icon name="mail"}
		</TD>
		<TD class="bold nobr">{trans("New message customer notification subject")}</TD>
		<TD>
			{$queue.newmessagesubject|replace:"\n":"<BR>"}
		</TD>
	</TR>
	{/if}
	{if $queue.newmessagebody}
	<TR>
		<TD>
			{icon name="edit"}
		</TD>
		<TD class="bold nobr">{trans("New message customer notification body")}</TD>
		<TD>
			<TABLE cellpadding="5">
				<TR>
					<TD class="fall superlight">
						{$queue.newmessagebody|replace:"\n":"<BR>"}
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	{/if}
	{if $queue.resolveticketsubject}
	<TR>
		<TD style="width: 1%;">
			{icon name="mail"}
		</TD>
		<TD class="bold nobr">{trans("Resolve ticket customer notification subject:")}</TD>
		<TD>
			{$queue.resolveticketsubject|replace:"\n":"<BR>"}
		</TD>
	</TR>
	{/if}
	{if $queue.resolveticketbody}
	<TR>
		<TD>
			{icon name="edit"}
		</TD>
		<TD class="bold nobr">{trans("Resolve ticket customer notification body:")}</TD>
		<TD>
			<TABLE cellpadding="5">
				<TR>
					<TD class="fall superlight">
						{$queue.resolveticketbody|replace:"\n":"<BR>"}
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	{/if}
	{if $queue.verifierticketsubject}
	<TR>
		<TD>
			{icon name="edit"}
		</TD>
		<TD class="bold nobr">{trans("Ticket verifier notification subject:")}</TD>
		<TD>
			<TABLE cellpadding="5">
				<TR>
					<TD class="fall superlight">
						{$queue.verifierticketsubject|replace:"\n":"<BR>"}
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	{/if}
	{if $queue.verifierticketbody}
	<TR>
		<TD>
			{icon name="edit"}
		</TD>
		<TD class="bold nobr">{trans("Ticket verifier notification body:")}</TD>
		<TD>
			<TABLE cellpadding="5">
				<TR>
					<TD class="fall superlight">
						{$queue.verifierticketbody|replace:"\n":"<BR>"}
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	{/if}
	<TR>
	    <TD COLSPAN="3" class="text-right">
		{button icon="view" href="?m=rtqueueview&id={$queue.id}" label="Browse"}
		{button icon="save" href="?m=rtqueueedit&id={$queue.id}" label="Edit"}
		{if $queue.deleted == 1 && $queue.deltime != 0 && (ConfigHelper::checkPrivilege('helpdesk_advanced_operations'))}
			{button icon="restore" label="Restore<!RT>" id="restore-rtqueue" data_name=$queue.name data_resource_id=$queue.id}
			{button icon="delete" label="Delete permanently" id="remove-rtqueue" data_name=$queue.name data_resource_id=$queue.id}
		{else}
			{button icon="delete" label="Delete" id="delete-rtqueue" data_name=$queue.name data_resource_id=$queue.id}
		{/if}
	    </TD>
	</TR>
    </TBODY>
</TABLE></P>
<script>

	$(function() {
		$('#delete-rtqueue').click(function () {
			var name = $(this).attr('data-name');
			confirmDialog($t("Are you sure, you want to remove queue '$a' and all assigned tickets and messages?", name), this).done(function () {
				location.href = '?m=rtqueuedel&qaction=delete&id=' + $(this).attr('data-resource-id');
			});
		});

		$('#restore-rtqueue').click(function () {
			var name = $(this).attr('data-name');
			confirmDialog($t("Are you sure, you want to restore queue '$a' and all assigned tickets and messages?", name), this).done(function () {
				location.href = '?m=rtrestore&qaction=restore&id=' + $(this).attr('data-resource-id');
			});
		});

		$('#remove-rtqueue').click(function () {
			var name = $(this).attr('data-name');
			confirmDialog($t("Are you sure, you want to permanently remove queue '$a' and all assigned tickets and messages?", name), this).done(function () {
				location.href = '?m=rtremove&qaction=delperm&id=' + $(this).attr('data-resource-id');
			});
		});
	});

</script>
{/block}
