Skip to content

Commit 4960ea9

Browse files
author
Emmanuel Garette
committed
add missing files
1 parent a629406 commit 4960ea9

2 files changed

Lines changed: 124 additions & 0 deletions

File tree

index.inc.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
/***********************************************
3+
* File : picture.inc.php
4+
* Project : piwigo-openstreetmap
5+
* Descr : Display map on right panel
6+
*
7+
* Created : 20.08.2014
8+
*
9+
* Copyright 2013-2014 <xbgmsharp@gmail.com>
10+
*
11+
* This program is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*
24+
************************************************/
25+
26+
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
27+
28+
//check_status(ACCESS_GUEST);
29+
30+
// Do we have to show the right panel
31+
if ($conf['osm_conf']['category_description']['enabled'])
32+
{
33+
// Hook to add comment
34+
add_event_handler('loc_begin_index', 'osm_render_category_description');
35+
}
36+
function osm_render_category_description()
37+
{
38+
include_once( dirname(__FILE__) .'/include/functions.php');
39+
include_once(dirname(__FILE__).'/include/functions_map.php');
40+
osm_load_language();
41+
load_language('plugin.lang', OSM_PATH);
42+
43+
global $template, $page, $conf;
44+
#comment are used only with this condition index.php l294
45+
if ($page['start']==0 and !isset($page['chronology_field']) )
46+
{
47+
$js_data = osm_get_items($page);
48+
if ($js_data != array())
49+
{
50+
$local_conf = array();
51+
$local_conf['pinid'] = 1;
52+
$local_conf['contextmenu'] = 'false';
53+
$local_conf['available_pin'] = '';
54+
$local_conf['control'] = false;
55+
$local_conf['img_popup'] = false;
56+
$local_conf['popup'] = 2;
57+
$local_conf['center_lat'] = 0;
58+
$local_conf['center_lng'] = 0;
59+
$local_conf['zoom'] = 2;
60+
$local_conf['auto_center'] = 0;
61+
$height = isset($conf['osm_conf']['category_description']['height']) ? $conf['osm_conf']['category_description']['height'] : '200';
62+
$width = isset($conf['osm_conf']['category_description']['width']) ? $conf['osm_conf']['category_description']['width'] : 'auto';
63+
$js = osm_get_js($conf, $local_conf, $js_data);
64+
$template->set_filename('map', dirname(__FILE__).'/template/osm-index.tpl' );
65+
$template->assign(
66+
array(
67+
'CONTENT_ENCODING' => get_pwg_charset(),
68+
'OSM_PATH' => embellish_url(get_absolute_root_url().OSM_PATH),
69+
'HOME' => make_index_url(),
70+
'HOME_PREV' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : get_absolute_root_url(),
71+
'HOME_NAME' => l10n("Home"),
72+
'HOME_PREV_NAME' => l10n("Previous"),
73+
'OSMJS' => $js,
74+
'HEIGHT' => $height,
75+
'WIDTH' => $width,
76+
)
77+
);
78+
79+
$osm_content = $template->parse('map', true);
80+
// $osm_content = '<div id="osmmap"><div class="map_title">'.l10n('EDIT_MAP').'</div>' . $osm_content . '</div>';
81+
if (empty($page['comment']))
82+
$page['comment'] = $osm_content;
83+
else
84+
$page['comment'] = '<div>' . $osm_content . $page['comment'] . '</div>';
85+
}
86+
}
87+
}

template/osm-index.tpl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{html_head}
2+
<link href="{$OSM_PATH}leaflet/leaflet.css" rel="stylesheet">
3+
<script src="{$OSM_PATH}leaflet/leaflet.js"></script>
4+
<!--<script src="{$OSM_PATH}togeojson.js"></script>-->
5+
<link rel="stylesheet" href="{$OSM_PATH}leaflet/MarkerCluster.css" />
6+
<link rel="stylesheet" href="{$OSM_PATH}leaflet/MarkerCluster.Default.css" />
7+
<script src="{$OSM_PATH}leaflet/leaflet.markercluster.js"></script>
8+
{/html_head}
9+
10+
{html_style}
11+
{literal}
12+
#map {
13+
height: {/literal}{$HEIGHT}{literal}px;
14+
width: {/literal}{$WIDTH}{literal}px;
15+
{/literal}{if $WIDTH != 'auto'}width: {$WIDTH}px;
16+
float: left;{/if}{literal}
17+
18+
}
19+
{/literal}
20+
{/html_style}
21+
22+
<div id="map"></div>
23+
<script type="text/javascript">{$OSMJS}
24+
25+
{literal}
26+
map.on('moveend', onMapMove);
27+
28+
function onMapMove(e){
29+
getMarkers();
30+
}
31+
32+
function getMarkers(){
33+
var bounds = map.getBounds();
34+
}
35+
{/literal}
36+
</script>
37+

0 commit comments

Comments
 (0)