Line 1: |
Line 1: |
| const DATA_CONTROLLER_ITEM_ID = 96; // because Q96 is data controller" | | const DATA_CONTROLLER_ITEM_ID = 96; // because Q96 is data controller" |
| const INSTANCE_OF_PROPERTY = 'claims.P3'; // because P3 is the property "instance of" | | const INSTANCE_OF_PROPERTY = 'claims.P3'; // because P3 is the property "instance of" |
| + | |
| + | function generateGDPRLink(qId) { |
| + | // make an API call to expand the letter template, using this item. |
| + | let api = new mw.Api(); |
| + | api.get( { |
| + | action: 'expandtemplates', |
| + | text: '{{User:Alexbfree/Template:GDPRMailtoAccess|qID='+qId+'}}' |
| + | } ).done( function ( data ) { |
| + | var expanded = $(data.expandtemplates["*"]) |
| + | mw.notify( expanded , { autoHide: false } ); // pop up the notification with the link |
| + | } ); |
| + | } |
| | | |
| function isDataController() { | | function isDataController() { |
Line 15: |
Line 27: |
| if (the_thing_it_is_an_instance_of['numeric-id'] === DATA_CONTROLLER_ITEM_ID ) | | if (the_thing_it_is_an_instance_of['numeric-id'] === DATA_CONTROLLER_ITEM_ID ) |
| { | | { |
| + | console.log('found data controller'); |
| // it's a data controller | | // it's a data controller |
| retVal = true; break; | | retVal = true; break; |
Line 32: |
Line 45: |
| console.log('qid is '+qId); | | console.log('qid is '+qId); |
| | | |
− | if (isDataController()) {
| + | let dc = isDataController(); |
− | // make an API call to expand the letter template, using this item.
| + | |
− | let api = new mw.Api();
| + | console.log('function returned:'); |
− | api.get( {
| + | console.log(dc); |
− | action: 'expandtemplates',
| |
− | text: '{{User:Alexbfree/Template:GDPRMailtoAccess|qID='+qId+'}}'
| |
− | } ).done( function ( data ) {
| |
− | var expanded = $(data.expandtemplates["*"])
| |
− | mw.notify( expanded , { autoHide: false } ); // pop up the notification with the link
| |
− | } );
| |
− | }
| |
− | // otherwise, we don't need to do anything
| |
| | | |
| console.log ("end of Alex's Access template"); | | console.log ("end of Alex's Access template"); |