Skip to content

Commit 38e13ec

Browse files
committed
Add preload for initial fetch request
1 parent 5c140b3 commit 38e13ec

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

lizmap/modules/lizmap/lib/Project/Project.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,25 @@ public function getWMSGetCapabilitiesUrl()
540540
);
541541
}
542542

543+
/**
544+
* Get the WMS GetCapabilities Url.
545+
*
546+
* @return string
547+
*/
548+
public function getWFSGetCapabilitiesUrl()
549+
{
550+
return $this->appContext->getFullUrl(
551+
'lizmap~service:index',
552+
array(
553+
'repository' => $this->repository->getKey(),
554+
'project' => $this->key,
555+
'SERVICE' => 'WFS',
556+
'VERSION' => '1.0.0',
557+
'REQUEST' => 'GetCapabilities',
558+
)
559+
);
560+
}
561+
543562
/**
544563
* Get the WMTS GetCapabilities Url.
545564
*

lizmap/modules/view/controllers/lizMap.classic.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,27 @@ public function index()
213213
'resourceUrlReplacement' => array(),
214214
);
215215

216+
// Add preload links
217+
$rep->addPreloadLink(
218+
jUrl::get(
219+
'lizmap~service:getProjectConfig',
220+
array('project' => $project, 'repository' => $repository),
221+
),
222+
'fetch',
223+
'application/json',
224+
);
225+
$rep->addPreloadLink(
226+
jUrl::get(
227+
'lizmap~service:getKeyValueConfig',
228+
array('project' => $project, 'repository' => $repository),
229+
),
230+
'fetch',
231+
'application/json',
232+
);
233+
$rep->addPreloadLink($lproj->getWMSGetCapabilitiesUrl(), 'fetch', 'application/xml');
234+
$rep->addPreloadLink($lproj->getWFSGetCapabilitiesUrl(), 'fetch', 'application/xml');
235+
$rep->addPreloadLink($lproj->getWMTSGetCapabilitiesUrl(), 'fetch', 'application/xml');
236+
216237
// Get optional WMS public url list
217238
$lser = lizmap::getServices();
218239
if ($lser->wmsPublicUrlList) {
@@ -316,6 +337,7 @@ function f($x)
316337
}
317338
}
318339

340+
// Add map theme
319341
$rep->addAssets('maptheme');
320342

321343
// Add dockable css

0 commit comments

Comments
 (0)