function output() { global $construct, $main, $db; if (get('subpage') != '') { return $this->page->output(); } if (isset($_POST['form_name']) && strstr($_POST['form_name'], 'table_links_ap') !== FALSE) { return $this->output_onpost_table_links_ap(); } if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_' . $_POST['form_name'])) { return call_user_func(array($this, 'output_onpost_' . $_POST['form_name'])); } include_map_dependencies(); $this->tpl['form_node'] = $construct->form($this->form_node(), __FILE__); $this->tpl['node'] = get('node'); if (get('action') == 'delete') { if ($db->del('nodes, dns_nameservers, dns_zones, dns_zones_nameservers, ip_addresses, ip_ranges, links, nodes_services, photos, services, subnets, users_nodes', 'nodes LEFT JOIN dns_nameservers ON nodes.id = dns_nameservers.node_id LEFT JOIN dns_zones ON nodes.id = dns_zones.node_id LEFT JOIN dns_zones_nameservers ON dns_zones.id = dns_zones_nameservers.zone_id OR dns_nameservers.id = dns_zones_nameservers.nameserver_id LEFT JOIN ip_addresses ON nodes.id = ip_addresses.node_id LEFT JOIN ip_ranges ON nodes.id = ip_ranges.node_id LEFT JOIN links ON nodes.id = links.node_id LEFT JOIN nodes_services ON nodes.id = nodes_services.node_id LEFT JOIN services ON nodes_services.service_id = services.id LEFT JOIN photos ON nodes.id = photos.node_id LEFT JOIN subnets ON nodes.id = subnets.node_id LEFT JOIN users_nodes ON nodes.id = users_nodes.node_id', "nodes.id = " . intval(get('node')))) { $main->message->set_fromlang('info', 'delete_success', self_ref()); } else { $main->message->set_fromlang('error', 'generic'); } } else { $this->tpl['node_method'] = get('node') == 'add' ? 'add' : 'edit'; if (get('node') != 'add') { $t = $db->get('id, name', 'nodes', "id = " . intval(get('node'))); $this->tpl['node_name'] = $t[0]['name']; $this->tpl['node_id'] = $t[0]['id']; $this->tpl['table_ip_ranges'] = $construct->table($this->table_ip_ranges(), __FILE__); $this->tpl['table_ip_ranges_v6'] = $construct->table($this->table_ip_ranges_v6(), __FILE__); $this->tpl['table_dns'] = $construct->table($this->table_dns(), __FILE__); $this->tpl['table_nameservers'] = $construct->table($this->table_nameservers(), __FILE__); $this->tpl['table_links'] = $construct->table($this->table_links(), __FILE__); $t = $db->get('id, ssid', 'links', "node_id = " . intval(get('node')) . " AND type = 'ap'"); foreach ((array) $t as $key => $value) { $this->tpl['table_links_ap'][$value['ssid']] = $construct->table($this->table_links_ap($value['id']), __FILE__); } $this->tpl['table_subnets'] = $construct->table($this->table_subnets(), __FILE__); $this->tpl['table_ipaddr'] = $construct->table($this->table_ipaddr(), __FILE__); $this->tpl['table_services'] = $construct->table($this->table_services(), __FILE__); $this->tpl['table_nodesettingschanges'] = $construct->table($this->table_nodesettingschanges(), __FILE__); $this->tpl['table_photosview'] = $construct->table($this->table_photosview(), __FILE__); if ($this->has_owner_access()) { $this->tpl['link_node_delete'] = self_ref(array('action' => 'delete')); } $this->tpl['link_node_view'] = make_ref('/nodes', array('node' => get('node'))); $this->tpl['link_req_cclass'] = make_ref('/node_editor/range', array('node' => get('node'))); $this->tpl['link_req_v6_cclass'] = make_ref('/node_editor/range_v6', array('node' => get('node'))); $this->tpl['link_req_dns_for'] = make_ref('/node_editor/dnszone', array('type' => 'forward', 'node' => get('node'), 'zone' => 'add')); $this->tpl['link_req_dns_rev'] = make_ref('/node_editor/dnszone', array('type' => 'reverse', 'node' => get('node'), 'zone' => 'add')); $this->tpl['link_nameserver_add'] = make_ref('/node_editor/dnsnameserver', array('node' => get('node'), 'nameserver' => 'add')); $this->tpl['link_link_add'] = make_ref('/node_editor/link', array('node' => get('node'), 'link' => 'add')); $this->tpl['link_subnet_add'] = make_ref('/node_editor/subnet', array('node' => get('node'), 'subnet' => 'add')); $this->tpl['link_ipaddr_add'] = make_ref('node_editor/ipaddr', array('node' => get('node'), 'ipaddr' => 'add')); $this->tpl['link_services_add'] = make_ref('/node_editor/services', array('node' => get('node'), 'service' => 'add')); $this->tpl['link_nodesettingschanges_add'] = make_ref('/node_editor/nodesettingschanges', array('node' => get('node'), 'nodesettingschanges' => 'add')); } $this->tpl['link_map_pickup'] = make_ref('/pickup/map', array("object_lat" => "form_node.elements['nodes__latitude']", "object_lon" => "form_node.elements['nodes__longitude']")); return template($this->tpl, __FILE__); } }
/** * Include map to the output * @param element_id The id of the element to render map on. * @param picker A flag to show that this is a place picker. */ function include_map($element_id) { global $main, $smarty, $vars; include_map_dependencies(); $main->html->head->add_extra("<script type=\"text/javascript\">\r\n\t\t\t\$(function() {\r\n\t\t\t\t// Load map\r\n\t\t\t\tmap = new NetworkMap('{$element_id}', map_options);\r\n\r\n\t\t\t\tcontrolNodeFilter = new NetworkMapControlNodeFilter(map);\r\n\t\t\t\tcontrolFullScreen = new NetworkMapControlFullScreen(map);\r\n\t\t\t\t\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t</script>"); }