<form id="application-form">
	<div class="inside-wrapper">
        <div class="show-help"><a class="show-configuration-help" target="_blank" href="/applications/admin/help/application.html">Help</a></div>
		<table class="normalrightcolumn applicationform">
			<tr>
				<th><label for="name">Name</label></th>
				<td><input type="text" id="name" name="name" value="<%-values.name ? values.name : ''%>" /></td>
			</tr>
			<tr class="closable">
				<th><label for="description">Description</label></th>
				<td><textarea id="description" name="description" cols="30" rows="4"><%-values.description ? values.description : ''%></textarea></td>
			</tr>
			<tr>
				<th><label for="framework-name">Framework</label></th>
				<td>
					<table class="inner">
						<tr>
							<th>Name</th>
							<th>Base configuration</th>
						</tr>
						<tr>
							<td>
								<select id="framework-name" name="framework-name">
									<%
								_.each(frameworks, function (value, key) {%>
									<option value="<%-key%>" <%= values.framework !== undefined && values.framework['name'] == key ? 'selected="selected"' : ''%>><%-key%></option>
									<%});%>
								</select>
							</td>
							<td>
								<select id="framework-configuration" name="framework-configuration" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr class="closable <%- values.framework_configuration ? '' : 'closed'%> even">
				<th><label for="framework_configuration">Optional additional framework configuration</label></th>
				<td>
					<p class="allwidth"><a href="#" id="add-framework_configuration">Add another attribute</a></p>
					<table class="inner shortrightcolumn" id="framework_configuration">
						<tr>
							<th>Key</th>
							<th>Value</th>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<th><label for="controller">Controller</label></th>
				<td>
					<table class="inner">
						<tr>
							<th>Required?</th>
							<th class="controller-details">Name</th>
							<th class="controller-details">Base configuration</th>
							<th class="controller-details">Survive crash?</th>
						</tr>
						<tr>
							<td>
								<% if(!values.controller) {%>
								<label for="controller-is">NO</label><input type="checkbox" name="controller-is" id="controller-is" value="true" />
								<%} else {%>
								<label for="controller-is">YES</label><input type="checkbox" checked="checked" name="controller-is" id="controller-is" value="true" />
								<%}%>
							</td>
							<td class="controller-details">
								<select id="controller-name" name="controller-name">
									<%
								_.each(controllers, function (value, key) {%>
									<option value="<%-key%>" <%= values.controller !== undefined && values.controller['name'] == key ? 'selected="selected"' : ''%>><%-key%></option>
									<% }); %>
								</select>
							</td class="controller-details">
							<td class="controller-details">
								<select id="controller-configuration" name="controller-configuration" />
							</td>
							<td class="controller-details">
								<% if(values.controller && values.controller.survive_controller === true) {%>
								<label for="controller-survive_controller">YES</label><input type="checkbox" name="controller-survive_controller" id="controller-survive_controller" value="true" checked="checked" />
								<%} else {%>
								<label for="controller-survive_controller">NO</label><input type="checkbox" name="controller-survive_controller" id="controller-survive_controller" value="true" />
								<%}%>
							</td>
						</tr>
					</table>
					<br />
					<p class="controller-details allwidth"><label for="controller_configuration">Optional additional controller configuration</label> (<a href="#" id="add-controller_configuration">Add another attribute</a>)</p>
					<table class="inner controller-details shortrightcolumn" id="controller_configuration">
						<tr>
							<th>Key</th>
							<th>Value</th>
						</tr>
					</table>
				</td>
			</tr>
			<tr class="closable">
				<th><label for="runtime">Platforms</label></th>
				<td>
					<table class="inner platforms">
						<tr>
							<th>Platform</th>
							<th>Settings</th>
						</tr>
						<% _.each(platforms, function (p) { %>
						<tr>
							<td>
								<label for="runtime-is-<%-p%>"><%-p%></label><input <%= values.runtime !== undefined && values.runtime[p] !== undefined ? 'checked="checked"' : ''%> class="notextchange runtime-is" type="checkbox" id="runtime-is-<%-p%>" name="runtime-is-<%-p%>" value="true" />
							</td>
							<td>
								<div class="runtime-configuration-details" id="runtime-configuration-details-<%-p%>">
									<p class="allwidth"><label for="runtime-<%-p%>"><%-p.firstUpper() %> configuration</label> (<a href="#" id="add-runtime-<%-p%>">Add another attribute</a>)</p>
									<table class="inner shortrightcolumn" id="runtime-<%-p%>">
										<tr>
											<th>Key</th>
											<th>Value</th>
										</tr>
									</table>
								</div>
							</td>
						</tr>
						<% }); %>
					</table>
				</td>
			</tr>
			<tr class="closable">
				<th><label for="parameters">Parameters</label></th>
				<td>
					<p class="allwidth"><a href="#" id="add-parameters">Add another parameter</a></p>
					<div id="parameters">
					</div>
				</td>
			</tr>
			<tr>
				<th>Visible?</th>
				<td><% if(values.visible || values.visible === undefined) {%>
					<label for="visible">YES</label><input type="checkbox" value="true" name="visible" id="visible" checked="checked" />
					<% } else { %>
					<label for="visible">NO</label><input type="checkbox" value="true" name="visible" id="visible" />
					<% } %>
				</td>
			</tr>
		</table>
	</div>
	<table class="buttons">
		<tr>
			<td><button type="reset" id="form-discard">Discard changes</button></td>
			<td><button type="submit" id="form-submit"><%-action.firstUpper() %></button></td>
		</tr>
	</table>
	<% if (values.id) { %>
	<input type="hidden" id="aid" name="aid" value="<%-values.id%>" />
	<% } %>
</form>
<a class="invisible" id="overlay-close" href="">Close</a>
