Skip to content

Commit 1fb6dac

Browse files
authored
Merge branch 'Piwigo:master' into master
2 parents b7ebeec + 5732e09 commit 1fb6dac

36 files changed

Lines changed: 1504 additions & 545 deletions

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Changes from v2.8.d to v2.9.a
2+
- Added "Select Place" functionality to batchmanagement
3+
- Allow more SSL geo providers
4+
- Fix logitude column
5+
- Update language, thanks to the contributors
6+
17
Changes from v2.8.c to v2.8.d
28
- Fix PHP syntax
39

admin.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
include(dirname(__FILE__).'/admin/admin.php');
3+
?>

admin/admin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
else
4646
$page['tab'] = $_GET['tab'];
4747

48-
$my_base_url = get_admin_plugin_menu_link(__FILE__);
48+
$my_base_url = get_root_url().'admin.php?page=plugin-piwigo_openstreetmap';
4949

5050
$tabsheet = new tabsheet();
51-
$tabsheet->add( 'config', '<span class="icon-cog"></span>' . l10n('Configuration'), add_url_params( $my_base_url, array('tab'=>'config') ) );
52-
$tabsheet->add( 'tag', '<span class="icon-tags"></span>' . l10n('Tags'), add_url_params( $my_base_url, array('tab'=>'tag') ) );
53-
$tabsheet->add( 'place', '<span class="osm-location"></span>' . l10n('Places'), add_url_params( $my_base_url, array('tab'=>'place') ) );
51+
$tabsheet->add( 'config', '<span class="icon-cog"></span>' . l10n('Configuration'), $my_base_url.'-config');
52+
$tabsheet->add( 'tag', '<span class="icon-tags"></span>' . l10n('Tags'), $my_base_url.'-tag');
53+
$tabsheet->add( 'place', '<span class="osm-location"></span>' . l10n('OSM_PLACES'), $my_base_url.'-place');
5454
$tabsheet->select($page['tab']);
5555

5656
$tabsheet->assign();

