Skip to content

Commit 87f0003

Browse files
committed
Improve unify code + solve #37
1 parent 509ef44 commit 87f0003

8 files changed

Lines changed: 173 additions & 470 deletions

File tree

admin/admin_gps.php

100755100644
File mode changed.

category.inc.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ function osm_render_category_description()
4646
if ($js_data != array())
4747
{
4848
$local_conf = array();
49-
$local_conf['pinid'] = 1;
5049
$local_conf['contextmenu'] = 'false';
51-
$local_conf['available_pin'] = '';
52-
$local_conf['control'] = false;
50+
$local_conf['control'] = true;
5351
$local_conf['img_popup'] = false;
5452
$local_conf['popup'] = 2;
5553
$local_conf['center_lat'] = 0;

include/functions_map.php

100755100644
Lines changed: 139 additions & 87 deletions
Large diffs are not rendered by default.

maintain.inc.php

100755100644
File mode changed.

menu.inc.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ function osm_apply_menu($menu_ref_arr)
5858
if ($js_data != array())
5959
{
6060
$local_conf = array();
61-
$local_conf['pinid'] = 1;
6261
$local_conf['contextmenu'] = 'false';
63-
$local_conf['available_pin'] = '';
64-
$local_conf['control'] = false;
62+
$local_conf['control'] = true;
6563
$local_conf['img_popup'] = false;
6664
$local_conf['popup'] = 2;
6765
$local_conf['center_lat'] = 0;

osmmap.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,32 @@
6363
$result = osm_parse_map_data_url($tokens, $next_token);
6464
$page = array_merge( $page, $result );
6565

66-
6766
if (isset($page['category']))
6867
check_restrictions($page['category']['id']);
6968

69+
/* If the config include parameters get them */
70+
$zoom = isset($conf['osm_conf']['left_menu']['zoom']) ? $conf['osm_conf']['left_menu']['zoom'] : 2;
71+
$center = isset($conf['osm_conf']['left_menu']['center']) ? $conf['osm_conf']['left_menu']['center'] : '0,0';
72+
$center_arr = preg_split('/,/', $center);
73+
$center_lat = isset($center_arr) ? $center_arr[0] : 0;
74+
$center_lng = isset($center_arr) ? $center_arr[1] : 0;
75+
76+
/* If we have zoom and center coordonate, set it otherwise fallback default */
77+
$zoom = isset($_GET['zoom']) ? $_GET['zoom'] : $zoom;
78+
$center_lat = isset($_GET['center_lat']) ? $_GET['center_lat'] : $center_lat;
79+
$center_lng = isset($_GET['center_lng']) ? $_GET['center_lng'] : $center_lng;
80+
7081
$local_conf = array();
71-
$local_conf['zoom'] = '2';
72-
$local_conf['center_lat'] = '0';
73-
$local_conf['center_lng'] = '0';
74-
$local_conf['pinid'] = 1;
82+
$local_conf['zoom'] = $zoom;
83+
$local_conf['center_lat'] = $center_lat;
84+
$local_conf['center_lng'] = $center_lng;
7585
$local_conf['contextmenu'] = 'false';
76-
$local_conf['available_pin'] = '';
77-
$local_conf['control'] = false;
86+
$local_conf['control'] = true;
7887
$local_conf['img_popup'] = false;
7988
$local_conf['paths'] = osm_get_gps($page);
89+
$local_conf = $local_conf + $conf['osm_conf']['map'] + $conf['osm_conf']['left_menu'];
8090

8191
$js_data = osm_get_items($page);
8292
$js = osm_get_js($conf, $local_conf, $js_data);
83-
osm_gen_template($conf, $js, $js_data, 'osm-map.tpl', $template)
93+
osm_gen_template($conf, $js, $js_data, 'osm-map.tpl', $template);
8494
?>

0 commit comments

Comments
 (0)