Skip to content

Commit

Permalink
Merge pull request #10 from mebis-lp/MBS-9118_fullscreen_mode
Browse files Browse the repository at this point in the history
MBS-9118: Fullscreen mode
  • Loading branch information
tholudwig authored Jul 18, 2024
2 parents 36e3d95 + ce83d7e commit e36d4f0
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 31 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ jobs:
fail-fast: false
matrix:
include:
- php: '8.1'
- php: '8.3'
moodle-branch: 'master'
database: 'pgsql'
- php: '8.0'
- php: '8.2'
moodle-branch: 'master'
database: 'pgsql'
- php: '8.1'
moodle-branch: 'MOODLE_401_STABLE'
moodle-branch: 'master'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_401_STABLE'
- php: '8.3'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
- php: '8.3'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
- php: '8.1'
moodle-branch: 'MOODLE_401_STABLE'
database: 'pgsql'

steps:
Expand Down
8 changes: 4 additions & 4 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'user' => CAP_ALLOW
'user' => CAP_ALLOW,
),

'clonepermissionsfrom' => 'moodle/my:manageblocks'
'clonepermissionsfrom' => 'moodle/my:manageblocks',
),

'block/qr:addinstance' => array(
Expand All @@ -43,9 +43,9 @@
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
'manager' => CAP_ALLOW,
),

'clonepermissionsfrom' => 'moodle/site:manageblocks'
'clonepermissionsfrom' => 'moodle/site:manageblocks',
),
);
2 changes: 1 addition & 1 deletion edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected function specific_definition($mform) {
$sizeoptions = [
QR_SIZE_SMALL => get_string('small', 'block_qr'),
QR_SIZE_MEDIUM => get_string('medium', 'block_qr'),
QR_SIZE_LARGE => get_string('large', 'block_qr')
QR_SIZE_LARGE => get_string('large', 'block_qr'),
];
$selectsize = $mform->addElement(
'select',
Expand Down
1 change: 1 addition & 0 deletions lang/de/block_qr.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
$string['event_start'] = 'Startdatum';
$string['event_summary'] = 'Titel';
$string['externalurl'] = 'URL';
$string['fullscreen'] = 'Im Vollbild anzeigen';
$string['geo'] = 'Geo';
$string['geolocation'] = 'Geokoordinaten (Breite/Länge)';
$string['internalcontent'] = 'Link zu einem Abschnitt oder Aktivität';
Expand Down
1 change: 1 addition & 0 deletions lang/en/block_qr.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
$string['event_start'] = 'Start date';
$string['event_summary'] = 'Title';
$string['externalurl'] = 'URL';
$string['fullscreen'] = 'Show in full screen';
$string['geo'] = 'Geo';
$string['geolocation'] = 'Geolocation (lat/lon)';
$string['internalcontent'] = 'Link to a section or activity';
Expand Down
46 changes: 30 additions & 16 deletions templates/qr.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
{{#qrurl}}
</a>
{{/qrurl}}
<div class="text-center">
<button class="btn btn-secondary" id="qrcodeModalButton{{id}}">{{#str}}
fullscreen, block_qr
{{/str}}</button>
</div>
<hr>
{{^calendar}}
<p class="text-center">{{description}}<br></p>
Expand Down Expand Up @@ -90,47 +95,56 @@
{{#wifissid}}
<p class="text-left">
<b>
{{#str}}
ssid_label, block_qr
{{/str}}: </b>{{{wifissid}}}<br><b>
{{#str}}
config_wifiauthentication, block_qr
{{/str}}: </b> {{{wifiauthentication}}}<br><b>
{{#str}}
passkey_label, block_qr
{{/str}}: </b> {{{wifipasskey}}}<br>
{{#str}}
ssid_label, block_qr
{{/str}}: </b>{{{wifissid}}}<br><b>
{{#str}}
config_wifiauthentication, block_qr
{{/str}}: </b> {{{wifiauthentication}}}<br><b>
{{#str}}
passkey_label, block_qr
{{/str}}: </b> {{{wifipasskey}}}<br>
</p>
{{/wifissid}}


{{#fullview}}
{{#configshortlink}}
<p class="text-center">
<i class="fa fa-location-arrow"></i>
<a href="{{urlshort}}" target="_blank">
{{#str}}
urlshortlabel, block_qr
{{/str}}
{{#str}}
urlshortlabel, block_qr
{{/str}}
</a>
</p>
{{/configshortlink}}
{{/configshortlink}}
{{/fullview}}
<div style="width: 100%;text-align: center">
</div>
{{#qrcodecontent}}
<script src="{{javascript}}"></script>
{{#js}}
if (typeof QRCode !== 'undefined') {
let config{{id}} = {
// Configuration for QR Code
let config{{id}} = {
content: "{{{qrcodecontent}}}",
color: "#000000",
background: "#ffffff",
ecl: "M", // Error correction level (L, M, H, Q).
container: "svg-viewbox", // Responsive use.
join: true // Crisp rendering and 4-5x reduced file size.
};
// eslint-disable-next-line no-undef

let qrcode{{id}} = new QRCode(config{{id}});
let svg{{id}} = qrcode{{id}}.svg();
document.getElementById("container{{id}}").innerHTML = svg{{id}};
// Add event listener to button
document.getElementById("qrcodeModalButton{{id}}").addEventListener("click", () => {
// Creating the modal with the QR code content inside the button click event
require(['core/modal'], (MF) => {
MF.create({title: '{{{description}}}', body: svg{{id}}}).then((modal) => modal.show());
});
});
}
{{/js}}
{{/qrcodecontent}}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->release = 'v0.0.1';
$plugin->version = 2024012900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024071300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022041200; // Requires this Moodle version.
$plugin->component = 'block_qr'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_BETA; // This is considered as ready for production sites.

0 comments on commit e36d4f0

Please sign in to comment.