r42690 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42689‎ | r42690 | r42691 >
Date:22:07, 27 October 2008
Author:tparscal
Status:old
Tags:
Comment:
Added configuration variables for Single/MultiLine, MultiLine size, and whether to insert the UserName and TimeStamp when logging
Modified paths:
  • /trunk/extensions/LogEntry/LogEntry.hooks.php (modified) (history)
  • /trunk/extensions/LogEntry/LogEntry.page.php (modified) (history)
  • /trunk/extensions/LogEntry/LogEntry.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LogEntry/LogEntry.page.php
@@ -21,6 +21,7 @@
2222
2323 public function execute( $par ) {
2424 global $wgRequest, $wgOut, $wgUser;
 25+ global $egLogEntryAppend, $egLogEntryUserName, $egLogEntryTimeStamp;
2526
2627 // Begin output
2728 $this->setHeaders();
@@ -48,8 +49,16 @@
4950 $article = new Article( $title );
5051
5152 // Build new line
52 - $newLine = sprintf( "* %s %s: %s", gmdate( 'H:i' ), $wgUser->getName(),
53 - trim( htmlspecialchars( $wgRequest->getText( 'line' ) ) ) );
 53+ $newLine = '*';
 54+ if ( $egLogEntryUserName ) {
 55+ $newLine .= ' ' . $wgUser->getName();
 56+ }
 57+ if ( $egLogEntryTimeStamp ) {
 58+ $newLine .= ' ' . gmdate( 'H:i' );
 59+ }
 60+ $newLine .= ': ' . str_replace( "\n", '<br />',
 61+ trim( htmlspecialchars( $wgRequest->getText( 'line' ) ) )
 62+ );
5463
5564 // Get content without logentry tag in it
5665 $content = $article->getContent();
Index: trunk/extensions/LogEntry/LogEntry.php
@@ -21,10 +21,25 @@
2222 'svn-date' => '$LastChangedDate$',
2323 'svn-revision' => '$LastChangedRevision$',
2424 'url' => 'http://www.mediawiki.org/wiki/Extension:LogEntry',
25 - 'description' => 'This tag extension provides a form for appending to log pages',
 25+ 'description' => 'This tag extension provides a form for appending/prepending to log pages',
2626 'descriptionmsg' => 'logentry-parserhook-desc',
2727 );
2828
 29+// Append == true, Prepend == false
 30+$egLogEntryAppend = true;
 31+
 32+// Show TimeStamp == true, No TimeStamp == false
 33+$egLogEntryTimeStamp = true;
 34+
 35+// Show UserName == true, No UserName == false
 36+$egLogEntryUserName = true;
 37+
 38+// Use MultiLine == true, Use SingleLine == false
 39+$egLogEntryMultiLine = false;
 40+
 41+// Number of rows if MultiLine is enabled
 42+$egLogEntryMultiLineRows = 3;
 43+
2944 // Shortcut to this extension directory
3045 $dir = dirname( __FILE__ ) . '/';
3146
Index: trunk/extensions/LogEntry/LogEntry.hooks.php
@@ -25,6 +25,7 @@
2626 // Render the entry form
2727 public static function render( $input, $args, &$parser ) {
2828 global $wgUser;
 29+ global $egLogEntryMultiLine, $egLogEntryMultiLineRows;
2930
3031 // Don't cache since we are passing the token in the form
3132 $parser->disableCache();
@@ -42,22 +43,44 @@
4344 'enctype' => 'multipart/form-data'
4445 )
4546 );
 47+ if ( $egLogEntryMultiLine ) {
 48+ $htmlResult .= Xml::element( 'textarea',
 49+ array(
 50+ 'rows' => $egLogEntryMultiLineRows,
 51+ 'name' => 'line',
 52+ 'style' => 'width:100%;'
 53+ )
 54+ );
 55+ $htmlResult .= Xml::tags( 'div',
 56+ array(
 57+ 'align' => 'right'
 58+ ),
 59+ Xml::element( 'input',
 60+ array(
 61+ 'type' => 'submit',
 62+ 'name' => 'append',
 63+ 'value' => wfMsg( 'logentry-append' )
 64+ )
 65+ )
 66+ );
 67+ } else {
 68+ $htmlResult .= Xml::element( 'input',
 69+ array(
 70+ 'type' => 'text',
 71+ 'name' => 'line',
 72+ 'style' => 'width:80%;'
 73+ )
 74+ );
 75+ $htmlResult .= Xml::element( 'input',
 76+ array(
 77+ 'type' => 'submit',
 78+ 'name' => 'append',
 79+ 'value' => wfMsg( 'logentry-append' )
 80+ )
 81+ );
 82+ }
4683 $htmlResult .= Xml::element( 'input',
4784 array(
48 - 'type' => 'text',
49 - 'name' => 'line',
50 - 'style' => 'width:80%;'
51 - )
52 - );
53 - $htmlResult .= Xml::element( 'input',
54 - array(
55 - 'type' => 'submit',
56 - 'name' => 'append',
57 - 'value' => wfMsg( 'logentry-append' )
58 - )
59 - );
60 - $htmlResult .= Xml::element( 'input',
61 - array(
6285 'type' => 'hidden',
6386 'name' => 'page',
6487 'value' => $parser->getTitle()->getPrefixedText()

Follow-up revisions

RevisionCommit summaryAuthorDate
r42692Update logentry-parserhook-desc per r42690siebrand22:09, 27 October 2008

Status & tagging log