Added support for renaming pages using the Spreadsheet Interface
After finishing with the implementation of update and insert, I decided to work on implementing the renaming pages functionality. I also tried quite a few MediaWiki modules to display the success and error messages for the spreadsheet.
Renaming pages using MediaWiki Move API
The Move API can be used to rename a page with the help of a csrf token.
The token can be obtained using the Query API:
1
2
3
4
function getToken() {
var url = baseUrl + '/api.php?action=query&format=json&meta=tokens&type=csrf';
return $.post( url );
}
1
baseUrl + '/api.php?action=move&format=json&' + 'from=' + encodeURIComponent( fromPage ) + "&to=" + encodeURIComponent( toPage ) + "&movetalk&noredirect";
Success and error messages
I have used the mw.notify() module to display success and error messages as popups on the screen and they hide automatically after some time. I have also added a parameter type: ‘error’ to add formatting to the error messages. For example: