mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-61899 tool_dataprivacy: Addition of js file and misc. updates.
Includes MDL-61489
This commit is contained in:
parent
eb6b4c2368
commit
c2aad2188a
1
admin/tool/dataprivacy/amd/build/expand_contract.min.js
vendored
Normal file
1
admin/tool/dataprivacy/amd/build/expand_contract.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
define(["jquery","core/url","core/str"],function(a,b,c){var d=a('<img alt="" src="'+b.imageUrl("t/expanded")+'"/>'),e=a('<img alt="" src="'+b.imageUrl("t/collapsed")+'"/>');return{expandCollapse:function(a,b){a.hasClass("hide")?(a.removeClass("hide"),a.addClass("visible"),a.attr("aria-expanded",!0),b.find(":header i.fa").removeClass("fa-plus-square"),b.find(":header i.fa").addClass("fa-minus-square"),b.find(":header img.icon").attr("src",d.attr("src"))):(a.removeClass("visible"),a.addClass("hide"),a.attr("aria-expanded",!1),b.find(":header i.fa").removeClass("fa-minus-square"),b.find(":header i.fa").addClass("fa-plus-square"),b.find(":header img.icon").attr("src",e.attr("src")))},expandCollapseAll:function(b){var f="visible"==b?"hide":"visible",g="visible"==b,h="visible"==b?"fa-plus-square":"fa-minus-square",i="visible"==b?"fa-minus-square":"fa-plus-square",j="visible"==b?d.attr("src"):e.attr("src");a("."+f).each(function(){a(this).removeClass(f),a(this).addClass(b),a(this).attr("aria-expanded",g)}),a(".tool_dataprivacy-expand-all").data("visibilityState",f),c.get_string(f,"tool_dataprivacy").then(function(b){a(".tool_dataprivacy-expand-all").html(b)})["catch"](Notification.exception),a(":header i.fa").each(function(){a(this).removeClass(h),a(this).addClass(i)}),a(":header img.icon").each(function(){a(this).attr("src",j)})}}});
|
89
admin/tool/dataprivacy/amd/src/expand_contract.js
Normal file
89
admin/tool/dataprivacy/amd/src/expand_contract.js
Normal file
@ -0,0 +1,89 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Potential user selector module.
|
||||
*
|
||||
* @module tool_dataprivacy/expand_contract
|
||||
* @class page-expand-contract
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Adrian Greeve
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define(['jquery', 'core/url', 'core/str'], function($, url, str) {
|
||||
|
||||
var expandedImage = $('<img alt="" src="' + url.imageUrl('t/expanded') + '"/>');
|
||||
var collapsedImage = $('<img alt="" src="' + url.imageUrl('t/collapsed') + '"/>');
|
||||
|
||||
return /** @alias module:tool_dataprivacy/expand-collapse */ {
|
||||
/**
|
||||
* Expand or collapse a selected node.
|
||||
*
|
||||
* @param {object} targetnode The node that we want to expand / collapse
|
||||
* @param {object} thisnode The node that was clicked.
|
||||
* @return {null}
|
||||
*/
|
||||
expandCollapse: function(targetnode, thisnode) {
|
||||
if (targetnode.hasClass('hide')) {
|
||||
targetnode.removeClass('hide');
|
||||
targetnode.addClass('visible');
|
||||
targetnode.attr('aria-expanded', true);
|
||||
thisnode.find(':header i.fa').removeClass('fa-plus-square');
|
||||
thisnode.find(':header i.fa').addClass('fa-minus-square');
|
||||
thisnode.find(':header img.icon').attr('src', expandedImage.attr('src'));
|
||||
} else {
|
||||
targetnode.removeClass('visible');
|
||||
targetnode.addClass('hide');
|
||||
targetnode.attr('aria-expanded', false);
|
||||
thisnode.find(':header i.fa').removeClass('fa-minus-square');
|
||||
thisnode.find(':header i.fa').addClass('fa-plus-square');
|
||||
thisnode.find(':header img.icon').attr('src', collapsedImage.attr('src'));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Expand or collapse all nodes on this page.
|
||||
*
|
||||
* @param {string} nextstate The next state to change to.
|
||||
* @return {null}
|
||||
*/
|
||||
expandCollapseAll: function(nextstate) {
|
||||
var currentstate = (nextstate == 'visible') ? 'hide' : 'visible';
|
||||
var ariaexpandedstate = (nextstate == 'visible') ? true : false;
|
||||
var iconclassnow = (nextstate == 'visible') ? 'fa-plus-square' : 'fa-minus-square';
|
||||
var iconclassnext = (nextstate == 'visible') ? 'fa-minus-square' : 'fa-plus-square';
|
||||
var imagenow = (nextstate == 'visible') ? expandedImage.attr('src') : collapsedImage.attr('src');
|
||||
$('.' + currentstate).each(function() {
|
||||
$(this).removeClass(currentstate);
|
||||
$(this).addClass(nextstate);
|
||||
$(this).attr('aria-expanded', ariaexpandedstate);
|
||||
});
|
||||
$('.tool_dataprivacy-expand-all').data('visibilityState', currentstate);
|
||||
|
||||
str.get_string(currentstate, 'tool_dataprivacy').then(function(langString) {
|
||||
$('.tool_dataprivacy-expand-all').html(langString);
|
||||
}).catch(Notification.exception);
|
||||
|
||||
$(':header i.fa').each(function() {
|
||||
$(this).removeClass(iconclassnow);
|
||||
$(this).addClass(iconclassnext);
|
||||
});
|
||||
$(':header img.icon').each(function() {
|
||||
$(this).attr('src', imagenow);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
@ -139,7 +139,7 @@ class metadata_registry {
|
||||
return array_map(function($plugins) {
|
||||
return array_filter($plugins, function($plugindata) {
|
||||
return !$plugindata->is_standard();
|
||||
});
|
||||
});
|
||||
}, \core_plugin_manager::instance()->get_plugins());
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use stdClass;
|
||||
use templatable;
|
||||
|
||||
require_once($CFG->libdir . '/coursecatlib.php');
|
||||
@ -41,6 +40,7 @@ require_once($CFG->libdir . '/blocklib.php');
|
||||
*/
|
||||
class data_registry_compliance_page implements renderable, templatable {
|
||||
|
||||
/** @var array meta-data to be displayed about the system. */
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
@ -57,13 +57,6 @@ class data_registry_compliance_page implements renderable, templatable {
|
||||
* @return stdClass
|
||||
*/
|
||||
public function export_for_template(renderer_base $output) {
|
||||
global $PAGE;
|
||||
|
||||
$data = ['types' => $this->metadata];
|
||||
// print_object($data);
|
||||
|
||||
return $data;
|
||||
return ['types' => $this->metadata];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ $string['dataprivacy:managedatarequests'] = 'Manage data requests';
|
||||
$string['dataprivacy:managedataregistry'] = 'Manage data registry';
|
||||
$string['dataprivacysettings'] = 'Data privacy settings';
|
||||
$string['dataregistry'] = 'Data registry';
|
||||
$string['dataregistry2'] = 'Plugin privacy registry';
|
||||
$string['dataregistrysetup'] = 'Settings';
|
||||
$string['datarequestemailsubject'] = 'Data request: {$a}';
|
||||
$string['datarequests'] = 'Data requests';
|
||||
@ -130,6 +129,7 @@ $string['nopurposes'] = 'There are no purposes yet';
|
||||
$string['nosubjectaccessrequests'] = 'There are no data requests that you need to act on';
|
||||
$string['nosystemdefaults'] = 'Site purpose and category have not yet been defined.';
|
||||
$string['notset'] = 'Not set (use the default value)';
|
||||
$string['pluginregistry'] = 'Plugin privacy registry';
|
||||
$string['pluginregistrytitle'] = 'Plugin privacy compliance registry';
|
||||
$string['privacy'] = 'Privacy';
|
||||
$string['privacy:metadata:request'] = 'Information from personal data requests (subject access and deletion requests) made for this site.';
|
||||
|
@ -28,8 +28,8 @@ require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/dataprivacy/lib.php');
|
||||
$contextlevel = optional_param('contextlevel', CONTEXT_SYSTEM, PARAM_INT);
|
||||
$contextid = optional_param('contextid', 0, PARAM_INT);
|
||||
|
||||
$url = new moodle_url('/admin/tool/dataprivacy/dataregistry2.php');
|
||||
$title = get_string('dataregistry2', 'tool_dataprivacy');
|
||||
$url = new moodle_url('/' . $CFG->admin . '/tool/dataprivacy/pluginregistry.php');
|
||||
$title = get_string('pluginregistry', 'tool_dataprivacy');
|
||||
|
||||
\tool_dataprivacy\page_helper::setup($url, $title);
|
||||
|
@ -70,8 +70,9 @@ $ADMIN->add('privacy', new admin_externalpage('dataregistry', get_string('datare
|
||||
// Link that leads to the review page of expired contexts that are up for deletion.
|
||||
$ADMIN->add('privacy', new admin_externalpage('datadeletion', get_string('datadeletion', 'tool_dataprivacy'),
|
||||
new moodle_url('/admin/tool/dataprivacy/datadeletion.php'), 'tool/dataprivacy:managedataregistry')
|
||||
);
|
||||
|
||||
// Link that leads to the other data registry management page.
|
||||
$ADMIN->add('dataprivacysettings', new admin_externalpage('dataregistry2', get_string('dataregistry2', 'tool_dataprivacy'),
|
||||
new moodle_url('/admin/tool/dataprivacy/dataregistry2.php'), 'tool/dataprivacy:managedataregistry')
|
||||
$ADMIN->add('privacy', new admin_externalpage('pluginregistry', get_string('pluginregistry', 'tool_dataprivacy'),
|
||||
new moodle_url('/admin/tool/dataprivacy/pluginregistry.php'), 'tool/dataprivacy:managedataregistry')
|
||||
);
|
||||
|
@ -50,10 +50,9 @@
|
||||
<hr />
|
||||
<div class="row">
|
||||
{{#compliant}}
|
||||
<a class="expand" data-component="{{raw_component}}" href='#'>
|
||||
<h4 class="d-inline p-l-2 " id="{{raw_component}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugin, tool_dataprivacy{{/str}}{{/pix}}{{component}}</h4>
|
||||
<a class="component-expand p-l-2" data-component="{{raw_component}}" href='#'>
|
||||
<h4 class=" d-inline p-l-2 " id="{{raw_component}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugin, tool_dataprivacy{{/str}}{{/pix}}{{component}}</h4>
|
||||
</a>
|
||||
<!-- <span class="badge badge-pill badge-success">{{#str}}compliant, tool_dataprivacy{{/str}}</span> -->
|
||||
{{/compliant}}
|
||||
{{^compliant}}
|
||||
<h4 class="d-inline p-l-3 " id="{{raw_component}}">{{component}}</h4>
|
||||
@ -103,30 +102,4 @@
|
||||
{{/nullprovider}}
|
||||
</div>
|
||||
{{/compliant}}
|
||||
</div>
|
||||
|
||||
{{#js}}
|
||||
require(['jquery', 'core/url'], function($, url) {
|
||||
|
||||
var expandedImage = $('<img alt="" src="' + url.imageUrl('t/expanded') + '"/>');
|
||||
var collapsedImage = $('<img alt="" src="' + url.imageUrl('t/collapsed') + '"/>');
|
||||
|
||||
$('.expand').click(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
var component = $(this).data('component');
|
||||
var metadata = $('[data-section=\'' + component + '\']');
|
||||
var metainfo = metadata.attr('class');
|
||||
if (metadata.attr('class') === 'hide') {
|
||||
metadata.attr('class', 'visible');
|
||||
$(this).children('img').attr('src', expandedImage.attr('src'));
|
||||
metadata.attr('aria-expanded', true);
|
||||
} else {
|
||||
metadata.attr('class', 'hide');
|
||||
$(this).children('img').attr('src', collapsedImage.attr('src'));
|
||||
metadata.attr('aria-expanded', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
{{/js}}
|
||||
</div>
|
@ -36,7 +36,7 @@
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div>
|
||||
<div class="dataprivacy-main">
|
||||
<h2>{{#str}}pluginregistrytitle, tool_dataprivacy{{/str}}</h2>
|
||||
<hr />
|
||||
<p><strong>{{#str}}explanationtitle, tool_dataprivacy{{/str}}</strong></p>
|
||||
@ -51,11 +51,11 @@
|
||||
{{#types}}
|
||||
<div>
|
||||
<div>
|
||||
<a class="other-expand" href='#' data-plugin="{{plugin_type_raw}}">
|
||||
<a class="type-expand" href='#' data-plugin="{{plugin_type_raw}}">
|
||||
<h3 id="{{plugin_type_raw}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugintype, tool_dataprivacy{{/str}}{{/pix}}{{plugin_type}}</h3>
|
||||
</a>
|
||||
</div>
|
||||
<div class="hide" data-plugintarget="{{plugin_type_raw}}" aria-expanded="false">
|
||||
<div class="hide p-b-1" data-plugintarget="{{plugin_type_raw}}" aria-expanded="false">
|
||||
{{#plugins}}
|
||||
{{> tool_dataprivacy/component_status}}
|
||||
{{/plugins}}
|
||||
@ -64,45 +64,31 @@
|
||||
{{/types}}
|
||||
</div>
|
||||
{{#js}}
|
||||
require(['jquery', 'core/url', 'core/str'], function($, url, str) {
|
||||
require(['jquery', 'tool_dataprivacy/expand_contract'], function($, ec) {
|
||||
|
||||
var expandedImage = $('<img alt="" src="' + url.imageUrl('t/expanded') + '"/>');
|
||||
var collapsedImage = $('<img alt="" src="' + url.imageUrl('t/collapsed') + '"/>');
|
||||
|
||||
$('.other-expand').click(function(e) {
|
||||
$('.type-expand').click(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
window.console.log(this);
|
||||
var plugin = $(this).data('plugin');
|
||||
var thisnode = $(this);
|
||||
var plugin = thisnode.data('plugin');
|
||||
var metadata = $('[data-plugintarget=\'' + plugin + '\']');
|
||||
if (metadata.attr('class') === 'hide') {
|
||||
metadata.attr('class', 'visible p-b-2');
|
||||
$(this).children('img').attr('src', expandedImage.attr('src'));
|
||||
metadata.attr('aria-expanded', true);
|
||||
} else {
|
||||
metadata.attr('class', 'hide');
|
||||
$(this).children('img').attr('src', collapsedImage.attr('src'));
|
||||
metadata.attr('aria-expanded', false);
|
||||
}
|
||||
ec.expandCollapse(metadata, thisnode);
|
||||
});
|
||||
|
||||
$('.component-expand').click(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var thisnode = $(this);
|
||||
var plugin = thisnode.data('component');
|
||||
var metadata = $('[data-section=\'' + plugin + '\']');
|
||||
ec.expandCollapse(metadata, thisnode);
|
||||
});
|
||||
|
||||
$('.tool_dataprivacy-expand-all').click(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var nextstate = $(this).data('visibilityState');
|
||||
var currentstate = (nextstate == 'visible') ? 'hide' : 'visible';
|
||||
var ariaexpandedstate = (nextstate == 'visible') ? true : false;
|
||||
$('.' + currentstate).each(function() {
|
||||
$(this).attr('class', nextstate);
|
||||
$(this).attr('aria-expanded', ariaexpandedstate);
|
||||
});
|
||||
$(this).data('visibilityState', currentstate);
|
||||
|
||||
str.get_string(currentstate, 'tool_dataprivacy').then(function(langString) {
|
||||
var visibilitynode = $('.tool_dataprivacy-expand-all');
|
||||
visibilitynode.html(langString);
|
||||
}).catch(Notification.exception);
|
||||
ec.expandCollapseAll(nextstate);
|
||||
});
|
||||
});
|
||||
{{/js}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user