Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -201,9 +201,6 @@ |
202 | 202 | 'namespaces', |
203 | 203 | 'variants', |
204 | 204 | ), |
205 | | - 'metadata_help' => array( |
206 | | - 'metadata_help', |
207 | | - ), |
208 | 205 | 'miscellaneous2' => array( |
209 | 206 | 'errorpagetitle', |
210 | 207 | 'returnto', |
— | — | @@ -3156,7 +3153,6 @@ |
3157 | 3154 | 'miscellaneous1' => '', |
3158 | 3155 | 'cologneblue' => 'Cologne Blue skin', |
3159 | 3156 | 'vector' => 'Vector skin', |
3160 | | - 'metadata_help' => 'Metadata in edit box', |
3161 | 3157 | 'miscellaneous2' => '', |
3162 | 3158 | 'links' => 'All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage) and the disambiguation template definition (see disambiguations).', |
3163 | 3159 | 'badaccess' => '', |
Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -638,6 +638,10 @@ |
639 | 639 | &$text: Text to preload with |
640 | 640 | &$title: Title object representing the page being created |
641 | 641 | |
| 642 | +'EditFormInitialText': Allows modifying the edit form when editing existing |
| 643 | +pages |
| 644 | +$editPage: EditPage object |
| 645 | + |
642 | 646 | 'EditPage::attemptSave': called before an article is |
643 | 647 | saved, that is before insertNewArticle() is called |
644 | 648 | $editpage_Obj: the current EditPage object |
— | — | @@ -689,6 +693,15 @@ |
690 | 694 | $title: title of page being edited |
691 | 695 | &$msg: localization message name, overridable. Default is either 'copyrightwarning' or 'copyrightwarning2' |
692 | 696 | |
| 697 | +'EditPageGetDiffText': Allow modifying the wikitext that will be used in |
| 698 | +"Show changes" |
| 699 | +$editPage: EditPage object |
| 700 | +&$newtext: wikitext that will be used as "your version" |
| 701 | + |
| 702 | +'EditPageGetPreviewText': Allow modifying the wikitext that will be previewed |
| 703 | +$editPage: EditPage object |
| 704 | +&$toparse: wikitext that will be parsed |
| 705 | + |
693 | 706 | 'EditPageNoSuchSection': When a section edit request is given for an non-existent section |
694 | 707 | &$editpage: The current EditPage object |
695 | 708 | &$res: the HTML of the error text |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -45,7 +45,6 @@ |
46 | 46 | var $mArticle; |
47 | 47 | var $mTitle; |
48 | 48 | var $action; |
49 | | - var $mMetaData = ''; |
50 | 49 | var $isConflict = false; |
51 | 50 | var $isCssJsSubpage = false; |
52 | 51 | var $isCssSubpage = false; |
— | — | @@ -247,95 +246,6 @@ |
248 | 247 | } |
249 | 248 | } |
250 | 249 | |
251 | | - /** |
252 | | - * This is the function that extracts metadata from the article body on the first view. |
253 | | - * To turn the feature on, set $wgUseMetadataEdit = true ; in LocalSettings |
254 | | - * and set $wgMetadataWhitelist to the *full* title of the template whitelist |
255 | | - */ |
256 | | - function extractMetaDataFromArticle () { |
257 | | - global $wgUseMetadataEdit, $wgMetadataWhitelist, $wgContLang; |
258 | | - $this->mMetaData = ''; |
259 | | - if ( !$wgUseMetadataEdit ) return; |
260 | | - if ( $wgMetadataWhitelist == '' ) return; |
261 | | - $s = ''; |
262 | | - $t = $this->getContent(); |
263 | | - |
264 | | - # MISSING : <nowiki> filtering |
265 | | - |
266 | | - # Categories and language links |
267 | | - $t = explode( "\n" , $t ); |
268 | | - $catlow = strtolower( $wgContLang->getNsText( NS_CATEGORY ) ); |
269 | | - $cat = $ll = array(); |
270 | | - foreach ( $t as $key => $x ) { |
271 | | - $y = trim( strtolower ( $x ) ); |
272 | | - while ( substr( $y , 0 , 2 ) == '[[' ) { |
273 | | - $y = explode( ']]' , trim ( $x ) ); |
274 | | - $first = array_shift( $y ); |
275 | | - $first = explode( ':' , $first ); |
276 | | - $ns = array_shift( $first ); |
277 | | - $ns = trim( str_replace( '[' , '' , $ns ) ); |
278 | | - if ( $wgContLang->getLanguageName( $ns ) || strtolower( $ns ) == $catlow ) { |
279 | | - $add = '[[' . $ns . ':' . implode( ':' , $first ) . ']]'; |
280 | | - if ( strtolower( $ns ) == $catlow ) $cat[] = $add; |
281 | | - else $ll[] = $add; |
282 | | - $x = implode( ']]', $y ); |
283 | | - $t[$key] = $x; |
284 | | - $y = trim( strtolower( $x ) ); |
285 | | - } else { |
286 | | - $x = implode( ']]' , $y ); |
287 | | - $y = trim( strtolower( $x ) ); |
288 | | - } |
289 | | - } |
290 | | - } |
291 | | - if ( count( $cat ) ) $s .= implode( ' ' , $cat ) . "\n"; |
292 | | - if ( count( $ll ) ) $s .= implode( ' ' , $ll ) . "\n"; |
293 | | - $t = implode( "\n" , $t ); |
294 | | - |
295 | | - # Load whitelist |
296 | | - $sat = array () ; # stand-alone-templates; must be lowercase |
297 | | - $wl_title = Title::newFromText( $wgMetadataWhitelist ); |
298 | | - $wl_article = new Article ( $wl_title ); |
299 | | - $wl = explode ( "\n" , $wl_article->getContent() ); |
300 | | - foreach ( $wl AS $x ) { |
301 | | - $isentry = false; |
302 | | - $x = trim ( $x ); |
303 | | - while ( substr ( $x , 0 , 1 ) == '*' ) { |
304 | | - $isentry = true; |
305 | | - $x = trim ( substr ( $x , 1 ) ); |
306 | | - } |
307 | | - if ( $isentry ) { |
308 | | - $sat[] = strtolower ( $x ); |
309 | | - } |
310 | | - |
311 | | - } |
312 | | - |
313 | | - # Templates, but only some |
314 | | - $t = explode( '{{' , $t ); |
315 | | - $tl = array() ; |
316 | | - foreach ( $t as $key => $x ) { |
317 | | - $y = explode( '}}' , $x , 2 ); |
318 | | - if ( count( $y ) == 2 ) { |
319 | | - $z = $y[0]; |
320 | | - $z = explode( '|' , $z ); |
321 | | - $tn = array_shift( $z ); |
322 | | - if ( in_array( strtolower( $tn ) , $sat ) ) { |
323 | | - $tl[] = '{{' . $y[0] . '}}'; |
324 | | - $t[$key] = $y[1]; |
325 | | - $y = explode( '}}' , $y[1] , 2 ); |
326 | | - } |
327 | | - else $t[$key] = '{{' . $x; |
328 | | - } |
329 | | - else if ( $key != 0 ) $t[$key] = '{{' . $x; |
330 | | - else $t[$key] = $x; |
331 | | - } |
332 | | - if ( count( $tl ) ) $s .= implode( ' ' , $tl ); |
333 | | - $t = implode( '' , $t ); |
334 | | - |
335 | | - $t = str_replace( "\n\n\n", "\n", $t ); |
336 | | - $this->mArticle->mContent = $t; |
337 | | - $this->mMetaData = $s; |
338 | | - } |
339 | | - |
340 | 250 | /* |
341 | 251 | * Check if a page was deleted while the user was editing it, before submit. |
342 | 252 | * Note that we rely on the logging table, which hasn't been always there, |
— | — | @@ -427,7 +337,6 @@ |
428 | 338 | if ( $this->previewOnOpen() ) { |
429 | 339 | $this->formtype = 'preview'; |
430 | 340 | } else { |
431 | | - $this->extractMetaDataFromArticle () ; |
432 | 341 | $this->formtype = 'initial'; |
433 | 342 | } |
434 | 343 | } |
— | — | @@ -495,6 +404,8 @@ |
496 | 405 | } |
497 | 406 | if ( !$this->mTitle->getArticleId() ) |
498 | 407 | wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) ); |
| 408 | + else |
| 409 | + wfRunHooks( 'EditFormInitialText', array( $this ) ); |
499 | 410 | } |
500 | 411 | |
501 | 412 | $this->showEditForm(); |
— | — | @@ -620,7 +531,7 @@ |
621 | 532 | $this->textbox1 = $textbox1; |
622 | 533 | wfProfileOut( get_class($this)."::importContentFormData" ); |
623 | 534 | } |
624 | | - $this->mMetaData = rtrim( $request->getText( 'metadata' ) ); |
| 535 | + |
625 | 536 | # Truncate for whole multibyte characters. +5 bytes for ellipsis |
626 | 537 | $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250, '' ); |
627 | 538 | |
— | — | @@ -690,7 +601,6 @@ |
691 | 602 | # Not a posted form? Start with nothing. |
692 | 603 | wfDebug( __METHOD__ . ": Not a posted form.\n" ); |
693 | 604 | $this->textbox1 = ''; |
694 | | - $this->mMetaData = ''; |
695 | 605 | $this->summary = ''; |
696 | 606 | $this->edittime = ''; |
697 | 607 | $this->starttime = wfTimestampNow(); |
— | — | @@ -852,8 +762,7 @@ |
853 | 763 | wfProfileIn( __METHOD__ ); |
854 | 764 | wfProfileIn( __METHOD__ . '-checks' ); |
855 | 765 | |
856 | | - if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) |
857 | | - { |
| 766 | + if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) { |
858 | 767 | wfDebug( "Hook 'EditPage::attemptSave' aborted article saving\n" ); |
859 | 768 | return self::AS_HOOK_ERROR; |
860 | 769 | } |
— | — | @@ -869,10 +778,6 @@ |
870 | 779 | } |
871 | 780 | } |
872 | 781 | |
873 | | - # Reintegrate metadata |
874 | | - if ( $this->mMetaData != '' ) $this->textbox1 .= "\n" . $this->mMetaData ; |
875 | | - $this->mMetaData = '' ; |
876 | | - |
877 | 782 | # Check for spam |
878 | 783 | $match = self::matchSummarySpamRegex( $this->summary ); |
879 | 784 | if ( $match === false ) { |
— | — | @@ -1392,10 +1297,6 @@ |
1393 | 1298 | if ( isset($this->editFormTextAfterWarn) && $this->editFormTextAfterWarn !== '' ) |
1394 | 1299 | $wgOut->addHTML( $this->editFormTextAfterWarn ); |
1395 | 1300 | |
1396 | | - global $wgUseMetadataEdit; |
1397 | | - if ( $wgUseMetadataEdit ) |
1398 | | - $this->showMetaData(); |
1399 | | - |
1400 | 1301 | $this->showStandardInputs(); |
1401 | 1302 | |
1402 | 1303 | $this->showFormAfterText(); |
— | — | @@ -1749,15 +1650,6 @@ |
1750 | 1651 | |
1751 | 1652 | $wgOut->addHTML( Html::textarea( $name, $wikitext, $attribs ) ); |
1752 | 1653 | } |
1753 | | - |
1754 | | - protected function showMetaData() { |
1755 | | - global $wgOut, $wgContLang, $wgUser; |
1756 | | - $metadata = htmlspecialchars( $wgContLang->recodeForEdit( $this->mMetaData ) ); |
1757 | | - $ew = $wgUser->getOption( 'editwidth' ) ? ' style="width:100%"' : ''; |
1758 | | - $cols = $wgUser->getIntOption( 'cols' ); |
1759 | | - $metadata = wfMsgWikiHtml( 'metadata_help' ) . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>" ; |
1760 | | - $wgOut->addHTML( $metadata ); |
1761 | | - } |
1762 | 1654 | |
1763 | 1655 | protected function displayPreviewArea( $previewOutput, $isOnTop = false ) { |
1764 | 1656 | global $wgOut; |
— | — | @@ -1969,10 +1861,10 @@ |
1970 | 1862 | # If we're adding a comment, we need to show the |
1971 | 1863 | # summary as the headline |
1972 | 1864 | if ( $this->section == "new" && $this->summary != "" ) { |
1973 | | - $toparse="== {$this->summary} ==\n\n" . $toparse; |
| 1865 | + $toparse = "== {$this->summary} ==\n\n" . $toparse; |
1974 | 1866 | } |
1975 | 1867 | |
1976 | | - if ( $this->mMetaData != "" ) $toparse .= "\n" . $this->mMetaData; |
| 1868 | + wfRunHooks( 'EditPageGetPreviewText', array( $this, &$toparse ) ); |
1977 | 1869 | |
1978 | 1870 | // Parse mediawiki messages with correct target language |
1979 | 1871 | if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { |
— | — | @@ -2496,6 +2388,9 @@ |
2497 | 2389 | $oldtext = $this->mArticle->fetchContent(); |
2498 | 2390 | $newtext = $this->mArticle->replaceSection( |
2499 | 2391 | $this->section, $this->textbox1, $this->summary, $this->edittime ); |
| 2392 | + |
| 2393 | + wfRunHooks( 'EditPageGetDiffText', array( $this, &$newtext ) ); |
| 2394 | + |
2500 | 2395 | $newtext = $this->mArticle->preSaveTransform( $newtext ); |
2501 | 2396 | $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) ); |
2502 | 2397 | $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2486,16 +2486,6 @@ |
2487 | 2487 | */ |
2488 | 2488 | $wgEnableNewpagesUserFilter = true; |
2489 | 2489 | |
2490 | | -/** |
2491 | | - * Whether to use metadata edition |
2492 | | - * This will put categories, language links and allowed templates in a separate text box |
2493 | | - * while editing pages |
2494 | | - * EXPERIMENTAL |
2495 | | - */ |
2496 | | -$wgUseMetadataEdit = false; |
2497 | | -/** Full name (including namespace) of the page containing templates names that will be allowed as metadata */ |
2498 | | -$wgMetadataWhitelist = ''; |
2499 | | - |
2500 | 2490 | # |
2501 | 2491 | # Copyright and credits settings |
2502 | 2492 | # |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -800,9 +800,6 @@ |
801 | 801 | 'namespaces' => 'Namespaces', |
802 | 802 | 'variants' => 'Variants', |
803 | 803 | |
804 | | -# Metadata in edit box |
805 | | -'metadata_help' => 'Metadata:', |
806 | | - |
807 | 804 | 'errorpagetitle' => 'Error', |
808 | 805 | 'returnto' => 'Return to $1.', |
809 | 806 | 'tagline' => 'From {{SITENAME}}', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -101,6 +101,8 @@ |
102 | 102 | for controlling debug output. |
103 | 103 | * New $wgBlockDisablesLogin when set to true disallows blocked users from |
104 | 104 | logging in. |
| 105 | +* (bug 8790) Metadata edition ($wgUseMetadataEdit) has been moved to a separate |
| 106 | + extension "MetadataEdit". |
105 | 107 | |
106 | 108 | === New features in 1.16 === |
107 | 109 | |
Index: trunk/extensions/MetadataEdit/MetadataEdit.i18n.php |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for MetadataEdit extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +$messages['en'] = array( |
| 13 | + 'metadataedit-desc' => 'Put categories, language links and allowed templates in a separate text box while editing pages', |
| 14 | + 'metadata_help' => 'Metadata:', |
| 15 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/MetadataEdit/MetadataEdit.i18n.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 16 | + native |
Index: trunk/extensions/MetadataEdit/MetadataEdit.php |
— | — | @@ -0,0 +1,165 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Put categories, language links and allowed templates in a separate text box |
| 6 | + * while editing pages. |
| 7 | + * |
| 8 | + * @file |
| 9 | + * @ingroup Extensions |
| 10 | + * @author Magnus Manske and Alexandre Emsenhuber |
| 11 | + */ |
| 12 | + |
| 13 | +$wgExtensionCredits['other'][] = array( |
| 14 | + 'path' => __FILE__, |
| 15 | + 'name' => 'MetadataEdit', |
| 16 | + 'author' => array( 'Magnus Manske', 'Alexandre Emsenhuber' ), |
| 17 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:MetadataEdit', |
| 18 | + 'description' => 'Put categories, language links and allowed templates in a separate text box while editing pages', |
| 19 | + 'descriptionmsg' => 'metadataedit-desc', |
| 20 | + 'version' => '0.1', |
| 21 | +); |
| 22 | + |
| 23 | +/** |
| 24 | + * Full name (including namespace) of the page containing templates names that |
| 25 | + * will be allowed as metadata |
| 26 | + */ |
| 27 | +$wgMetadataWhitelist = ''; |
| 28 | + |
| 29 | +$wgExtensionMessagesFiles['MetadataEdit'] = dirname( __FILE__ ) . '/MetadataEdit.i18n.php'; |
| 30 | + |
| 31 | +$wgHooks['EditFormInitialText'][] = 'wfMetadataEditExtractFromArticle'; |
| 32 | +$wgHooks['EditPage::importFormData'][] = 'wfMetadataEditOnImportData'; |
| 33 | +$wgHooks['EditPage::attemptSave'][] = 'wfMetadataEditOnAttemptSave'; |
| 34 | +$wgHooks['EditPage::showEditForm:fields'][] = 'wfMetadataEditOnShowFields'; |
| 35 | +$wgHooks['EditPageGetPreviewText'][] = 'wfMetadataEditOnGetPreviewText'; |
| 36 | +$wgHooks['EditPageGetDiffText'][] = 'wfMetadataEditOnGetDiffText'; |
| 37 | + |
| 38 | +function wfMetadataEditExtractFromArticle( $editPage ) { |
| 39 | + global $wgMetadataWhitelist, $wgContLang; |
| 40 | + |
| 41 | + $editPage->mMetaData = ''; |
| 42 | + if ( $wgMetadataWhitelist == '' ) return true; |
| 43 | + $s = ''; |
| 44 | + $t = $editPage->textbox1; |
| 45 | + |
| 46 | + # MISSING : <nowiki> filtering |
| 47 | + |
| 48 | + # Categories and language links |
| 49 | + $t = explode( "\n" , $t ); |
| 50 | + $catlow = strtolower( $wgContLang->getNsText( NS_CATEGORY ) ); |
| 51 | + $cat = $ll = array(); |
| 52 | + foreach ( $t as $key => $x ) { |
| 53 | + $y = trim( strtolower ( $x ) ); |
| 54 | + while ( substr( $y , 0 , 2 ) == '[[' ) { |
| 55 | + $y = explode( ']]' , trim ( $x ) ); |
| 56 | + $first = array_shift( $y ); |
| 57 | + $first = explode( ':' , $first ); |
| 58 | + $ns = array_shift( $first ); |
| 59 | + $ns = trim( str_replace( '[' , '' , $ns ) ); |
| 60 | + if ( $wgContLang->getLanguageName( $ns ) || strtolower( $ns ) == $catlow ) { |
| 61 | + $add = '[[' . $ns . ':' . implode( ':' , $first ) . ']]'; |
| 62 | + if ( strtolower( $ns ) == $catlow ) $cat[] = $add; |
| 63 | + else $ll[] = $add; |
| 64 | + $x = implode( ']]', $y ); |
| 65 | + $t[$key] = $x; |
| 66 | + $y = trim( strtolower( $x ) ); |
| 67 | + } else { |
| 68 | + $x = implode( ']]' , $y ); |
| 69 | + $y = trim( strtolower( $x ) ); |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + if ( count( $cat ) ) $s .= implode( ' ' , $cat ) . "\n"; |
| 74 | + if ( count( $ll ) ) $s .= implode( ' ' , $ll ) . "\n"; |
| 75 | + $t = implode( "\n" , $t ); |
| 76 | + |
| 77 | + # Load whitelist |
| 78 | + $sat = array () ; # stand-alone-templates; must be lowercase |
| 79 | + $wl_title = Title::newFromText( $wgMetadataWhitelist ); |
| 80 | + if ( !$wl_title ) { |
| 81 | + throw new MWException( '$wgMetadataWhitelist is not set to a valid page title.' ); |
| 82 | + } |
| 83 | + $wl_article = new Article ( $wl_title ); |
| 84 | + $wl = array();//explode ( "\n" , $wl_article->getContent() ); |
| 85 | + foreach ( $wl AS $x ) { |
| 86 | + $isentry = false; |
| 87 | + $x = trim ( $x ); |
| 88 | + while ( substr ( $x , 0 , 1 ) == '*' ) { |
| 89 | + $isentry = true; |
| 90 | + $x = trim ( substr ( $x , 1 ) ); |
| 91 | + } |
| 92 | + if ( $isentry ) { |
| 93 | + $sat[] = strtolower ( $x ); |
| 94 | + } |
| 95 | + |
| 96 | + } |
| 97 | + |
| 98 | + # Templates, but only some |
| 99 | + $t = explode( '{{' , $t ); |
| 100 | + $tl = array() ; |
| 101 | + foreach ( $t as $key => $x ) { |
| 102 | + $y = explode( '}}' , $x , 2 ); |
| 103 | + if ( count( $y ) == 2 ) { |
| 104 | + $z = $y[0]; |
| 105 | + $z = explode( '|' , $z ); |
| 106 | + $tn = array_shift( $z ); |
| 107 | + if ( in_array( strtolower( $tn ) , $sat ) ) { |
| 108 | + $tl[] = '{{' . $y[0] . '}}'; |
| 109 | + $t[$key] = $y[1]; |
| 110 | + $y = explode( '}}' , $y[1] , 2 ); |
| 111 | + } |
| 112 | + else $t[$key] = '{{' . $x; |
| 113 | + } |
| 114 | + else if ( $key != 0 ) $t[$key] = '{{' . $x; |
| 115 | + else $t[$key] = $x; |
| 116 | + } |
| 117 | + if ( count( $tl ) ) $s .= implode( ' ' , $tl ); |
| 118 | + $t = implode( '' , $t ); |
| 119 | + |
| 120 | + $t = str_replace( "\n\n\n", "\n", $t ); |
| 121 | + $editPage->textbox1 = $t; |
| 122 | + $editPage->mMetaData = $s; |
| 123 | + |
| 124 | + return true; |
| 125 | +} |
| 126 | + |
| 127 | +function wfMetadataEditOnImportData( $editPage, $request ) { |
| 128 | + if ( $request->wasPosted() ) { |
| 129 | + $editPage->mMetaData = rtrim( $request->getText( 'metadata' ) ); |
| 130 | + } else { |
| 131 | + $editPage->mMetaData = ''; |
| 132 | + } |
| 133 | + |
| 134 | + return true; |
| 135 | +} |
| 136 | + |
| 137 | +function wfMetadataEditOnAttemptSave( $editPage ) { |
| 138 | + # Reintegrate metadata |
| 139 | + if ( $editPage->mMetaData != '' ) $editPage->textbox1 .= "\n" . $editPage->mMetaData; |
| 140 | + $editPage->mMetaData = ''; |
| 141 | + |
| 142 | + return true; |
| 143 | +} |
| 144 | + |
| 145 | +function wfMetadataEditOnShowFields( $editPage ) { |
| 146 | + global $wgContLang, $wgUser; |
| 147 | + $metadata = htmlspecialchars( $wgContLang->recodeForEdit( $editPage->mMetaData ) ); |
| 148 | + $ew = $wgUser->getOption( 'editwidth' ) ? ' style="width:100%"' : ''; |
| 149 | + $cols = $wgUser->getIntOption( 'cols' ); |
| 150 | + $metadata = wfMsgWikiHtml( 'metadata_help' ) . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>" ; |
| 151 | + $editPage->editFormTextAfterContent .= $metadata; |
| 152 | + |
| 153 | + return true; |
| 154 | +} |
| 155 | + |
| 156 | +function wfMetadataEditOnGetPreviewText( $editPage, &$toparse ) { |
| 157 | + if ( $editPage->mMetaData != '' ) $toparse .= "\n" . $editPage->mMetaData; |
| 158 | + |
| 159 | + return true; |
| 160 | +} |
| 161 | + |
| 162 | +function wfMetadataEditOnGetDiffText( $editPage, &$newText ) { |
| 163 | + if ( $editPage->mMetaData != '' ) $newText .= "\n" . $editPage->mMetaData; |
| 164 | + |
| 165 | + return true; |
| 166 | +} |
Property changes on: trunk/extensions/MetadataEdit/MetadataEdit.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 167 | + native |