r69286 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69285‎ | r69286 | r69287 >
Date:10:05, 12 July 2010
Author:thomasv
Status:ok
Tags:
Comment:
follow up to r69212 ; setup a permission, and send it to javascript too
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage.php (modified) (history)
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage.php
@@ -34,8 +34,8 @@
3535 # Bump the version number every time you change proofread.js
3636 $wgProofreadPageVersion = 26;
3737
38 -# set to true in order to allow anons to modify pagequality
39 -$wgProofreadPageAllowAnons = false;
 38+# Group allowed to modify pagequality
 39+$wgGroupPermissions['user']['pagequality'] = true;
4040
4141 # Max width of zoomable image
4242 $wgProofreadPageMaxWidth = 2048;
@@ -377,7 +377,7 @@
378378
379379 function pr_preparePage( $out, $m, $isEdit ) {
380380 global $wgJsMimeType, $wgScriptPath, $wgRequest, $wgProofreadPageVersion, $wgProofreadPageMaxWidth;
381 - global $wgTitle;
 381+ global $wgTitle, $wgUser;
382382
383383 if ( !isset( $wgTitle->pr_index_title ) ) {
384384 pr_load_index( $wgTitle );
@@ -430,6 +430,8 @@
431431 'proofreadPageNextURL' => $next_url,
432432 'proofreadPageHeader' => $header,
433433 'proofreadPageFooter' => $footer,
 434+ 'proofreadPageAddButtons' => $wgUser->isAllowed('pagequality'),
 435+ 'proofreadPageUserName' => $wgUser->getName(),
434436 );
435437 $varScript = Skin::makeVariablesScript( $jsVars );
436438
@@ -955,7 +957,7 @@
956958 * Check the format of pages in "Page" namespace.
957959 */
958960 function pr_attemptSave( $editpage ) {
959 - global $wgOut, $wgUser, $wgProofreadPageAllowAnons;
 961+ global $wgOut, $wgUser;
960962
961963 $page_namespace = pr_page_ns();
962964 $index_namespace = pr_index_ns();
@@ -992,7 +994,7 @@
993995 list( $old_q , $old_username, $old_ptext ) = pr_parse_page( $old_text );
994996 if( $old_q != -1 ) {
995997 //check usernames
996 - if( ($old_q != $q) && $wgUser->isAnon() && !$wgProofreadPageAllowAnons ) {
 998+ if( ($old_q != $q) && !$wgUser->isAllowed('pagequality') ) {
997999 $wgOut->showErrorPage( 'proofreadpage_nologin', 'proofreadpage_nologintext' );
9981000 return false;
9991001 }
Index: trunk/extensions/ProofreadPage/proofread.js
@@ -886,7 +886,7 @@
887887 function pr_add_quality(form,value){
888888
889889 self.proofreadpage_quality = value;
890 - self.proofreadpage_username = wgUserName;
 890+ self.proofreadpage_username = proofreadPageUserName;
891891 var text="";
892892 switch( value ) {
893893 case 0: text = proofreadPageMessageQuality0; break;
@@ -903,8 +903,9 @@
904904
905905 function pr_add_quality_buttons(){
906906
 907+ if( !proofreadPageAddButtons ) return;
907908 var ig = document.getElementById("wpWatchthis");
908 - if(!wgUserName) ig = document.getElementById("wpSummary");
 909+ if( !ig ) ig = document.getElementById("wpSummary");
909910 if( !ig ) return;
910911 var f = document.createElement("span");
911912 f.innerHTML =
@@ -916,10 +917,9 @@
917918 +'<span class="quality4"> <input type="radio" name="quality" value=4 onclick="pr_add_quality(this.form,4)" tabindex=4> </span>';
918919 f.innerHTML = f.innerHTML + '&nbsp;' + escapeQuotesHTML(proofreadPageMessageStatus);
919920
920 - if(!wgUserName) f.style.cssText = 'display:none';
921921 ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling);
922922
923 - if( ! ( ( self.proofreadpage_quality == 4 ) || ( ( self.proofreadpage_quality == 3 ) && ( self.proofreadpage_username != wgUserName ) ) ) ) {
 923+ if( ! ( ( self.proofreadpage_quality == 4 ) || ( ( self.proofreadpage_quality == 3 ) && ( self.proofreadpage_username != proofreadPageUserName ) ) ) ) {
924924 document.editform.quality[4].parentNode.style.cssText = 'display:none';
925925 document.editform.quality[4].disabled = true;
926926 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r73384Follow-up r69286: Add a message that explains the new userright on Special:Li...raymond16:02, 20 September 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69212allow anons to set page quality (option)thomasv15:28, 9 July 2010

Status & tagging log