Index: trunk/extensions/LogEntry/LogEntry.page.php |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | |
23 | 23 | public function execute( $par ) { |
24 | 24 | global $wgRequest, $wgOut, $wgUser; |
| 25 | + global $egLogEntryAppend, $egLogEntryUserName, $egLogEntryTimeStamp; |
25 | 26 | |
26 | 27 | // Begin output |
27 | 28 | $this->setHeaders(); |
— | — | @@ -48,8 +49,16 @@ |
49 | 50 | $article = new Article( $title ); |
50 | 51 | |
51 | 52 | // 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 | + ); |
54 | 63 | |
55 | 64 | // Get content without logentry tag in it |
56 | 65 | $content = $article->getContent(); |
Index: trunk/extensions/LogEntry/LogEntry.php |
— | — | @@ -21,10 +21,25 @@ |
22 | 22 | 'svn-date' => '$LastChangedDate$', |
23 | 23 | 'svn-revision' => '$LastChangedRevision$', |
24 | 24 | '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', |
26 | 26 | 'descriptionmsg' => 'logentry-parserhook-desc', |
27 | 27 | ); |
28 | 28 | |
| 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 | + |
29 | 44 | // Shortcut to this extension directory |
30 | 45 | $dir = dirname( __FILE__ ) . '/'; |
31 | 46 | |
Index: trunk/extensions/LogEntry/LogEntry.hooks.php |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | // Render the entry form |
27 | 27 | public static function render( $input, $args, &$parser ) { |
28 | 28 | global $wgUser; |
| 29 | + global $egLogEntryMultiLine, $egLogEntryMultiLineRows; |
29 | 30 | |
30 | 31 | // Don't cache since we are passing the token in the form |
31 | 32 | $parser->disableCache(); |
— | — | @@ -42,22 +43,44 @@ |
43 | 44 | 'enctype' => 'multipart/form-data' |
44 | 45 | ) |
45 | 46 | ); |
| 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 | + } |
46 | 83 | $htmlResult .= Xml::element( 'input', |
47 | 84 | 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( |
62 | 85 | 'type' => 'hidden', |
63 | 86 | 'name' => 'page', |
64 | 87 | 'value' => $parser->getTitle()->getPrefixedText() |