示例#1
0
 /**
  * Retreives the admin interface of this object
  *
  * @return string The HTML fragment for this interface
  */
 public function getAdminUI()
 {
     Security::requirePermission(Permission::P('NETWORK_PERM_EDIT_NETWORK_CONFIG'), $this);
     require_once 'classes/InterfaceElements.php';
     // Init values
     $html = '';
     /*
      * Verify if an error message was registered before outputting the form
      */
     if (isset($this->errorMsg)) {
         $html .= "<div class='errormsg'>" . $this->errorMsg . "</div>";
     }
     /*
      * Begin with admin interface
      */
     $html .= "<fieldset class='admin_container " . get_class($this) . "'>\n";
     $html .= "<legend>" . _("Network management") . "</legend>\n";
     $html .= "<ul class='admin_element_list'>\n";
     /*
      * Content management
      */
     $html .= parent::getContentAdminUI();
     /*
      * Network information
      */
     $html_network_information = array();
     // network_id
     $title = _("Network ID");
     $data = htmlspecialchars($this->getId(), ENT_QUOTES);
     $html_network_information[] = InterfaceElements::generateAdminSectionContainer("network_id", $title, $data);
     // name
     $title = _("Network name");
     $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_name", $this->getName(), "network_name_input");
     $html_network_information[] = InterfaceElements::generateAdminSectionContainer("network_name", $title, $data);
     // creation_date
     $title = _("Network creation date");
     $data = DateTimeWD::getSelectDateTimeUI(new DateTimeWD($this->getCreationDate()), "network_" . $this->getId() . "_creation_date", DateTimeWD::INTERFACE_DATETIME_FIELD, "network_creation_date_input");
     $html_network_information[] = InterfaceElements::generateAdminSectionContainer("network_creation_date", $title, $data);
     // homepage_url
     $title = _("Network's web site");
     $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_homepage_url", $this->getWebSiteURL(), "network_homepage_url_input");
     $html_network_information[] = InterfaceElements::generateAdminSectionContainer("network_homepage_url", $title, $data);
     // tech_support_email
     $title = _("Technical support email");
     $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_tech_support_email", $this->getTechSupportEmail(), "network_tech_support_email_input");
     $html_network_information[] = InterfaceElements::generateAdminSectionContainer("network_tech_support_email", $title, $data);
     // Build section
     $html .= InterfaceElements::generateAdminSectionContainer("network_information", _("Information about the network"), implode(null, $html_network_information));
     /*
      * Network authentication
      */
     $html_network_authentication = array();
     //  network_authenticator_class
     $title = _("Network authenticator class");
     $help = _("The subclass of Authenticator to be used for user authentication. Example: AuthenticatorRadius");
     $name = "network_" . $this->getId() . "_network_authenticator_class";
     $value = htmlspecialchars($this->getAuthenticatorClassName(), ENT_QUOTES);
     $data = $this->getSelectAuthenticator($name, $value);
     $html_network_authentication[] = InterfaceElements::generateAdminSectionContainer("network_network_authenticator_class", $title, $data, $help);
     //  network_authenticator_params
     $title = _("Authenticator parameters");
     $help = _("The explicit parameters to be passed to the authenticator. You MUST read the constructor documentation of your desired authenticator class (in wifidog/classes/Authenticators/) BEFORE you start playing with this.  Example: 'my_network_id', '192.168.0.11', 1812, 1813, 'secret_key', 'CHAP_MD5'");
     $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_network_authenticator_params", $this->getAuthenticatorConstructorParams(), "network_network_authenticator_params_input");
     $html_network_authentication[] = InterfaceElements::generateAdminSectionContainer("network_network_authenticator_params", $title, $data, $help);
     // Build section
     $html .= InterfaceElements::generateAdminSectionContainer("network_authentication", _("Network Authentication"), implode(null, $html_network_authentication));
     /*
      * Network properties
      */
     $html_network_properties = array();
     //  theme_pack
     $title = _("Selected theme pack for this network");
     $data = ThemePack::getSelectUI("network_" . $this->getId() . "_theme_pack", $this->getThemePack());
     $html_network_properties[] = InterfaceElements::generateAdminSectionContainer("network_theme_pack", $title, $data);
     // Build section
     $html .= InterfaceElements::generateAdminSectionContainer("network_properties", _("Network properties"), implode(null, $html_network_properties));
     /*
      * Network's node properties
      */
     $html_network_node_properties = array();
     //  allow_splash_only_nodes
     $title = _("Splash-only nodes");
     $help = _("Are nodes allowed to be set as splash-only (no login)?");
     $data = InterfaceElements::generateInputCheckbox("network_" . $this->getId() . "_allow_splash_only_nodes", "", _("Yes"), $this->getSplashOnlyNodesAllowed(), "network_allow_splash_only_nodes_radio");
     $html_network_node_properties[] = InterfaceElements::generateAdminSectionContainer("network_allow_splash_only_nodes", $title, $data, $help);
     //  allow_custom_portal_redirect
     $title = _("Portal page redirection");
     $help = _("Are nodes allowed to redirect users to an arbitrary web page instead of the portal?");
     $data = InterfaceElements::generateInputCheckbox("network_" . $this->getId() . "_allow_custom_portal_redirect", "", _("Yes"), $this->getCustomPortalRedirectAllowed(), "network_allow_custom_portal_redirect_radio");
     $html_network_node_properties[] = InterfaceElements::generateAdminSectionContainer("network_allow_custom_portal_redirect", $title, $data, $help);
     //  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?");
     $data = InterfaceElements::generateInputCheckbox("network_" . $this->getId() . "_allow_original_URL_redirect", "", _("Yes"), $this->getPortalOriginalUrlAllowed(), "network_allow_original_URL_redirect_radio");
     $html_network_node_properties[] = InterfaceElements::generateAdminSectionContainer("network_allow_original_URL_redirect", $title, $data, $help);
     // Build section
     $html .= InterfaceElements::generateAdminSectionContainer("network_node_properties", _("Network's node properties"), implode(null, $html_network_node_properties));
     /*
      * Network's user verification
      */
     $html_network_user_verification = array();
     //  validation_grace_time
     $title = _("Validation grace period");
     $help = _("The length of the validation grace period in seconds.  A new user is granted Internet access for this period check his email and validate his account.");
     $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_validation_grace_time", $this->getValidationGraceTime(), "network_validation_grace_time_input");
     $html_network_user_verification[] = InterfaceElements::generateAdminSectionContainer("network_validation_grace_time", $title, $data, $help);
     //  validation_email_from_address
     $title = _("This will be the from address of the validation email");
     $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_validation_email_from_address", $this->getValidationEmailFromAddress(), "network_validation_email_from_address_input");
     $html_network_user_verification[] = InterfaceElements::generateAdminSectionContainer("network_validation_email_from_address", $title, $data);
     //  allow_multiple_login
     $title = _("Multiple connections");
     $help = _("Can an account be connected more than once at the same time?");
     $data = InterfaceElements::generateInputCheckbox("network_" . $this->getId() . "_allow_multiple_login", "", _("Yes"), $this->getMultipleLoginAllowed(), "network_allow_multiple_login_radio");
     $html_network_user_verification[] = InterfaceElements::generateAdminSectionContainer("network_allow_multiple_login", $title, $data, $help);
     //  network_authenticator_params
     $title = _("Case sensitivity");
     $help = _("Are usernames case sensitive?");
     $data = InterfaceElements::generateInputCheckbox("network_" . $this->getId() . "_usernames_case_sensitive", "", _("Yes"), $this->getUsernamesCaseSensitive(), "network_usernames_case_sensitive");
     $html_network_user_verification[] = InterfaceElements::generateAdminSectionContainer("network_usernames_case_sensitive", $title, $data, $help);
     // Build section
     $html .= InterfaceElements::generateAdminSectionContainer("network_user_verification", _("Network's user verification"), implode(null, $html_network_user_verification));
     /*
      * Dynamic abuse control
      */
     $html_dynamic_abuse_control = array();
     $permArray = null;
     $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_DYNAMIC_ABUSE_CONTROL'), $this);
     if (Security::hasAnyPermission($permArray)) {
         //  connection_limit_window
         $title = _("Abuse control window");
         $help = _("The length of the window during which the user must not have exceeded the limits below.  Any valid postgresql interval expression is acceptable, typically '1 month' '1 week'.  A user who exceeds the limits will be denied access until his usage falls below the limits.");
         $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_connection_limit_window", $this->getConnectionLimitWindow(), "network_connection_limit_window_input");
         $html_dynamic_abuse_control[] = InterfaceElements::generateAdminSectionContainer("network_connection_limit_window", $title, $data, $help);
         //  connection_limit_network_max_total_bytes
         $title = _("Network max total bytes transfered");
         $help = _("Maximum data transfer during the abuse control window");
         $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_connection_limit_network_max_total_bytes", $this->getConnectionLimitNetworkMaxTotalBytes(), "network_connection_limit_network_max_total_bytes");
         $html_dynamic_abuse_control[] = InterfaceElements::generateAdminSectionContainer("network_connection_limit_network_max_total_bytes", $title, $data, $help);
         //  connection_limit_network_max_usage_duration
         $title = _("Network max connection duration");
         $help = _("Maximum connection duration during the abuse control window.  Any valid postgresql interval expression is acceptable, such as hh:mm:ss");
         $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_connection_limit_network_max_usage_duration", $this->getConnectionLimitNetworkMaxDuration(), "network_connection_limit_network_max_usage_duration");
         $html_dynamic_abuse_control[] = InterfaceElements::generateAdminSectionContainer("network_connection_limit_network_max_usage_duration", $title, $data, $help);
         //  connection_limit_node_max_total_bytes
         $title = _("Node max total bytes transfered");
         $help = _("Maximum data transfer during the abuse control window");
         $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_connection_limit_node_max_total_bytes", $this->getConnectionLimitNodeMaxTotalBytes(), "network_connection_limit_node_max_total_bytes");
         $html_dynamic_abuse_control[] = InterfaceElements::generateAdminSectionContainer("network_connection_limit_node_max_total_bytes", $title, $data, $help);
         //  connection_limit_node_max_usage_duration
         $title = _("Node max connection duration");
         $help = _("Maximum connection duration during the abuse control window.  Any valid postgresql interval expression is acceptable, such as hh:mm:ss");
         $data = InterfaceElements::generateInputText("network_" . $this->getId() . "_connection_limit_node_max_usage_duration", $this->getConnectionLimitNodeMaxDuration(), "network_connection_limit_node_max_usage_duration");
         $html_dynamic_abuse_control[] = InterfaceElements::generateAdminSectionContainer("network_connection_limit_node_max_usage_duration", $title, $data, $help);
     } else {
         $html_dynamic_abuse_control[] = _("You do not have access to edit these options");
     }
     // Build section
     $html .= InterfaceElements::generateAdminSectionContainer("network_user_verification", _("Dynamic abuse control"), implode(null, $html_dynamic_abuse_control));
     /*
      * Access management
      */
     $html_access_rights = array();
     /*
      * Access rights
      */
     if (true) {
         require_once 'classes/Stakeholder.php';
         $html_access_rights = Stakeholder::getAssignStakeholdersUI($this);
         $html .= InterfaceElements::generateAdminSectionContainer("access_rights", _("Access rights"), $html_access_rights);
     }
     /*
      * Network GIS data
      */
     if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED == true) {
         $html_network_gis_data = array();
         $gis_point = $this->getGisLocation();
         $gis_lat_name = "network_" . $this->getId() . "_gis_latitude";
         $gis_lat_value = htmlspecialchars($gis_point->getLatitude(), ENT_QUOTES);
         $gis_long_name = "network_" . $this->getId() . "_gis_longitude";
         $gis_long_value = htmlspecialchars($gis_point->getLongitude(), ENT_QUOTES);
         $gis_alt_name = "network_" . $this->getId() . "_gis_altitude";
         $gis_alt_value = htmlspecialchars($gis_point->getAltitude(), ENT_QUOTES);
         $html_network_gis_data[] = '<p>' . _("Note that to be valid, all 3 values must be present.") . "</p>\n";
         $title = _("Latitude");
         $help = _("Center latitude for the area covered by your wireless network");
         $data = InterfaceElements::generateInputText($gis_lat_name, $gis_lat_value, "network_gis_latitude_input");
         $html_network_gis_data[] = InterfaceElements::generateAdminSectionContainer("network_gis_latitude", $title, $data, $help);
         $title = _("Longitude");
         $help = _("Center longitude for the area covered by your wireless network");
         $data = InterfaceElements::generateInputText($gis_long_name, $gis_long_value, "network_gis_longitude_input");
         $html_network_gis_data[] = InterfaceElements::generateAdminSectionContainer("network_gis_longitude", $title, $data, $help);
         $title = _("Zoomlevel");
         $help = _("Zoomlevel of the Google Map.  12 is a typical value.");
         $data = InterfaceElements::generateInputText($gis_alt_name, $gis_alt_value, "network_gis_altitude_input");
         $html_network_gis_data[] = InterfaceElements::generateAdminSectionContainer("network_gis_altitude", $title, $data, $help);
         $title = _("Map type");
         $help = _("Default Google Map type for your the area of your wireless network");
         $data = $this->getSelectGisMapType("network_" . $this->getId() . "_gmaps_map_type", $this->getGisMapType());
         $html_network_gis_data[] = InterfaceElements::generateAdminSectionContainer("network_gmaps_map_type", $title, $data, $help);
         // Build section
         $html .= InterfaceElements::generateAdminSectionContainer("network_gis_data", _("GIS data"), implode(null, $html_network_gis_data));
     }
     // Profile templates
     $title = _("Network profile templates");
     $name = "network_" . $this->_id . "_profile_templates";
     $data = ProfileTemplate::getLinkedProfileTemplateUI($name, "network_has_profile_templates", "network_id", $this->_id);
     $html .= InterfaceElements::generateAdminSectionContainer("network_profile_templates", $title, $data);
     // objects hierarchy
     $html .= parent::getGraphAdminUI($this);
     $html .= "</ul>\n";
     $html .= "</fieldset>";
     return $html;
 }
