<script language="JavaScript">
<!--
	var me = '{$smarty.server.PHP_SELF}';
	var projectId = '{$project_id}';
	{literal}

	function popupComponent(id) {
		window.open(me + '?op=edit_component&project_id='+projectId+'&use_js=1&id='+id, 'ewin', 'dependent=yes,width=450,height=300,scrollbars=1');
		return false;
	}

	function popupVersion(id) {
		window.open(me + '?op=edit_version&project_id='+projectId+'&use_js=1&id='+id, 'ewin', 'dependent=yes,width=250,height=150,scrollbars=1');
		return false;
	}
	{/literal}
// -->
</script>

<form action="{$smarty.server.PHP_SELF}" method="post">
<input type="hidden" name="id" value="{$project_id}">
<input type="hidden" name="do" value="project">
<table border="0" cellpadding="2" cellspacing="2" width="100%">
	{if $error}
  	<tr>
			<td colspan="2" class="error">{$error}</td>
  	</tr>
	{/if}
	<tr>
		<td valign="top" width="360">
			Name:
			<br>
			<input type="text" size="30" maxlength="30" name="project_name" value="{$project_name|stripslashes}">
		</td>
		<td valign="top" rowspan="3">
			Only users in the following groups can see this project:
			<br>
			<select name="usergroup[]" size="10" multiple>
      	{build_select box=group selected=$project_groups project=1}
      </select>
		</td>
	</tr>
	<tr>
		<td valign="top">
			Description:
			<br>
			<textarea name="project_desc" cols=40 rows=5 wrap=virtual>{$project_desc|stripslashes}</textarea>
		</td>
	</tr>
	<tr>
		<td valign="top">
			Active:
			<br>
			<input type="checkbox" name="active" value="1" {if $active}checked{/if}>
		</td>
	</tr>
</table>
<input type='submit' name='submit' value='Submit'>
</form>
<br>
<table border="0" width="100%">
	<tr>
		<td width="50%" valign="top">
			<br>
			&nbsp;<b>Versions</b> - <a href="{$smarty.server.PHP_SELF}?op=edit_version&project_id={$project_id}&id=0" onClick="return popupVersion(0);">{$STRING.addnew} Version</a>
			<hr size="1">
			<table border="0" cellpadding="2" width="100%">
				<tr>
					<th>Version</th>
					<th>Created</th>
					<th>Active</th>
					<th>Delete</th>
				</tr>
				{section name=version loop=$versions}
				<tr{if $smarty.section.version.iteration is even} class="alt"{/if}>
					<td><a href="{$smarty.server.PHP_SELF}?op=edit_version&id={$versions[version].version_id}" onClick="popupVersion({$versions[version].version_id}); return false;">{$versions[version].version_name|stripslashes}</a></td>
					<td align="center">{$versions[version].created_date|date:DATE_FORMAT}</td>
					<td align="center">{if $versions[version].active}Yes{else}No{/if}</td>
					<td align="center">{if not $versions[version].bug_count}<a href="{$smarty.server.PHP_SELF}?op=del_version&id={$versions[version].version_id}&project_id={$project_id}">Delete</a>{/if}</td>
				</tr>
				{sectionelse}
					<tr>
						<td colspan="4" align="center">{$STRING.noversions}</td>
					</tr>
				{/section}
			</table>
		</td>
		<td width="50%" valign="top">
			<br>
			&nbsp;<b>Components</b> - <a href="{$smarty.server.PHP_SELF}?op=edit_component&project_id={$project_id}&id=0" onClick="return popupComponent(0);">{$STRING.addnew} Component</a>
			<hr size="1">
			<table border="0" cellpadding="2" width="100%">
				<tr>
					<th>Component</th>
					<th>Created</th>
					<th>Active</th>
					<th>Delete</th>
				</tr>
				{section name=component loop=$components}
				<tr{if $smarty.section.component.iteration is even} class="alt"{/if}>
					<td><a href="{$smarty.server.PHP_SELF}?op=edit_component&id={$components[component].component_id}" onClick="popupComponent({$components[component].component_id}); return false;">{$components[component].component_name|stripslashes}</a></td>
					<td align="center">{$components[component].created_date|date:DATE_FORMAT}</td>
					<td align="center">{if $components[component].active}Yes{else}No{/if}</td>
					<td align="center">{if not $components[component].bug_count}<a href="{$smarty.server.PHP_SELF}?op=del_component&id={$components[component].component_id}&project_id={$project_id}">Delete</a>{/if}</td>
				</tr>
				{sectionelse}
					<tr>
						<td colspan="4" align="center">{$STRING.nocomponents}</td>
					</tr>
				{/section}
			</table>
		</td>
	</tr>
</table>
