Index: trunk/extensions/WhiteList/SpecialWhitelistEdit_body.php |
— | — | @@ -486,7 +486,7 @@ |
487 | 487 | } |
488 | 488 | |
489 | 489 | function execute($user = '') { |
490 | | - global $wgRequest, $wgOut, $wgUser, $wgWhitelistOverride; |
| 490 | + global $wgRequest, $wgOut, $wgUser, $wgWhitelistOverride, $wgWhiteListManagerGroup, $wgSitename; |
491 | 491 | $dbr = wfGetDB( DB_SLAVE ); |
492 | 492 | |
493 | 493 | $user = ($user == '') ? $wgUser : User::newFromId($user); |
— | — | @@ -494,24 +494,71 @@ |
495 | 495 | $this->setHeaders(); |
496 | 496 | $wgOut->setPagetitle(wfMsgTL('whitelist')); |
497 | 497 | |
498 | | - $wgOut->addWikiText(wfMsg('whitelistpagelist', $user->getRealName())); |
| 498 | + if ($wgRequest->getVal('submit', '') == wfMsg('whitelistnewtableprocess')) |
| 499 | + { |
| 500 | + $sender = new MailAddress($wgUser->getEmail(), $wgUser->getRealName()); |
| 501 | + $to = ''; |
| 502 | + if (constant("MW_USER_VERSION") < 4) { |
| 503 | + $to = new User(); |
| 504 | + $to->mId = $wgRequest->getint('manager',0); |
| 505 | + } else { |
| 506 | + $to = User::newFromId($wgRequest->getint('manager',0)); |
| 507 | + } |
| 508 | + $to->sendMail("[${wgSitename}] " . wfMsg('whitelistrequest'), |
| 509 | + wfMsg('whitelistrequestmsg',$wgUser->getRealName(), $wgRequest->getVal('newPages')), |
| 510 | + $sender->toString() |
| 511 | + ); |
499 | 512 | |
| 513 | + $wgOut->addWikiText(wfMsg('whitelistrequestconf', $to->getRealName())); |
| 514 | + $wgOut->addWikiText(""); |
| 515 | + } |
| 516 | + |
| 517 | + |
| 518 | + $wgOut->addHtml("<table cellspacing=0 cellpadding=2 border=1 width=100%><tr>"); |
| 519 | + $wgOut->addHtml("<th>" . wfMsg('whitelistpagelist', $user->getRealName()) . "</th><th>" . wfMsg('whitelistrequest') . "</th>"); |
| 520 | + $wgOut->addHtml("</tr><tr><td width=30%>"); |
| 521 | + |
500 | 522 | $res = WhitelistEdit::contractorWhitelistTable($dbr, $user->getId()); |
501 | 523 | for ($row = $dbr->fetchObject($res); $row; $row = $dbr->fetchObject($res)) { |
502 | 524 | $wgOut->addWikiText("* [[$row->wl_page_title]]"); |
503 | 525 | } |
504 | 526 | $dbr->freeResult($res); |
505 | | - |
506 | 527 | $pages = array(); |
507 | | - |
508 | 528 | foreach ($wgWhitelistOverride['always']['read'] as $page) |
509 | 529 | array_push($pages, $page); |
510 | 530 | foreach ($wgWhitelistOverride['always']['edit'] as $page) |
511 | 531 | array_push($pages, $page); |
512 | | - |
513 | 532 | sort($pages); |
514 | 533 | foreach ($pages as $page) |
515 | 534 | $wgOut->addWikiText("* [[$page]]"); |
| 535 | + |
| 536 | + |
| 537 | + $wgOut->addHtml("</td><td valign=top>"); |
| 538 | + $wgOut->addHtml("<table cellspacing=0 cellpadding=2 border=0 width=100%><tr><td align='right'>$wgWhiteListManagerGroup:</td><td>"); |
| 539 | + $wgOut->addHTML("<form method=\"post\">"); |
| 540 | + $wgOut->addHTML('<select name="manager">'); |
| 541 | + |
| 542 | + $users = array(); |
| 543 | + $res = $dbr->select( 'user_groups', 'ug_user', array('ug_group'=>$wgWhiteListManagerGroup), __METHOD__); |
| 544 | + for ( $row = $dbr->fetchObject($res); $row; $row = $dbr->fetchObject($res)) { |
| 545 | + $u = User::newFromID($row->ug_user); |
| 546 | + $users[$u->getRealName()] = $row->ug_user; |
| 547 | + } |
| 548 | + $dbr->freeResult($res); |
| 549 | + ksort($users); |
| 550 | + foreach ($users as $name => $id) |
| 551 | + $wgOut->addHTML("<option value=\"$id\">".$name."</option>"); |
| 552 | + $wgOut->addHTML('</select> '); |
| 553 | + |
| 554 | + |
| 555 | + $wgOut->addHtml("</td></tr><tr><td align='right'>" . wfMsg('mywhitelistpages') . ":</td><td>"); |
| 556 | + $wgOut->addHtml("<textarea name='newPages' cols=40 rows=5></textarea>"); |
| 557 | + $wgOut->addHtml("</td></tr><tr><td colspan=2><center>"); |
| 558 | + $wgOut->addHTML("<input type='submit' name='submit' value='" . wfMsg('whitelistnewtableprocess') . "' />"); |
| 559 | + $wgOut->addHTML("</form>"); |
| 560 | + $wgOut->addHtml("</center></td></tr></table>"); |
| 561 | + $wgOut->addHtml("</td></tr></table>"); |
| 562 | + $wgOut->addHtml("</td></tr></table>"); |
516 | 563 | } |
517 | 564 | } |
518 | 565 | |
Index: trunk/extensions/WhiteList/SpecialWhitelistEdit.i18n.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | 'whitelistnewtableprocess' => 'Process', |
58 | 58 | 'whitelistnewtablereview' => 'Review', |
59 | 59 | 'whitelistselectrestricted' => '== Select Restricted User Name ==', |
60 | | - 'whitelistpagelist' => "== {{SITENAME}} pages for $1 ==", |
| 60 | + 'whitelistpagelist' => "{{SITENAME}} pages for $1", |
61 | 61 | 'whitelistnocalendar' => "<font color='red' size=3>It looks like [http://www.mediawiki.org/wiki/Extension:Usage_Statistics Extension:UsageStatistics], a prerequisite for this extension, was not installed properly!</font>", |
62 | 62 | 'whitelistbadtitle' => 'Bad title - ', |
63 | 63 | 'whitelistoverview' => "== Overview of changes for $1 ==", |
— | — | @@ -64,6 +64,9 @@ |
65 | 65 | 'whitelistoverviewsa' => "* Setting access to '''$1''' for [[$2]]", |
66 | 66 | 'whitelistoverviewrm' => "* Removing access to [[$1]]", |
67 | 67 | 'whitelistoverviewna' => "* Adding [[$1]] to whitelist with access '''$2''' and '''$3''' expiry date", |
| 68 | + 'whitelistrequest' => "Request access to more pages", |
| 69 | + 'whitelistrequestmsg' => "$1 has requested access to the following pages:\n\n$2", |
| 70 | + 'whitelistrequestconf' => "Request for new pages was sent to $1", |
68 | 71 | ) |
69 | 72 | ); |
70 | 73 | ?> |
Index: trunk/extensions/WhiteList/SpecialWhitelistEdit.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | |
33 | 33 | $wgExtensionCredits['specialpage'][] = array( |
34 | 34 | 'name' => 'WhiteListEdit', |
35 | | - 'version' => 'v0.5', |
| 35 | + 'version' => 'v0.6', |
36 | 36 | 'author' => 'Paul Grinberg, Mike Sullivan', |
37 | 37 | 'email' => 'gri6507 at yahoo dot com, ms-mediawiki AT umich DOT edu', |
38 | 38 | 'description' => 'Edit the access permissions of restricted users', |