forked from hugowetterberg/simple_geo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_geo_admin.inc.php
185 lines (155 loc) · 6.11 KB
/
simple_geo_admin.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
// $Id$
/**
* @file
* Admin functions for simple geo
*/
function simple_geo_settings() {
drupal_add_css(drupal_get_path('module', 'simple_geo') .'/css/simple_geo_admin.css');
$form = array();
$form['position_set'] = array(
'#type' => 'fieldset',
'#title' => t('Default position'),
'#after_build' => array('simple_geo_add_form_js'),
);
$form['position_set']['simple_geo_default_position'] = array(
'#type' => 'textfield',
'#title' => t('Coordinates'),
'#default_value' => variable_get('simple_geo_default_position', ''),
'#prefix' => '<div class="map-placeholder"></div><div id="edit-simple-geo-position-wrapper">',
'#suffix' => '</div>',
'#attributes' => array(
'id' => 'edit-simple-geo-position',
),
);
$form['user_set'] = array(
'#type' => 'fieldset',
'#title' => t('Users'),
);
$form['user_set']['simple_geo_position_users'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_position_users', 1),
'#title' => t('Enable user positioning'),
);
$form['user_set']['simple_geo_search_address'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_search_address', 1),
'#title' => t('Enable "Search for address" field'),
);
$form['user_set']['simple_geo_search_address_icon'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_search_address_icon', 1),
'#title' => t('Enable marker icon for search result'),
);
$form['node_set'] = array(
'#type' => 'fieldset',
'#title' => t('Node rendering'),
);
$form['node_set']['simple_geo_show_map_link'] = array(
'#type' => 'select',
'#title' => t('Show map links for nodes'),
'#options' => array(
'always' => t('Always'),
'teaser' => t('In teaser'),
'full' => t('When viewing full node'),
'never' => t('Never'),
),
'#default_value' => variable_get('simple_geo_show_map_link', 'always'),
);
$form['node_set']['simple_geo_add_microformat_tag'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_add_microformat_tag', 1),
'#title' => t('Show microformat tag for node positions'),
);
$form['micromap_set'] = array(
'#type' => 'fieldset',
'#title' => t('Micromap'),
);
$form['micromap_set']['simple_geo_use_microformat_map'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_use_microformat_map', 1),
'#title' => t('Use map to display microformat positions'),
);
$form['micromap_set']['simple_geo_micromap_parent'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('simple_geo_micromap_parent', '#main-inner'),
'#title' => t('Parent element'),
'#description' => t('The jQuery expression that should be used to find the micromap parent'),
);
$form['micromap_set']['simple_geo_use_microformat_map'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_use_microformat_map', 1),
'#title' => t('Use map to display microformat positions'),
);
$form['micromap_set']['simple_geo_micromap_add_mode'] = array(
'#type' => 'select',
'#title' => t('Add method'),
'#options' => array(
'prepend' => t('Prepend'),
'append' => t('Append'),
),
'#default_value' => variable_get('simple_geo_micromap_add_mode', 'prepend'),
);
$form['micromap_set']['simple_geo_geocoding_suffix'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('simple_geo_geocoding_suffix', ''),
'#title' => t('Geocoding suffix'),
'#description' => t('Any suffix entered here will be appended to the address with a separating comma before a geocoding lookup is performed'),
);
$array = drupal_map_assoc(range(1, 17));
// $form['micromap_set']['simple_geo_zoom_title'] = array(
// '#type' => 'item',
// '#title' => 'Zoom level',
// );
$form['micromap_set']['simple_geo_min_zoom'] = array(
'#type' => 'select',
'#prefix' => '<div id="edit-simple-geo-zoom-level" class="form-item"><label>' . t('Zoom level') . '</label></div>',
'#title' => t('Min'),
'#options' => $array,
'#default_value' => variable_get('simple_geo_min_zoom', 1),
);
$form['micromap_set']['simple_geo_max_zoom'] = array(
'#type' => 'select',
'#title' => t('Max'),
'#options' => $array,
'#default_value' => variable_get('simple_geo_max_zoom', 14),
);
$form['micromap_set']['simple_geo_zoom_desc'] = array(
'#type' => 'item',
'#description' => t('This affects only the zoom level that\'s automatically chosen by the micromap'),
);
$form['micromap_set']['simple_geo_overview_map_show'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_overview_map_show', 0),
'#title' => t('Show overview map in lower right corner'),
);
$form['micromap_set']['simple_geo_overview_map_size'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('simple_geo_overview_map_size', 150),
'#title' => t('Overview map size'),
'#description' => t('Choose the size of the overview map, (value x value)'),
'#field_suffix' => 'px',
);
$form['google'] = array(
'#type' => 'fieldset',
'#title' => t('Google maps'),
'#description' => t('Google Maps must be configured for most of the simple_geo functionality'),
);
$form['google']['simple_geo_manually_load'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_manually_load', 1),
'#title' => t('Automatically load Google Maps scripts'),
);
$form['google']['gmaps_api_key'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('gmaps_api_key', ''),
'#title' => t('Your google maps api key'),
);
$form['google']['simple_geo_add_google_jsapi'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('simple_geo_add_google_jsapi', 1),
'#title' => t('Add the Google AJAX API Loader to the page'),
'#description' => t('Adds a script tag that loads the Google AJAX API Loader from Google. Disable this if another module or theme already handles this'),
);
return system_settings_form($form);
}