if ($network->getAuthenticator()->isRegistrationPermitted()) { $sources[$network->getId()] = $network->getName(); } } if (isset($sources)) { $smarty->assign('auth_sources', $sources); } // Pass the account_origin along, if it's set if (isset($_REQUEST["auth_source"])) { $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]); } if (Server::getServer()->getUseGlobalUserAccounts()) { $default_network_param = Network::getDefaultNetwork()->getId(); $smarty->assign('SelectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='{$default_network_param}' />"); } else { $smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source')); } // Compile HTML code $html_body = $smarty->fetch("templates/sites/lost_password.tpl"); /* * Render output */ $ui = MainUI::getObject(); $ui->addContent('left_area_middle', $html); $ui->addContent('main_area_middle', $html_body); $ui->display(); /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil
public function getAdminUI() { $db = AbstractDb::getObject(); $html = ''; $html .= "<fieldset class='admin_container'>\n"; $html .= "<legend>" . _("Report configuration") . "</legend>\n"; $html .= "<ul class='admin_element_list'>\n"; // Network $html .= "<li class='admin_element_item_container'>\n"; $html .= "<div class='admin_element_data'>\n"; $networks = Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_VIEW_STATISTICS')); $additionalWhere = " AND (FALSE\n"; foreach ($networks as $network) { $idStr = $db->escapeString($network->getId()); $additionalWhere .= " OR network_id='{$idStr}'\n"; } $additionalWhere .= ")\n"; $networkUserData['preSelectedObject'] = reset($this->report_selected_networks); $networkUserData['allowEmpty'] = true; $networkUserData['additionalWhere'] = $additionalWhere; $html .= Network::getSelectUI('Statistics', $networkUserData); $html .= "</div>\n"; $html .= "</li>\n"; // Date range $html .= "<li class='admin_element_item_container'>\n"; $html .= "<fieldset class='admin_element_group'>\n"; $html .= "<legend>" . _("Restrict the time range for which statistics will be computed") . " : </legend>\n"; $html .= $this->getDateRangeUI(); $html .= "</fieldset>\n"; $html .= "</li>\n"; // Selected nodes $html .= "<li class='admin_element_item_container'>\n"; $html .= "<fieldset class='admin_element_group'>\n"; $html .= "<legend>" . _("Restrict stats to the following nodes") . " : </legend>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= $this->getSelectedNodesUI(); $html .= "</div>\n"; $html .= "</fieldset>\n"; $html .= "</li>\n"; // Unique user criteria $html .= "<li class='admin_element_item_container'>\n"; $html .= "<fieldset class='admin_element_group'>\n"; $html .= "<legend>" . _("Distinguish users by") . " : </legend>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= $this->getDistinguishUsersByUI(); $html .= "</div>\n"; $html .= "</fieldset>\n"; $html .= "</li>\n"; // Selected users $html .= "<li class='admin_element_item_container'>\n"; $html .= "<fieldset class='admin_element_group'>\n"; $html .= "<legend>" . _("Restrict stats to the selected users") . " : </legend>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= $this->getSelectedUsersUI(); $html .= "</div>\n"; $html .= "</fieldset class='admin_element_group'>\n"; $html .= "</li>\n"; // Reports $html .= "<li class='admin_element_item_container'>\n"; $html .= "<fieldset>\n"; $html .= "<legend>" . _("Selected reports") . " : </legend>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= $this->getSelectedReportsUI(); $html .= "</div>\n"; $html .= "</fieldset>\n"; $html .= "</ul>\n"; $html .= "</fieldset>\n"; $html .= "</li>\n"; return $html; }
/** * Get an interface to add a user to a list * * @param string $user_prefix A identifier provided by the programmer * to recognise it's generated HTML form * @param string $add_button_name Name of optional "add" button * @param string $add_button_value Value of optional "add" button * * @return string HTML markup */ public static function getSelectUserUI($user_prefix, $add_button_name = null, $add_button_value = null) { $db = AbstractDb::getObject(); $networkSelector = Network::getSelectUI($user_prefix); // Check if we need to add an "add" button if ($add_button_name && $add_button_value) { $userSelector = _("Username") . ": " . InterfaceElements::generateInputText("select_user_" . $user_prefix . "_username", "", "", "input_text", array("onkeypress" => "if ((event.which ? event.which : event.keyCode) == 13) {form.{$add_button_name}.click() }")); $userSelector .= InterfaceElements::generateInputSubmit($add_button_name, $add_button_value); } else { $userSelector = _("Search for Username or Email Address") . ": " . InterfaceElements::generateInputText("select_user_" . $user_prefix . "_username"); } $html = "<div class='user_select_user_ui_container'>" . $networkSelector . "<br>" . $userSelector . "</div>\n"; return $html; }
// Compile HTML code $htmlToolContent = $smarty->fetch("templates/sites/signup.tpl"); /* * Main content */ // Use the account_origin along, if it was set (it may be set in case there was an error processing the form). if (isset($_REQUEST["auth_source"])) { $selectedNetwork = Network::getObject($_REQUEST['auth_source']); } else { $selectedNetwork = Network::getDefaultNetwork(); } if (Server::getServer()->getUseGlobalUserAccounts()) { $smarty->assign('SelectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='" . $selectedNetwork->getId() . "' />"); } else { //Make sure to only list networks whose authenticator allows user self-signup $smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source', array('preSelectedObject' => $selectedNetwork, 'onlyNetwoksAllowingSignup' => true))); } // Set section of Smarty template $smarty->assign('sectionTOOLCONTENT', false); $smarty->assign('sectionMAINCONTENT', true); // Compile HTML code $htmlMainContent = $smarty->fetch("templates/sites/signup.tpl"); /* * Render final output */ $ui = MainUI::getObject(); $ui->addContent('left_area_middle', $htmlToolContent); $ui->addContent('main_area_middle', $htmlMainContent); $ui->display(); /* * Local variables:
/** * Retrieves the admin interface of this object * * @return string The HTML fragment for this interface * * @access public * * @todo Most of this code will be moved to Hotspot class when the * abtraction will be completed */ public function getAdminUI() { $permArray = null; $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $this->getNetwork()); $permArray[] = array(Permission::P('NODE_PERM_EDIT_CONFIG'), $this); $permArray[] = array(Permission::P('NODE_PERM_EDIT_GATEWAY_ID'), $this); $permArray[] = array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this); Security::requireAnyPermission($permArray); require_once 'classes/InterfaceElements.php'; require_once 'classes/Stakeholder.php'; // Init values $html = ''; // Get information about the network $network = $this->getNetwork(); $node_id = $this->getId(); /* * Check for a warning message */ if ($this->_warningMessage != "") { $html .= "<div class='errormsg'>" . $this->_warningMessage . "</div>\n"; } /* * Begin with admin interface */ $html .= "<fieldset class='admin_container " . get_class($this) . "'>\n"; $html .= "<legend>" . _("Edit a node") . "</legend>\n"; $html .= "<ul class='admin_element_list'>\n"; /* * Display stats */ $permArray = null; $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); $permArray[] = array(Permission::P('NODE_PERM_ALLOW_GENERATING_PUBLIC_STATS'), $this); if (Security::hasAnyPermission($permArray)) { $_title = _("Statistics"); $_data = InterfaceElements::generateInputCheckbox("allows_public_stats", "", _("Allow public access to some node statistics."), $this->getAllowsPublicStats(), "allows_public_stats"); $_data .= InterfaceElements::generateInputSubmit("node_" . $this->id . "_get_stats", _("Get access statistics"), "node_get_stats_submit"); $html .= InterfaceElements::generateAdminSectionContainer("node_get_stats", $_title, $_data); } /* * Information about the node */ $_html_node_information = array(); // Gateway ID $_title = _("Gateway ID"); $permArray = null; $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); $permArray[] = array(Permission::P('NODE_PERM_EDIT_GATEWAY_ID'), $this); if (Security::hasAnyPermission($permArray)) { $_data = InterfaceElements::generateInputText("node_" . $node_id . "_gw_id", $this->getGatewayId(), "gw_id_input"); } else { $_data = htmlspecialchars($this->getGatewayId(), ENT_QUOTES); $_data .= InterfaceElements::generateInputHidden("node_" . $node_id . "_gw_id", $this->getGatewayId()); } $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("gateway_id", $_title, $_data); //Node content $html .= parent::getContentAdminUI(); // Name $permArray = null; $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); $permArray[] = array(Permission::P('NODE_PERM_EDIT_NAME'), $this); if (Security::hasAnyPermission($permArray)) { $_title = _("Name"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_name", $this->getName(), "node_name_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_name", $_title, $_data); } else { $_title = _("Name"); $_data = $this->getName(); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_name", $_title, $_data); } // Creation date $_title = _("Creation date"); $permArray = null; $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); $permArray[] = array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this); if (Security::hasAnyPermission($permArray)) { $_data = DateTimeWD::getSelectDateTimeUI(new DateTimeWD($this->getCreationDate()), "node_" . $node_id . "_creation_date", DateTimeWD::INTERFACE_DATETIME_FIELD, "node_creation_date_input"); } else { $_data = htmlspecialchars($this->getCreationDate(), ENT_QUOTES); $_data .= InterfaceElements::generateInputHidden("node_" . $node_id . "_creation_date", $this->getCreationDate()); } $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_creation_date", $_title, $_data); // Description $_title = _("Description"); $name = "node_" . $node_id . "_description"; $_data = "<textarea name='{$name}' cols=80 rows=5 id='node_description_textarea'>\n" . $this->getDescription() . "\n</textarea>\n"; $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_description", $_title, $_data); // Civic number $_title = _("Civic number"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_civic_number", $this->getCivicNumber(), "node_civic_number_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_civic_number", $_title, $_data); // Street name $_title = _("Street name"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_street_name", $this->getStreetName(), "node_street_name_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_street_name", $_title, $_data); // City $_title = _("City"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_city", $this->getCity(), "node_city_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_city", $_title, $_data); // Province $_title = _("Province / State"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_province", $this->getProvince(), "node_province_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_province", $_title, $_data); // Postal Code $_title = _("Postal code"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_postal_code", $this->getPostalCode(), "node_postal_code_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_postal_code", $_title, $_data); // Country $_title = _("Country"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_country", $this->getCountry(), "node_country_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_country", $_title, $_data); // Public phone # $_title = _("Public phone number"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_public_phone", $this->getTelephone(), "node_public_phone_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_public_phone", $_title, $_data); // Public mail $_title = _("Public email"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_public_email", $this->getEmail(), "node_public_email_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_public_email", $_title, $_data); // Homepage URL $_title = _("Homepage URL"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_homepage_url", $this->getWebSiteURL(), "node_homepage_url_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_homepage_url", $_title, $_data); // Mass transit info $_title = _("Mass transit info"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_mass_transit_info", $this->getTransitInfo(), "node_mass_transit_info_input"); $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_mass_transit_info", $_title, $_data); // Build section $html .= InterfaceElements::generateAdminSectionContainer("node_information", _("Information about the node"), implode(null, $_html_node_information)); /* * Node GIS data */ $_html_node_gis_data = array(); $gis_point = $this->getGisLocation(); // Latitude $_title = _("Latitude"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_gis_latitude", $gis_point->getLatitude(), "node_" . $node_id . "_gis_latitude"); $_html_node_gis_data[] = InterfaceElements::generateAdminSectionContainer("node_gis_latitude", $_title, $_data); // Latitude $_title = _("Longitude"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_gis_longitude", $gis_point->getLongitude(), "node_" . $node_id . "_gis_longitude"); $_html_node_gis_data[] = InterfaceElements::generateAdminSectionContainer("node_gis_longitude", $_title, $_data); // Call the geocoding service, if Google Maps is enabled then use Google Maps to let the user choose a more precise location if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED === true) { $_data = InterfaceElements::generateInputSubmit("geocode_only", _("Geocode the address or postal code above"), "geocode_only_submit"); $_data .= InterfaceElements::generateInputButton("google_maps_geocode", _("Check using Google Maps"), "google_maps_geocode_button", "submit", array("onclick" => "window.open('hotspot_location_map.php?node_id={$this->getId()}', 'hotspot_location', 'toolbar = 0, scrollbars = 1, resizable = 1, location = 0, statusbar = 0, menubar = 0, width = 600, height = 600');")); $_data .= "<div class='admin_section_hint' id='node_gis_geocode_hint'>" . "(" . _("Use a geocoding service, then use Google Maps to pinpoint the exact location.") . ")" . "</div>\n"; } else { $_data = InterfaceElements::generateInputSubmit("geocode_only", _("Geocode the address or postal code above"), "geocode_only_submit"); $_data .= "<div class='admin_section_hint' id='node_gis_geocode_hint'>" . "(" . _("Use a geocoding service") . ")" . "</div>\n"; } $_html_node_gis_data[] = InterfaceElements::generateAdminSectionContainer("node_gis_geocode", "", $_data); // Map URL $_title = _("Map URL"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_map_url", $this->getMapURL(), "node_map_url_input"); $_html_node_gis_data[] = InterfaceElements::generateAdminSectionContainer("node_map_url", $_title, $_data); $_title = _("Show node on map"); $help = _("Should this node be visible on the map when deployed?"); $_data = InterfaceElements::generateInputCheckbox("node_" . $node_id . "_show_on_map", "", _("Yes"), $this->showOnMap(), "node_show_on_map_input"); $_html_node_gis_data[] = InterfaceElements::generateAdminSectionContainer("node_show_on_map", $_title, $_data, $help); // Build section $html .= InterfaceElements::generateAdminSectionContainer("node_gis_data", _("GIS data"), implode(null, $_html_node_gis_data)); /* * Node configuration section */ $_html_node_config = array(); // Deployment status $_title = _("Node deployment status"); $_data = $this->getSelectDeploymentStatus("node_" . $node_id . "_deployment_status"); $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_deployment_status", $_title, $_data); // Network selection $_title = _("Node Network"); $_data = Network::getSelectUI("node_" . $node_id . "_network_id", array('preSelectedObject' => $this->getNetwork())); $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_network", $_title, $_data); // is_splash_only_node if ($network->getSplashOnlyNodesAllowed()) { $_title = _("Is this node splash-only (no login)?"); $_data = InterfaceElements::generateInputCheckbox("node_" . $node_id . "_is_splash_only_node", "", _("Yes"), $this->isConfiguredSplashOnly(), "node_is_splash_only_node_radio"); $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_is_splash_only_node", $_title, $_data); } // custom_portal_redirect_url if ($network->getCustomPortalRedirectAllowed()) { $_title = _("URL to show instead of the portal"); $_data = InterfaceElements::generateInputText("node_" . $node_id . "_custom_portal_redirect_url", $this->getCustomPortalRedirectUrl(), "node_custom_portal_redirect_url_input"); $_data .= _("If this is not empty, the portal will be disabled and this URL will be shown instead"); $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_custom_portal_redirect_url", $_title, $_data); } // allow_original_URL_redirect $title = _("Original URL redirection"); $help = _("Are nodes allowed to redirect users to the web page they originally requested instead of the portal? this will overide the custom portal URL"); $data = InterfaceElements::generateInputCheckbox("node_" . $node_id . "_allow_original_URL_redirect", "", _("Yes"), $this->getPortalOriginalUrlAllowed(), "node_allow_original_URL_redirect_radio"); $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_allow_original_URL_redirect", $title, $data, $help); // Build section $html .= InterfaceElements::generateAdminSectionContainer("node_config", _("Node configuration"), implode(null, $_html_node_config)); /* * Access rights */ if (User::getCurrentUser()->DEPRECATEDisSuperAdmin()) { require_once 'classes/Stakeholder.php'; $html_access_rights = Stakeholder::getAssignStakeholdersUI($this); $html .= InterfaceElements::generateAdminSectionContainer("access_rights", _("Access rights"), $html_access_rights); } //Node hierarchy $html .= parent::getGraphAdminUI($network); $html .= "</ul>\n"; $html .= "</fieldset>"; return $html; }
$nodes_list[] = $node_row; } // Sort using PHP if ($sort_by_using_sql === false) { // Using natural-sort algorithm . switch ($sort_by_param) { case "node_id": Utils::natsort2d($nodes_list, "node_id"); break; case "num_online_users": Utils::natsort2d($nodes_list, "num_online_users"); break; } } // Pass values to Smarty $smarty->assign('selectNetworkUI', Network::getSelectUI('network_id', array('preSelectedObject' => $network, 'allowEmpty' => true, 'nullCaptionString' => _("All"), 'onChange' => "submit.click();")) . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : "")); if ($network !== null) { $smarty->assign('selectedNetwork', $network->getName()); } else { $smarty->assign('allNetworks', _("All networks")); } $smarty->assign("nodes", $nodes_list); $smarty->assign("sort_by_param", $sort_by_param); require_once 'classes/MainUI.php'; $ui = MainUI::getObject(); $ui->addContent('main_area_middle', $smarty->fetch("templates/node_list.html")); $ui->display(); /* * Local variables: * tab-width: 4 * c-basic-offset: 4
// Add Google Maps JavaScript (must set config values) if (!($vhost = VirtualHost::getCurrentVirtualHost())) { throw new Exception(_("Unable to get the google API key, because I couldn't find a vhost matching the current hostname")); } $html_headers = "<script src='http://maps.google.com/maps?file=api&v=2&&key=" . $vhost->getGoogleAPIKey() . "' type='text/javascript'></script>"; $html_headers .= "<script src='js/hotspots_status_map.js' type='text/javascript'></script>"; $html = null; /* * Main content */ // Set section of Smarty template $smarty->assign('sectionMAINCONTENT', true); // Set network selector $preSelectedObject = !empty($_REQUEST['network_map']) ? Network::getObject($_REQUEST['network_map']) : Network::getCurrentNetwork(); //$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "javascript: document.lang_form.submit();")); $selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "submit.click();")); $smarty->assign('selectNetworkUI', $selectNetworkUI . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : "")); // Compile HTML code $html_body = $smarty->fetch("templates/sites/hotspots_map.tpl"); /* * Footer JavaScripts */ // Get GIS data to set if (!empty($_REQUEST['network_map'])) { $network = Network::getObject($_REQUEST['network_map']); } else { $network = Network::getCurrentNetwork(); } $gis_data = $network->getGisLocation(); // The onLoad code should only be called once all DIV are created. $script = "<script type=\"text/javascript\">//<![CDATA[\n";
/** * Get the login interface * @param string $userData=null Array of contextual data optionally sent to the method. * The function must still function if none of it is present. * * * This method understands: * $userData['preSelectedUser'] An optional User object. * @return HTML markup */ public static function getLoginUI($userData = null) { require_once 'classes/SmartyWifidog.php'; $networkUserData = null; if (!empty($userData['preSelectedUser'])) { $selectedUser = $userData['preSelectedUser']; $networkUserData['preSelectedObject'] = $selectedUser; } else { $selectedUser = null; } $smarty = SmartyWiFiDog::getObject(); // Set network selector $network_array = Network::getAllNetworks(); $default_network = Network::getDefaultNetwork(); foreach ($network_array as $network) { if ($network->getName() == $default_network->getName()) { $default_network_param = $network->getId(); } } if (Server::getServer()->getUseGlobalUserAccounts()) { $smarty->assign('selectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='{$default_network_param}' />"); } else { $smarty->assign('selectNetworkUI', Network::getSelectUI('auth_source', $networkUserData)); } // Set user details $smarty->assign('user_id', $selectedUser ? $selectedUser->getId() : ""); $smarty->assign('username', $selectedUser ? $selectedUser->getUsername() : ""); // Set error message $smarty->assign('error', self::$_loginLastError); // Check if one of the network allow signup $network_array = Network::getAllNetworks(); $networksAllowingSignup = null; foreach ($network_array as $network) { if ($network->getAuthenticator()->isRegistrationPermitted()) { $networksAllowingSignup[] = $network; } } //pretty_print_r($networksAllowingSignup); if (count($networksAllowingSignup) > 0) { //FIXME: This is far from ideal, it assumes that all networks use the same signup URL, or that only one network allows signup. $smarty->assign('signupUrl', $networksAllowingSignup[0]->getAuthenticator()->getSignupUrl()); } // Compile HTML code $html = self::ArrayToHiddenInput($_POST); //This must remain BEFORE the actual form. It allws repeating the request if the login attempt is causes by a session timeout or insufficient permissions. $html .= $smarty->fetch("templates/classes/Authenticator_getLoginForm.tpl"); return $html; }
/** Get an interface to create a new node group. * @param $network Optional: The network to which the new node will belong, * if absent, the user will be prompted. * @return html markup */ public static function getCreateNewObjectUI($network = null) { $html = ''; $html .= _("Add a new node group with name ") . " \n"; $name = "new_node_group_name"; $html .= "<input type='text' size='40' name='{$name}'>\n"; if ($network) { $name = "new_node_group_network_id"; $html .= "<input type='hidden' name='{$name}' value='{$network->getId()}'>\n"; } else { $html .= " " . _("in ") . " \n"; $html .= Network::getSelectUI('new_node_group'); } return $html; }
/** * Retreives the admin interface of this object * * @return string The HTML fragment for this interface */ public function getAdminUI() { Security::requirePermission(Permission::P('SERVER_PERM_EDIT_ANY_VIRTUAL_HOST'), Server::getServer()); // Init values $html = ''; $html .= "<fieldset class='admin_container " . get_class($this) . "'>\n"; $html .= "<legend>" . _("Virtual hosts management") . "</legend>\n"; $html .= "<ul class='admin_element_list'>\n"; // creation_date $name = "server_" . $this->getId() . "_creation_date"; $_value = htmlspecialchars($this->getCreationDate(), ENT_QUOTES); $html .= "<li class='admin_element_item_container'>\n"; $html .= "<div class='admin_element_label'>" . _("Creation date") . ":</div>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= "{$_value}\n"; $html .= "</div>\n"; $html .= "</li>\n"; // hostname $name = "server_" . $this->getId() . "_hostname"; $_value = htmlspecialchars($this->getHostname(), ENT_QUOTES); $html .= "<li class='admin_element_item_container'>\n"; $html .= "<div class='admin_element_label'>" . _("Hostname") . ":</div>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= "<input type='text' size='50' value='{$_value}' name='{$name}'>\n"; $html .= "</div>\n"; $html .= "</li>\n"; // default_network $html .= "<li class='admin_element_item_container'>\n"; $html .= "<div class='admin_element_label'>" . _("Default network for this vhost") . ":</div>\n"; $html .= "<div class='admin_element_data'>\n"; $name = "vhost_" . $this->getId() . "_default_network"; $html .= Network::getSelectUI($name, array('preSelectedObject' => $this->getDefaultNetwork())); $html .= "</div>\n"; $html .= "</li>\n"; // is_default_server $name = "vhost_" . $this->getId() . "_is_default_vhost"; if ($this->isDefaultVirtualHost()) { $_checked = "checked='checked'"; } else { $_checked = ""; } $html .= "<li class='admin_element_item_container'>\n"; $html .= "<div class='admin_element_label'>" . _("Make this Virtual Host the server's default?") . ":</div>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= "<input type='radio' name='{$name}' {$_checked}>\n"; $html .= "</div>\n"; $html .= "</li>\n"; // ssl_available $name = "server_" . $this->getId() . "_ssl_available"; if ($this->isSSLAvailable()) { $_checked = "checked='checked'"; } else { $_checked = ""; } $html .= "<li class='admin_element_item_container'>\n"; $html .= "<div class='admin_element_label'>" . _("Use SSL on this server?") . ":</div>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= "<input type='checkbox' name='{$name}' {$_checked}>\n"; $html .= "</div>\n"; $html .= "</li>\n"; // gmaps_api_key if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED == true) { $name = "server_" . $this->getId() . "_gmaps_api_key"; $_value = htmlspecialchars($this->getGoogleAPIKey(), ENT_QUOTES); $html .= "<li class='admin_element_item_container'>\n"; $html .= "<div class='admin_element_label'>" . _("Google public API key") . ":</div>\n"; $html .= "<div class='admin_element_data'>\n"; $html .= "<input type='text' size='50' value='{$_value}' name='{$name}'>\n"; $html .= "</div>\n"; $html .= "</li>\n"; } $html .= "</ul>\n"; $html .= "</fieldset>\n"; return $html; }
/** * Displays the output of this node list. * * @return void * * @author Benoit Grégoire <*****@*****.**> * @author Francois Proulx <*****@*****.**> * @author Max Horváth <*****@*****.**> * @copyright 2004-2006 Benoit Grégoire, Technologies Coeus inc. * @copyright 2004-2006 Francois Proulx, Technologies Coeus inc. * @copyright 2006 Max Horváth, Horvath Web Consulting */ public function getOutput() { // Init ALL smarty values $this->_smarty->assign('DEPRECATEDisSuperAdmin', false); $this->_smarty->assign('GMapsEnabled', false); $this->_smarty->assign('nodes', array()); $this->_smarty->assign('num_deployed_nodes', 0); $this->_smarty->assign('PdfSupported', false); $userData['preSelectedObject'] = $this->_network; $userData['allowEmpty'] = true; $userData['nullCaptionString'] = _("All"); $userData['onChange'] = "submit.click();"; $this->_smarty->assign('selectNetworkUI', Network::getSelectUI('network_id', $userData) . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : "")); $this->_smarty->assign('selectedNetworkName', $this->_network === null ? _("All networks") : $this->_network->getName()); /** * Define user security levels for the template * * These values are used in the default template of WiFoDog but could be used * in a customized template to restrict certain links to specific user * access levels. */ $this->_smarty->assign('DEPRECATEDisSuperAdmin', $this->_currentUser && $this->_currentUser->DEPRECATEDisSuperAdmin()); if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED == true) { $this->_smarty->assign('GMapsEnabled', true); } $_html = null; /* * Main content */ // Reset ALL smarty SWITCH values $this->_smarty->assign('sectionMAINCONTENT', false); // Set section of Smarty template $this->_smarty->assign('sectionMAINCONTENT', true); // Node details if ($this->_nodes) { foreach ($this->_nodes as $_nodeData) { $_node = Node::getObject($_nodeData['node_id']); $_nodeData['num_online_users'] = $_node->getNumOnlineUsers(); $this->_smarty->append("nodes", $_nodeData); } } $this->_smarty->assign("num_deployed_nodes", count($this->_nodes)); // Compile HTML code $_html_body = $this->_smarty->fetch("templates/sites/hotspot_status.tpl"); /* * Compile HTML output */ $this->_mainUI->setTitle(_("Hotspot list")); $this->_mainUI->appendHtmlHeadContent('<link rel="alternate" type="application/rss+xml" title="' . ($this->_network === null ? _("All networks") : $this->_network->getName()) . ": " . _("Newest Hotspots") . '" href="' . BASE_SSL_PATH . 'hotspot_status.php?format=RSS">'); $this->_mainUI->addContent('left_area_middle', $_html); $this->_mainUI->addContent('main_area_middle', $_html_body); $this->_mainUI->display(); }