Skip to content

Commit b593596

Browse files
committed
Merge GnunuX code. Thanks!
1 parent 7e9763b commit b593596

11 files changed

Lines changed: 452 additions & 130 deletions

admin/admin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141
$template->set_filename('plugin_admin_content', dirname(__FILE__).'/admin.tpl');
4242

4343
if (!isset($_GET['tab']))
44-
$page['tab'] = 'gps';
44+
$page['tab'] = 'config';
4545
else
4646
$page['tab'] = $_GET['tab'];
4747

4848
$my_base_url = get_admin_plugin_menu_link(__FILE__);
4949

5050
$tabsheet = new tabsheet();
51-
$tabsheet->add( 'gps', '<span class="icon-cog"></span>' . l10n('Upload GPS file'), add_url_params( $my_base_url, array('tab'=>'gps') ) );
5251
$tabsheet->add( 'config', '<span class="icon-cog"></span>' . l10n('Configuration'), add_url_params( $my_base_url, array('tab'=>'config') ) );
52+
$tabsheet->add( 'gps', '<span class="icon-cog"></span>' . l10n('Upload GPS file'), add_url_params( $my_base_url, array('tab'=>'gps') ) );
5353
$tabsheet->select($page['tab']);
5454

5555
$tabsheet->assign();

admin/admin_config.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@
114114
// Update conf if submitted in admin site
115115
if (isset($_POST['submit']) && !empty($_POST['osm_height']))
116116
{
117+
// Check the center GPS position is valid
118+
if ($_POST['osm_left_center'])
119+
//print explode(',', $_POST['osm_left_center'])[0];
120+
if (explode(',', $_POST['osm_left_center'])[0] <= -90 or explode(',', $_POST['osm_left_center'])[0] >= 90)
121+
array_push($page['warnings'], l10n('The specify center latitude (-90=S to 90=N) is not valid'));
122+
if (explode(',', $_POST['osm_left_center'])[1] <= -180 or explode(',', $_POST['osm_left_center'])[1] >= 180)
123+
array_push($page['warnings'], l10n('The specify center longitude (-180=W to 180=E) is not valid'));
124+
117125
// On post admin form
118126
$conf['osm_conf'] = array(
119127
'right_panel' => array(
@@ -137,6 +145,15 @@
137145
'zoom' => $_POST['osm_left_zoom'],
138146
'center' => $_POST['osm_left_center'],
139147
),
148+
'category_description' => array(
149+
'enabled' => get_boolean($_POST['osm_category_description']),
150+
'height' => $_POST['osm_cat_height'],
151+
'width' => $_POST['osm_cat_width'],
152+
),
153+
'main_menu' => array(
154+
'enabled' => get_boolean($_POST['osm_main_menu']),
155+
'height' => $_POST['osm_menu_height'],
156+
),
140157
'map' => array(
141158
'baselayer' => $_POST['osm_baselayer'],
142159
'custombaselayer' => $_POST['osm_custombaselayer'],

admin/admin_config.tpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@ Refer to the <a href="https://github.com/xbgmsharp/piwigo-openstreetmap/wiki" ta
103103
<small>{'LEFTPOPUPINFO_DESC'|@translate}</small>
104104
</li>
105105
<li>
106-
<label>{'ZOOM'|@translate} : </label>
106+
<label>{'ZOOM_MAP'|@translate} : </label>
107107
<select name="osm_left_zoom">
108108
{html_options options=$AVAILABLE_ZOOM selected=$left_menu.zoom}
109109
</select>
110-
<br/><small>{'ZOOM_DESC'|@translate}, default is 2</small>
110+
<br/><small>{'ZOOM_MAP_DESC'|@translate}</small>
111111
</li>
112112
<li>
113113
<label>{'CENTER_MAP'|@translate} : </label>
114114
<input type="text" value="{$left_menu.center}" name="osm_left_center" size="30" placeholder="0,0"/>
115-
<br/><small>{'CENTER_MAP_DESC'|@translate}. lat and lng separated by a comma, default is 0,0</small>
115+
<br/><small>{'CENTER_MAP_DESC'|@translate}</small>
116116
</li>
117117
</ul>
118118
</fieldset>
@@ -127,12 +127,12 @@ Refer to the <a href="https://github.com/xbgmsharp/piwigo-openstreetmap/wiki" ta
127127
</li>
128128
<li>
129129
<label>{'HEIGHT'|@translate} : </label>
130-
<input type="text" value="{$category_description.height}" name="osm_cat_height" size="4" required/>
130+
<input type="text" value="{$category_description.height}" name="osm_cat_height" size="4" required placeholder="200"/>
131131
<br/><small>{'HEIGHT_DESC'|@translate}</small>
132132
</li>
133133
<li>
134134
<label>{'WIDTH'|@translate} : </label>
135-
<input type="text" value="{$category_description.width}" name="osm_cat_width" size="4" required/>
135+
<input type="text" value="{$category_description.width}" name="osm_cat_width" size="4" required placeholder="auto"/>
136136
<br/><small>{'WIDTH_DESC'|@translate}</small>
137137
</li>
138138
</ul>
@@ -148,7 +148,7 @@ Refer to the <a href="https://github.com/xbgmsharp/piwigo-openstreetmap/wiki" ta
148148
</li>
149149
<li>
150150
<label>{'HEIGHT'|@translate} : </label>
151-
<input type="text" value="{$main_menu.height}" name="osm_menu_height" size="4" required/>
151+
<input type="text" value="{$main_menu.height}" name="osm_menu_height" size="4" required placeholder="200"/>
152152
<br/><small>{'HEIGHT_DESC'|@translate}</small>
153153
</li>
154154
</ul>

admin/admin_gps.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
/***********************************************
3-
* File : admin_config.php
3+
* File : admin_gps.php
44
* Project : piwigo-openstreetmap
5-
* Descr : Install / Uninstall method
5+
* Descr : read GPS file
66
*
7-
* Created : 28.05.2013
7+
* Created : 10.10.2014
88
*
99
* Copyright 2013-2014 <xbgmsharp@gmail.com>
1010
*

admin/admin_photo.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
'plugin_admin_content' => dirname(__FILE__).'/admin_photo.tpl'
8888
)
8989
);
90-
90+
9191
// Retrieving direct information about picture
9292
$query = 'SELECT * FROM '.IMAGES_TABLE.' WHERE id = '.$_GET['image_id'].';';
9393
$picture = pwg_db_fetch_assoc(pwg_query($query));
@@ -116,6 +116,7 @@
116116
else if($baselayer == 'mapquestaerial') $baselayerurl = 'http://oatile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg';
117117
else if($baselayer == 'custom') $baselayerurl = $custombaselayerurl;
118118

119+
include(dirname(__FILE__)."/../include/functions_map.php");
119120
$attribution = osmcopyright($attrleaflet, $attrimagery, $attrmodule, $baselayer, $custombaselayer);
120121

121122
if ($lat == 0 and $lon == 0) { $zoom = 2; }

index.inc.php renamed to category.inc.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
/***********************************************
3-
* File : picture.inc.php
3+
* File : category.inc.php
44
* Project : piwigo-openstreetmap
5-
* Descr : Display map on right panel
5+
* Descr : Display an OSM map on the category layout
66
*
7-
* Created : 20.08.2014
7+
* Created : 10.10.2014
88
*
99
* Copyright 2013-2014 <xbgmsharp@gmail.com>
1010
*
@@ -25,8 +25,6 @@
2525

2626
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
2727

28-
//check_status(ACCESS_GUEST);
29-
3028
// Do we have to show the right panel
3129
if ($conf['osm_conf']['category_description']['enabled'])
3230
{

language/en_UK/plugin.lang.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
$lang['POPUPLINK'] = "Add a link to image";
3535
$lang['POPUPCOMMENT'] = "Comment of the image";
3636
$lang['POPUPAUTHOR'] = "Author of the image";
37+
$lang['ZOOM_MAP'] = "Zoomlevel";
38+
$lang['ZOOM_MAP_DESC'] = "1: far away, 18: very close, default is 2.";
39+
$lang['CENTER_MAP'] = "Center map here";
40+
$lang['CENTER_MAP_DESC'] = "Center the worlmap on the specific location (GPS coordinate). lat and lng separated by a comma, default is 0,0";
3741

3842
$lang['C_MAP'] = "Category's description";
3943
$lang['SHOWCMAP'] = "Add a map in category's description";

main.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
}
2727
elseif (script_basename() == 'index')
2828
{
29-
include_once(dirname(__FILE__).'/index.inc.php');
30-
include_once(dirname(__FILE__).'/menu.inc.php');
29+
include_once(dirname(__FILE__).'/category.inc.php');
30+
include_once(dirname(__FILE__).'/menu.inc.php');
3131
}
3232

3333
// Do we have to show a link on the left menu

maintain.inc.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ function plugin_install()
3434
// Remove unused files from previous version
3535
$toremove = array("admin.tpl", "admin.php", "admin_boot.php",
3636
"leaflet/leaflet.ie.css", "leaflet/MarkerCluster.Default.ie.css",
37-
"admin/admin_sync.php", "admin/admin_sync.tpl", "admin/admin_batchmanager.php",
38-
"include/functions_metadata.php");
37+
"admin/admin_sync.php", "admin/admin_sync.tpl", "admin/admin_batchmanager.php");
3938
foreach ($toremove as $file)
4039
{
4140
if (is_file(OSM_PATH.$file))
@@ -146,7 +145,7 @@ function plugin_activate()
146145
global $conf;
147146

148147
if ( (!isset($conf['osm_conf']))
149-
or (count($conf['osm_conf'], COUNT_RECURSIVE) != 35))
148+
or (count($conf['osm_conf'], COUNT_RECURSIVE) != 40))
150149
{
151150
plugin_install();
152151
}

menu.inc.php

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,88 @@
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-
// Chech whether we are indeed included by Piwigo.
27-
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
28-
29-
if ($conf['osm_conf']['main_menu']['enabled'])
30-
{
31-
add_event_handler('blockmanager_register_blocks', 'osm_register_menu');
32-
add_event_handler('blockmanager_apply', 'osm_apply_menu');
33-
}
34-
function osm_register_menu( $menu_ref_arr )
35-
{
36-
$menu = & $menu_ref_arr[0];
37-
if ($menu->get_id() != 'menubar')
38-
return;
39-
$menu->register_block( new RegisteredBlock( 'mbAbout', 'About', 'A1M'));
40-
}
41-
42-
function osm_apply_menu($menu_ref_arr)
43-
{
44-
global $template, $page, $conf;
45-
46-
$menu = & $menu_ref_arr[0];
47-
48-
if (($block = $menu->get_block('mbLinks')) != null) {
49-
include_once( dirname(__FILE__) .'/include/functions.php');
50-
include_once(dirname(__FILE__).'/include/functions_map.php');
51-
osm_load_language();
52-
load_language('plugin.lang', OSM_PATH);
53-
54-
#comment are used only with this condition index.php l294
55-
if ($page['start']==0 and !isset($page['chronology_field']) )
56-
{
57-
$js_data = osm_get_items($page);
58-
if ($js_data != array())
59-
{
60-
$local_conf = array();
61-
$local_conf['pinid'] = 1;
62-
$local_conf['contextmenu'] = 'false';
63-
$local_conf['available_pin'] = '';
64-
$local_conf['control'] = false;
65-
$local_conf['img_popup'] = false;
66-
$local_conf['popup'] = 2;
67-
$local_conf['center_lat'] = 0;
68-
$local_conf['center_lng'] = 0;
69-
$local_conf['zoom'] = 2;
70-
$local_conf['auto_center'] = 0;
71-
$local_conf['divname'] = 'mapmenu';
72-
$local_conf['paths'] = osm_get_gps($page);
73-
$height = isset($conf['osm_conf']['main_menu']['height']) ? $conf['osm_conf']['main_menu']['height'] : '200';
74-
$js = osm_get_js($conf, $local_conf, $js_data);
75-
$template->set_template_dir(dirname(__FILE__).'/template/');
76-
$template->assign(
77-
array(
78-
'OSM_PATH' => embellish_url(get_absolute_root_url().OSM_PATH),
79-
'OSMJS' => $js,
80-
'HEIGHT' => $height,
81-
)
82-
);
83-
$block->template = 'osm-menu.tpl';
84-
}
85-
}
86-
}
87-
}
88-
?>
1+
<?php
2+
/***********************************************
3+
* File : menu.inc.php
4+
* Project : piwigo-openstreetmap
5+
* Descr : Display an OSM map on mainmenu right
6+
*
7+
* Created : 10.10.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+
// Chech whether we are indeed included by Piwigo.
27+
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
28+
29+
if ($conf['osm_conf']['main_menu']['enabled'])
30+
{
31+
add_event_handler('blockmanager_register_blocks', 'osm_register_menu');
32+
add_event_handler('blockmanager_apply', 'osm_apply_menu');
33+
}
34+
function osm_register_menu( $menu_ref_arr )
35+
{
36+
$menu = & $menu_ref_arr[0];
37+
if ($menu->get_id() != 'menubar')
38+
return;
39+
$menu->register_block( new RegisteredBlock( 'mbAbout', 'About', 'A1M'));
40+
}
41+
42+
function osm_apply_menu($menu_ref_arr)
43+
{
44+
global $template, $page, $conf;
45+
46+
$menu = & $menu_ref_arr[0];
47+
48+
if (($block = $menu->get_block('mbLinks')) != null) {
49+
include_once( dirname(__FILE__) .'/include/functions.php');
50+
include_once(dirname(__FILE__).'/include/functions_map.php');
51+
osm_load_language();
52+
load_language('plugin.lang', OSM_PATH);
53+
54+
#comment are used only with this condition index.php l294
55+
if ($page['start']==0 and !isset($page['chronology_field']) )
56+
{
57+
$js_data = osm_get_items($page);
58+
if ($js_data != array())
59+
{
60+
$local_conf = array();
61+
$local_conf['pinid'] = 1;
62+
$local_conf['contextmenu'] = 'false';
63+
$local_conf['available_pin'] = '';
64+
$local_conf['control'] = false;
65+
$local_conf['img_popup'] = false;
66+
$local_conf['popup'] = 2;
67+
$local_conf['center_lat'] = 0;
68+
$local_conf['center_lng'] = 0;
69+
$local_conf['zoom'] = 2;
70+
$local_conf['auto_center'] = 0;
71+
$local_conf['divname'] = 'mapmenu';
72+
$local_conf['paths'] = osm_get_gps($page);
73+
$height = isset($conf['osm_conf']['main_menu']['height']) ? $conf['osm_conf']['main_menu']['height'] : '200';
74+
$js = osm_get_js($conf, $local_conf, $js_data);
75+
$template->set_template_dir(dirname(__FILE__).'/template/');
76+
$template->assign(
77+
array(
78+
'OSM_PATH' => embellish_url(get_absolute_root_url().OSM_PATH),
79+
'OSMJS' => $js,
80+
'HEIGHT' => $height,
81+
)
82+
);
83+
$block->template = 'osm-menu.tpl';
84+
}
85+
}
86+
}
87+
}
88+
?>

0 commit comments

Comments
 (0)