{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<!--// $Id$ //-->
<H1>{$layout.pagetitle}</H1>
<script type="text/javascript">
<!--
	function setSelectionRange(input, selectionStart, selectionEnd)
	{
		if (input.setSelectionRange)
		{
			input.focus();
			input.setSelectionRange(selectionStart, selectionEnd);
		}
		else if (input.createTextRange)
		{
			var range = input.createTextRange();
			range.collapse(true);
			range.moveEnd('character', selectionEnd);
			range.moveStart('character', selectionStart);
			range.select();
		}
	}

	function replaceSelection (input, replaceString)
	{
		if (input.setSelectionRange)
		{
			var selectionStart = input.selectionStart;
			var selectionEnd = input.selectionEnd;
			var scrollTop = input.scrollTop; // fix scrolling issue with Firefox

			input.value = input.value.substring(0, selectionStart)+ replaceString + input.value.substring(selectionEnd);
			input.scrollTop = scrollTop;

			if (selectionStart != selectionEnd)
			{
				setSelectionRange(input, selectionStart, selectionStart + replaceString.length);
			} else {
				setSelectionRange(input, selectionStart + replaceString.length, selectionStart + replaceString.length);
			}
		}
		else if (document.selection)
		{
			var range = document.selection.createRange();
			if (range.parentElement() == input)
			{
				var isCollapsed = range.text == '';
				range.text = replaceString;
				if (!isCollapsed)
				{
					range.moveStart('character', -replaceString.length);
					range.select();
				}
			}
		}
	}

	// We are going to catch the TAB key so that we can use it, Hooray!
	function catchTab(item,e)
	{
		if(document.forms['config'].elements['config[var]'].value != 'script')
			return;

		c = e.which ? e.which : e.keyCode;

		if (c == 9)
		{
			replaceSelection(item, String.fromCharCode(9));
			setTimeout("document.getElementById('"+item.id+"').focus();", 0);
			return false;
		}
	}
//-->
</script>
<P><FORM method="POST" action="?m=daemonconfigedit&id={$config.id}" name="config">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <THEAD>
	<TR>
		<TD width="1%">
			<img src="img/settings.gif" alt="">
		</TD>
		<TD width="1%">
			<B>{trans("Name:")}</B>
		</TD>
		<TD width="98%">
			<INPUT type="text" name="config[var]" value="{$config.var}" {tip text="Enter option name" trigger="var" bold=1}>
		</TD>
	</TR>
    </THEAD>
    <TBODY>
	<TR>
		<TD width="1%">
			<img src="img/settings.gif" alt="">
		</TD>
		<TD width="1%">
			<B>{trans("Value:")}</B>
		</TD>
		<TD width="98%">
			<TEXTAREA rows="20" cols="100" name="config[value]" id="config[value]" onkeydown="return catchTab(this,event)" {tip text="Enter option value" trigger="value"}>{$config.value}</TEXTAREA>
		</TD>
	</TR>
	<TR>
		<TD width="1%">
			<img src="img/info.gif" alt="">
		</TD>
		<TD width="1%">
			<B>{trans("Description:")}</B>
		</TD>
		<TD width="98%">
			<TEXTAREA rows="5" cols="100" name="config[description]" {tip text="Enter additional information (optional)" trigger="description"}>{$config.description}</TEXTAREA>
		</TD>
	</TR>
	<TR>
		<TD width="1%">
			<img src="img/wait.gif" alt="">
		</TD>
		<TD width="1%">
			<B>{trans("Status:")}</B>
		</TD>
		<TD width="98%">
			<INPUT type="checkbox" name="config[disabled]" value="1" {if $config.disabled} CHECKED{/if}{tip text="You can turn it off"}> {trans("Off")}
		</TD>
	</TR>
	<TR>
		<TD align="right" colspan="3">
			<A href="javascript:document.config.submit();" accesskey="s">{trans("Submit")} <img src="img/save.gif" alt=""></A>
			<A href="?m=daemoninstanceview&id={$config.instanceid}">{trans("Cancel")} <img src="img/cancel.gif" alt=""></A>
		</TD>
	</TR>
    </TBODY>
</TABLE>
</P>
<SCRIPT type="text/javascript">
<!--
$(function() {
	$('form[name="config"] [name="config[var]"]').focus();
});
//-->
</SCRIPT>
{/block}
