Protect content with mams_protect problem with javascript
Posted: Fri Mar 26, 2021 8:01 pm
I'm using cms 2.2.15 and MAMS 1.0. I have about five graphs and each graph is for a different person. That's why I want the graph only to show that person and hide the other four.
The code is:
<div class="grafiekWrap">
{mams_protect groups='groep_1'}
<div class="grafiek">
<h3>Naam 1</h3>
<canvas id="polarChart1"></canvas>
</div><!--grafiek-->
{/mams_protect}
{mams_protect groups='groep_2'}
<div class="grafiek">
<h3>Naam 2</h3>
<canvas id="polarChart2"></canvas>
</div><!--grafiek-->
{/mams_protect}
<div class="grafiek">
<h3>Naam 3</h3>
<canvas id="polarChart3"></canvas>
</div><!--grafiek-->
<div class="grafiek">
<h3>Naam 4</h3>
<canvas id="polarChart4"></canvas>
</div><!--grafiek-->
<div class="grafiek">
<h3>Naam 5</h3>
<canvas id="polarChart5"></canvas>
</div><!--grafiek-->
</div><!--grafiekWrap-->
I'm using Chart.js to proces the graph and using json to retrieve the data for the graph from an html-table. The problem is that if I protect each graph for a specific group, I get five empty canvas.
If I protect one graph with {mams_protect} alle graphs are shown. So there is no protection.
The {mams_protect} works if the whole <div class="grafiekWrap"> is protected. But as I try to explain, I'm looking for protection for each graph for a different person.
I would be nice if someone knows the solution.
The code is:
<div class="grafiekWrap">
{mams_protect groups='groep_1'}
<div class="grafiek">
<h3>Naam 1</h3>
<canvas id="polarChart1"></canvas>
</div><!--grafiek-->
{/mams_protect}
{mams_protect groups='groep_2'}
<div class="grafiek">
<h3>Naam 2</h3>
<canvas id="polarChart2"></canvas>
</div><!--grafiek-->
{/mams_protect}
<div class="grafiek">
<h3>Naam 3</h3>
<canvas id="polarChart3"></canvas>
</div><!--grafiek-->
<div class="grafiek">
<h3>Naam 4</h3>
<canvas id="polarChart4"></canvas>
</div><!--grafiek-->
<div class="grafiek">
<h3>Naam 5</h3>
<canvas id="polarChart5"></canvas>
</div><!--grafiek-->
</div><!--grafiekWrap-->
I'm using Chart.js to proces the graph and using json to retrieve the data for the graph from an html-table. The problem is that if I protect each graph for a specific group, I get five empty canvas.
If I protect one graph with {mams_protect} alle graphs are shown. So there is no protection.
The {mams_protect} works if the whole <div class="grafiekWrap"> is protected. But as I try to explain, I'm looking for protection for each graph for a different person.
I would be nice if someone knows the solution.