function editPortForm($headingName, $titleName, $infoArray, $infoKey, $ports = '') { parent::setHeadings($headingName); parent::setTitles($titleName); parent::setData($infoArray); parent::setSortable(false); parent::setDatabase($infoKey); parent::setType($ports); parent::setUpdateValue("updatePort"); return parent::editForm(1); }
function editPortForm($headingName, $titleName, $infoArray, $infoKey, $ports = '') { parent::setHeadings($headingName); parent::setTitles($titleName); parent::setData($infoArray); parent::setSortable(false); parent::setDatabase($infoKey); foreach ($type as $id => $value) { if (is_array($value)) { parent::setType($value); } else { parent::setType($type); break; } } parent::setUpdateValue("updatePort"); return parent::editForm(1); }
function editLocationForm() { return parent::editForm(5); }
function editContactForm() { return parent::editForm(5); }
// or false for not sortable $form->setHeadings($heading); $form->setType($status); $form->setType($location); $form->setType($assign); $form->setTitles($titles); $form->setData($data); $form->setDatabase($keys); $form->setFieldType($fieldType); //set the table size $form->setTableWidth("1024px"); $form->setTitleWidth("20%"); $form->setUpdateValue("searchVLAN"); $form->setUpdateText("Search VLAN"); //create the form echo $form->editForm(); } //show all the vlans if that is called (ALL 4096 VLANS) if ($_GET['action'] == 'showAll') { $vlan_manager = new Vlan_database(); $all_vlans = $vlan_manager->get_all_vlans(); $num_max = 4096; $arr = array(); foreach ($all_vlans as $id => $v_id) { $arr[$v_id] = $id; } //set the default column $form = new Form("auto", 6); //create the headings for these $heading = array("VLAN ID", "Name", "Status", "Location", "Assigned To", "VLAN Distinguisher"); $titles = array();
function add_interface_form() { // This function will be the wizard that allows the user // to add interfaces to an accounting profile // First check if Device ID is set, if not then render device menu if (isset($_POST['device_id'])) { $device = new Device($_POST['device_id']); $all_interfaces = $device->get_interfaces(); $data = array(); $title = array(); foreach ($all_interfaces as $id => $value) { array_push($title, "<input type='checkbox' class='check_pref' name='if_add[]' value='" . $id . "' />"); array_push($data, $value->get_name()); array_push($data, $value->get_alias()); array_push($data, $value->get_oper_status()); } $form = new Form("auto", 4); $heading = array("Select All<input name='all' type='checkbox' value='Select All' onclick=\"checkAll(document.dataForm['if_add[]'],this)\"", "Interface name", "Description", "Status"); $form->setSortable(true); // or false for not sortable $form->setHeadings($heading); $form->setTitles($title); $form->setTitleWidth("50px"); $form->setData($data); $form->setTableWidth("500px"); $content .= "<form action='' id='dataForm' method='POST' name='dataForm'>"; $content .= $form->showForm(); $content .= "<div style='clear:both'></div>\n <INPUT TYPE=SUBMIT VALUE='Add Selected Interfaces' name='addInterfacesToProfile'>\n <INPUT TYPE=hidden NAME=action VALUE='add_device_interface_to_profile'>\n <INPUT TYPE=hidden NAME=tab VALUE='" . $_GET['tab'] . "'>\n <INPUT TYPE=hidden NAME=name VALUE='" . $_POST['name'] . "'>\n <INPUT TYPE=hidden NAME=pluginID VALUE='" . $_GET['pluginID'] . "'>\n <INPUT TYPE=hidden NAME=device_id VALUE='" . $_POST['device_id'] . "'>\n </form>"; $content .= $form->showForm(); print_r($_POST); return $content; } elseif (isset($_POST['addInterfacesToProfile'])) { print "adding ifs!!<br>"; print_r($_POST); } else { // Render device menu $heading = array("Select Device"); $titles = array("Device"); $keys = array("device_id"); $all_devices = Device::get_devices(); $myDropDownListener = "alert('Your gender is '+this.value)"; $fieldType = array("drop_down"); $form = new Form("auto", 2); $form->setHeadings($heading); $form->setTitles($titles); $form->setDatabase($keys); $form->setType($all_devices); $form->setFieldType($fieldType); $form->setUpdateText("Continue to select Interface"); $form->setUpdateValue("select_if"); //$form->setMethod("GET") ; echo $form->editForm(); } return; }
function displayMyPass() { global $tool, $propertyForm; print "<h2>Change password</h2>"; // 1st check if local user $user_id = $_SESSION[userid]; $user_name = $_SESSION[username]; $user = new User($user_id); if (!$user->is_local_user($user_name, 'local')) { print "Sorry this feature is only available for Local users.<br>\n\t\t\tYou are not a local user, most likely an LDAP user. LDAP users have to\n\t\t\tUpdate their account at the LDAP server.<br>"; return; } $form = new Form("auto", 2); $heading = array("<h3>Change Password</h3>"); $titles = array("Current password:"******"New password:"******"Confirm new password:"******"<input name='oldpass' type='password' id='oldpass'>"; $custom2 = "<input name='newpass1' type='password' id='newpass1'>"; $custom3 = "<input name='newpass2' type='password' id='newpass2'>"; $customData = array($custom1, $custom2, $custom3); $fieldType = array("custom", "custom", "custom"); $form->setFieldType($fieldType); $form->setData($customData); $form->setHeadings($heading); $form->setTitles($titles); $form->setDatabase($postkeys); $form->setTableWidth("500px"); $form->setUpdateValue("changePass"); $form->setUpdateText("Save Password"); echo $form->editForm(); }
function displayPaths() { global $tool, $propertyForm; $my_paths = array("path_snmpwalk" => "snmpwalk", "path_snmpget" => "snmpget", "path_rrdupdate" => "rrdupdate", "path_rrdtool" => "rrdtool", "path_rrddir" => "RRD Directory"); $content = ""; $content .= "<h1>System Paths</h1>"; $content .= "<div style='padding-left: 600px;'>\n\t\t\t<a class='tooltip' title='This will try to detect the tools below in the current \$path'><img src='icons/Info.png' height='19'></a>\n\t\t\t<a href='javascript:LoadPage(\"configurations.php?action=paths&mode=autodetect\",\"settingsInfo\")'>\n\t\t\tclick here to Auto Discover paths</a></div>"; $form = new Form("auto", 2); $keyHandlers = array(); $keyData = array(); $keyTitle = array(); $postKeys = array(); foreach ($my_paths as $id => $path) { $property = new Property(); $value = $property->get_property($id); if ($value === false) { $value = "WARNING: Property '{$id}' Not Found in Property table, Contact your admininistrator" . $property->get_error(); } $desc = $property->get_desc($id); if (is_readable($value)) { $check = "<font size='' color='green'>Found!</font>"; if ($id == 'path_rrdtool') { $cmd = "{$value} -v| awk '{print \$2}'|head -1"; exec($cmd, $output, $return_var); if ($output[0] < "1.4") { $check = "<font size='' color='Orange'>Found version {$output['0']}! You need at least RRDtool version 1.4.0 otherwise some graphs won't display correctlty</font>"; } } } else { $check = "<font size='' color='orange'>Not Found!</font>"; } array_push($postKeys, "{$id}"); array_push($keyData, "{$value}"); array_push($keyTitle, "<font size='2'>{$path}</font><br><i>{$desc}</i><br>{$check}"); #$content .= "<tr><td><input type=checkbox name=devices[] value='$id' $checked ></td>"; #$content .= "<td>$name</td><td>". $deviceInfo->get_type_name() ."</td>"; #$content .= "<td>". $deviceInfo->get_location_name() ."</td></tr>"; } #$content .= "</table> <br>"; //get all the device and display them all in the 3 sections "Device Name", "Device Type", "Location". $heading = array("Program", "Path"); $form->setSortable(true); // or false for not sortable $form->setHeadings($heading); $form->setEventHandler($handler); $form->setData($keyData); $form->setTitles($keyTitle); $form->setTableWidth("800px"); $form->setDatabase($postKeys); $form->setUpdateValue("savePaths"); $form->setUpdateText("Save Program Paths"); $content .= $form->editForm(); print $content; }