Skip to content

Commit 5b23c92

Browse files
committed
Add new options for worldmap #40
1 parent 9673eb5 commit 5b23c92

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

admin/admin_config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,14 @@
128128
'left_menu' => array(
129129
'enabled' => get_boolean($_POST['osm_left_menu']),
130130
'link' => $_POST['osm_left_link'],
131-
'popup' => $_POST['osm_left_popup'],
131+
'popup' => $_POST['osm_left_popup'],
132132
'popupinfo_name' => isset($_POST['osm_left_popupinfo_name']),
133133
'popupinfo_img' => isset($_POST['osm_left_popupinfo_img']),
134134
'popupinfo_link' => isset($_POST['osm_left_popupinfo_link']),
135135
'popupinfo_comment' => isset($_POST['osm_left_popupinfo_comment']),
136136
'popupinfo_author' => isset($_POST['osm_left_popupinfo_author']),
137+
'zoom' => $_POST['osm_left_zoom'],
138+
'center' => $_POST['osm_left_center'],
137139
),
138140
'map' => array(
139141
'baselayer' => $_POST['osm_baselayer'],

admin/admin_config.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ Refer to the <a href="https://github.com/xbgmsharp/piwigo-openstreetmap/wiki" ta
102102
</div>
103103
<small>{'LEFTPOPUPINFO_DESC'|@translate}</small>
104104
</li>
105+
<li>
106+
<label>{'ZOOM'|@translate} : </label>
107+
<select name="osm_left_zoom">
108+
{html_options options=$AVAILABLE_ZOOM selected=$left_menu.zoom}
109+
</select>
110+
<br/><small>{'ZOOM_DESC'|@translate}, default is 0</small>
111+
</li>
112+
<li>
113+
<label>{'CENTER_MAP'|@translate} : </label>
114+
<input type="text" value="{$left_menu.center}" name="osm_left_center" size="30" placeholder="0,0"/>
115+
<br/><small>{'CENTER_MAP_DESC'|@translate} Must be separate by a comma, default is 0,0</small>
116+
</li>
105117
</ul>
106118
</fieldset>
107119
<fieldset>

osmmap2.php

100755100644
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,16 @@
234234
$pinoffset = isset($conf['osm_conf']['pin']['pinoffset']) ? $conf['osm_conf']['pin']['pinoffset'] : '';
235235
$pinpopupoffset = isset($conf['osm_conf']['pin']['pinpopupoffset']) ? $conf['osm_conf']['pin']['pinpopupoffset'] : '';
236236

237+
/* If the config include parameters get them */
238+
$zoom = isset($conf['osm_conf']['left_menu']['zoom']) ? $conf['osm_conf']['left_menu']['zoom'] : 2;
239+
$center = isset($conf['osm_conf']['left_menu']['center']) ? $conf['osm_conf']['left_menu']['center'] : '0,0';
240+
$center_lat = isset($center) ? explode(',', $center)[0] : 0;
241+
$center_lng = isset($center) ? explode(',', $center)[1] : 0;
242+
237243
/* If we have zoom and center coordonate, set it otherwise fallback default */
238-
$zoom = isset($_GET['zoom']) ? $_GET['zoom'] : '2';
239-
$center_lat = isset($_GET['center_lat']) ? $_GET['center_lat'] : '0';
240-
$center_lng = isset($_GET['center_lng']) ? $_GET['center_lng'] : '0';
244+
$zoom = isset($_GET['zoom']) ? $_GET['zoom'] : $zoom;
245+
$center_lat = isset($_GET['center_lat']) ? $_GET['center_lat'] : $center_lat;
246+
$center_lng = isset($_GET['center_lng']) ? $_GET['center_lng'] : $center_lng;
241247

242248
// Load baselayerURL
243249
// Key1 BC9A493B41014CAABB98F0471D759707

0 commit comments

Comments
 (0)