<inp2:adm_SetPopupSize width="1000" height="650"/>
<inp2:m_include t="incs/header"/>

<inp2:m_RenderElement name="combined_header" section="in-portal:system_logs" prefix="system-log" title_preset="system_log_edit"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  	<td>
  		<script type="text/javascript">
				a_toolbar = new ToolBar();

				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Close" escape="1"/>', function() {
						submit_event('system-log', 'OnCancel');
					}
				));

				a_toolbar.AddButton( new ToolBarSeparator('sep1') );

				a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
							go_to_id('system-log', '<inp2:system-log_PrevId/>');
						}
				));

				a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
							go_to_id('system-log', '<inp2:system-log_NextId/>');
						}
				));

				a_toolbar.Render();

				<inp2:m_if check="system-log_IsSingle">
					a_toolbar.HideButton('prev');
					a_toolbar.HideButton('next');
					a_toolbar.HideButton('sep1');
				<inp2:m_else/>
					<inp2:m_if check="system-log_IsLast">
						a_toolbar.DisableButton('next');
					</inp2:m_if>
					<inp2:m_if check="system-log_IsFirst">
						a_toolbar.DisableButton('prev');
					</inp2:m_if>
				</inp2:m_if>
			</script>
		</td>
	</tr>
</tbody>
</table>

<inp2:system-log_SaveWarning name="grid_save_warning"/>
<inp2:system-log_ErrorWarning name="form_error_warning"/>

<style type="text/css">
	.control-cell {
		font-size: 12px;
	}

	.highlight-area {
		border: 1px solid black;
		padding: 8px;
		font-family: serif;
		background-color: #F6F6F6;
		overflow: auto;
	}

	.log_backtrace {
		margin: 0;
		padding-left: 25px;
	}

	.log_backtrace div {
		margin: 4px 0;
	}
</style>

<inp2:m_DefineElement name="inp_serialized_label">
	<inp2:m_RenderElement design="form_row" pass_params="1">
		<td class="control-cell" valign="top">
			<div class="highlight-area" style="width: 760px; height: 234px;">
				<inp2:{$prefix}_PrintArray field="$field"/>
			</div>
		</td>
	</inp2:m_RenderElement>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="backtrace_element">
	<li>
		<inp2:m_if check="m_Param" name="has_args">
			<a href="#" title="<inp2:m_Phrase name='hint:la_LogBacktraceFunction' html_escape='1'/>" trace_index="<inp2:m_Param name='index'/>"><inp2:m_Phrase name="la_LogBacktraceFunction"/>:</a> <inp2:m_Param name="file_info"/>

			<div class="highlight-area" style="display: none;" id="trace_args_<inp2:m_Param name='index'/>">
				<inp2:m_Param name="args"/>
			</div>
		<inp2:m_else/>
			<inp2:m_Phrase name="la_LogBacktraceFunction"/>: <inp2:m_Param name="file_info"/>
		</inp2:m_if>
	</li>
</inp2:m_DefineElement>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" title="la_title_General"/>
			<inp2:m_RenderElement name="inp_id_label" prefix="system-log" field="LogId" title="la_fld_Id"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogLevel"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogType"/>

			<inp2:m_if check="system-log_Field" name="LogCode" db="db">
				<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogCode"/>
			</inp2:m_if>

			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogMessage" no_special="no_special"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogTimestamp"/>

		<inp2:m_RenderElement name="subsection" title="la_title_LogRequest"/>
			<inp2:m_if check="system-log_Field" name="IpAddress" db="db">
				<inp2:m_RenderElement name="inp_label" prefix="system-log" field="IpAddress"/>
			</inp2:m_if>

			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogHostname"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogInterface"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogRequestSource"/>

			<inp2:m_RenderElement design="form_row" prefix="system-log" field="LogRequestURI">
				<td class="control-cell" valign="top">
					<inp2:$prefix_RequestURI/>
				</td>
			</inp2:m_RenderElement>

			<inp2:m_if check="system-log_Field" name="LogRequestData" db="db">
				<inp2:m_RenderElement name="inp_serialized_label" prefix="system-log" field="LogRequestData"/>
			</inp2:m_if>

		<inp2:m_RenderElement name="subsection" title="la_title_LogSession"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="Username"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogSessionKey"/>

			<inp2:m_if check="system-log_Field" name="LogSessionData" db="db">
				<inp2:m_RenderElement name="inp_serialized_label" prefix="system-log" field="LogSessionData"/>
			</inp2:m_if>

		<inp2:m_RenderElement name="subsection" title="la_title_LogSource"/>
			<inp2:m_RenderElement design="form_row" prefix="system-log" field="LogSourceFilename">
				<td class="control-cell" valign="top">
					<strong><inp2:$prefix_Filename/></strong> <inp2:m_Phrase name="la_OnLine"/> <strong><inp2:$prefix_Field field="LogSourceFileLine"/></strong>
				</td>
			</inp2:m_RenderElement>

			<inp2:m_if check="system-log_Field" name="LogEventName" db="db">
				<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogEventName"/>
			</inp2:m_if>

			<inp2:m_if check="system-log_Field" name="LogBacktrace" db="db">
				<inp2:m_RenderElement design="form_row" prefix="system-log" field="LogBacktrace">
					<td class="control-cell" valign="top">
						<ol class="log_backtrace">
							<inp2:$prefix_PrintBacktrace render_as="backtrace_element" include_args="1"/>
						</ol>
					</td>
				</inp2:m_RenderElement>
			</inp2:m_if>

		<inp2:m_RenderElement name="subsection" title="la_title_LogOther"/>
			<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogProcessId"/>

			<inp2:m_RenderElement design="form_row" prefix="system-log" field="LogMemoryUsed">
				<td class="control-cell" valign="top">
					<strong><inp2:$prefix_MemoryUsage/></strong> (<inp2:{$prefix}_Field field="$field"/> bytes)
				</td>
			</inp2:m_RenderElement>

			<inp2:m_if check="system-log_Field" name="LogUserData" db="db">
				<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogUserData" nl2br="1"/>
			</inp2:m_if>

			<inp2:m_if check="system-log_Field" name="LogNotificationStatus" db="db">
				<inp2:m_RenderElement name="inp_edit_radio" prefix="system-log" field="LogNotificationStatus"/>
			</inp2:m_if>
		<inp2:m_RenderElement name="inp_edit_filler"/>
	</table>
</div>

<script type="text/javascript">
	$(document).ready(function () {
		$('a', '.log_backtrace').click(function () {
			$('#trace_args_' + $(this).attr('trace_index')).toggle();

			return false;
		});
	});
</script>

<inp2:m_include t="incs/footer"/>