示例#2
0
 /**
  * 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;
 }
 /**
  * Shows the administration interface for ContentGroupElement
  *
  * @param string $subclass_admin_interface HTML code to be added after the
  *                                         administration interface
  *
  * @return string HTML code for the administration interface
  */
 public function getAdminUI($subclass_admin_interface = null, $title = null)
 {
     $db = AbstractDb::getObject();
     // Init values
     $html = '';
     $html .= "<li class='admin_element_item_container'>\n";
     $html .= "<fieldset class='admin_element_group'>\n";
     $html .= "<legend>" . sprintf(_("%s %d display conditions"), get_class($this), $this->getDisplayOrder()) . "</legend>\n";
     $allowed_node_rows = null;
     $html .= "<ul class='admin_element_list'>\n";
     /* display_order */
     $html .= "<li class='admin_element_item_container'>\n";
     $html .= "<div class='admin_element_label'>Display order: </div>\n";
     $html .= "<div class='admin_element_data'>\n";
     $name = "content_group_element_" . $this->id . "_display_order";
     $html .= "<input type='text' name='{$name}' value='" . $this->getDisplayOrder() . "' size='2'>\n";
     $html .= _("(Ignored if display type is random)") . "\n";
     $html .= "</div>\n";
     $html .= "</li>\n";
     $html .= "<li class='admin_element_item_container'>\n";
     // valid_from_timestamp
     $title_str = _("Content can be displayed at any date if no start or end date is specified.  Warning:  If you do not specify a specific time of day, midnight is assumed.");
     $html .= "<a href=\"#\" title=\"{$title_str}\">" . _("Only display from") . "</a>\n";
     $html .= "<div class='admin_element_data'>\n";
     $name = "content_group_element_" . $this->id . "_valid_from";
     $datetime_from = new DateTimeWD($this->getValidFromDate());
     $html .= DateTimeWD::getSelectDateTimeUI($datetime_from, $name, DateTimeWD::INTERFACE_DATETIME_FIELD, null);
     $html .= "</div>\n";
     // valid_until_timestamp
     $html .= "<div class='admin_element_label'>until</div>\n";
     $html .= "<div class='admin_element_data'>\n";
     $name = "content_group_element_" . $this->id . "_valid_until";
     $datetime_untill = new DateTimeWD($this->getValidUntilDate());
     $html .= DateTimeWD::getSelectDateTimeUI($datetime_untill, $name, DateTimeWD::INTERFACE_DATETIME_FIELD, null);
     $html .= "</div>\n";
     if (!$datetime_from->isEmpty() && $datetime_from->getTimestamp() > time()) {
         $html .= "<div class=warningmsg>Element not yet displayed</div>\n";
     }
     if (!$datetime_untill->isEmpty() && $datetime_untill->getTimestamp() < time()) {
         $html .= "<div class=warningmsg>Element has expired</div>\n";
     }
     $html .= "</li>\n";
     /* content_group_element_has_allowed_nodes */
     $html .= "<li class='admin_element_item_container'>\n";
     $html .= "<div class='admin_element_label'>" . _("Only display at node(s):") . _(" (DEPRECATED should use NodeGroups instead)") . "</div>\n";
     $html .= "<ul class='admin_element_list'>\n";
     $sql = "SELECT * FROM content_group_element_has_allowed_nodes WHERE content_group_element_id='{$this->id}'";
     $db->execSql($sql, $allowed_node_rows, false);
     if ($allowed_node_rows != null) {
         foreach ($allowed_node_rows as $allowed_node_row) {
             $node = Node::getObject($allowed_node_row['node_id']);
             $html .= "<li class='admin_element_item_container'>\n";
             $html .= "<div class='admin_element_data'>\n";
             $html .= "" . $node->GetId() . ": " . $node->GetName() . "";
             $html .= "</div>\n";
             $html .= "<div class='admin_element_tools'>\n";
             $name = "content_group_element_" . $this->id . "_allowed_node_" . $node->GetId() . "_remove";
             $html .= "<input type='submit' name='{$name}' value='" . _("Remove") . "'>";
             $html .= "</div>\n";
             $html .= "</li>\n";
         }
     }
     $html .= "<li class='admin_element_item_container'>\n";
     $userDataNode['additionalWhere'] = "AND node_id NOT IN (SELECT node_id FROM content_group_element_has_allowed_nodes WHERE content_group_element_id='{$this->id}')";
     $name = "content_group_element_{$this->id}_new_allowed_node";
     $html .= Node::getSelectUI($name, $userDataNode);
     $name = "content_group_element_{$this->id}_new_allowed_node_submit";
     $html .= "<input type='submit' name='{$name}' value='" . _("Add new allowed node") . "'>";
     $html .= "</li'>\n";
     $html .= "</ul>\n";
     $html .= _("(Content can be displayed at ANY node unless one or more nodes are selected)") . "\n";
     $html .= "</li>\n";
     $html .= "</fieldset>\n";
     $html .= "</li>\n";
     /* displayed_content_id */
     $html .= "<li class='admin_element_item_container'>\n";
     if (empty($this->content_group_element_row['displayed_content_id'])) {
         $html .= "<div class='errormsg'>Sorry, display element is missing.</div>\n";
         /*        	$html .= "<fieldset class='admin_element_group'>\n";
                    $html .= "<legend>"._("Add a new displayed content OR select an existing one")."</legend>\n";
                    $html .= self :: getNewContentUI("content_group_element_{$this->id}_new_displayed_content")."<br>";
                    $html .= self :: getSelectExistingContentUI("content_group_element_{$this->id}_new_displayed_existing_element", "AND content_id != '$this->id'");
                    $html .= "</fieldset>\n";*/
     } else {
         $displayed_content = self::getObject($this->content_group_element_row['displayed_content_id']);
         $html .= $displayed_content->getAdminUI(null, sprintf(_("%s %d displayed content (%s)"), get_class($this), $this->getDisplayOrder(), get_class($displayed_content)));
         /*$html .= "<div class='admin_element_tools'>\n";
           $name = "content_group_element_{$this->id}_erase_displayed_content";
           $html .= "<input type='submit' name='$name' value='"._("Delete")."'>";
           $html .= "</div>\n";*/
     }
     $html .= "</li>\n";
     $html .= $subclass_admin_interface;
     return parent::getAdminUI($html, $title);
 }
