forked from SimilisTools/MediaWiki-Extension--UserAdmin
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all or none checkbox javascript done
- Loading branch information
Lance Gatlin
committed
Jul 8, 2011
1 parent
739c027
commit 23619a1
Showing
8 changed files
with
119 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 0.1.0 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 0.1.0 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 0.1.0 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 0.1.0 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 0.1.0 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
/* | ||
|
@@ -160,6 +160,8 @@ function validateGETParams() | |
*/ | ||
function doGET() | ||
{ | ||
global $wgOut; | ||
|
||
$this->validateGETParams(); | ||
|
||
// Load the users from database according to pagination parameters | ||
|
@@ -201,6 +203,23 @@ function doGET() | |
$groupsfieldHTML = $this->groupsfield; | ||
$lastEditDatefieldHTML = $this->lasteditdatefield; | ||
|
||
$wgOut->includeJQuery(); | ||
|
||
$allOrNoneScript = <<<EOT | ||
<script language="javascript" type="text/javascript"> | ||
var allOrNoneToggle = true; | ||
jQuery( document ).ready( function( $ ) { | ||
$("#allornone").click( | ||
function() { | ||
$(".selusr").attr('checked', allOrNoneToggle); | ||
allOrNoneToggle = !allOrNoneToggle; | ||
} | ||
); | ||
}); | ||
</script> | ||
EOT; | ||
$wgOut->addScript($allOrNoneScript); | ||
|
||
return <<<EOT | ||
$pageNavHTML | ||
$pageSizerHTML | ||
|
@@ -212,7 +231,7 @@ function doGET() | |
<table> | ||
<tr> | ||
<th><button type="submit" name="action" value="newuser">$this->uapnewuseractionlabel</button></th> | ||
<th><input type="checkbox" name="allOrNone"/></th> | ||
<th><input id="allornone" type="checkbox" name="allOrNone" onclick="all()"/></th> | ||
<th>$idfieldHTML</th> | ||
<th>$userNamefieldHTML</th> | ||
<th>$realNamefieldHTML</th> | ||
|
@@ -266,7 +285,7 @@ function getUsersFromDb() | |
|
||
// SQL WHERE based on filter | ||
$sqlConds = ''; | ||
if (!empty($this->filtertext)) { | ||
if (strlen($this->filtertext) > 0) { | ||
$sqlConds = $this->mLookupUserField[$this->filterby] . ' '; | ||
|
||
if($this->filterneg) | ||
|
@@ -276,8 +295,10 @@ function getUsersFromDb() | |
|
||
$sqlConds .= $dbr->addQuotes($this->filtertext); | ||
} | ||
|
||
$estRowCount = $dbr->estimateRowCount('user', '*', $sqlConds); | ||
|
||
$result = $dbr->select('user', 'user_id', $sqlConds); | ||
$estRowCount = $result->numRows(); | ||
// $estRowCount = $dbr->estimateRowCount('user', '*', $sqlConds); | ||
|
||
// SQL LIMIT based on pagenum/pagesize | ||
if ($this->pagesize != 'all') | ||
|
@@ -391,7 +412,7 @@ function getUserRowHTML($user) | |
return <<<EOT | ||
<tr> | ||
<td><a href="$editHref">($this->editactionlabel</a> | <a href="$contribsHref">$this->contributionsactionlabel</a> | <a href="$logsHref">$this->logsactionlabel</a>)</td> | ||
<td><input type="checkbox" name="userids[]" value="$id"/></td> | ||
<td><input class="selusr" type="checkbox" name="userids[]" value="$id"/></td> | ||
<td>$id</td> | ||
<td><a href="$userPageURL">$userName</a></td> | ||
<td>$realName</td> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 0.1.0 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
$aliases = array(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,14 +16,14 @@ | |
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 0.1.0 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
# Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. | ||
if (!defined('MEDIAWIKI')) { | ||
echo <<<EOT | ||
To install the UserAdmin extension, put the following line in LocalSettings.php: | ||
require_once( "\$IP/extensions/UserAdmin/UserAdmin.php" ); | ||
require_once( "$IP/extensions/UserAdmin/UserAdmin.php" ); | ||
EOT; | ||
exit( 1 ); | ||
} | ||
|
@@ -38,64 +38,30 @@ | |
|
||
$dir = dirname(__FILE__) . '/'; | ||
|
||
$wgExtensionMessagesFiles['UserAdmin'] = $dir . 'UserAdmin.i18n.php'; # Location of a messages file (Tell MediaWiki to load this file) | ||
$wgExtensionMessagesFiles['UserAdmin'] = $dir . 'UserAdmin.i18n.php'; | ||
|
||
$wgAutoloadClasses['SpecialUserAdminPanel'] = $dir . 'SpecialUserAdminPanel.class.php'; # Location of the SpecialMyExtension class (Tell MediaWiki to load this file) | ||
$wgAutoloadClasses['SpecialAddUser'] = $dir . 'SpecialAddUser.class.php'; # Location of the SpecialMyExtension class (Tell MediaWiki to load this file) | ||
$wgAutoloadClasses['SpecialDeleteUser'] = $dir . 'SpecialDeleteUser.class.php'; # Location of the SpecialMyExtension class (Tell MediaWiki to load this file) | ||
$wgAutoloadClasses['SpecialEditUser'] = $dir . 'SpecialEditUser.class.php'; # Location of the SpecialMyExtension class (Tell MediaWiki to load this file) | ||
$wgAutoloadClasses['SpecialUADMBase'] = $dir . 'SpecialUADMBase.class.php'; # Location of the SpecialMyExtension class (Tell MediaWiki to load this file) | ||
$wgAutoloadClasses['SpecialUserAdminPanel'] = $dir . 'SpecialUserAdminPanel.class.php'; | ||
$wgAutoloadClasses['SpecialAddUser'] = $dir . 'SpecialAddUser.class.php'; | ||
$wgAutoloadClasses['SpecialDeleteUser'] = $dir . 'SpecialDeleteUser.class.php'; | ||
$wgAutoloadClasses['SpecialEditUser'] = $dir . 'SpecialEditUser.class.php'; | ||
$wgAutoloadClasses['SpecialUADMBase'] = $dir . 'SpecialUADMBase.class.php'; | ||
$wgAutoloadClasses['UADMLogActionHandler'] = $dir . 'UserAdminLogActionHandler.class.php'; | ||
|
||
$wgSpecialPages['UserAdmin'] = 'SpecialUserAdminPanel'; # Tell MediaWiki about the new special page and its class name | ||
$wgSpecialPages['AddUser'] = 'SpecialAddUser'; # Tell MediaWiki about the new special page and its class name | ||
$wgSpecialPages['DeleteUser'] = 'SpecialDeleteUser'; # Tell MediaWiki about the new special page and its class name | ||
$wgSpecialPages['EditUser'] = 'SpecialEditUser'; # Tell MediaWiki about the new special page and its class name | ||
$wgSpecialPages['UserAdmin'] = 'SpecialUserAdminPanel'; | ||
$wgSpecialPages['AddUser'] = 'SpecialAddUser'; | ||
$wgSpecialPages['DeleteUser'] = 'SpecialDeleteUser'; | ||
$wgSpecialPages['EditUser'] = 'SpecialEditUser'; | ||
|
||
$wgSpecialPageGroups['UserAdmin'] = 'users'; # Place this under the users grouping in special pages | ||
$wgSpecialPageGroups['AddUser'] = 'users'; # Place this under the users grouping in special pages | ||
$wgSpecialPageGroups['DeleteUser'] = 'users'; # Place this under the users grouping in special pages | ||
$wgSpecialPageGroups['EditUser'] = 'users'; # Place this under the users grouping in special pages | ||
$wgSpecialPageGroups['UserAdmin'] = 'users'; | ||
$wgSpecialPageGroups['AddUser'] = 'users'; | ||
$wgSpecialPageGroups['DeleteUser'] = 'users'; | ||
$wgSpecialPageGroups['EditUser'] = 'users'; | ||
|
||
$wgLogActionsHandlers['rights/uadm-changeduserpasswordlog'] = 'UADM_logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-changeduseremaillog'] = 'UADM_logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-changedusernamelog'] = 'UADM_logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-changeduserrealnamelog'] = 'UADM_logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-emailpasswordlog'] = 'UADM_logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-emailwelcomelog'] = 'UADM_logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-usersdeletedlog'] = 'UADM_logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-changeduserpasswordlog'] = 'UADMLogActionHandler::logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-changeduseremaillog'] = 'UADMLogActionHandler::logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-changedusernamelog'] = 'UADMLogActionHandler::logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-changeduserrealnamelog'] = 'UADMLogActionHandler::logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-emailpasswordlog'] = 'UADMLogActionHandler::logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-emailwelcomelog'] = 'UADMLogActionHandler::logActionHandler'; | ||
$wgLogActionsHandlers['rights/uadm-usersdeletedlog'] = 'UADMLogActionHandler::logActionHandler'; | ||
|
||
/* | ||
* Formats log messages when invoked by MW | ||
* | ||
* @param $type unused | ||
* @param $action string the log message type | ||
* @param $title Title object | ||
* @param $skin Skin objec | ||
* @param $params array of string parameters for message | ||
* @return string formatted log message | ||
*/ | ||
function UADM_logActionHandler($type, $action, $title, $skin, $params) | ||
{ | ||
foreach($params as &$param) | ||
if($param == '') | ||
$param = '(empty)'; | ||
|
||
$options = array('parseinline', 'replaceafter'); | ||
switch($action) | ||
{ | ||
case 'uadm-usersdeletedlog' : | ||
return wfMsgExt($action, $options, $params[0]); | ||
|
||
case 'uadm-emailpasswordlog' : | ||
case 'uadm-emailwelcomelog' : | ||
case 'uadm-changeduserpasswordlog' : | ||
return wfMsgExt($action, $options, $title->getPrefixedText()); | ||
|
||
case 'uadm-changedusernamelog' : | ||
return wfMsgExt($action, $options, $params[0], $params[1], $params[2]); | ||
|
||
case 'uadm-changeduseremaillog' : | ||
case 'uadm-changeduserrealnamelog' : | ||
return wfMsgExt($action, $options, $title->getPrefixedText(), $params[0], $params[1]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/** | ||
* UserAdmin is a MediaWiki extension which allows administrators to add and | ||
* delete users (e.g. spam or unused accounts), change user passwords, edit user | ||
* details (e.g. username, real name or email), edit user groups, resend emails | ||
* (e.g. reset password email or welcome message email). This extension is | ||
* primarily for administrators of private wikis that require tighter control of | ||
* user accounts. | ||
* | ||
* Usage: | ||
* require_once("extensions/UserAdmin/UserAdmin.php"); in LocalSettings.php | ||
* | ||
* @file | ||
* @ingroup Extensions | ||
* @link http://www.mediawiki.org/wiki/Extension:UserAdmin Documentation | ||
* @author Lance Gatlin <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* @version 1.0.0 | ||
*/ | ||
|
||
class UADMLogActionHandler { | ||
|
||
/* | ||
* Formats log messages when invoked by MW | ||
* | ||
* @param $type unused | ||
* @param $action string the log message type | ||
* @param $title Title object | ||
* @param $skin Skin objec | ||
* @param $params array of string parameters for message | ||
* @return string formatted log message | ||
*/ | ||
static function UlogActionHandler($type, $action, $title, $skin, $params) | ||
{ | ||
foreach($params as &$param) | ||
if($param == '') | ||
$param = '(empty)'; | ||
|
||
$options = array('parseinline', 'replaceafter'); | ||
switch($action) | ||
{ | ||
case 'uadm-usersdeletedlog' : | ||
return wfMsgExt($action, $options, $params[0]); | ||
|
||
case 'uadm-emailpasswordlog' : | ||
case 'uadm-emailwelcomelog' : | ||
case 'uadm-changeduserpasswordlog' : | ||
return wfMsgExt($action, $options, $title->getPrefixedText()); | ||
|
||
case 'uadm-changedusernamelog' : | ||
return wfMsgExt($action, $options, $params[0], $params[1], $params[2]); | ||
|
||
case 'uadm-changeduseremaillog' : | ||
case 'uadm-changeduserrealnamelog' : | ||
return wfMsgExt($action, $options, $title->getPrefixedText(), $params[0], $params[1]); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
?> |