Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
Bugdar - Commitdiff - ViewGit - Blue Static

Update admin/product.php to use the new admin templates

Robert Sesek [2009-03-24 17:47]
Update admin/product.php to use the new admin templates

* product.php
* templates/nav.html: Link up product.php
* templates/product.html: New file
* templates/product_edit.html: New file
* templates/version_edit.html: New file
diff --git a/admin/product.php b/admin/product.php
index dcd02db..4fac001 100755
--- a/admin/product.php
+++ b/admin/product.php
@@ -19,14 +19,17 @@
 || ###################################################################
 \*=====================================================================*/

+$fetchtemplates = array(
+	'product',
+	'product_edit',
+	'version_edit'
+);
+
 // TODO - add API for product.php

 require_once('./global.php');
 require_once('./includes/functions_datastore.php');

-NavLinks::productsAdd();
-$navigator->set_focus('tab', 'products', null);
-
 if (!can_perform('canadminversions'))
 {
 	admin_login();
@@ -63,7 +66,7 @@ function construct_option_list($type_display, $type, $id, $edit, $addcomponent,

 	$name = $type . '_' . $id;

-	$displayorder = (($displayorder != -1) ? '<input type="text" name="displayorder[' . $name . ']" value="' . $displayorder . '" size="4" class="input" /> ' : '');
+	$displayorder = (($displayorder != -1) ? '<input type="text" name="displayorder[' . $name . ']" value="' . $displayorder . '" size="4" class="input" style="width:25px" /> ' : '');

 	return $displayorder . '<select id="' . $name . '" name="' . $name . '" onchange="exec_action(\'' . $name . '\')" class="input">' . $opt . '</select> <input type="button" class="button" name="gobutton" value="  ' . T('Go') . '  " onclick="exec_action(\'' . $name . '\')" />';
 }
@@ -99,7 +102,7 @@ if ($_REQUEST['do'] == 'deleteversion')

 if ($_REQUEST['do'] == 'insertversion')
 {
-	$db->query("INSERT INTO " . TABLE_PREFIX . "version (productid, version, displayorder, obsolete) VALUES (" . $input->inputClean('productid', TYPE_UINT) . ", '" . $bugsys->input_escape('version') . "', " . $input->inputClean('displayorder', TYPE_UINT) . ", " . $input->inputClean('obsolete', TYPE_UINT) . ")");
+	$db->query("INSERT INTO " . TABLE_PREFIX . "version (productid, version, displayorder, obsolete) VALUES (" . $input->inputClean('productid', TYPE_UINT) . ", '" . $input->input_escape('version') . "', " . $input->inputClean('displayorder', TYPE_UINT) . ", " . $input->inputClean('obsolete', TYPE_UINT) . ")");
 	build_versions();
 	$admin->redirect('product.php?do=modify');
 }
@@ -108,36 +111,15 @@ if ($_REQUEST['do'] == 'insertversion')

 if ($_REQUEST['do'] == 'addversion')
 {
-	NavLinks::productsEdit($input->inputClean('productid', TYPE_UINT));
-	$navigator->set_focus('link', 'products-edit-version', 'products-edit');
-
-	if ($input->in['productid'] != -1)
-	{
-		$product = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->in['productid']);
-		if (!is_array($product))
-		{
-			$admin->error(L_INVALID_ID);
-		}
-	}
-	else
+	$product = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->inputClean('productid', TYPE_UINT));
+	if (!$product)
 	{
-		$input->in['productid'] = 0;
+		$admin->error(L_INVALID_ID);
 	}

-	$admin->page_start(T('Add Version'));
-
-	$admin->form_start('product.php', 'insertversion');
-	$admin->form_hidden_field('productid', $input->in['productid']);
-	$admin->table_start();
-	$admin->table_head(T('Add New Version'));
-	$admin->row_input(T('Version Number<div><dfn>This is the version string for this product.</dfn></div>'), 'version');
-	$admin->row_input(T('Display Order<div><dfn>The order in which the versions are displayed.</dfn></div>'), 'displayorder');
-	$admin->row_yesno(T('Obsolete<div><dfn>An obsolete version cannot have new bugs filed against it, but existing ones can be set to it.</dfn></div>'), 'obsolete', false);
-	$admin->row_submit();
-	$admin->table_end();
-	$admin->form_end();
-
-	$admin->page_end();
+	$tpl = new BSTemplate('version_edit');
+	$tpl->vars['product'] = $product;
+	$tpl->evaluate()->flush();
 }

 // ###################################################################