admin/admin_batchmanager.php

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,71 @@ function osm_perform_batch_manager_prefilters($filter_sets, $prefilter)
6161
add_event_handler('loc_end_element_set_global', 'osm_loc_end_element_set_global');
6262
function osm_loc_end_element_set_global()
6363
{
64-
global $template, $conf;
64+
global $template, $conf, $prefixeTable;
65+
define('osm_place_table', $prefixeTable.'osm_places');
66+
// Save location, eg Place
67+
$list_of_places = array();
68+
$available_places = array();
69+
$place_options = array();
70+
$query = '
71+
SELECT id, name, latitude, longitude
72+
FROM '.osm_place_table.'
73+
;';
74+
$result = pwg_query($query);
75+
// JS for the template
76+
while ($row = pwg_db_fetch_assoc($result))
77+
{
78+
$list_of_places[$row['id']] = array($row['name'], $row['latitude'], $row['longitude']);
79+
$available_places[$row['id']] = $row['name'];
80+
$place_options[] = '<option value="' . $row['id'] . '">' . $row['name'] . '</options>';
81+
}
82+
$jsplaces = "\nvar arr_places = ". json_encode($list_of_places) .";\n";
6583

6684
$batch_global_height = isset($conf['osm_conf']['batch']['global_height']) ? $conf['osm_conf']['batch']['global_height'] : '200';
6785
$template->append('element_set_global_plugins_actions',
6886
array('ID' => 'openstreetmap', 'NAME'=>l10n('OSM GeoTag'), 'CONTENT' => '
6987
<label>'.l10n('Latitude').' (-90=S to 90=N)
70-
<input type="text" size="8" name="osmlat">
88+
<input type="text" size="8" id="osmlat" name="osmlat">
7189
</label>
7290
<label>'.l10n('Longitude').' (-180=W to 180=E)
73-
<input type="text" size="9" name="osmlon">
91+
<input type="text" size="9" id="osmlon" name="osmlon">
92+
</label>
7493
</label> (Empty values will erase coordinates)
94+
<label>Saved Places:
95+
<select id="osmplaces" name="osmplaces" >
96+
<option value="NULL">--</option>
97+
'. implode("\n", $place_options) . '
98+
</select>
7599
<style type="text/css"> .map1 { height: '. $batch_global_height .'px !important; width:100% !important; margin: 5px; } </style>
76100
<script src="plugins/piwigo-openstreetmap/leaflet/qleaflet.jquery.js"></script>
77101
<div class="osm-map1 map1"></div>
78102
<script>
79-
$(document).ready(function() {
103+
$(document).ready(function() {' . $jsplaces . '
104+
var map;
80105
$("#permitAction").on("change", function (e) {
81106
var optionSelected = $("option:selected", this);
82107
if ("openstreetmap" == optionSelected.val()) {
83-
$(".osm-map1").qleaflet();
108+
map = $(".osm-map1").qleaflet();
109+
map.click(function(a,b,c) {
110+
$("#osmplaces").val("NULL");
111+
});
84112
}
85113
});
114+
$("#osmplaces").change(function(){
115+
var select = $("#osmplaces").val();
116+
var lat_elem = $("#osmlat");
117+
var lon_elem = $("#osmlon");
118+
if (select == "NULL")
119+
{
120+
lat_elem.val(0);
121+
lon_elem.val(0);
122+
}
123+
else
124+
{
125+
lat_elem.val(arr_places[select][1]);
126+
lon_elem.val(arr_places[select][2]);
127+
}
128+
});
86129
});
87130
</script>
88131
'));

admin/admin_boot.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,6 @@
2626
// Check whether we are indeed included by Piwigo.
2727
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
2828

29-
// Hook to a admin config page
30-
add_event_handler('get_admin_plugin_menu_links', 'osm_admin_menu');
31-
function osm_admin_menu($menu)
32-
{
33-
array_push($menu,
34-
array(
35-
'NAME' => '<span class="osm-globe"></span>OpenStreetMap',
36-
'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin.php')
37-
)
38-
);
39-
return $menu;
40-
}
41-
4229
// Batch_manager support
4330
include_once(dirname(__FILE__).'/admin_batchmanager.php');
4431

admin/admin_place.tpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ $("#searchInput").on("keydown", function(e) {
104104
{/if}
105105

106106
<fieldset>
107-
<legend>{'Add a place'|@translate}</legend>
107+
<legend>{'OSM_ADD_PLACE'|@translate}</legend>
108108
<ul>
109109
<li>
110-
<label>{'New place'|@translate} : </label>
110+
<label>{'OSM_NEW_PLACE'|@translate} : </label>
111111
<input type="text" name="add_place" size="50" require="" placeholder="Home">
112112
</li>
113113
<li>
114-
<label>{'Latitude'|@translate} : </label>
114+
<label>{'LATITUDE'|@translate} : </label>
115115
<input type="text" name="add_lat" size="40" require="" placeholder="48.858">
116116
</li>
117117
<li>
118-
<label>{'Longitude'|@translate} : </label>
118+
<label>{'LONGITUDE'|@translate} : </label>
119119
<input type="text" name="add_lon" size="40" require="" placeholder="2.2942">
120120
</li>
121121
</ul>
@@ -124,7 +124,7 @@ $("#searchInput").on("keydown", function(e) {
124124
</fieldset>
125125

126126
<fieldset>
127-
<legend>{'Place selection'|@translate}</legend>
127+
<legend>{'PLACE_SELECTION'|@translate}</legend>
128128

129129
{if count($all_places)}
130130
<div><label><span class="icon-filter" style="visibility:hidden" id="filterIcon"></span>{'Search'|@translate}: <input id="searchInput" type="text" size="12"></label></div>
@@ -146,8 +146,8 @@ $("#searchInput").on("keydown", function(e) {
146146

147147
<p>
148148
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
149-
<input type="submit" name="edit" value="{'Edit selected places'|@translate}">
150-
<input type="submit" name="delete" value="{'Delete selected places'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
149+
<input type="submit" name="edit" value="{'EDIT_PLACES'|@translate}">
150+
<input type="submit" name="delete" value="{'DELETE_PLACES'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
151151
</p>
152152
</fieldset>
153153

include/functions_map.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ function osm_get_items($page)
196196

197197
$query="SELECT i.latitude, i.longitude,
198198
IFNULL(i.name, '') AS `name`,
199-
IF(i.representative_ext IS NULL,
200-
CONCAT(SUBSTRING_INDEX(TRIM(LEADING '.' FROM i.path), '.', 1 ), '-sq.', SUBSTRING_INDEX(TRIM(LEADING '.' FROM i.path), '.', -1 )),
201-
TRIM(LEADING '.' FROM
199+
TRIM(LEADING '.' FROM IF(i.representative_ext IS NULL,
200+
CONCAT(LEFT(i.path,CHAR_LENGTH(i.path)-1-CHAR_LENGTH(SUBSTRING_INDEX(i.path, '.', -1 ))), '-sq.', SUBSTRING_INDEX(i.path, '.', -1 )),
202201
REPLACE(i.path, TRIM(TRAILING '.' FROM SUBSTRING_INDEX(i.path, '/', -1 )),
203202
CONCAT('pwg_representative/',
204203
CONCAT(
@@ -207,8 +206,7 @@ function osm_get_items($page)
207206
)
208207
)
209208
)
210-
)
211-
) AS `pathurl`,
209+
)) AS `pathurl`,
212210
TRIM(TRAILING '/' FROM CONCAT( i.id, '/category/', IFNULL(ic.category_id, '') ) ) AS `imgurl`,
213211
IFNULL(i.comment, '') AS `comment`,
214212
IFNULL(i.author, '') AS `author`,
@@ -307,15 +305,16 @@ function osm_get_js($conf, $local_conf, $js_data)
307305
? $local_conf['autocenter']
308306
: 0;
309307

310-
// When gallery is SSL and when switching baselayerURL to https is possible
311-
$httpx = (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')?'https':'http';
308+
// When gallery is SSL and when switching to SSL baselayerURL is possible, use $httpx
309+
$httpx = ((!empty($_SERVER['HTTPS'])) and (strtolower($_SERVER['HTTPS']) !== 'off')) ? 'https' : 'http';
312310

313311
// Load baselayerURL
314312
if ($baselayer == 'mapnik') $baselayerurl = $httpx.'://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
315313
else if($baselayer == 'mapquest') $baselayerurl = 'http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png';
316314
else if($baselayer == 'mapnikde') $baselayerurl = $httpx.'://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png';
317315
else if($baselayer == 'mapnikfr') $baselayerurl = $httpx.'://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png';
318-
else if($baselayer == 'blackandwhite') $baselayerurl = 'http://{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png';
316+
// else if($baselayer == 'blackandwhite') $baselayerurl = 'http://{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png';
317+
else if($baselayer == 'blackandwhite') $baselayerurl = 'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png';
319318
else if($baselayer == 'mapnikhot') $baselayerurl = $httpx.'://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png';
320319
else if($baselayer == 'mapquestaerial') $baselayerurl = 'http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png';
321320
else if($baselayer == 'toner') $baselayerurl = $httpx.'://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png';

language/br_FR/plugin.lang.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,10 @@
141141
$lang['RIGHTLINKCSS_DESC'] = 'Giz CSS personelaet da lakaat d\'an talbenn-lec\'h';
142142
$lang['SHOWLOCATION'] = 'Diskouez kartenn al lec\'h';
143143
$lang['PINSHADOWPATH'] = 'Skeud';
144-
$lang['PINSHADOWSIZE'] = 'Ment ar skeud';
144+
$lang['PINSHADOWSIZE'] = 'Ment ar skeud';
145+
$lang['DELETE_PLACES'] = 'Dilemel al lec\'hioù diuzet';
146+
$lang['EDIT_PLACES'] = 'Aozañ al lec\'hioù diuzet';
147+
$lang['OSM_ADD_PLACE'] = 'Ouzhpennañ ul lec\'h';
148+
$lang['OSM_NEW_PLACE'] = 'Lec\'h nevez';
149+
$lang['OSM_PLACES'] = 'Lec\'hioù';
150+
$lang['PLACE_SELECTION'] = 'Diuz al lec\'h';

language/ca_ES/description.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Integració de l'OpenStreetMap al Piwigo.

language/da_DK/plugin.lang.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,10 @@
141141
$lang['LAYOUT_MAP'] = 'Verdenskortlayout';
142142
$lang['LAYOUT_MAP_DESC'] = 'Vælg den verdenskortstil du foretrækker';
143143
$lang['POSITION_INDEX_CMAP'] = 'Vis kort på';
144-
$lang['POSITION_INDEX_CMAP_DESC'] = 'Viser kortet på det angivne indeks';
144+
$lang['POSITION_INDEX_CMAP_DESC'] = 'Viser kortet på det angivne indeks';
145+
$lang['DELETE_PLACES'] = 'Slet valgt steder';
146+
$lang['EDIT_PLACES'] = 'Rediger valgte steder';
147+
$lang['OSM_ADD_PLACE'] = 'Tilføj et sted';
148+
$lang['OSM_NEW_PLACE'] = 'Nyt sted';
149+
$lang['OSM_PLACES'] = 'Steder';
150+
$lang['PLACE_SELECTION'] = 'Steds placering';

0 commit comments

Comments
 (0)