Example #1
0
 private function renderFirewallCounterForm()
 {
     $content = '<h2>Firewall Counters</h2>';
     $allDevices = Device::get_devices();
     //$allDevices = array();
     asort($allDevices);
     $getdeviceID = "";
     if (isset($_GET['deviceID'])) {
         $getdeviceID = $_GET['deviceID'];
     }
     $getFrom = "-1d";
     if (isset($_GET['From'])) {
         $getFrom = $_GET['From'];
     }
     $form = new Form("auto", 2);
     $values = array();
     $handler = array();
     $titles = array("Device", "Time Frame", "tab", "pluginID");
     $postKeys = array("deviceID", "From", "tab", "pluginID");
     array_push($values, $getdeviceID, $getFrom, $_GET['tab'], $_GET['pluginID']);
     $heading = array("Select location");
     $fieldType[0] = "drop_down";
     $fieldType[1] = "drop_down";
     $fieldType[2] = "hidden";
     $fieldType[3] = "hidden";
     $form->setType($allDevices);
     $allFrom = array();
     $allFrom["-1h"] = "Past 1 Hour";
     $allFrom["-1d"] = "Past 1 Day";
     $allFrom["-1w"] = "Past 1 Week";
     $allFrom["-1y"] = "Past 1 Year";
     $form->setType($allFrom);
     $form->setFieldType($fieldType);
     $form->setSortable(false);
     $form->setHeadings($heading);
     $form->setTitles($titles);
     $form->setData($values);
     $form->setDatabase($postKeys);
     //set the table size
     $form->setTableWidth("100");
     $form->setTitleWidth("20%");
     $form->setUpdateValue("GetCounters");
     $form->setUpdateText("Get Counters");
     $form->setMethod("GET");
     $content .= $form->EditForm(1);
     $content .= "<div style=\"clear:both;\"></div> </p>";
     return $content;
 }
Example #2
0
 function render_edit_accounting_profile()
 {
     // Include contact class
     if (isset($_GET['pid']) && is_numeric($_GET['pid'])) {
         $pid = $_GET['pid'];
     } else {
         return "<b>Sorry invalid profile id " . $_GET['pid'] . "</b>";
     }
     $allGroups = Contact::get_groups();
     $query = "Select title, client_id, notes, traffic_cap\n\t\t\tFROM accounting_profiles\n\t\t\tWHERE profile_id = '{$pid}'";
     $result = mysql_query($query);
     if (!$result) {
         return "<b>Sorry something went wrong</b>" . mysql_error() . $query;
     }
     $obj = mysql_fetch_object($result);
     $thisGroup = new Contact($obj->client_id);
     $groupName = $thisGroup->get_name();
     $values = array($obj->title, "{$groupName}", $this->int_to_si($obj->traffic_cap), $obj->notes);
     $content .= "<h1>Accounting Profiles</h1>";
     $form = new Form("auto", 2);
     $heading = array("Edit Accounting Profile");
     $titles = array("Name", "Client", "Traffic Cap.tip.Configured cap or Contracted rate.<br>Examples 100M, 2M, 1G, 155M, 800K", "Notes");
     $post_keys = array("Name", "Client", "TrafficCap", "Notes");
     $form->setType($allGroups);
     // Drop down
     $fieldType = array(1 => "drop_down", 3 => "text_area");
     $form->setFieldType($fieldType);
     $form->setSortable(false);
     $form->setHeadings($heading);
     $form->setTitles($titles);
     $form->setDatabase($post_keys);
     $form->setData($values);
     //set the table size
     $form->setTableWidth("1024px");
     $form->setTitleWidth("20%");
     $content .= $form->EditForm(1);
     return $content;
 }
