''), $iso_list_sorted); $form = array(); $form['location_default_country'] = array( '#type' => 'select', '#title' => t('Default country selection'), '#default_value' => variable_get('location_default_country', 'us'), '#options' => $iso_list_sorted, '#description' => t('This will be the country that is automatically selected when a location form is served for a new location.') ); $form['location_display_location'] = array( '#type' => 'radios', '#title' => t('Toggle location display'), '#default_value' => variable_get('location_display_location', 1), '#options' => array( 0 => t('Disable the display of locations.'), 1 => t('Enable the display of locations.') ), '#description' => t('If you are interested in turning off locations and having a custom theme control their display, you may want to disable the display of locations so your theme can take that function.') ); $form['location_use_province_abbreviation'] = array( '#type' => 'radios', '#title' => t('Province display'), '#default_value' => variable_get('location_use_province_abbreviation', 1), '#options' => array( 0 => t('Display full province name.'), 1 => t('Display province/state code.'), ), ); $form['location_usegmap'] = array( '#type' => 'checkbox', '#title' => t('Use a Google Map to set latitude and longitude '), '#default_value' => variable_get('location_usegmap', FALSE), '#description' => t('If the gmap.module is installed and enabled, and this setting is also turned on, users that are allowed to manually enter latitude/longitude coordinates will be able to do so with an interactive Google Map. You should also make sure you have entered a Google Maps API key into your gmap module settings.', array('@enabled' => url('admin/build/modules'), '@google_maps_api_key' => 'http://www.google.com/apis/maps', '@gmap_module_settings' => url('admin/config/content/gmap'))), // @@@ megapatch This is an idea, but I'd opt more for a warning here... // '#disabled' => !module_exists('gmap'), ); $form['location_locpick_macro'] = array( '#type' => 'textfield', '#title' => t('Location chooser macro'), '#size' => 50, '#maxlength' => 500, '#default_value' => variable_get('location_locpick_macro', '[gmap]'), '#description' => t('If you would like to change the macro used to generate the location chooser map, you can do so here. Note: Behaviors locpick and collapsehack are forced to be enabled and cannot be changed.'), ); $form['location_jit_geocoding'] = array( '#type' => 'checkbox', '#title' => t('Enable JIT geocoding'), '#default_value' => variable_get('location_jit_geocoding', FALSE), '#description' => t('If you are going to be importing locations in bulk directly into the database, you may wish to enable JIT geocoding and load the locations with source set to 4 (LOCATION_LATLON_JIT_GEOCODING). The system will automatically geocode locations as they are loaded.'), ); $form['maplink_external'] = array( '#type' => 'fieldset', '#title' => t('Map link'), ); $form['maplink_external']['location_maplink_external'] = array( '#type' => 'checkbox', '#title' => t('Open map link in new window'), '#default_value' => variable_get('location_maplink_external', 0), '#description' => t('Select this if you want the map link to open in a separate window'), ); $form['maplink_external']['location_maplink_external_method'] = array( '#type' => 'radios', '#title' => t('Open in new window method'), '#options' => array( 'target="_blank"' => 'target="_blank"', 'rel="external"' => 'rel="external"', ), '#default_value' => variable_get('location_maplink_external_method', 'target="_blank"'), '#description' => t('If you have selected to open map in a new window this controls the method used to open in a new window. target="_blank" will just work but is not XTHML Strict compliant. rel="external" is XHTML Strict compliant but will not open in a new window unless you add some jQuery to your site to add the target attribute. If you are unsure leave set to target="_blank"'), ); return system_settings_form($form); } /** * Settings page for map links. */ function location_map_link_options_form($form, &$form_state) { $form = array(); $form['countries'] = array( '#type' => 'markup', '#markup' => '' ); foreach (_location_supported_countries() as $country_iso => $country_name) { location_load_country($country_iso); $form['countries'][$country_iso] = array( '#type' => 'markup', '#markup' => '' ); $form['countries'][$country_iso]['label_'. $country_iso] = array( '#type' => 'markup', '#markup' => $country_name ); // Set up '#options' array for mapping providers for the current country $mapping_options = array(); $provider_function = 'location_map_link_'. $country_iso .'_providers'; $default_provider_function = 'location_map_link_'. $country_iso .'_default_providers'; $checked = variable_get('location_map_link_'. $country_iso, function_exists($default_provider_function) ? $default_provider_function() : array()); //print "Calling provider function $provider_function"; if (function_exists($provider_function)) { foreach ($provider_function() as $name => $details) { $mapping_options[$name] = ''. $details['name'] .' (Terms of Use)'; } } if (count($mapping_options)) { $form['countries'][$country_iso]['location_map_link_'. $country_iso] = array( '#title' => '', '#type' => 'checkboxes', '#default_value' => $checked, '#options' => $mapping_options ); } else { $form['countries'][$country_iso]['location_map_link_'. $country_iso] = array( '#type' => 'markup', '#markup' => t('None supported.') ); } } $form = system_settings_form($form); $form['#theme'] = 'location_map_link_options'; return $form; } function location_geocoding_options_form($form, &$form_state) { $form = array(); $form['location_geocode_google_minimum_accuracy'] = array( '#type' => 'select', '#title' => t('Google Maps geocoding minimum accuracy'), '#options' => location_google_geocode_accuracy_codes(), '#default_value' => variable_get('location_geocode_google_minimum_accuracy', '3'), '#description' => t('The Google Maps geocoding API returns results with a given accuracy. Any responses below this minimum accuracy will be ignored. See a !accuracy_values_link.', array('!accuracy_values_link' => 'description of these values')) ); $form['countries'] = array(); // First, we build two arrays to help us figure out on the fly whether a specific country is covered by a multi-country geocoder, // and what the details of the multi-country geocoder are // (1) Get list of geocoders $general_geocoders_list = location_get_general_geocoder_list(); // (2) get data about each geocoder and the list of coutnries covered by each geocoder $general_geocoders_data = array(); $general_geocoders_countries = array(); foreach ($general_geocoders_list as $geocoder_name) { location_load_geocoder($geocoder_name); $info_function = $geocoder_name .'_geocode_info'; if (function_exists($info_function)) { $general_geocoders_data[$geocoder_name] = $info_function(); } $countries_function = $geocoder_name .'_geocode_country_list'; if (function_exists($countries_function)) { $general_geocoders_countries[$geocoder_name] = $countries_function(); } } foreach (_location_supported_countries() as $country_iso => $country_name) { location_load_country($country_iso); $geocoding_options = array(); $form['countries'][$country_iso] = array( '#type' => 'markup', '#markup' => '' ); $form['countries'][$country_iso]['label_'. $country_iso] = array( '#type' => 'markup', '#markup' => '