|
| 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 | +} |
0 commit comments