Disable picture download

Re: Disable picture download

by H D -
Number of replies: 9
Thanks.
In reply to H D

Re: Disable picture download

by Mariela Castro Kohler -
Hello
I did it by creating a css style in the single template:



and then in the table:


I hope that helps smile and don't forget to purge caches wink
Best regards
Mariela
Average of ratings: Useful (1)
In reply to Mariela Castro Kohler

Re: Disable picture download

by William Lu -
Picture of Particularly helpful Moodlers

Hi Mariela,

Thank you very much for your contribution.

I tried to type your CSS into my Single Template like below:

Inside table:
<td class="nolink">image</td>
.......
At the bottom:
<style>
.nolink {cursor:not-allowed !important; point-events:none !important}
</style>

Then I tested it on my Mac, but not working.

I did clean Cache first.

Did I miss something?


Have you got a chance to test it on a Mac?

Thanks.

In reply to William Lu

Re: Disable picture download

by Mariela Castro Kohler -
Hallo William,

styles are normally defined at the top of a HTML page within the head section and then used in the body section where the table is defined.

I am no Mac user so I have not tested this on a Mac setting. However I have tested it in Opera, Chrome, Edge, Firefox and works everywhere.

So my template looks something like this (I have shortened the table to show only the first row):


I hope that helps smile

Best regards,
Mariela
Average of ratings: Useful (1)
In reply to Mariela Castro Kohler

Re: Disable picture download

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
It’s nothing to do with a Mac. CSS can’t be entered directly into a database template.

The database activity has a CSS template where you can add in CSS that only affects that activity. It’s with all the other templates: List view, Single view, Advanced search, Add entry, RSS template, CSS template.
In reply to Jon Bolton

Re: Disable picture download

by Mariela Castro Kohler -
Sorry to disagree with you John. You can definitely enter CSS in the single template in a style tag if you first disable the editor and then add the style Tag at the top in what in a normal HTML page the Head section is, like you see on my picture. You may also try to add it in CSS template but in my case affected all other database templates, which was not what I wanted... so I only added it to the single template and it works "as designed".
Average of ratings: Useful (1)
In reply to Mariela Castro Kohler

Re: Disable picture download

by William Lu -
Picture of Particularly helpful Moodlers
Hi John,

Yes, in most cases, we can enter CSS or Javascript inside any template, either at the top or at the bottom. They work the same as in the CSS Template or in the Javascript Template.

However, I couldn't get Mariela's CSS to work on my Moodle3.9x, nor on Moodle cloud. I tried to add her code in the Top /  the bottom of the Single template / the CSS template. I tested on Windows PC and Mac, I cleaned the cache before each test.

Hi Mariela,
I suspect that I didn't type in your code correctly. Could you please share your preset zip file here?

Thank you.
In reply to William Lu

Re: Disable picture download

by Mariela Castro Kohler -
Hi William,

please find attached the preset. Also please bear in mind, that this is a work in progress, I am experimenting with some stuff with the database activity.
So far this works for me... I hope it will also work for you. I would also be happy if others help to improve this preset wink

Best regards
Mariela
Average of ratings: Useful (1)
In reply to Mariela Castro Kohler

Re: Disable picture download

by William Lu -
Picture of Particularly helpful Moodlers
Hi Mariela,

Thank you very much for your preset. it works!

It was my fault, I didn't type in your code correctly. I missed the last ";".
Now, the code is:

<style>
.nolink {cursor:not-allowed !important; pointer-events: none !important;}
</style>

I tested it on my Mac, works straightaway.

I also tested the code at the bottom of the Single Template, which works as well 😀.

Thank you again for your contribution.