Example #3
0
function displayService($services)
{
    //global all variables
    global $serviceKey, $serviceForm, $tool, $headings, $titles, $serviceTypes, $location, $status_array;
    $serviceForm->setCols(2);
    //make the tool bar for this page
    if ($_SESSION['access'] >= 50) {
        $toolNames = array("Edit Service", "Delete Service");
        $toolIcons = array("edit", "delete");
        $toolHandlers = array("handleEvent('services.php?action=edit&ID={$_GET['ID']}', 'devicePart');", "handleEvent('services.php?action=remove&ID={$_GET['ID']}')");
        echo $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
    }
    //check the service layer and display according to the layer
    //if the layer is 3
    if ($services->get_service_layer() == 3) {
        //store the values in the heading and title array
        $headings = array("Service Information", "*<break>*", "Port Specific Information", "*<break>*", "Routing Specific Information", "*<break>*", "IPv4 Information", "*<break>*", "IPv6 Information");
        $titles = array("Customer name", "Customer ID", "Service type", "Service ID", "Include statistics in portal?.tip.If YES is selected the user will be able to see the statistics for this particular service in the wiki portal. If this is not selected, traffic stats for this service will not be available in the wiki portal", "Service description (name).tip.A useful description for this service", "Notes.tip.Here you can add generic notes for this service, for example: This is a tempory backup connection.", "Status.tip.Specifies the production status of this Service", "In production date", "Out of production date", "*<break>*", "Device for Service", "Interface.tip.Name of the physical interface, for example ge-2/0/1<br>Do not use subinterface format no ge-2/0/1.10", "Interface MTU Size.tip.Default for ORAN and CU_ALL is 9000 bytes, the commodity and IX instance use 1500", "Interface tagged", "Vlan number.tip.Please enter a vlan number. If this is an untagged routed port and has no vlan, than please use 0. This means no vlan configuration", "*<break>*", "Logical router", "Routing type", "AS number", "Traffic Policing", "*<break>*", "IPv4 unicast", "IPv4 multicast", "BCNET router address.tip.IPv4 address of the BCNET side of this link. Please include masklenght. Format: x.x.x.x/30", "Customer router address.tip.IPv4 address of the Customer side of this link. Please include masklenght. Format: x.x.x.x/30", "IPv4 prefix", "*<break>*", "IPv6 unicast", "IPv6 multicast", "BCNET router address", "Customer router address", "IPv6 prefix");
        $layer3Service = new Layer3_service($services->get_service_id());
        //add all the prefixes for ipv4 and ipv6 together
        foreach (array_keys($layer3Service->get_prefixes(4)) as $prefix) {
            $address4Prefix .= $prefix . "<br />";
        }
        foreach (array_keys($layer3Service->get_prefixes(6)) as $prefix) {
            $address6Prefix .= $prefix . "<br />";
        }
        //switch the values into strings
        $layer3Service->get_portal_statistics() == 1 ? $stats = 'Yes' : ($stats = 'No');
        $layer3Service->get_tagged() == 1 ? $tagged = 'Tagged' : ($tagged = 'Untagged');
        $layer3Service->get_ipv4_unicast() == 1 ? $uni4 = 'True' : ($uni4 = 'False');
        $layer3Service->get_ipv4_multicast() == 1 ? $multi4 = 'True' : ($multi4 = 'False');
        $layer3Service->get_ipv6_unicast() == 1 ? $uni6 = 'True' : ($uni6 = 'False');
        $layer3Service->get_ipv6_multicast() == 1 ? $multi6 = 'True' : ($multi6 = 'False');
        //store the values in the info
        $info = array($layer3Service->get_contact_name(), $layer3Service->get_contact_id(), $layer3Service->get_service_type_name(), $layer3Service->get_service_id(), $stats, $layer3Service->get_name(), $layer3Service->get_notes(), $layer3Service->get_status(), $layer3Service->get_in_production_date(), $layer3Service->get_out_production_date(), $layer3Service->get_pe_name(), $layer3Service->get_port_name(), $layer3Service->get_mtu(), $tagged, $layer3Service->get_vlan_id(), $layer3Service->get_logical_router(), $layer3Service->get_routing_type(), $layer3Service->get_bgp_as(), $layer3Service->get_traffic_policing(), $uni4, $multi4, $layer3Service->get_pe_address(4), $layer3Service->get_ce_address(4), $address4Prefix, $uni6, $multi6, $layer3Service->get_pe_address(6), $layer3Service->get_ce_address(6), $address6Prefix);
    } elseif ($services->get_service_layer() == 2) {
        //store the values in the heading and title array
        $headings = array("Service Information", "*<break>*", "Layer 2 Specific Information");
        $titles = array("Customer name", "Customer ID", "Service type", "Service ID", "Include statistics in portal?", "Service description (name)", "Notes", "Status.tip.Specify the production status of this Service", "In production date", "Out of production date", "*<break>*", "Vlan number");
        $layer2Service = new Layer2_service($services->get_service_id());
        //change the value into strings
        $layer2Service->get_portal_statistics() == 1 ? $stats = 'Yes' : ($stats = 'No');
        $info = array($layer2Service->get_contact_name(), $layer2Service->get_contact_id(), $layer2Service->get_service_type_name(), $layer2Service->get_service_id(), $stats, $layer2Service->get_name(), $layer2Service->get_notes(), $layer2Service->get_status(), $layer2Service->get_in_production_date(), $layer2Service->get_out_production_date(), $layer2Service->get_vlan_id());
        $layer2Interfaces = $layer2Service->get_interfaces();
        //store the interface port into the array
        $titles2 = array();
        $info2 = array();
        $headings2 = array("Device Name", "Port name", "Tagged", "Vlan", "MTU", "Actions");
        $handlers = array();
        //~atoonk/test/rrd/graph.php?file=deviceid12_ge-0-0-3.653&titel=cr1.keltx1.bc.net -- ge-0/0/3.653
        //add the ports information together
        $key = array("interfaceID", "deviceName", "portName", "tagged", "vlan", "mtu");
        $titlePort = array("Interface ID", "Device Name", "Port name.tip.Name of the physical interface, for example ge-2/0/1<br>Do not use subinterface format no ge-2/0/1.10", "Tagged", "Vlan.tip.Please enter a vlan number. If this is an untagged routed port and has no vlan, than please use 0. This means no vlan configuration", "MTU.tip.Default for ORAN and CU_ALL is 9000 bytes, the commodity and IX instance use 1500");
        $infoPort = array();
        $headingPort = array('Port Information');
        $fieldType = array("static", "drop_down", "", "radio", "", "");
        $types = array(Device::get_devices());
        //push all the interface port information
        foreach ($layer2Interfaces as $id => $value) {
            $infoPort = array();
            //Array ( [service_interface_id] => 184 [device_id] => 11 [device_name] => cr1.victx1.bc.net [port_name] => ge-0/1/2 [tagged] => 1 [vlan_id] => 0 [mtu] => 1500 )
            $oriPortName = $value[port_name];
            $portName = str_replace("/", "-", $value[port_name]);
            $portName = str_replace(" ", "-", $portName);
            // Determine port alias /descs
            //print_r(Port::get_device_interfaces($value[device_id]));
            if ($value[tagged] == 1) {
                // Nortel hack
                // Nortel BPS / baystack switches don't append the vlan id to the interface
                // So if it's a Nortel switch don't append
                // Nortel interfaces start with ifc24 (Slot: 1 Port: 24)
                if (!preg_match("/ifc\\d+\\s\\(Slot:/", $oriPortName)) {
                    $oriPortName = $oriPortName . "." . $value[vlan];
                    $portName = $portName . "." . $value[vlan];
                }
            }
            // Determine port alias /descs
            $device = new Device($value[device_id]);
            $port = new Port($device->get_interface_id_by_name($oriPortName));
            $port_alias = $port->get_alias();
            $port_alias = '';
            if ($port->get_alias() != '') {
                $port_alias = " <i> (" . $port->get_alias() . ")</i>";
            }
            // Done Determine port alias /descs
            $link = 'rrdgraph.php?file=deviceid' . $value[device_id] . "_" . $portName . ".rrd&title=" . $value[device_name] . "%20--%20" . $oriPortName;
            array_push($handlers, $link);
            array_push($titles2, $value['device_name'] . "//" . $device->get_interface_id_by_name($oriPortName) . "//" . $value[device_id]);
            array_push($infoPort, $value['service_interface_id']);
            array_push($infoPort, $value['device_name']);
            foreach ($value as $subID => $subValue) {
                if ($subID == "tagged") {
                    if ($subValue == 1) {
                        array_push($info2, 'Tagged');
                        array_push($infoPort, 'Tagged');
                    } else {
                        array_push($info2, 'Untagged');
                        array_push($infoPort, 'Untagged');
                    }
                } else {
                    if ($subID != "service_interface_id" && $subID != "device_id" && $subID != "device_name") {
                        // Append port desc
                        if ($subID == 'port_name') {
                            array_push($info2, $subValue . $port_alias);
                            array_push($infoPort, $subValue);
                        } else {
                            array_push($info2, $subValue);
                            array_push($infoPort, $subValue);
                        }
                    }
                }
            }
            if ($_SESSION['access'] >= 50) {
                array_push($info2, "<a name=modal href='#dialog" . $id . "'>Edit</a> | <a href='#' onclick=\"handleEvent('services.php?action=remove&ID={$_GET['ID']}&portID={$id}')\">Delete</a>");
            } else {
                array_push($info2, 'No Access');
            }
            //create the modal form for current values for the interface ports
            $serviceForm2 = $serviceForm;
            $serviceForm2->setFieldType($fieldType);
            $ff .= $serviceForm2->modalForm($headingPort, $titlePort, $infoPort, $key, $types, "", "dialog" . $id);
        }
        //For ports
        $newKey = array("deviceName", "portName", "tagged", "vlan", "mtu");
        $newTitlePort = array("Device Name", "Port name.tip.Name of the physical interface, for example ge-2/0/1<br>Do not use subinterface format no ge-2/0/1.10", "Tagged", "Vlan.tip.Please enter a vlan number. If this is an untagged routed port and has no vlan, than please use 0. This means no vlan configuration", "MTU.tip.Default for ORAN and CU_ALL is 9000 bytes, the commodity and IX instance use 1500");
        $newHeadingPort = array('Port Information');
        //create a new modal form for a new interface ports
        $fieldType = array("drop_down", "", "radio", "", "");
        $serviceForm->setFieldType($fieldType);
        $serviceForm->setNewModalID("newInterface");
        echo $serviceForm->newModalForm($newHeadingPort, $newTitlePort, $newKey, $types);
    }
    //if the user is editting this information, make it all editable
    if ($_GET['action'] == edit) {
        // Get all L3 & L2 service types
        $allServiceTypes = ServiceType::get_service_types();
        $lay3Types = array();
        $lay2Types = array();
        foreach ($allServiceTypes as $id => $value) {
            $curServiceType = new ServiceType($id);
            if ($curServiceType->get_service_layer() == 3) {
                $lay3Types[$id] = $curServiceType->get_name();
            } elseif ($curServiceType->get_service_layer() == 2) {
                $lay2Types[$id] = $curServiceType->get_name();
            }
        }
        //if the layer is 3 use a different key
        if ($services->get_service_layer() == 3) {
            // Get all L3 service types
            $allServiceTypes = ServiceType::get_service_types();
            $lay3Types = array();
            foreach ($allServiceTypes as $id => $value) {
                $curServiceType = new ServiceType($id);
                if ($curServiceType->get_service_layer() == 3) {
                    $lay3Types[$id] = $curServiceType->get_name();
                }
            }
            // Now we have all L3 service types
            $serviceKey = array("cusName", "cusID", "serviceType", "serviceID", "stats", "description", "notes", "status", "in_production", "out_production", "device", "interface", "interfaceMTU", "tagged", "vlanNum", "logiRout", "routType", "ASNum", "trafPolice", "ipv4Uni", "ipv4Multi", "pRoutAd4", "cRoutAd4", "prefix4", "ipv6Uni", "ipv6Multi", "pRoutAd6", "cRoutAd6", "prefix6");
            $fieldType = array("static", "static", "drop_down", "static", "radio", "", "text_area", "drop_down", "date_picker", "date_picker", "drop_down", "", "drop_down", "radio", "", "", "drop_down", "", "", "radio", "radio", "custom", "custom", "text_area.width:150px.height:100px", "radio", "radio", "custom", "custom", "text_area.width:200px.height:100px");
            $allCustomData = array($layer3Service->get_pe_address(4), $layer3Service->get_ce_address(4), $layer3Service->get_pe_address(6), $layer3Service->get_ce_address(6));
            $customKeys = array("pRoutAd4", "cRoutAd4", "pRoutAd6", "cRoutAd6");
            $custom = array();
            foreach ($allCustomData as $id => $value) {
                $full = explode("/", $value, 2);
                $address = $full[0];
                $length = $full[1];
                $custom[$id] = "<input name=\"" . $customKeys[$id] . "\" id=\"" . $customKeys[$id] . "\" value=\"" . $address . "\" type=\"text\" maxChar=\"250\" style='width: 30%;'> / <input name=\"" . $customKeys[$id] . "-length\" id=\"" . $customKeys[$id] . "-length\" value=\"" . $length . "\" type=\"text\" maxChar=\"2\" style='width: 2%;'>";
            }
            //store the values in the info
            $info = array($layer3Service->get_contact_name(), $layer3Service->get_contact_id(), $layer3Service->get_service_type_name(), $layer3Service->get_service_id(), $stats, $layer3Service->get_name(), $layer3Service->get_notes(), $layer3Service->get_status(), $layer3Service->get_in_production_date(), $layer3Service->get_out_production_date(), $layer3Service->get_pe_name(), $layer3Service->get_port_name(), $layer3Service->get_mtu(), $tagged, $layer3Service->get_vlan_id(), $layer3Service->get_logical_router(), $layer3Service->get_routing_type(), $layer3Service->get_bgp_as(), $layer3Service->get_traffic_policing(), $uni4, $multi4, $custom[0], $custom[1], $address4Prefix, $uni6, $multi6, $custom[2], $custom[3], $address6Prefix);
            $serviceForm->setFieldType($fieldType);
            $MTU = array(1500 => '1500', 9000 => '9000');
            $routingType = array('BGP' => 'BGP', 'Static' => 'Static');
            $types = array($lay3Types, $status_array, Device::get_devices(), $MTU, $routingType);
            $serviceForm->setData($fieldCustomInfo);
            echo $serviceForm->editServiceForm($headings, $titles, $info, $serviceKey, $types);
        }
        //if the layer is 2 use a different key
        if ($services->get_service_layer() == 2) {
            $titles = array("Customer name", "Customer ID", "Service type", "Service ID", "Include statistics in portal?.tip.If YES is selected the user will be able to see the statistics for this particular service in the wiki portal. If this is not selected, traffic stats for this service will not be available in the wiki portal", "Service description (name).tip.A useful description for this service", "Notes.tip.Here you can add generic notes for this service, for example: This is a tempory backup connection.", "Status.tip.Specify the production status of this Service", "In production date", "Out of production date", "*<break>*", "Vlan number.tip.Please enter a vlan number. If this is an untagged routed port and has no vlan, than please use 0. This means no vlan configuration");
            $serviceKey = array("cusName", "cusID", "serviceType", "serviceID", "stats", "description", "notes", "status", "in_production", "out_production", "vlanNum");
            $fieldType = array("static", "static", "drop_down", "static", "radio", "", "text_area", "drop_down", "date_picker", "date_picker", "");
            global $status_array;
            $types = array($status_array);
            $serviceForm->setFieldType($fieldType);
            #print "<hr>2nd form<hr><pre>";print_r($serviceForm);print "</pre>end 2nd form<hr>";
            #echo $serviceForm->editServiceForm($headings, $titles, $info, $serviceKey,$types);
            $editForm = new Form();
            $editForm->setCols(2);
            $editForm->setFieldType($fieldType);
            $editForm->setType($lay2Types);
            $editForm->setType($status_array);
            $editForm->setHeadings($headings);
            $editForm->setTitles($titles);
            $editForm->setDatabase($serviceKey);
            $editForm->setData($info);
            echo $editForm->EditForm(2);
        }
    } else {
        if ($_GET['action'] == showID) {
            //if the layer is 3 show the service form
            if ($services->get_service_layer() == 3) {
                $id = $layer3Service->get_service_id();
                $title = $layer3Service->get_name();
                $title = str_replace(" ", "%20", $title);
                $link = 'rrdgraph.php?file=service_id_' . $id . '.rrd&title=' . $title;
                $directLink = "services.php?action=showGraphDetail&serviceID=" . $id . "&title=" . $title . "&type=traffic";
                echo "<div class='graph'>\r\n\t\t\t\t\t<a href='{$directLink}' class='screenshot' title='Statistics' rel='{$link}'><img src='{$link}'/></a>\r\n\t\t\t\t\t</div>";
                echo $serviceForm->showServiceForm($headings, $titles, $info);
            } elseif ($services->get_service_layer() == 2) {
                $titles = array("Customer name", "Customer ID", "Service type", "Service ID", "Include statistics in portal?.tip.If YES is selected the user will be able to see the statistics for this particular service in the wiki portal. If this is not selected, traffic stats for this service will not be available in the wiki portal", "Service description (name).tip.A useful description for this service", "Notes.tip.Here you can add generic notes for this service, for example: This is a tempory backup connection.", "Status.tip.Specifies the production status of this Service", "In production date", "Out of production date", "*<break>*", "Vlan number.tip.Please enter a vlan number. If this is an untagged routed port and has no vlan, than please use 0. This means no vlan configuration");
                echo $serviceForm->showServiceForm($headings, $titles, $info);
                $serviceForm->setCols(6);
                if ($_SESSION['access'] >= 50) {
                    $toolNames = array("Add Interface");
                    $toolIcons = array("add");
                    $formType = array("newInterface");
                    echo $tool->createNewModal($toolNames, $toolIcons, $formType);
                }
                echo $ff . $serviceForm->showAll($headings2, $titles2, $info2, $handlers, 3);
            }
        }
    }
}
Example #4
0
 function render_edit_change()
 {
     // First determine change id
     if (isset($_GET[cid]) && is_numeric($_GET[cid])) {
         $cid = $_GET[cid];
     } else {
         return "<b>Sorry change not found<br></b>";
     }
     //$content = "<h1>Change Details (#$cid) </h1>";
     $contentH .= "<div><p><a href='{$this->url}&action=edit_change&cid={$cid}&add_device#new_device'>\n<img src='icons/Add.png'>Add Device Component</a><br></p></div>";
     if (isset($_GET['add_device'])) {
         $add_device = 1;
     } else {
         $add_device = 0;
     }
     // Get all users
     $allUsers_real = User::get_users_by_fullname();
     $allUsers = User::get_users_by_fullname();
     // Do not show Administrator account in changed by dropdown
     unset($allUsers[1]);
     array_push($allUsers, "  ");
     asort($allUsers);
     /*
     	First Generic change info
     */
     $query = "SELECT change_id, title, notes, record_date, \n\t\t\t\t\tUNIX_TIMESTAMP(change_date) as change_date,\n\t\t\t\t\tUNIX_TIMESTAMP(planned_change_date) as planned_change_date,\n\t\t\t\t\tchange_contact_1, change_contact_2, impact, status\n\t\t\t\t\tFROM plugin_ChangeManager_Changes\n\t\t\t\t\tWHERE change_id = '{$cid}'";
     $result = mysql_query($query);
     if (!$result) {
         return "<b>Oops something went wrong, unable to select changes 'Error, query failed. '" . mysql_error() . "</b>";
     }
     $values = array();
     $form = new Form("auto", 2);
     // Need to count the number of sections in this form
     // Used by editForm($numHead)  later
     $form_sections = 1;
     while ($obj = mysql_fetch_object($result)) {
         // First initialized with correct date
         if (is_null($obj->change_date)) {
             $custom_date = '';
         } else {
             $year = date("Y", $obj->change_date);
             $month = date("m", $obj->change_date);
             $day = date("d", $obj->change_date);
             $hour = date("H", $obj->change_date);
             $minute = date("i", $obj->change_date);
             $sql_time = "{$hour}:{$minute}";
             $custom_date = "{$year}-{$month}-{$day}";
         }
         // First initialized with correct date
         if (is_null($obj->planned_change_date)) {
             $custom_planned_date = '';
         } else {
             $planned_year = date("Y", $obj->planned_change_date);
             $planned_month = date("m", $obj->planned_change_date);
             $planned_day = date("d", $obj->planned_change_date);
             $planned_hour = date("H", $obj->planned_change_date);
             $planned_minute = date("i", $obj->planned_change_date);
             $planned_sql_time = "{$planned_hour}:{$planned_minute}";
             $custom_planned_date = "{$planned_year}-{$planned_month}-{$planned_day}";
         }
         // Create status array
         /**
         $status_arr= array();
         $status_arr = $this->status_values;
         if ($obj->status == 1) {
         	$status_arr = array();
         	//$status_arr[0] = $this->status_values[0];
         	$status_arr[1] = $this->status_values[1];
         	$status_arr[2] = $this->status_values[2];
         }
         elseif ($obj->status == 2) {
         	//unset($status_arr[0]);
         	unset($status_arr[1]);
         }
         else {
         	unset($status_arr[0]);
         	unset($status_arr[1]);
         	unset($status_arr[2]);
         }
         */
         $status_arr = array();
         $status_arr = $this->status_values;
         // date and time for planned change date
         $fieldType[1] = "date_picker";
         $fieldType[2] = "drop_down";
         $form->setType($this->timetable);
         // Drop down
         // date and time for actual (completion)change date
         $custom_date = "{$year}-{$month}-{$day}";
         $fieldType[3] = "date_picker";
         $fieldType[4] = "drop_down";
         $form->setType($this->timetable);
         // Drop down
         $notes = $obj->notes;
         $user1 = new User($obj->change_contact_1);
         $contact_name1 = $user1->get_full_name();
         $user2 = new User($obj->change_contact_2);
         $contact_name2 = $user2->get_full_name();
         $fieldType[5] = "drop_down";
         $form->setType($allUsers);
         // Drop down
         $fieldType[6] = "drop_down";
         $form->setType($allUsers);
         // Drop down
         $fieldType[7] = "drop_down";
         $impact_name = "";
         if ($obj->impact == "0") {
             // Make it none of the existing drop down selected options if none were previously chosen
             $impact_name = "  ";
         } else {
             $impact_name = $this->impact_values[$obj->impact];
         }
         $form->setType($this->impact_values);
         // Drop down
         $fieldType[8] = "drop_down";
         $status_name = "";
         if ($obj->status == "0") {
             // Make it none of the existing drop down selected options if none were previously chosen
             $status_name = "  ";
         } else {
             $status_name = $this->status_values[$obj->status];
         }
         $form->setType($status_arr);
         // Drop down
         // End Custom field
         $title = $obj->title;
         $fieldType[9] = "text_area";
         array_push($values, $obj->title, $custom_planned_date, $planned_sql_time, $custom_date, $sql_time, $contact_name1, $contact_name2, $impact_name, $status_name, $notes);
     }
     $content = "<hr align=\"left\" style=\"width:94%;border:1px solid #C0C0C0;\">\n\t\t\t\t\t<h2>CHANGE (#{$cid}): {$title}</h2>\n\t\t\t\t\t<hr align=\"left\" style=\"width:94%;border:1px solid #C0C0C0;\">" . $contentH;
     $javascriptFormValidation = "\n\t\t<script language=\"javascript\">\n\t\tfunction validateForm()\n\t\t{\n\t\t\t// Parse Date and then check if change date is before planned date\n\t\t\tvar PlannedChangeDateStr = document.forms[\"MyClassForm\"][\"PlannedChangeDate\"].value;\n\t\t\tvar PlannedChangeDateStringArray = PlannedChangeDateStr.split(\"-\",3);\t\t\t\n\t\t\tvar PlannedYear = PlannedChangeDateStringArray[0];\n\t\t\tvar PlannedMonth = PlannedChangeDateStringArray[1];\n\t\t\tvar PlannedDay = PlannedChangeDateStringArray[2];\t\t\t\t\t\t\n\t\t\tvar PlannedChangeTimeStr = document.forms[\"MyClassForm\"][\"PlannedChangeTime\"].value;\n\t\t\tvar PlannedChangeTimeStringArray = PlannedChangeTimeStr.split(\":\",2);\t\t\t\n\t\t\tvar PlannedHour = PlannedChangeTimeStringArray[0];\n\t\t\tvar PlannedMinute = PlannedChangeTimeStringArray[1];\n\t\t\t\n\t\t\tvar PlannedChangeDateTime = new Date(PlannedYear,PlannedMonth,PlannedDay,PlannedHour,PlannedMinute);\n\t\t\t\n\t\t\t// alert('Date: ' + PlannedChangeDateTime.getDate());\n\t\t\t// alert('Month: ' + PlannedChangeDateTime.getMonth());\n\t\t\t// alert('Year: ' + PlannedChangeDateTime.getFullYear());\n\t\t\t// alert('Hour: ' + PlannedChangeDateTime.getHours());\n\t\t\t// alert('Minute: ' + PlannedChangeDateTime.getMinutes());\n\t\t\t\n\t\t\t// alert('PlannedChangeDate ' + document.forms[\"MyClassForm\"][\"PlannedChangeDate\"].value + ' was chosen.');\n\t\t\t// alert('PlannedChangeTime ' + document.forms[\"MyClassForm\"][\"PlannedChangeTime\"].value + ' was chosen.');\n\t\t\t\n\t\t\tif (document.forms[\"MyClassForm\"][\"PlannedChangeDate\"].value == \"\")\n\t\t\t{\n\t\t\t\talert('No Planned Change Date or Time entered!');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\tvar CompletionChangeDateStr = document.forms[\"MyClassForm\"][\"ChangeDate\"].value;\n\t\t\tvar CompletionChangeTimeStr = document.forms[\"MyClassForm\"][\"ChangeTime\"].value;\n\n\t\t\tif (\n\t\t\t\t(\n\t\t\t\t\t(\n\t\t\t\t\t\t(CompletionChangeDateStr != \"\")\n\t\t\t\t\t\t && \n\t\t\t\t\t\t(CompletionChangeTimeStr == \"Pick an option\")\n\t\t\t\t\t)\n\t\t\t\t) \n\t\t\t\t||\t\t\n\t\t\t\t(\n\t\t\t\t\t(\n\t\t\t\t\t\t(CompletionChangeDateStr == \"\")\n\t\t\t\t\t\t&&\n\t\t\t\t\t\t(CompletionChangeTimeStr != \"Pick an option\")\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t{\n\t\t\t\talert('Ensure both Completion Date and Completion Time entered!');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\tif(CompletionChangeDateStr != \"\" && CompletionChangeTimeStr != \"Pick an option\")\n\t\t\t{\t\t\t\n\t\t\t\tvar CompletionChangeDateStringArray = CompletionChangeDateStr.split(\"-\",3);\t\t\t\n\t\t\t\tvar CompletionYear = CompletionChangeDateStringArray[0];\n\t\t\t\tvar CompletionMonth = CompletionChangeDateStringArray[1];\n\t\t\t\tvar CompletionDay = CompletionChangeDateStringArray[2];\t\t\t\t\t\t\n\n\t\t\t\tvar CompletionChangeTimeStringArray = CompletionChangeTimeStr.split(\":\",2);\t\t\t\n\t\t\t\tvar CompletionHour = CompletionChangeTimeStringArray[0];\n\t\t\t\tvar CompletionMinute = CompletionChangeTimeStringArray[1];\n\t\t\t\t\n\t\t\t\tvar CompletionChangeDateTime = new Date(CompletionYear,CompletionMonth,CompletionDay,CompletionHour,CompletionMinute);\n\t\t\t\t\n\t\t\t\t/* alert('Date: ' + CompletionChangeDateTime.getDate());\n\t\t\t\talert('Month: ' + CompletionChangeDateTime.getMonth());\n\t\t\t\talert('Year: ' + CompletionChangeDateTime.getFullYear());\n\t\t\t\talert('Hour: ' + CompletionChangeDateTime.getHours());\n\t\t\t\talert('Minute: ' + CompletionChangeDateTime.getMinutes()); */\n\t\t\t\t\n\t\t\t\t//alert('CompletionChangeDate ' + document.forms[\"MyClassForm\"][\"ChangeDate\"].value + ' was chosen.');\n\t\t\t\t//alert('CompletionChangeTime ' + document.forms[\"MyClassForm\"][\"ChangeTime\"].value + ' was chosen.');\n\n\t\t\t\tif(CompletionChangeDateTime < PlannedChangeDateTime)\n\t\t\t\t{\n\t\t\t\t\talert(\"Completion Date: \" + document.forms[\"MyClassForm\"][\"PlannedChangeDate\"].value + \" \" + document.forms[\"MyClassForm\"][\"PlannedChangeTime\"].value + \" entered is before Planned Date: \" + document.forms[\"MyClassForm\"][\"PlannedChangeDate\"].value + \" \" + document.forms[\"MyClassForm\"][\"PlannedChangeTime\"].value + \"!\"); \n\t\t\t\t\treturn false;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\t\n\t\t\tif (document.forms[\"MyClassForm\"][\"Summary\"].value == \"\")\n\t\t\t{\n\t\t\t\talert(\"Summary must be filled out!\");\n\t\t\t\treturn false;\n\t\t\t}\t\n\t\t}\n\t\t</script>";
     $content .= $javascriptFormValidation;
     $heading = array("Change Details");
     $titles = array("Summary", "Planned Date", "Planned Time", "Completion Date", "Completion Time", "Primary Contact", "Secondary Contact", "Impact", "Status", "Change Description");
     $postkeys = array("Summary", "PlannedChangeDate", "PlannedChangeTime", "ChangeDate", "ChangeTime", "PrimaryContact", "SecondaryContact", "Impact", "Status", "ChangeDescription");
     /*
     	Device specific change info
     */
     $query2 = "SELECT id, device_id, impact, effects, chgby_id, change_date, description, back_out, status\n\t\t\t\t\tFROM plugin_ChangeManager_Components\n\t\t\t\t\tWHERE change_id = '{$cid}'";
     $result2 = mysql_query($query2);
     if (!$result2) {
         return "<b>Oops something went wrong, unable to select changes </b>";
     }
     // Get all devices
     $allDevices = Device::get_devices();
     // For Field type index:
     $i = 9;
     while ($obj = mysql_fetch_object($result2)) {
         $form_sections++;
         // Determine device name
         $device = new Device($obj->device_id);
         $device_name = $device->get_name();
         $form->setType($allDevices);
         // Drop down
         $fieldType[$i + 1] = "drop_down";
         $form->setType($allUsers);
         // Drop down
         $fieldType[$i + 2] = "drop_down";
         // Determine user changed by name
         $user = new User($obj->chgby_id);
         $fullname = $user->get_full_name();
         $effects = $obj->effects;
         array_push($values, $device_name, $fullname, stripslashes($obj->description), stripslashes($effects), stripslashes($obj->back_out));
         array_push($heading, "*<break>*", "Device Details:  {$device_name}  <div style='text-align: right;'> \n<a href='{$this->url}&action=delete_device_component&cid={$cid}&component_id={$obj->id}&return=edit_change' style='color:#FFFFFF'>\nDelete <img src='icons/Delete.png' height=20></a></div>");
         array_push($titles, "*<break>*", "Device", "Changed By", "Change Details", "Effects", "Backout Procedure");
         array_push($postkeys, "device_component[{$obj->id}][Device]", "device_component[{$obj->id}][ChangedBy]", "device_component[{$obj->id}][Description]", "device_component[{$obj->id}][Effects]", "device_component[{$obj->id}][BackoutProcedure]");
         $fieldType[$i + 3] = "text_area.height:230px";
         $fieldType[$i + 4] = "text_area.height:90px";
         $fieldType[$i + 5] = "text_area.height:90px";
         //Update with the number of rows/fields we just added
         $i = $i + 5;
     }
     if ($add_device) {
         $form_sections++;
         array_push($heading, "*<break>*", "Device Details - New Device <span id=new_device></span>");
         array_push($titles, "*<break>*", "Device", "Changed By", "Change Details", "Effects", "Backout Procedure");
         $form->setType($allDevices);
         // Drop down
         $fieldType[$i + 1] = "drop_down";
         $form->setType($allUsers);
         // Drop down
         $fieldType[$i + 2] = "drop_down";
         array_push($postkeys, "new_device_component[Device]", "new_device_component[ChangedBy]", "new_device_component[Description]", "new_device_component[Effects]", "new_device_component[BackoutProcedure]");
         $fieldType[$i + 3] = "text_area.height:230px";
         $fieldType[$i + 4] = "text_area.height:90px";
         $fieldType[$i + 5] = "text_area.height:90px";
         array_push($values, "", $_SESSION['fullname'], "", "", "");
     }
     // Create Device index
     //set the table size
     $form->setFieldType($fieldType);
     $form->setSortable(false);
     $form->setHeadings($heading);
     $form->setTitles($titles);
     $form->setDatabase($postkeys);
     $form->setData($values);
     //set the table size
     $form->setTableWidth("94%");
     $form->setTableWidth("94%");
     $form->setTitleWidth("20%");
     $content .= $form->EditForm($form_sections);
     return $content;
 }