The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* <nowiki> */
/* Bharat Mitra: report module (administrators' noticeboard) */
( function () {
	'use strict';
	var BM = window.BharatMitra;
	var BOARD = "Bharatpedia:Administrators' noticeboard";
	var TYPES = [ 'Vandalism', 'Spam or advertising', 'Offensive username', 'Suspected sockpuppetry', 'Page protection request', 'Other administrator matter' ];
	function buildBody( v ) {
		var target = BM.core.cleanParam( v.target );
		var details = String( v.details || '' ).replace( /\r\n/g, '\n' ).trim();
		return '* \'\'\'Page/user concerned:\'\'\' [[:' + target + ']]\n' +
			'* \'\'\'Details:\'\'\' ' + details + '\n' + BM.SIG;
	}
	BM.register( 'report', {
		open: function () {
			var ns = mw.config.get( 'wgNamespaceNumber' );
			var target = '';
			if ( ns === 2 || ns === 3 ) {
				var u = BM.targetUser();
				if ( u ) { target = 'User:' + u; }
			} else {
				target = mw.config.get( 'wgPageName' ).replace( /_/g, ' ' );
			}
			BM.core.dialog( {
				title: 'Report to administrators\' noticeboard',
				help: 'The report will be added to the noticeboard as a new section, where administrators can reply.',
				fields: [
					{ name: 'type', label: 'Type of report', type: 'select', required: true,
						options: TYPES.map( function ( t ) { return [ t, t ]; } ) },
					{ name: 'target', label: 'Page or user (full title)', type: 'text', value: target, required: true,
						placeholder: 'e.g. User:Example or an article' },
					{ name: 'details', label: 'Details', type: 'textarea', rows: 4, required: true }
				],
				preview: function ( v ) { return buildBody( v ); },
				previewTitle: function () { return BOARD; },
				submitLabel: 'Send report',
				success: 'Report added to the noticeboard.',
				onSubmit: function ( v ) {
					var heading = v.type + ': ' + BM.core.cleanParam( v.target ).replace( /=/g, '-' );
					return BM.core.addSection( BOARD, heading, buildBody( v ),
						'Report (' + v.type + ') (using [[Bharatpedia:Bharat Mitra|Bharat Mitra]])' );
				}
			} );
		}
	} );
}() );
/* </nowiki> */