@@ -149,7 +131,7 @@ if ($_REQUEST['do'] == 'updateversion')
 		$admin->error(T('Please fill in a version number.'));
 	}

-	$db->query("UPDATE " . TABLE_PREFIX . "version SET version = '" . $bugsys->input_escape('version') . "', displayorder = " . $input->inputClean('displayorder', TYPE_UINT) . ", obsolete = " . $input->inputClean('obsolete', TYPE_UINT) . " WHERE versionid = " . $input->inputClean('versionid', TYPE_UINT));
+	$db->query("UPDATE " . TABLE_PREFIX . "version SET version = '" . $input->inputEscape('version') . "', displayorder = " . $input->inputClean('displayorder', TYPE_UINT) . ", obsolete = " . $input->inputClean('obsolete', TYPE_UINT) . " WHERE versionid = " . $input->inputClean('versionid', TYPE_UINT));
 	build_versions();

 	$admin->redirect('product.php?do=modify');
@@ -159,26 +141,15 @@ if ($_REQUEST['do'] == 'updateversion')

 if ($_REQUEST['do'] == 'editversion')
 {
-	$admin->page_start(T('Edit Version'));
+	$tpl = new BSTemplate('version_edit');

-	$version = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "version WHERE versionid = " . $input->inputClean('versionid', TYPE_UINT));
-	if (!is_array($version))
+	$tpl->vars['version'] = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "version WHERE versionid = " . $input->inputClean('versionid', TYPE_UINT));
+	if (!$tpl->vars['version'])
 	{
 		$admin->error(L_INVALID_ID);
 	}

-	$admin->form_start('product.php', 'updateversion');
-	$admin->form_hidden_field('versionid', $version['versionid']);
-	$admin->table_start();
-	$admin->table_head(sprintf(T('Edit Version - %1$s'), $version['version']));
-	$admin->row_input(T('Version Number<div><dfn>This is the version string for this product.</dfn></div>'), 'version', $version['version']);
-	$admin->row_input(T('Display Order<div><dfn>The order in which the versions are displayed.</dfn></div>'), 'displayorder', $version['displayorder']);
-	$admin->row_yesno(T('Obsolete<div><dfn>An obsolete version cannot have new bugs filed against it, but existing ones can be set to it.</dfn></div>'), 'obsolete', $version['obsolete']);
-	$admin->row_submit();
-	$admin->table_end();
-	$admin->form_end();
-
-	$admin->page_end();
+	$tpl->evaluate()->flush();
 }

 // ###################################################################
@@ -221,8 +192,8 @@ if ($_REQUEST['do'] == 'insertproduct')
 		INSERT INTO " . TABLE_PREFIX . "product
 			(title, parentid, description, displayorder)
 		VALUES
-			('" . $bugsys->input_escape('title') . "', " . $input->inputClean('parentid', TYPE_UINT) . ",
-			'" . $bugsys->input_escape('description') . "', " . $input->inputClean('displayorder', TYPE_UINT) . "
+			('" . $input->inputEscape('title') . "', " . $input->inputClean('parentid', TYPE_UINT) . ",
+			'" . $input->inputEscape('description') . "', " . $input->inputClean('displayorder', TYPE_UINT) . "
 		)"
 	);
 	build_products();
@@ -234,30 +205,9 @@ if ($_REQUEST['do'] == 'insertproduct')

 if ($_REQUEST['do'] == 'addproduct')
 {
-	if ($input->inputClean('productid', TYPE_UINT))
-	{
-		NavLinks::productsEdit($input->in['productid']);
-	}
-	else
-	{
-		NavLinks::productsAdd();
-	}
-	$navigator->set_focus('link', 'products-add', 'products');
-
-	$admin->page_start(T('Add New Product'));
-
-	$admin->form_start('product.php', 'insertproduct');
-	$admin->form_hidden_field('parentid', $input->in['productid']);
-	$admin->table_start();
-	$admin->table_head(T('Add Product'));
-	$admin->row_input(T('Title'), 'title');
-	$admin->row_textarea(T('Description<div><dfn>A short description of this product.</dfn></div>'), 'description');
-	$admin->row_input(T('Display Order<div><dfn>The order in which the products are displayed.</dfn></div>'), 'displayorder');
-	$admin->row_submit();
-	$admin->table_end();
-	$admin->form_end();
-
-	$admin->page_end();
+	$tpl = new BSTemplate('product_edit');
+	$tpl->vars['parent'] = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->inputClean('productid', TYPE_UINT));
+	$tpl->evaluate()->flush();
 }

 // ###################################################################
