public function testGetEquipmentTypesDropDownShouldSelectPhysics() { $formName = "equips"; $formSize = "1"; $expectedHTML = "<select name=\"".$formName."\" size=\"".$formSize."\">"; $expectedHTML = $expectedHTML . "<option value=\"Geology\">Geology</option>"; $expectedHTML = $expectedHTML . "<option value=\"Geospatial\">Geospatial</option>"; $expectedHTML = $expectedHTML . "<option value=\"Physics\" selected=\"selected\">Physics</option>"; $expectedHTML = $expectedHTML . "<option value=\"Anthropology\">Anthropology</option>"; $expectedHTML = $expectedHTML . "<option value=\"Forensics Institute\">Forensics Institute</option></select>"; $actualHTML = getEquipmentTypesDropDownSelected($formName, $formSize, 'Physics'); $this->assertEquals($expectedHTML, $actualHTML, "Equipment form improperly generated."); }
function getEquipmentTypesDropDown($name, $size) { return getEquipmentTypesDropDownSelected($name, $size, null); }
if (getSessionVariable('user_level') >= RES_USERLEVEL_ADMIN) { } else { die("Error: You don't have permissions to access this page!"); } } else { die("Error: You don't have permissions to access this page!"); } $message = ""; $equipid = 0; if ($pageid == "saveequip") { require 'adminfunctions.php'; saveEquipment($_POST['equipid'], $_POST['name'], $_POST['type'], $_POST['serial'], $_POST['max'], $_POST['minuserlevel'], $_POST['checkoutfrom'], $_POST['description']); $equipid = $_POST['equipid']; $message = "<font color=\"#005500\"><b>Successfully saved this equipment!</b><br><br></font>"; } if ($equipid == 0) { $equipid = $_POST['selector']; } $equip = mysql_fetch_assoc(getEquipmentByID($equipid)); $users = "<select name=\"checkoutfrom\"><option value=\"-1\">None</option>"; $userresult = getAllUsersOrderByName(); while ($row = mysql_fetch_assoc($userresult)) { $selected = false; if ($row['user_id'] == $equip['checkoutfrom']) { $users = $users . "<option value=\"" . $row['user_id'] . "\" SELECTED>" . $row['name'] . "</option>"; } else { $users = $users . "<option value=\"" . $row['user_id'] . "\">" . $row['name'] . "</option>"; } } echo "<center><h3>Edit Equipment</h3>" . $message . "</center>\r\n\r\n\t<form enctype=\"multipart/form-data\" action=\"./index.php?pageid=saveequip\" method=\"post\">\r\n\t<input type=\"hidden\" name=\"equipid\" value=\"" . $equipid . "\">\r\n\t<table class=\"newequip\">\r\n\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=4 class=\"header\">Equipment Information</td>\r\n\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=2 class=\"centeredcellbold\">Name</td>\r\n\t\t\t<td colspan=2 class=\"centeredcell\"><input type=\"text\" size=30 name=\"name\" value=\"" . $equip['name'] . "\"></td>\r\n\t\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=2 class=\"centeredcellbold\">Equipment Type</td>\r\n\t\t\t<td colspan=2 class=\"centeredcell\">" . getEquipmentTypesDropDownSelected("type", 1, $equip['type']) . "</td>\r\n\t\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=2 class=\"centeredcellbold\">Primary Serial Number</td>\r\n\t\t\t<td colspan=2 class=\"centeredcell\"><input type=\"text\" size=30 name=\"serial\" value=\"" . $equip['serial'] . "\"></td>\r\n\t\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=2 class=\"centeredcellbold\">Checkout From</td>\r\n\t\t\t<td colspan=2 class=\"centeredcell\">" . $users . "</td>\r\n\t\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td class=\"centeredcellbold\">Max Length (days)</td>\r\n\t\t\t<td class=\"centeredcell\"><input type=\"text\" size=4 name=\"max\" value=\"" . $equip['max_length'] . "\"></td>\r\n\t\t\t<td class=\"centeredcell\"><b>Minimum User Level</b></td>\r\n\t\t\t<td class=\"centeredcell\">" . getUserLevelDropDownSelected("minuserlevel", $equip['min_user_level']) . "</td>\r\n\t\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=4 class=\"header\">Equipment Description</td>\r\n\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=4 class=\"centeredcell\"><textarea cols=50 rows=10 name=\"description\">" . $equip['description'] . "</textarea></td>\r\n\t\t\r\n\t\t</tr>\r\n\t\t\r\n\t\t<tr>\r\n\t\t\r\n\t\t\t<td colspan=4 class=\"centeredcellbold\"><input type=\"submit\" value=\"save\"></td>\r\n\t\t\r\n\t\t</tr>\r\n\t\r\n\t</table>\r\n\t\r\n\t</form>";
<td colspan=4 class=\"header\">Equipment Information</td> </tr> <tr> <td colspan=2 class=\"centeredcellbold\">Name</td> <td colspan=2 class=\"centeredcell\"><input type=\"text\" size=30 name=\"name\" value=\"".$equip['name']."\"></td> </tr> <tr> <td colspan=2 class=\"centeredcellbold\">Equipment Type</td> <td colspan=2 class=\"centeredcell\">".getEquipmentTypesDropDownSelected("type", 1, $equip['type'])."</td> </tr> <tr> <td colspan=2 class=\"centeredcellbold\">Primary Serial Number</td> <td colspan=2 class=\"centeredcell\"><input type=\"text\" size=30 name=\"serial\" value=\"".$equip['serial']."\"></td> </tr> <tr> <td colspan=2 class=\"centeredcellbold\">Checkout From</td> <td colspan=2 class=\"centeredcell\">".$users."</td>