r53673 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53672‎ | r53673 | r53674 >
Date:12:55, 23 July 2009
Author:roberthl
Status:deferred
Tags:
Comment:
freenodeChat:
* Various updates and cleanup.
Modified paths:
  • /trunk/extensions/freenodeChat/freenodeChat.php (modified) (history)
  • /trunk/extensions/freenodeChat/freenodeChat_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/freenodeChat/freenodeChat_body.php
@@ -12,7 +12,7 @@
1313
1414 function execute( $par ) {
1515 global $wgOut, $wgUser;
16 - global $wgFreenodeChannel;
 16+ global $wgFreenodeChatChannel, $wgFreenodeChatExtraParameters;
1717
1818 // Preperation.
1919 wfLoadExtensionMessages( 'FreenodeChat' );
@@ -22,13 +22,12 @@
2323 $wgOut->addWikiMsg( 'freenodechat-header' );
2424
2525 // Prepare query string to pass to widget.
26 - $queryAssoc = array(
27 - 'channels' => $wgFreenodeChannel
28 - );
29 -
30 - if ( $wgUser->IsLoggedIn() ) $queryAssoc[ 'nick' ] = str_replace( ' ', '_', $wgUser->getName() );
31 -
32 - foreach ( $queryAssoc as $parameter => $value ) {
 26+ $queryAssoc = array( 'channels' => $wgFreenodeChatChannel );
 27+ if ( $wgUser->IsLoggedIn() ) $queryAssoc[ 'nick' ] = str_replace( ' ', '_', $wgUser->getName() );
 28+ if ( $wgFreenodeChatExtraParameters ) {
 29+ $queryAssoc = array_merge( $queryAssoc, $wgFreenodeChatExtraParameters );
 30+ }
 31+ foreach ( $queryAssoc as $parameter => $value ) {
3332 $query[] = $parameter . '=' . urlencode( $value );
3433 }
3534 $queryString = implode( '&', $query );
@@ -37,7 +36,24 @@
3837 $wgOut->addHTML( Xml::openElement( 'iframe', array(
3938 'width' => '1000',
4039 'height' => '500',
 40+ 'scrolling' => 'no',
 41+ 'border' => '0',
 42+ 'onLoad' => 'freenodeChatExpand( this )',
4143 'src' => 'http://webchat.freenode.net/?' . $queryString
4244 ) ) . Xml::closeElement( 'iframe' ) );
 45+
 46+ // Hack to make the chat area a reasonable size.
 47+ $wgOut->addHTML( Xml::tags( 'script',
 48+ array( 'type' => 'text/javascript' ),
 49+'/* <![CDATA[ */
 50+function freenodeChatExpand( elem ) {
 51+ height = elem.height;
 52+ width = elem.width;
 53+ elem.height = screen.height - 500;
 54+ elem.width = screen.width - 250;
 55+}
 56+/* ]]> */'
 57+ ) );
 58+
4359 }
4460 }
Index: trunk/extensions/freenodeChat/freenodeChat.php
@@ -20,7 +20,7 @@
2121 'name' => 'Freenode Chat',
2222 'description' => 'Adds a special page used to chat in real time with other wiki users (using freenode web IRC client).',
2323 'descriptionmsg' => 'freenodechat-desc',
24 - 'version' => '0.1.1',
 24+ 'version' => '1.0.0',
2525 'author' => array( 'Robert Leverington', 'Marco 27' )
2626 );
2727
@@ -35,8 +35,12 @@
3636 $wgExtensionMessagesFiles[ 'FreenodeChat' ] = $dir . 'freenodeChat.i18n.php';
3737 $wgExtensionAliasesFiles[ 'FreenodeChat' ] = $dir . 'freenodeChat.alias.php';
3838
 39+// Default configuration.
 40+$wgFreenodeChatChannel = '#mediawiki-i18n';
 41+$wgFreenodeChatExtraParameters = array();
 42+
3943 // Permissions.
4044 $wgAvailableRights[] = 'freenodechat';
41 -$wgGroupPermissions[ '*' ][ 'freenodechat' ] = true;
 45+$wgGroupPermissions[ '*' ][ 'freenodechat' ] = false;
4246 $wgGroupPermissions[ 'user' ][ 'freenodechat' ] = true;
4347 $wgGroupPermissions[ 'sysop' ][ 'freenodechat' ] = true;

Status & tagging log