diff --git a/assets/src/legacy/map.js b/assets/src/legacy/map.js index ad6d0c8fc0..ada74584f1 100644 --- a/assets/src/legacy/map.js +++ b/assets/src/legacy/map.js @@ -2396,29 +2396,36 @@ window.lizMap = function() { break; } } - if ( !popupsAvailable ) + if ( !popupsAvailable ) { + if ($('#mapmenu .nav-list > li.popupcontent > a').length ) { + $('#mapmenu .nav-list > li.popupcontent').remove(); + } return null; + } // Create the dock if needed if( 'popupLocation' in config.options && - config.options.popupLocation != 'map' && - !$('#mapmenu .nav-list > li.popupcontent > a').length ) { - // Verifying the message - if ( !('popup.msg.start' in lizDict) ) - lizDict['popup.msg.start'] = 'Click to the map to get informations.'; - // Initialize dock - var popupContainerId = 'popupcontent'; - var pcontent = '

'+lizDict['popup.msg.start']+'

'; - addDock(popupContainerId, 'Popup', config.options.popupLocation, pcontent, 'icon-comment'); - $('#button-popupcontent').click(function(){ - if($(this).parent().hasClass('active')) { - // clean locate layer - clearDrawLayer('locatelayer'); - // remove information - $('#popupcontent > div.menu-content').html('

'+lizDict['popup.msg.start']+'

'); - } - }); - + config.options.popupLocation != 'map' ) { + if ( !$('#mapmenu .nav-list > li.popupcontent > a').length ) { + // Verifying the message + if ( !('popup.msg.start' in lizDict) ) + lizDict['popup.msg.start'] = 'Click to the map to get informations.'; + // Initialize dock + var popupContainerId = 'popupcontent'; + var pcontent = '

'+lizDict['popup.msg.start']+'

'; + addDock(popupContainerId, 'Popup', config.options.popupLocation, pcontent, 'icon-comment'); + $('#button-popupcontent').click(function(){ + if($(this).parent().hasClass('active')) { + // clear highlight layer + lizMap.mainLizmap.map.clearHighlightFeatures(); + // remove information + $('#popupcontent > div.menu-content').html('

'+lizDict['popup.msg.start']+'

'); + } + }); + } else { + $('#mapmenu .nav-list > li.popupcontent > a > span.icon').append(''); + $('#mapmenu .nav-list > li.popupcontent > a > span.icon').css('background-image', 'none'); + } } var WMSGetFeatureInfo = new OpenLayers.Control.WMSGetFeatureInfo({ diff --git a/lizmap/modules/lizmap/lib/Project/Project.php b/lizmap/modules/lizmap/lib/Project/Project.php index c40d5b3d94..f89e1f7b19 100644 --- a/lizmap/modules/lizmap/lib/Project/Project.php +++ b/lizmap/modules/lizmap/lib/Project/Project.php @@ -2168,6 +2168,15 @@ public function getDefaultDockable() ); } + if ($this->getOption('popupLocation') === 'dock') { + $dockable[] = new \lizmapMapDockItem( + 'popupcontent', + 'Popup', + '', + 4 + ); + } + return $dockable; } @@ -2182,6 +2191,15 @@ public function getDefaultMiniDockable() $dockable = array(); $bp = $this->appContext->appConfig()->urlengine['basePath']; + if ($this->getOption('popupLocation') === 'mini-dock') { + $dockable[] = new \lizmapMapDockItem( + 'popupcontent', + 'Popup', + '', + 0 + ); + } + if ($this->hasAttributeLayers()) { // Add layer-export attribute to lizmap-selection-tool component if allowed $layerExport = $this->appContext->aclCheck('lizmap.tools.layer.export', $this->repository->getKey()) ? 'layer-export' : ''; @@ -2339,6 +2357,27 @@ public function getDefaultBottomDockable() return $dockable; } + /** + * @throws \jExceptionSelector + * + * @return \lizmapMapDockItem[] + */ + public function getDefaultRightDockable() + { + $dockable = array(); + + if ($this->getOption('popupLocation') === 'right-dock') { + $dockable[] = new \lizmapMapDockItem( + 'popupcontent', + 'Popup', + '', + 0 + ); + } + + return $dockable; + } + /** * Check if the project needs an update which lead to an error. * diff --git a/lizmap/modules/view/controllers/lizMap.classic.php b/lizmap/modules/view/controllers/lizMap.classic.php index a3333f5571..8162d12e89 100644 --- a/lizmap/modules/view/controllers/lizMap.classic.php +++ b/lizmap/modules/view/controllers/lizMap.classic.php @@ -625,7 +625,7 @@ protected function getProjectDockables() $items = jEvent::notify('mapBottomDockable', array('repository' => $repository, 'project' => $project))->getResponse(); $assign['bottomdockable'] = mapDockItemsMerge($assign['bottomdockable'], $items); - $assign['rightdockable'] = array(); + $assign['rightdockable'] = $lproj->getDefaultRightDockable(); $items = jEvent::notify('mapRightDockable', array('repository' => $repository, 'project' => $project))->getResponse(); $assign['rightdockable'] = mapDockItemsMerge($assign['rightdockable'], $items);