示例#4
0
 /**
  * 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;
     /** @todo this should not be the default network here */
     $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODEGROUP_CONFIG'), Network::getDefaultNetwork());
     $permArray[] = array(Permission::P('NODEGROUP_PERM_EDIT_ANY_NODEGROUP_CONFIG'), $this);
     $permArray[] = array(Permission::P('NODEGROUP_PERM_EDIT_NODEGROUP_CONFIG'), $this);
     Security::requireAnyPermission($permArray);
     require_once 'classes/InterfaceElements.php';
     require_once 'classes/Stakeholder.php';
     // Init values
     $html = '';
     $ng_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 group") . "</legend>\n";
     $html .= "<ul class='admin_element_list'>\n";
     /*
      * Information about the node group
      */
     $_html_node_information = array();
     // Name
     $permArray = null;
     $permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODEGROUP_CONFIG'), Network::getDefaultNetwork());
     $permArray[] = array(Permission::P('NODEGROUP_PERM_EDIT_NODEGROUP_CONFIG'), $this);
     if (Security::hasAnyPermission($permArray)) {
         $_title = _("Name");
         $_data = InterfaceElements::generateInputText("node_group_" . $ng_id . "_name", $this->getName(), "node_group_name_input");
         $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_group_name", $_title, $_data);
     } else {
         $_title = _("Name");
         $_data = $this->getName();
         $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_group_name", $_title, $_data);
     }
     // Description
     $_title = _("Description");
     $name = "node_" . $ng_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);
     // Creation date
     $_title = _("Creation date");
     $_data = DateTimeWD::getSelectDateTimeUI(new DateTimeWD($this->getCreationDate()), "node_group_" . $ng_id . "_creation_date", DateTimeWD::INTERFACE_DATETIME_FIELD, "node_group_creation_date_input");
     $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_creation_date", $_title, $_data);
     //Node content
     $html .= parent::getContentAdminUI();
     //Node hierarchy
     $html .= parent::getGraphAdminUI();
     // Build section
     $html .= InterfaceElements::generateAdminSectionContainer("node_group_information", _("Information about the node group"), implode(null, $_html_node_information));
     /*
      * 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);
     }
     $html .= "</ul>\n";
     $html .= "</fieldset>";
     return $html;
 }