| 1 |
<?php |
<?php |
| 2 |
// $Id: location.admin.inc,v 1.19 2009/03/02 20:41:34 bdragon Exp $ |
// $Id: location.admin.inc,v 1.20 2009/04/17 19:09:53 bdragon Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 21 |
$iso_list_sorted = array_merge(array('' => ''), $iso_list_sorted); |
$iso_list_sorted = array_merge(array('' => ''), $iso_list_sorted); |
| 22 |
|
|
| 23 |
$form = array(); |
$form = array(); |
| 24 |
$form['location_default_country'] = array( |
|
| 25 |
'#type' => 'select', |
// @@@TODO 7.x -- Verify integrity of site_default_country and direct user |
| 26 |
'#title' => t('Default country selection'), |
// to the appropriate place to change it if necessary. |
| 27 |
'#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.') |
|
|
); |
|
| 28 |
$form['location_display_location'] = array( |
$form['location_display_location'] = array( |
| 29 |
'#type' => 'radios', |
'#type' => 'radios', |
| 30 |
'#title' => t('Toggle location display'), |
'#title' => t('Toggle location display'), |
| 72 |
|
|
| 73 |
$form['countries'] = array( |
$form['countries'] = array( |
| 74 |
'#type' => 'markup', |
'#type' => 'markup', |
| 75 |
'#value' => '' |
'#markup' => '' |
| 76 |
); |
); |
| 77 |
|
|
| 78 |
foreach (_location_supported_countries() as $country_iso => $country_name) { |
foreach (_location_supported_countries() as $country_iso => $country_name) { |
| 80 |
|
|
| 81 |
$form['countries'][$country_iso] = array( |
$form['countries'][$country_iso] = array( |
| 82 |
'#type' => 'markup', |
'#type' => 'markup', |
| 83 |
'#value' => '' |
'#markup' => '' |
| 84 |
); |
); |
| 85 |
|
|
| 86 |
$form['countries'][$country_iso]['label_'. $country_iso] = array( |
$form['countries'][$country_iso]['label_'. $country_iso] = array( |
| 87 |
'#type' => 'markup', |
'#type' => 'markup', |
| 88 |
'#value' => $country_name |
'#markup' => $country_name |
| 89 |
); |
); |
| 90 |
|
|
| 91 |
// Set up '#options' array for mapping providers for the current country |
// Set up '#options' array for mapping providers for the current country |
| 111 |
else { |
else { |
| 112 |
$form['countries'][$country_iso]['location_map_link_'. $country_iso] = array( |
$form['countries'][$country_iso]['location_map_link_'. $country_iso] = array( |
| 113 |
'#type' => 'markup', |
'#type' => 'markup', |
| 114 |
'#value' => t('None supported.') |
'#markup' => t('None supported.') |
| 115 |
); |
); |
| 116 |
} |
} |
| 117 |
} |
} |
| 188 |
else { |
else { |
| 189 |
$form['countries'][$country_iso]['location_geocode_'. $country_iso] = array( |
$form['countries'][$country_iso]['location_geocode_'. $country_iso] = array( |
| 190 |
'#type' => 'markup', |
'#type' => 'markup', |
| 191 |
'#value' => t('None supported.') |
'#markup' => t('None supported.') |
| 192 |
); |
); |
| 193 |
} |
} |
| 194 |
|
|
| 196 |
if ($current_value == 'none') { |
if ($current_value == 'none') { |
| 197 |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
| 198 |
'#type' => 'markup', |
'#type' => 'markup', |
| 199 |
'#value' => t('No service selected for country.') |
'#markup' => t('No service selected for country.') |
| 200 |
); |
); |
| 201 |
} |
} |
| 202 |
else { |
else { |
| 207 |
if (function_exists($geocode_settings_form_function_specific)) { |
if (function_exists($geocode_settings_form_function_specific)) { |
| 208 |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
| 209 |
'#type' => 'markup', |
'#type' => 'markup', |
| 210 |
'#value' => l(t('Configure parameters'), 'admin/settings/location/geocoding/'. $country_iso .'/'. $current_val_chopped) |
'#markup' => l(t('Configure parameters'), 'admin/settings/location/geocoding/'. $country_iso .'/'. $current_val_chopped) |
| 211 |
); |
); |
| 212 |
} |
} |
| 213 |
elseif (function_exists($geocode_settings_form_function_general)) { |
elseif (function_exists($geocode_settings_form_function_general)) { |
| 214 |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
| 215 |
'#type' => 'markup', |
'#type' => 'markup', |
| 216 |
'#value' => l(t('Configure parameters'), 'admin/settings/location/geocoding/'. $country_iso .'/'. $current_value) |
'#markup' => l(t('Configure parameters'), 'admin/settings/location/geocoding/'. $country_iso .'/'. $current_value) |
| 217 |
); |
); |
| 218 |
} |
} |
| 219 |
else { |
else { |
| 220 |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
$form['countries'][$country_iso]['location_geocode_config_link_'. $country_iso] = array( |
| 221 |
'#type' => 'markup', |
'#type' => 'markup', |
| 222 |
'#value' => t('No configuration necessary for selected service.') |
'#markup' => t('No configuration necessary for selected service.') |
| 223 |
); |
); |
| 224 |
} |
} |
| 225 |
} |
} |
| 261 |
$rows[] = $row; |
$rows[] = $row; |
| 262 |
} |
} |
| 263 |
$output = theme('table', $header, $rows); |
$output = theme('table', $header, $rows); |
| 264 |
foreach (element_children($form) as $key) { |
$output .= drupal_render_children($form); |
|
$output .= drupal_render($form[$key]); |
|
|
} |
|
|
$output .= drupal_render($form); |
|
| 265 |
return $output; |
return $output; |
| 266 |
} |
} |
| 267 |
|
|
| 286 |
$rows[] = $row; |
$rows[] = $row; |
| 287 |
} |
} |
| 288 |
$output = theme('table', $header, $rows); |
$output = theme('table', $header, $rows); |
| 289 |
foreach (element_children($form) as $key) { |
$output .= drupal_render_children($form); |
|
$output .= drupal_render($form[$key]); |
|
|
} |
|
|
$output .= drupal_render($form); |
|
| 290 |
return $output; |
return $output; |
| 291 |
} |
} |
| 292 |
|
|