r65071 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65070‎ | r65071 | r65072 >
Date:18:18, 15 April 2010
Author:kipcool
Status:deferred
Tags:
Comment:
Added hook to allow creating a new expression when not found
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)
  • /trunk/extensions/Wikidata/Wikidata.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/Wikidata.i18n.php
@@ -85,6 +85,9 @@
8686 'ow_exporttsv_export_failed' => 'Export failed',
8787
8888 'addcollection' => 'Wikidata: Add collection',
 89+ 'ow_searchnoresult' => "<p>You may:<br />
 90+* '''Create the expression \"[[Expression:\$1]]\"''' (and add a definition)<br />
 91+* '''Create the page \"[[:\$1]]\"''' (a standard wiki page)</p>",
8992 'ow_save' => 'Save',
9093 'ow_history' => 'History',
9194 'ow_datasets' => 'Data-set selection',
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -131,4 +131,20 @@
132132 *
133133 */
134134 $wgPropertyToColumnFilters = array();
 135+
 136+// Hook: replace the proposition to "create new page" by a custom, allowing to create new expression as well
 137+$wgHooks[ 'SpecialSearchNogomatch' ][] = 'owNoGoMatchHook';
 138+
 139+function owNoGoMatchHook( &$title ) {
 140+ global $wgOut,$wgDisableTextSearch;
 141+ $wgOut->addWikiMsg( 'search-nonefound' );
 142+ $wgOut->addWikiMsg( 'ow_searchnoresult', wfEscapeWikiText( $title ) );
 143+// $wgOut->addWikiMsg( 'ow_searchnoresult', $title );
 144+
 145+ $wgDisableTextSearch = true ;
 146+ return true;
 147+}
 148+
 149+
 150+
135151 ?>

Status & tagging log