Skip to content

Commit

Permalink
Use unix newline style
Browse files Browse the repository at this point in the history
Use tabs in xml file

Change-Id: I9695c898c78421b4338ea04f3d2df17f5c79e769
  • Loading branch information
umherirrender committed Aug 5, 2018
1 parent cb230e7 commit ec6d1b6
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 141 deletions.
8 changes: 4 additions & 4 deletions .phpcs.xml
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>
100 changes: 50 additions & 50 deletions extension.json
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"
]
}
}
24 changes: 12 additions & 12 deletions i18n/en.json
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"
}
16 changes: 8 additions & 8 deletions resources/renderUserAgreement.css
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;
}
134 changes: 67 additions & 67 deletions resources/renderUserAgreement.js
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 );
}
});

0 comments on commit ec6d1b6

Please sign in to comment.