@@ -274,7 +224,7 @@ if ($_REQUEST['do'] == 'updateproduct')
 		$admin->error(L_INVALID_ID);
 	}

-	$db->query("UPDATE " . TABLE_PREFIX . "product SET title = '" . $bugsys->input_escape('title') . "', description = '" . $bugsys->input_escape('description') . "', displayorder = " . $input->inputClean('displayorder', TYPE_UINT) . " WHERE productid = " . $input->inputClean('productid', TYPE_UINT));
+	$db->query("UPDATE " . TABLE_PREFIX . "product SET title = '" . $input->inputEscape('title') . "', description = '" . $input->inputEscape('description') . "', displayorder = " . $input->inputClean('displayorder', TYPE_UINT) . " WHERE productid = " . $input->inputClean('productid', TYPE_UINT));
 	build_products();

 	$admin->redirect('product.php?do=modify');
@@ -284,29 +234,15 @@ if ($_REQUEST['do'] == 'updateproduct')

 if ($_REQUEST['do'] == 'editproduct')
 {
-	NavLinks::productsEdit($input->inputClean('productid', TYPE_UINT));
-	$navigator->set_focus('link', 'products-edit', 'products-edit');
-
-	$admin->page_start(T('Edit Product'));
-
-	$product = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->in['productid']);
-	if (!is_array($product))
+	$tpl = new BSTemplate('product_edit');
+	$tpl->vars['product'] = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->in['productid']);
+	if (!is_array($tpl->vars['product']))
 	{
 		$admin->error(L_INVALID_ID);
 	}
-
-	$admin->form_start('product.php', 'updateproduct');
-	$admin->form_hidden_field('productid', $product['productid']);
-	$admin->table_start();
-	$admin->table_head(sprintf(T('Edit Product - %1$s'), $product['title']));
-	$admin->row_input(T('Title'), 'title', $product['title']);
-	$admin->row_textarea(T('Description<div><dfn>A short description of this product.</dfn></div>'), 'description', $product['description']);
-	$admin->row_input(T('Display Order<div><dfn>The order in which the products are displayed.</dfn></div>'), 'displayorder', $product['displayorder']);
-	$admin->row_submit();
-	$admin->table_end();
-	$admin->form_end();
-
-	$admin->page_end();
+	$tpl->vars['parent'] = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = {$tpl->vars['product']['parentid']}");
+
+	$tpl->evaluate()->flush();
 }

 // ###################################################################
@@ -316,121 +252,50 @@ if ($_POST['do'] == 'displayorder')
 	$input->inputClean('displayorder', TYPE_UINT);
 	if (is_array($input->in['displayorder']))
 	{
-		foreach ($input->in['displayorder'] AS $namebit => $displayorder)
+		foreach ($input->in['displayorder'] as $namebit => $order)
 		{
 			$name = explode('_', $namebit);
-			if ($name[0] == 'product' OR $name[0] == 'version')
+			if ($name[0] == 'product' || $name[0] == 'version')
 			{
-				$id = $bugsys->clean($name[1], TYPE_UINT);
-				$order = $displayorder;
+				$id = $input->clean($name[1], TYPE_UINT);
 				$db->query("UPDATE " . TABLE_PREFIX . "$name[0] SET displayorder = $order WHERE $name[0]id = $id");
 			}
 		}
 		build_products();
 		build_versions();
 	}
