forked from wikimedia/mediawiki-extensions-UserAgreement
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use tabs in xml file Change-Id: I9695c898c78421b4338ea04f3d2df17f5c79e769
- Loading branch information
1 parent
cb230e7
commit ec6d1b6
Showing
5 changed files
with
141 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0"?> | ||
<ruleset> | ||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" /> | ||
<file>.</file> | ||
<arg name="extensions" value="php,php5,inc" /> | ||
<arg name="encoding" value="UTF-8" /> | ||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" /> | ||
<file>.</file> | ||
<arg name="extensions" value="php,php5,inc" /> | ||
<arg name="encoding" value="UTF-8" /> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
{ | ||
"name": "UserAgreement", | ||
"version": "1.0.1", | ||
"author": [ | ||
"[https://www.mediawiki.org/wiki/User:Kevin.ji Kevin Ji]", | ||
"[http://www.mediawiki.org/wiki/User:Cindy.cicalese Cindy Cicalese]" | ||
], | ||
"url": "https://www.mediawiki.org/wiki/Extension:UserAgreement", | ||
"descriptionmsg": "useragreement-desc", | ||
"manifest_version": 1, | ||
"type": "parserhook", | ||
"MessagesDirs": { | ||
"UserAgreement": [ | ||
"i18n" | ||
] | ||
}, | ||
"APIModules": { | ||
"uaAcceptAgreement": "ApiUAAcceptAgreement" | ||
}, | ||
"AutoloadClasses": { | ||
"UserAgreement": "includes/UserAgreement.php", | ||
"UserAgreementHooks": "includes/UserAgreementHooks.php", | ||
"ApiUAAcceptAgreement": "includes/ApiUAAcceptAgreement.php" | ||
}, | ||
"ResourceModules": { | ||
"ext.UserAgreement.render": { | ||
"styles": [ | ||
"/resources/renderUserAgreement.css" | ||
], | ||
"scripts": [ | ||
"/resources/renderUserAgreement.js" | ||
], | ||
"messages": [ | ||
"useragreement-dialog-message" | ||
] | ||
} | ||
}, | ||
"ResourceFileModulePaths": { | ||
"localBasePath": "", | ||
"remoteExtPath": "UserAgreement" | ||
}, | ||
"Hooks": { | ||
"LoadExtensionSchemaUpdates": [ | ||
"UserAgreementHooks::loadExtensionSchemaUpdates" | ||
], | ||
"BeforePageDisplay": [ | ||
"UserAgreementHooks::addUserAgreement" | ||
] | ||
} | ||
} | ||
{ | ||
"name": "UserAgreement", | ||
"version": "1.0.1", | ||
"author": [ | ||
"[https://www.mediawiki.org/wiki/User:Kevin.ji Kevin Ji]", | ||
"[http://www.mediawiki.org/wiki/User:Cindy.cicalese Cindy Cicalese]" | ||
], | ||
"url": "https://www.mediawiki.org/wiki/Extension:UserAgreement", | ||
"descriptionmsg": "useragreement-desc", | ||
"manifest_version": 1, | ||
"type": "parserhook", | ||
"MessagesDirs": { | ||
"UserAgreement": [ | ||
"i18n" | ||
] | ||
}, | ||
"APIModules": { | ||
"uaAcceptAgreement": "ApiUAAcceptAgreement" | ||
}, | ||
"AutoloadClasses": { | ||
"UserAgreement": "includes/UserAgreement.php", | ||
"UserAgreementHooks": "includes/UserAgreementHooks.php", | ||
"ApiUAAcceptAgreement": "includes/ApiUAAcceptAgreement.php" | ||
}, | ||
"ResourceModules": { | ||
"ext.UserAgreement.render": { | ||
"styles": [ | ||
"/resources/renderUserAgreement.css" | ||
], | ||
"scripts": [ | ||
"/resources/renderUserAgreement.js" | ||
], | ||
"messages": [ | ||
"useragreement-dialog-message" | ||
] | ||
} | ||
}, | ||
"ResourceFileModulePaths": { | ||
"localBasePath": "", | ||
"remoteExtPath": "UserAgreement" | ||
}, | ||
"Hooks": { | ||
"LoadExtensionSchemaUpdates": [ | ||
"UserAgreementHooks::loadExtensionSchemaUpdates" | ||
], | ||
"BeforePageDisplay": [ | ||
"UserAgreementHooks::addUserAgreement" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"@metadata": { | ||
"authors": [ | ||
"kji" | ||
] | ||
}, | ||
"useragreement-desc": "Renders the user agreement after login.", | ||
"useragreement": "", | ||
"useragreement-dialog-message": "Check box to consent to the conditions above", | ||
"apihelp-uaAcceptAgreement-description": "Accept the user agreement", | ||
"apihelp-uaAcceptAgreement-summary": "Accept the user agreement" | ||
} | ||
{ | ||
"@metadata": { | ||
"authors": [ | ||
"kji" | ||
] | ||
}, | ||
"useragreement-desc": "Renders the user agreement after login.", | ||
"useragreement": "", | ||
"useragreement-dialog-message": "Check box to consent to the conditions above", | ||
"apihelp-uaAcceptAgreement-description": "Accept the user agreement", | ||
"apihelp-uaAcceptAgreement-summary": "Accept the user agreement" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#uaAcceptInput{ | ||
text-align:center; | ||
} | ||
|
||
#uaModal{ | ||
border:1px solid grey; | ||
padding:10px; | ||
font-size:small; | ||
#uaAcceptInput{ | ||
text-align:center; | ||
} | ||
|
||
#uaModal{ | ||
border:1px solid grey; | ||
padding:10px; | ||
font-size:small; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
/* | ||
* Copyright (c) 2018 The MITRE Corporation | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
* DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
( function( mw, $ ) { | ||
/** | ||
* Gobal function to display a user agreement. | ||
*/ | ||
window.renderUserAgreement = function( useragreement ) { | ||
( { | ||
/** | ||
* Render the user agreement on the page. | ||
*/ | ||
render: function( useragreement ) { | ||
var useragreementHtml = | ||
"<div id='uaModal'>" + | ||
JSON.parse(useragreement).ua + | ||
"<div id='uaAcceptInput'> \ | ||
<input id='uaAccept' type='checkbox'>" + | ||
mw.message( 'useragreement-dialog-message' ) + | ||
"</input> \ | ||
</div> \ | ||
</div>"; | ||
|
||
$(function () { | ||
$("body").html(useragreementHtml); | ||
$("#uaAccept").click( function () { | ||
var api = new mw.Api(); | ||
api.post({ | ||
action: 'uaAcceptAgreement', | ||
token: mw.user.tokens.get( 'editToken' ), | ||
}).done(function(data) { | ||
location.reload(true); | ||
}).fail(function(data) { | ||
console.error("[UserAgreement] Failed to accept user agreement for the current user."); | ||
}); | ||
}); | ||
}); | ||
}, | ||
} ) | ||
.render( useragreement ); | ||
}; | ||
}( mediaWiki, jQuery ) ); | ||
|
||
$( function() { | ||
if ( mw.config.exists( 'UserAgreement' ) ) { | ||
var uaData = mw.config.get( 'UserAgreement' ); | ||
renderUserAgreement( uaData.useragreement ); | ||
} | ||
/* | ||
* Copyright (c) 2018 The MITRE Corporation | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
* DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
( function( mw, $ ) { | ||
/** | ||
* Gobal function to display a user agreement. | ||
*/ | ||
window.renderUserAgreement = function( useragreement ) { | ||
( { | ||
/** | ||
* Render the user agreement on the page. | ||
*/ | ||
render: function( useragreement ) { | ||
var useragreementHtml = | ||
"<div id='uaModal'>" + | ||
JSON.parse(useragreement).ua + | ||
"<div id='uaAcceptInput'> \ | ||
<input id='uaAccept' type='checkbox'>" + | ||
mw.message( 'useragreement-dialog-message' ) + | ||
"</input> \ | ||
</div> \ | ||
</div>"; | ||
|
||
$(function () { | ||
$("body").html(useragreementHtml); | ||
$("#uaAccept").click( function () { | ||
var api = new mw.Api(); | ||
api.post({ | ||
action: 'uaAcceptAgreement', | ||
token: mw.user.tokens.get( 'editToken' ), | ||
}).done(function(data) { | ||
location.reload(true); | ||
}).fail(function(data) { | ||
console.error("[UserAgreement] Failed to accept user agreement for the current user."); | ||
}); | ||
}); | ||
}); | ||
}, | ||
} ) | ||
.render( useragreement ); | ||
}; | ||
}( mediaWiki, jQuery ) ); | ||
|
||
$( function() { | ||
if ( mw.config.exists( 'UserAgreement' ) ) { | ||
var uaData = mw.config.get( 'UserAgreement' ); | ||
renderUserAgreement( uaData.useragreement ); | ||
} | ||
}); |