Skip to content

Commit 280f3ec

Browse files
hide graph and map views when js is disabled, close #548
1 parent 974b3c5 commit 280f3ec

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

app/class/Controllerhome.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public function desktop(): never
4444
}
4545
$display = $_GET['display'] ?? 'list';
4646

47+
if (Config::disablejavascript() && ($display === 'graph' || $display === 'map')) {
48+
http_response_code(403);
49+
$this->showtemplate('forbidden', ['message' => 'only list mode is available as javscript is disabled']);
50+
}
51+
4752
$pagelist = $this->pagemanager->pagelist();
4853

4954

app/view/templates/home.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@
6868
<i class="fa fa-search" title="There is active search"></i>
6969
<?php endif ?>
7070
<span>
71-
<a href="?display=list" <?= $display === 'list' ? 'class="selected"' : '' ?> ><i class="fa fa-th-list"></i></a>
72-
<a href="?display=graph" <?= $display === 'graph' ? 'class="selected"' : '' ?> ><i class="fa fa-sitemap"></i></a>
73-
<a href="?display=map" <?= $display === 'map' ? 'class="selected"' : '' ?> ><i class="fa fa-globe"></i></a>
71+
<?php if(!Wcms\Config::disablejavascript()) : ?>
72+
<a href="?display=list" <?= $display === 'list' ? 'class="selected"' : '' ?> ><i class="fa fa-th-list"></i></a>
73+
<a href="?display=graph" <?= $display === 'graph' ? 'class="selected"' : '' ?> ><i class="fa fa-sitemap"></i></a>
74+
<a href="?display=map" <?= $display === 'map' ? 'class="selected"' : '' ?> ><i class="fa fa-globe"></i></a>
75+
<?php endif ?>
7476
</span>
7577
</h2>
7678

0 commit comments

Comments
 (0)