-	$admin->redirect('product.php?do=modify');
+
+	admin_flash_redirect('product.php?do=modify');
 }

 // ###################################################################

 if ($_REQUEST['do'] == 'modify')
 {
-	$navigator->set_focus('link', 'products-manage', 'products');
-
-	$admin->page_start(T('Products and Versions'));
-
-	$javascript = <<<EOF
-<script type="text/javascript">
-<!--
-	function exec_action(name)
-	{
-		window.location = document.getElementById(name).value;
-	}
-//-->
-</script>
-EOF;
-
-	$admin->page_code($javascript);
-
-	$admin->form_start('product.php', 'displayorder');
+	$tpl = new BSTemplate('product');

 	$products_get = $db->query("SELECT * FROM " . TABLE_PREFIX . "product ORDER BY displayorder ASC");
-	$products = array();
+	$tpl->vars['products'] = $tpl->vars['components'] = $tpl->vars['version'] = array();
 	foreach ($products_get as $prod)
 	{
 		if (!$prod['parentid'])
 		{
-			$products["$prod[productid]"] = $prod;
+			$tpl->vars['products'][$prod['productid']] = $prod;
 		}
 		else
 		{
-			$components["$prod[parentid]"][] = $prod;
+			$tpl->vars['components'][$prod['parentid']][] = $prod;
 		}
-		$version["$prod[productid]"] = array();
+		$tpl->vars['version'][$prod['productid']] = array();
 	}

 	$versions_get = $db->query("SELECT * FROM " . TABLE_PREFIX . "version ORDER BY displayorder ASC");
-	$versions = array();
 	foreach ($versions_get as $vers)
 	{
-		$versions["$vers[productid]"]["$vers[versionid]"] = $vers;
-	}
-
-	$admin->table_start();
-	$admin->table_head(T('Products / Versions'));
-
-	// Handle our global versions
-	if (is_array($versions['0']))
-	{
-		$admin->row_text(T('Global Versions'), construct_option_list(T('Product'), 'product', -1, 0, 0, 1, 0, -1), 'middle', 2, 'alt3');
-		foreach ($versions['0'] AS $version)
-		{
-			$admin->row_text('-- ' . $version['version'], construct_option_list(T('Version'), 'version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']), 'middle', 2, 'alt2');
-		}
-	}
-
-	// Now let's do the rest of the versions
-	foreach ($products AS $product)
-	{
-		// Product
-		$admin->row_text("<a href=\"product.php?do=editproduct&amp;productid=$product[productid]\">$product[title]</a>", construct_option_list(T('Product'), 'product', $product['productid'], 1, 1, 1, 1, $product['displayorder']), 'middle', 2, 'alt3');
-
-		// Versions
-		if (is_array($versions["$product[productid]"]))
-		{
-			foreach ($versions["$product[productid]"] AS $version)
-			{
-				$admin->row_text('-- ' . $version['version'], construct_option_list(T('Version'), 'version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']), 'middle', 2, 'alt2');
-			}
-		}
-
-		// Components
-		if (is_array($components["$product[productid]"]))
-		{
-			foreach ($components["$product[productid]"] AS $comp)
-			{
-				$admin->row_text("-- <a href=\"product.php?do=editproduct&amp;productid=$comp[productid]\">$comp[title]</a>", construct_option_list(T('Component'), 'component', $comp['productid'], 1, 0, 1, 1, $comp['displayorder']), 'middle', 2, 'alt1');
-
-				// Component versions
-				if (is_array($versions["$comp[productid]"]))
-				{
-					foreach ($versions["$comp[productid]"] AS $version)
-					{
-						$admin->row_text('---- ' . $version['version'], construct_option_list(T('Version'), 'version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']), 'middle', 2, 'alt2');
-					}
-				}
-			}
-		}
+		$tpl->vars['versions'][$vers['productid']][$vers['versionid']] = $vers;
 	}
-
-	$admin->row_submit(null, T('Save Display Order'), null);
-
-	$admin->table_end();
-
-	$admin->form_end();
-
-	$admin->page_end();
+
+	$tpl->evaluate()->flush();
 }

 ?>
\ No newline at end of file
diff --git a/admin/templates/nav.html b/admin/templates/nav.html
index 0b05df3..b70f900 100644
--- a/admin/templates/nav.html
+++ b/admin/templates/nav.html
@@ -19,10 +19,10 @@
 			</ul>
 		</li>

-		<li><%- T('Fields') %></li>
+		<li id="nav_fields"><%- T('Fields') %></li>
 		<li>
 			<ul>
-				<li><a href="product.php"><%- T('Products') %></a></li>
+				<li id="nav_fields_product"><a href="product.php"><%- T('Products') %></a></li>
 				<li><a href="field.php"><%- T('Custom Fields') %></a></li>
 				<li><a href="priority.php"><%- T('Priorities') %></a></li>
 				<li><a href="resolution.php"><%- T('Resolutions') %></a></li>
