Skip to content

feat: Add presentation module to core #5561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: release_3_10
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
__DIR__.'/lizmap/modules/dataviz',
__DIR__.'/lizmap/modules/filter',
__DIR__.'/lizmap/modules/lizmap',
__DIR__.'/lizmap/modules/presentation',
__DIR__.'/lizmap/modules/view',
__DIR__.'/lizmap/plugins/',
__DIR__.'/lizmap/app/responses',
Expand Down
1 change: 1 addition & 0 deletions lizmap/app/system/mainconfig.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
filter.enabled=on
action.enabled=on
lizmap.enabled=on
presentation.enabled=on
proj4php.enabled=on
view.enabled=on
jacl2db_admin.enabled=on
Expand Down
4 changes: 4 additions & 0 deletions lizmap/modules/admin/lib/ModulesInfo/ModulesChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class ModulesChecker
'proj4php',
'view',
);
// TODO, implement a core module which is disabled by default
private const coreAdditionalModules = array(
'presentation',
);

/**
* Get the list of installed modules with their metadata.
Expand Down
63 changes: 63 additions & 0 deletions lizmap/modules/presentation/classes/presentation.listener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

use Presentation\PresentationConfig;

/**
* @author Michaël DOUCHIN - 3Liz
* @copyright 2011-2024 3liz
*
* @see http://3liz.com
*
* @license Mozilla Public License : http://www.mozilla.org/MPL/
*/
class presentationListener extends jEventListener
{
public function ongetMapAdditions($event)
{
// Check presentation can be used by the current user
$presentationConfig = new PresentationConfig($event->repository, $event->project);
if (!$presentationConfig->getStatus()) {
return;
}

// Add JSON configuration
$presentationData = array();
$presentationData['url'] = jUrl::get(
'presentation~presentation:index',
array(
'repository' => $event->repository,
'project' => $event->project,
)
);
$jsCode = array();
$jsCode[] = 'const presentationConfig = '.json_encode($presentationData).';';

// Lizmap application URL basepath
$basePath = jApp::urlBasePath();

// Add JS files
$js = array();
$js[] = $basePath.'modules-assets/presentation/js/Presentation.js';
$js[] = $basePath.'modules-assets/presentation/js/PresentationPage.js';
$js[] = $basePath.'modules-assets/presentation/js/PresentationCards.js';

// Add CSS file
$css = array();
$css[] = $basePath.'modules-assets/presentation/css/presentation.css';

// add presentation form needed JS and CSS
$form = jForms::create('presentation~presentation');
$form->getBuilder('html')->outputMetaContent(null);
$formPage = jForms::create('presentation~presentation_page');
$formPage->getBuilder('html')->outputMetaContent(null);

// Add event JS & CSS
$event->add(
array(
'js' => $js,
'jscode' => $jsCode,
'css' => $css,
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Presentation\PresentationConfig;

class presentationDockableListener extends jEventListener
{
private function checkConfig($event, $dock)
{
// Check config
$presentationConfig = new PresentationConfig($event->repository, $event->project);
if ($presentationConfig->getStatus()) {
// Use template presentationConfig
$assign = array(
'repository' => $event->repository,
'project' => $event->project,
);
$content = array('presentation~presentation_'.$dock, $assign);
$dock = new lizmapMapDockItem(
'presentation',
jLocale::get('presentation~presentation.dock.title'),
$content,
15,
null, // done with the getMapAdditions event
null // idem
);
$event->add($dock);
}
}

public function onmapDockable($event)
{
$this->checkConfig($event, 'dock');
}
}
Loading
Loading