diff --git a/admin/templates/product.html b/admin/templates/product.html
new file mode 100644
index 0000000..083ae73
--- /dev/null
+++ b/admin/templates/product.html
@@ -0,0 +1,90 @@
+<%- $templates['doctype'] %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
+<head>
+	<%- $templates['headinclude'] %>
+	<title><%- $templates['title'] %> - <%- T('Products and Versions') %></title>
+
+	<script type="text/javascript" charset="utf-8">
+	/*<![CDATA[*/
+		function exec_action(name)
+		{
+			window.location = document.getElementById(name).value;
+		}
+	/*]]>*/
+	</script>
+</head>
+
+<body>
+
+<%- $templates['nav'] %>
+
+<div id="title"><%- T('Products and Versions') %></div>
+
+<div id="body">
+
+<%- admin_flash() %>
+
+<form action="product.php" method="post">
+<input type="hidden" name="do" value="displayorder" />
+
+<table>
+<thead>
+	<tr><td colspan="2"><%- T('Products / Versions') %></td></tr>
+</thead>
+
+<% foreach ($products as $product): %>
+<tr class="headings">
+	<td><a href="product.php?do=editproduct&amp;productid=<%- $product['productid'] %>"><%- $product['title'] %></a></td>
+	<td><%- construct_option_list(T('Product'), 'product', $product['productid'], 1, 1, 1, 1, $product['displayorder']) %></td>
+</tr>
+
+	<!-- non-component versions -->
+	<% foreach ($versions[$product['productid']] as $version): %>
+	<tr class="alt2">
+		<td>-- <%- $version['version'] %></td>
+		<td><%- construct_option_list(T('Version'), 'version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']) %></td>
+	</tr>
+	<% endforeach %>
+	<!-- / non-component versions -->
+
+	<!-- components -->
+	<% if (is_array($components[$product['productid']])): %>
+	<% foreach ($components[$product['productid']] as $comp): %>
+	<tr class="alt1">
+		<td>-- <a href="product.php?do=editproduct&amp;productid=<%- $comp['productid'] %>"><%- $comp['title'] %></a></td>
+		<td><%- construct_option_list(T('Component'), 'component', $comp['productid'], 1, 0, 1, 1, $comp['displayorder']) %></td>
+	</tr>
+
+		<!-- component versions -->
+		<% if (is_array($versions[$comp['productid']])): %>
+		<% foreach ($versions[$comp['productid']] as $version): %>
+		<tr class="alt2">
+			<td>---- <%- $version['version'] %></td>
+			<td><%- construct_option_list(T('Version'), 'version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']) %></td>
+		</tr>
+		<% endforeach %>
+		<% endif %>
+		<!-- / component versions -->
+	<% endforeach %>
+	<% endif  %>
+	<!-- / components -->
+<% endforeach %>
+<tr class="submit">
+	<td colspan="2" style="text-align:center">
+		<a href="product.php?do=addproduct" class="button"><%- T('Add New Product') %></a>
+		<input type="submit" value="<%- T('Save Display Order') %>" />
+	</td>
+</tr>
+</table>
+
+</form>
+
+<%- admin_footer() %>
+
+</div>
+
+<script type="text/javascript"> nav_init("fields", "fields_product"); </script>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/admin/templates/product_edit.html b/admin/templates/product_edit.html
new file mode 100644
index 0000000..82e0879
--- /dev/null
+++ b/admin/templates/product_edit.html
@@ -0,0 +1,71 @@
+<%- $templates['doctype'] %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
+<head>
+	<%- $templates['headinclude'] %>
+	<title><%- $templates['title'] %> - <%- T('Manage Products') %></title>
+</head>
+
+<body>
+
+<%- $templates['nav'] %>
+
+<div id="title"><%- T('Manage Products') %></div>
+
+<div id="body">
+
+<%- admin_flash() %>
+
+<form action="product.php" method="post">
+<input type="hidden" name="do" value="<%- ($product ? 'updateproduct' : 'insertproduct') %>" />
+<% if ($product): %><input type="hidden" name="productid" value="<%- $product['productid'] %>" /><% endif %>
+<% if (!$product): %><input type="hidden" name="parentid" value="<%- $parent['productid'] %>" /><% endif %>
+
+<fieldset>
+	<legend><%- ($product ? T('Edit Product') : T('Add New Product')) %></legend>
+
+	<dl>
+
+	<% if ($parent): %>
+	<dt><label><%- T('Component for Product') %></label></dt>
+	<dd><%- $parent['title'] %></dd>
+	<% endif %>
+
+	<dt><label for="l_title"><%- T('Title') %></label></dt>
+	<dd><input type="text" name="title" value="<%- $product['title'] %>" id="l_title" /></dd>
+
+	<dt>
+		<label for="description">
+			<%- T('Description') %>
+			<dfn><%- T('A short description of this product.') %></dfn>
+		</label>
+	</dt>
+	<dd><textarea name="description" id="description"><%- $product['description'] %></textarea></dd>
+
+	<dt>
+		<label for="displayorder">
+			<%- T('Display Order') %>
+			<dfn><%- T('The order in which the products are displayed.') %></dfn>
+		</label>
+	</dt>
+	<dd><input type="text" name="displayorder" value="<%- $product['displayorder'] %>" id="displayorder" /></dd>
+
+	</dl>
+</fieldset>
+
+<div class="submit">
+	<input type="submit" value="<%- T('Save') %>" />
+	<input type="reset" value="<%- T('Reset') %>" />
+	<% if ($product): %><a href="product.php?do=deleteproduct&amp;productid=<%- $product['versionid'] %>" class="button"><%- T('Delete') %></a><% endif %>
+</div>
+
+<%- admin_footer() %>
+
+</div>
+
+</body>
+
+<script type="text/javascript"> nav_init("fields", "fields_product"); </script>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/admin/templates/version_edit.html b/admin/templates/version_edit.html
new file mode 100644
index 0000000..49aca9f
--- /dev/null
+++ b/admin/templates/version_edit.html
@@ -0,0 +1,76 @@
+<%- $templates['doctype'] %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
+<head>
+	<%- $templates['headinclude'] %>
+	<title><%- $templates['title'] %> - <%- ($version ? T('Edit Version') : T('Add New Version')) %></title>
+</head>
+
+<body>
+
+<%- $templates['nav'] %>
+
+<div id="title"><%- ($version ? T('Edit Version') : T('Add New Version')) %></div>
+
+<div id="body">
+
+<%- admin_flash() %>
+
+<form action="product.php" method="post">
+<input type="hidden" name="do" value="<%- ($version ? 'updateversion' : 'insertversion') %>" />
+<% if ($version): %><input type="hidden" name="versionid" value="<%- $version['versionid'] %>" /><% endif %>
+<% if (!$version): %><input type="hidden" name="productid" value="<%- $product['productid'] %>" /><% endif %>
+
+<fieldset>
+	<legend><%- ($version ? T('Edit Version') : T('Add New Version')) %></legend>
+
+	<dl>
+
+	<% if (!$version): %>
+	<dt><label><%- T('Version for Product') %></label></dt>
+	<dd><%- $product['title'] %></dd>
+	<% endif %>
+
+	<dt>
+		<label for="version">
+			<%- T('Version Number') %>
+			<dfn><%- T('This is the version string for this product.') %></dfn>
+		</label>
+	</dt>
+	<dd><input type="text" name="version" value="<%- $version['version'] %>" id="version" /></dd>
+
+	<dt>
+		<label for="displayorder">
+			<%- T('Display Order') %>
+			<dfn><%- T('The order in which the versions are displayed.') %></dfn>
+		</label>
+	</dt>
+	<dd><input type="text" name="displayorder" value="<%- $version['displayorder'] %>" id="displayorder" /></dd>
+
+	<dt>
+		<label for="obsolete">
+			<%- T('Obsolete') %>
+			<dfn><%- T('An obsolete version cannot have new bugs filed against it, but existing ones can be set to it.') %></dfn>
+		</label>
+	</dt>
+	<dd><%- BSDecorator::yesno('obsolete', $version['obsolete']) %></dd>
+
+	</dl>
+</fieldset>
+
+<div class="submit">
+	<input type="submit" value="<%- T('Save') %>" />
+	<input type="reset" value="<%- T('Reset') %>" />
+	<% if ($version): %><a href="product.php?do=deleteversion&amp;versionid=<%- $version['versionid'] %>" class="button"><%- T('Delete') %></a><% endif %>
+</div>
+
+<%- admin_footer() %>
+
+</div>
+
+</body>
+
+<script type="text/javascript"> nav_init("fields", "fields_product"); </script>
+
+</body>
+
+</html>
\ No newline at end of file