Index: trunk/extensions/SemanticGlossary/SpecialSemanticGlossaryBrowser.php |
— | — | @@ -1,507 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * File holding the SpecialSemanticGlossaryBrowser class. |
6 | | - * |
7 | | - * @author Stephan Gambke |
8 | | - * |
9 | | - * @file |
10 | | - * @ingroup SemanticGlossary |
11 | | - */ |
12 | | -if ( !defined( 'SG_VERSION' ) ) { |
13 | | - die( 'This file is part of the Semantic Glossary extension, it is not a valid entry point.' ); |
14 | | -} |
15 | | - |
16 | | -/** |
17 | | - * This class creates and processes Special:GlossaryBrowser. |
18 | | - * |
19 | | - * Includable special pages have an execute() function which can be |
20 | | - * called from either context, so to parse text within them, it's |
21 | | - * necessary to check $this->mIncluding to determine the correct function |
22 | | - * to use. |
23 | | - * |
24 | | - * @todo Write this class. |
25 | | - * @ingroup SemanticGlossary |
26 | | - */ |
27 | | -class SpecialSemanticGlossaryBrowser extends SpecialPage { |
28 | | - |
29 | | - private $mMessages; |
30 | | - |
31 | | - function __construct() { |
32 | | - parent::__construct( 'SemanticGlossaryBrowser' ); |
33 | | - $this->mMessages = new LingoMessageLog(); |
34 | | - } |
35 | | - |
36 | | - function execute( $subpage ) { |
37 | | - global $wgRequest, $wgOut, $wgUser; |
38 | | - |
39 | | - // preparation stuff |
40 | | - $this->setHeaders(); |
41 | | - $this->loadModules(); |
42 | | - |
43 | | - $hasEditRights = $wgUser->isAllowed( 'editglossary' ); |
44 | | - |
45 | | - if ( $this->isActionAllowed() ) { |
46 | | - if ( $wgRequest->getText( 'submit' ) != null ) { |
47 | | - // if the form was submitted, store the data |
48 | | - $this->actionStoreData(); |
49 | | - } elseif ( $wgRequest->getText( 'createnew' ) != null ) { |
50 | | - // if a new term was defined, create it |
51 | | - $this->actionCreateNewTerm(); |
52 | | - } elseif ( $wgRequest->getText( 'delete' ) != null ) { |
53 | | - // if a new term was defined, create it |
54 | | - $this->actionDeleteData(); |
55 | | - } |
56 | | - } |
57 | | - |
58 | | - // get the glossary data |
59 | | - $parser = new LingoParser( $this->mMessages ); |
60 | | - $glossaryarray = $parser->getLingoArray(); |
61 | | - |
62 | | - // set function to create a table row (textareas when editing is |
63 | | - // allowed, else normal text) |
64 | | - if ( $hasEditRights ) { |
65 | | - $createTableRowMethod = 'createTableRowForEdit'; |
66 | | - } else { |
67 | | - $createTableRowMethod = 'createTableRowForDisplay'; |
68 | | - } |
69 | | - |
70 | | - // create HTML fragment for table rows |
71 | | - $tablerows = ''; |
72 | | - |
73 | | - // loop through all terms |
74 | | - foreach ( $glossaryarray as $term => $glossaryElement ) { |
75 | | - // One term may have several definitions. Include them all. |
76 | | - while ( ( $key = $glossaryElement->getCurrentKey() ) !== null ) { |
77 | | - $source = $glossaryElement->getSource( $key ); |
78 | | - $definition = $glossaryElement->getDefinition( $key ); |
79 | | - $link = $glossaryElement->getLink( $key ); |
80 | | - |
81 | | - $tablerows .= $this->$createTableRowMethod( $source->getInterwiki() . ":" . $source->getNamespace() . ":" . $source->getDBkey(), |
82 | | - $term, $definition, $link ); |
83 | | - |
84 | | - $glossaryElement->next(); |
85 | | - } |
86 | | - } |
87 | | - |
88 | | - if ( $tablerows != '' ) { |
89 | | - $listOfTermsFragment = |
90 | | - Html::rawElement( 'table', null, |
91 | | - Html::rawElement( 'tbody', null, $tablerows ) |
92 | | - ); |
93 | | - |
94 | | - if ( $hasEditRights ) { |
95 | | - // append action buttons |
96 | | - $listOfTermsFragment .= |
97 | | - Html::element( 'input', array('type' => 'submit', 'name' => 'delete', 'value' => wfMsg( 'semanticglossary-deleteselected' ), 'accesskey' => 'd') ) . |
98 | | - Html::element( 'input', array('type' => 'submit', 'name' => 'submit', 'value' => wfMsg( 'semanticglossary-savechanges' ), 'accesskey' => 's') ); |
99 | | - } |
100 | | - |
101 | | - $listOfTermsFragment = |
102 | | - Html::rawElement( 'div', array('class' => 'termslist'), |
103 | | - Html::element( 'div', array('class' => 'heading'), wfMsg( 'semanticglossary-termsdefined' ) ) . |
104 | | - $listOfTermsFragment |
105 | | - ); |
106 | | - } else { |
107 | | - $listOfTermsFragment = |
108 | | - Html::rawElement( 'div', array('class' => 'termslist'), |
109 | | - Html::element( 'div', array('class' => 'heading'), wfMsg( 'semanticglossary-notermsdefined' ) ) |
110 | | - ); |
111 | | - } |
112 | | - |
113 | | - // From here on no more errors should occur. Create list of errors. |
114 | | - $errors = $this->mMessages->getMessagesFormatted( LingoMessageLog::MESSAGE_NOTICE, wfMsg( 'semanticglossary-messageheader' ) ); |
115 | | - |
116 | | - if ( $errors !== null ) { |
117 | | - $wgOut->addParserOutputNoText( $errors ); |
118 | | - $errorsFragment = $errors->getText() . Html::rawElement( 'hr' ); |
119 | | - } else { |
120 | | - $errorsFragment = ''; |
121 | | - } |
122 | | - |
123 | | - if ( $hasEditRights ) { |
124 | | - // create form fragment to allow input of a new term |
125 | | - $newTermFragment = |
126 | | - Html::rawElement( 'hr' ) . |
127 | | - Html::rawElement( 'div', array('class' => 'newterm'), |
128 | | - Html::rawElement( 'div', array('class' => 'heading'), wfMsg( 'semanticglossary-enternewterm' ) ) . |
129 | | - Html::rawElement( 'table', null, |
130 | | - Html::rawElement( 'tbody', null, |
131 | | - Html::rawElement( 'tr', array('class' => 'row'), |
132 | | - Html::rawElement( 'td', array('class' => 'termcell'), |
133 | | - Html::element( 'textarea', array('name' => 'newterm') ) |
134 | | - ) . |
135 | | - Html::rawElement( 'td', array('class' => 'definitioncell'), |
136 | | - Html::rawElement( 'div', array('class' => 'definitionareawrapper'), |
137 | | - Html::element( 'textarea', array('name' => 'newdefinition') ) |
138 | | - ) |
139 | | - ) . |
140 | | - Html::rawElement( 'td', array('class' => 'linkcell'), |
141 | | - Html::element( 'textarea', array('name' => 'newlink') ) |
142 | | - ) |
143 | | - ) |
144 | | - ) |
145 | | - ) . |
146 | | - Html::element( 'input', array('type' => 'submit', 'name' => 'createnew', 'value' => wfMsg( 'semanticglossary-createnew' ), 'accesskey' => 'n') ) |
147 | | - ); |
148 | | - |
149 | | - $salt = rand( 10000, 99999 ); |
150 | | - $editTokenFragment = Html::rawElement( 'input', array('type' => 'hidden', 'name' => 'editToken', 'value' => $wgUser->editToken( $salt ) . $salt) ); |
151 | | - |
152 | | - // assemble output |
153 | | - $output = |
154 | | - Html::rawElement( 'div', array('class' => 'glossarybrowser'), |
155 | | - $errorsFragment . |
156 | | - Html::rawElement( 'form', array('method' => 'POST'), |
157 | | - $listOfTermsFragment . |
158 | | - $newTermFragment . |
159 | | - $editTokenFragment |
160 | | - ) |
161 | | - ); |
162 | | - } else { |
163 | | - // assemble output |
164 | | - $output = |
165 | | - Html::rawElement( 'div', array('class' => 'glossarybrowser'), |
166 | | - $errorsFragment . |
167 | | - $listOfTermsFragment |
168 | | - ); |
169 | | - } |
170 | | - |
171 | | - $wgOut->addHTML( $output ); |
172 | | - } |
173 | | - |
174 | | - /** |
175 | | - * Returns the name that goes in the <h1> in the special page itself, and also the name that |
176 | | - * will be listed in Special:Specialpages |
177 | | - * |
178 | | - * @return String |
179 | | - */ |
180 | | - function getDescription() { |
181 | | - return wfMsg( 'semanticglossary-browsertitle' ); |
182 | | - } |
183 | | - |
184 | | - /** |
185 | | - * Loads the CSS file for the GlossaryBrowser Special page |
186 | | - */ |
187 | | - protected function loadModules() { |
188 | | - global $wgOut, $wgScriptPath; |
189 | | - |
190 | | - if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) { |
191 | | - $wgOut->addModuleStyles( 'ext.SemanticGlossary.Browser' ); |
192 | | - } else { |
193 | | - $wgOut->addHeadItem( 'ext.SemanticGlossary.Browser.css', '<link rel="stylesheet" href="' . $wgScriptPath . '/extensions/SemanticGlossary/skins/SemanticGlossaryBrowser.css" />' ); |
194 | | - } |
195 | | - } |
196 | | - |
197 | | - /** |
198 | | - * Gets data from wgRequest and stores it |
199 | | - */ |
200 | | - protected function actionStoreData() { |
201 | | - global $wgRequest; |
202 | | - |
203 | | - // get ass array of input values |
204 | | - $inputdata = $wgRequest->getValues(); |
205 | | - |
206 | | - // loop through all input values |
207 | | - foreach ( $inputdata as $key => $value ) { |
208 | | - |
209 | | - // only consider terms here, other parameters are accessed by name |
210 | | - if ( substr( $key, -5 ) == ':term' ) { |
211 | | - // cut off ':term' |
212 | | - $pageString = substr( $key, 0, -5 ); |
213 | | - |
214 | | - // new data |
215 | | - $newTerm = $value; |
216 | | - $newDefinition = $inputdata[$pageString . ':definition']; |
217 | | - $newLink = $inputdata[$pageString . ':link']; |
218 | | - |
219 | | - $page = $this->getPageObjectFromInputName( $pageString ); |
220 | | - |
221 | | - // get its data |
222 | | - $pageData = smwfGetStore()->getSemanticData( $page ); |
223 | | - |
224 | | - |
225 | | - // get old values |
226 | | - $oldTerm = $this->getPropertyFromData( $pageData, '___glt' ); |
227 | | - if ( $oldTerm === false ) { |
228 | | - continue; |
229 | | - } |
230 | | - |
231 | | - $oldDefinition = $this->getPropertyFromData( $pageData, '___gld' ); |
232 | | - if ( $oldDefinition === false ) { |
233 | | - continue; |
234 | | - } |
235 | | - |
236 | | - $oldLink = $this->getPropertyFromData( $pageData, '___gll' ); |
237 | | - if ( $oldLink === false ) { |
238 | | - continue; |
239 | | - } |
240 | | - |
241 | | - // only store data if anything changed |
242 | | - if ( $newTerm != $oldTerm || |
243 | | - $newDefinition != $oldDefinition || |
244 | | - $newLink != $oldLink |
245 | | - ) { |
246 | | - $this->updateData( $page, array( |
247 | | - '___glt' => ( $newTerm ? new SMWDIString( $newTerm ) : null ), |
248 | | - '___gld' => ( $newDefinition ? new SMWDIBlob( $newDefinition ) : null ), |
249 | | - '___gll' => ( $newLink ? new SMWDIString( $newLink ) : null ) |
250 | | - ) ); |
251 | | - |
252 | | - // issue a warning if the original definition is on a real page |
253 | | - $title = $page->getTitle(); |
254 | | - if ( $title->isKnown() ) { |
255 | | - $this->mMessages->addMessage( |
256 | | - wfMsg( 'semanticglossary-storedtermdefinedinarticle', array($oldTerm, $title->getPrefixedText()) ), |
257 | | - LingoMessageLog::MESSAGE_WARNING |
258 | | - ); |
259 | | - } else { |
260 | | - $this->mMessages->addMessage( |
261 | | - wfMsg( 'semanticglossary-termchanged', array($oldTerm) ), |
262 | | - LingoMessageLog::MESSAGE_NOTICE |
263 | | - ); |
264 | | - } |
265 | | - } |
266 | | - } |
267 | | - } |
268 | | - } |
269 | | - |
270 | | - protected function actionCreateNewTerm() { |
271 | | - global $wgRequest; |
272 | | - |
273 | | - $newTerm = $wgRequest->getText( 'newterm' ); |
274 | | - |
275 | | - if ( $newTerm == null || $newTerm == '' ) { |
276 | | - $this->mMessages->addMessage( 'Term was empty. Nothing created.', LingoMessageLog::MESSAGE_WARNING ); |
277 | | - return; |
278 | | - } |
279 | | - |
280 | | - $newDefinition = $wgRequest->getText( 'newdefinition' ); |
281 | | - $newLink = $wgRequest->getText( 'newlink' ); |
282 | | - |
283 | | - $page = $this->findNextPageName(); |
284 | | - |
285 | | - // store data |
286 | | - $this->updateData( $page, array( |
287 | | - '___glt' => ( $newTerm ? new SMWDIString( $newTerm ) : null ), |
288 | | - '___gld' => ( $newDefinition ? new SMWDIBlob( $newDefinition ) : null ), |
289 | | - '___gll' => ( $newLink ? new SMWDIString( $newLink ) : null ) |
290 | | - ) ); |
291 | | - |
292 | | - $this->mMessages->addMessage( |
293 | | - wfMsg( 'semanticglossary-termadded', array($newTerm) ), |
294 | | - LingoMessageLog::MESSAGE_NOTICE |
295 | | - ); |
296 | | - } |
297 | | - |
298 | | - protected function actionDeleteData() { |
299 | | - global $wgRequest; |
300 | | - |
301 | | - // get ass array of input values |
302 | | - $inputdata = $wgRequest->getValues(); |
303 | | - |
304 | | - foreach ( $inputdata as $key => $value ) { |
305 | | - // only consider checkboxes here |
306 | | - if ( substr( $key, -8 ) == ':checked' ) { |
307 | | - // cut off ':checked' |
308 | | - $pageString = substr( $key, 0, -8 ); |
309 | | - |
310 | | - $page = $this->getPageObjectFromInputName( $pageString ); |
311 | | - |
312 | | - $this->updateData( $page, array( |
313 | | - '___glt' => null, |
314 | | - '___gld' => null, |
315 | | - '___gll' => null, |
316 | | - ) ); |
317 | | - |
318 | | - $oldTerm = $wgRequest->getVal( $pageString . ':term' ); |
319 | | - |
320 | | - $title = $page->getTitle(); |
321 | | - if ( $title && $title->isKnown() ) { |
322 | | - $this->mMessages->addMessage( |
323 | | - wfMsg( 'semanticglossary-deletedtermdefinedinarticle', array($oldTerm, $title->getPrefixedText()) ), |
324 | | - LingoMessageLog::MESSAGE_WARNING |
325 | | - ); |
326 | | - } else { |
327 | | - $this->mMessages->addMessage( |
328 | | - wfMsg( 'semanticglossary-termdeleted', array($oldTerm) ), |
329 | | - LingoMessageLog::MESSAGE_NOTICE |
330 | | - ); |
331 | | - } |
332 | | - } |
333 | | - } |
334 | | - } |
335 | | - |
336 | | - protected function getPropertyFromData( SMWSemanticData &$pageData, $propertyName ) { |
337 | | - $property = new SMWDIProperty( $propertyName ); |
338 | | - $propertyValues = $pageData->getPropertyValues( $property ); |
339 | | - |
340 | | - if ( count( $propertyValues ) == 1 ) { |
341 | | - return $propertyValues[0]->getString(); |
342 | | - } elseif ( count( $propertyValues ) > 1 ) { |
343 | | - if ( count( $propertyValues ) > 1 ) { |
344 | | - $this->mMessages->addMessage( |
345 | | - wfMsg( 'semanticglossary-storedtermdefinedtwice', array($pageData->getSubject()->getPrefixedText(), $propertyName, $newTerm) ), |
346 | | - LingoMessageLog::MESSAGE_ERROR |
347 | | - ); |
348 | | - } |
349 | | - return false; |
350 | | - } else { |
351 | | - return null; |
352 | | - } |
353 | | - } |
354 | | - |
355 | | - protected function getPageObjectFromInputName( $pageString ) { |
356 | | - // split the source string into interwiki reference, namespace and page title |
357 | | - $matches = array(); |
358 | | - preg_match( '/^(.*):(.*):(.*)$/', $pageString, $matches ); |
359 | | - |
360 | | - // create SMWWikiPageValue (SMW's wiki page representation) |
361 | | - return new SMWDIWikiPage( $matches[3], $matches[2], $matches[1] ); |
362 | | - } |
363 | | - |
364 | | - // find unused SMW page |
365 | | - protected function findNextPageName() { |
366 | | - $termPages = smwfGetStore()->getAllPropertySubjects( new SMWDIProperty( '___glt' ) ); |
367 | | - $defPages = smwfGetStore()->getAllPropertySubjects( new SMWDIProperty( '___gld' ) ); |
368 | | - $linkPages = smwfGetStore()->getAllPropertySubjects( new SMWDIProperty( '___gll' ) ); |
369 | | - |
370 | | - $pages = array(); |
371 | | - |
372 | | - foreach ( $termPages as $page ) { |
373 | | - $pages[$page->getDBkey()] = $page->getDBkey(); |
374 | | - } |
375 | | - |
376 | | - foreach ( $defPages as $page ) { |
377 | | - $pages[$page->getDBkey()] = $page->getDBkey(); |
378 | | - } |
379 | | - |
380 | | - foreach ( $linkPages as $page ) { |
381 | | - $pages[$page->getDBkey()] = $page->getDBkey(); |
382 | | - } |
383 | | - |
384 | | - $termNumber = count( $pages ); |
385 | | - |
386 | | - |
387 | | - while ( array_key_exists( "GlossaryTerm#$termNumber", $pages ) ) { |
388 | | - $termNumber++; |
389 | | - } |
390 | | - |
391 | | - return new SMWDIWikiPage( "GlossaryTerm#$termNumber", NS_MAIN, '', '#SemanticGlossary#' ); |
392 | | - |
393 | | - exit(); |
394 | | - } |
395 | | - |
396 | | - protected function updateData( SMWDIWikiPage &$page, array $data ) { |
397 | | - $newData = new SMWSemanticData( $page, false ); |
398 | | - |
399 | | - $oldData = smwfGetStore()->getSemanticData( $page ); |
400 | | - $oldProps = $oldData->getProperties(); |
401 | | - |
402 | | - // get properties, replace as requested, retain other properties |
403 | | - foreach ( $oldProps as $property ) { |
404 | | - $propertyID = $property->getKey(); |
405 | | - |
406 | | - if ( array_key_exists( $propertyID, $data ) ) { |
407 | | - // set new data if defined, else ignore property (i.e. delete property from page) |
408 | | - if ( $data[$propertyID] != null ) { |
409 | | - $newData->addPropertyObjectValue( $property, $data[$propertyID] ); |
410 | | - } |
411 | | - |
412 | | - unset( $data[$propertyID] ); |
413 | | - } else { |
414 | | - $values = $oldData->getPropertyValues( $property ); |
415 | | - foreach ( $values as $value ) { |
416 | | - $newData->addPropertyObjectValue( $property, $value ); |
417 | | - } |
418 | | - } |
419 | | - } |
420 | | - |
421 | | - // store properties that were not present before, i.e. properties |
422 | | - // remaining in $data |
423 | | - foreach ( $data as $propertyID => $propertyValue ) { |
424 | | - // set new data if defined, else ignore property (i.e. do not set property on this page) |
425 | | - if ( $data[$propertyID] != null ) { |
426 | | - $property = new SMWDIProperty( $propertyID ); |
427 | | - $newData->addPropertyObjectValue( $property, $data[$propertyID] ); |
428 | | - } |
429 | | - |
430 | | - unset( $data[$propertyID] ); |
431 | | - } |
432 | | - |
433 | | - // finally store the updated page data |
434 | | - smwfGetStore()->doDataUpdate( $newData ); |
435 | | - } |
436 | | - |
437 | | - private function createTableRowForEdit( $source, $term, $definition, $link ) { |
438 | | - return |
439 | | - Html::rawElement( 'tr', array('class' => 'row'), |
440 | | - Html::rawElement( 'td', array('class' => 'actioncell'), |
441 | | - Html::input( "$source:checked", 'true', 'checkbox' ) |
442 | | - ) . |
443 | | - Html::rawElement( 'td', array('class' => 'termcell'), |
444 | | - Html::textarea( "$source:term", $term ) |
445 | | - ) . |
446 | | - Html::rawElement( 'td', array('class' => 'definitioncell'), |
447 | | - Html::rawElement( 'div', array('class' => 'definitionareawrapper'), |
448 | | - Html::textarea( "$source:definition", $definition ) |
449 | | - ) |
450 | | - ) . |
451 | | - Html::rawElement( 'td', array('class' => 'linkcell'), |
452 | | - Html::textarea( "$source:link", $link ) |
453 | | - ) |
454 | | - ); |
455 | | - } |
456 | | - |
457 | | - private function createTableRowForDisplay( $source, $term, $definition, $link ) { |
458 | | - return |
459 | | - Html::rawElement( 'tr', array('class' => 'row'), |
460 | | - Html::rawElement( 'td', array('class' => 'termcell'), $term ) . |
461 | | - Html::rawElement( 'td', array('class' => 'definitioncell'), $definition ) . |
462 | | - Html::rawElement( 'td', array('class' => 'linkcell'), $link ) |
463 | | - ); |
464 | | - } |
465 | | - |
466 | | - /** |
467 | | - * Checks if the user wants to perform an action, has the necessary right |
468 | | - * and submitted a valid edit token. |
469 | | - * |
470 | | - * @return Boolean |
471 | | - */ |
472 | | - private function isActionAllowed() { |
473 | | - global $wgRequest, $wgUser; |
474 | | - |
475 | | - $editTokenWithSalt = $wgRequest->getText( 'editToken' ); |
476 | | - $actionRequested = ( $editTokenWithSalt != null ); |
477 | | - |
478 | | - if ( $actionRequested ) { // user wants to perform an action |
479 | | - if ( $wgUser->isAllowed( 'editglossary' ) ) { // user has the necessary right |
480 | | - $editTokenAndSaltArray = explode( EDIT_TOKEN_SUFFIX, $editTokenWithSalt ); |
481 | | - $tokenValid = $wgUser->matchEditTokenNoSuffix( |
482 | | - $editTokenAndSaltArray[0], |
483 | | - $editTokenAndSaltArray[1] |
484 | | - ); |
485 | | - |
486 | | - if ( $tokenValid ) { // edit token is valid |
487 | | - return true; |
488 | | - } else { |
489 | | - $this->mMessages->addMessage( |
490 | | - wfMsg( 'semanticglossary-brokensession' ), |
491 | | - LingoMessageLog::MESSAGE_ERROR |
492 | | - ); |
493 | | - } |
494 | | - } else { |
495 | | - $this->mMessages->addMessage( |
496 | | - wfMsg( 'semanticglossary-norights' ), |
497 | | - LingoMessageLog::MESSAGE_ERROR |
498 | | - ); |
499 | | - } |
500 | | - } |
501 | | - |
502 | | - // user does not want to perform an action |
503 | | - // OR does not have the rights |
504 | | - // OR did not submit a valid edit token |
505 | | - return false; |
506 | | - } |
507 | | - |
508 | | -} |
Index: trunk/extensions/SemanticGlossary/SemanticGlossary.alias.php |
— | — | @@ -1,56 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Special page aliases for Semantic Glossary |
5 | | - */ |
6 | | - |
7 | | -$specialPageAliases = array(); |
8 | | - |
9 | | -/** English (English) */ |
10 | | -$specialPageAliases['en'] = array( |
11 | | - 'SemanticGlossaryBrowser' => array( 'Glossary' ), |
12 | | -); |
13 | | - |
14 | | -/** Arabic (العربية) */ |
15 | | -$specialPageAliases['ar'] = array( |
16 | | - 'SemanticGlossaryBrowser' => array( 'قاموس' ), |
17 | | -); |
18 | | - |
19 | | -/** German (Deutsch) */ |
20 | | -$specialPageAliases['de'] = array( |
21 | | - 'SemanticGlossaryBrowser' => array( 'Semantisches_Glossar' ), |
22 | | -); |
23 | | - |
24 | | -/** Persian (فارسی) */ |
25 | | -$specialPageAliases['fa'] = array( |
26 | | - 'SemanticGlossaryBrowser' => array( 'واژهنامه' ), |
27 | | -); |
28 | | - |
29 | | -/** Luxembourgish (Lëtzebuergesch) */ |
30 | | -$specialPageAliases['lb'] = array( |
31 | | - 'SemanticGlossaryBrowser' => array( 'Glossaire' ), |
32 | | -); |
33 | | - |
34 | | -/** Macedonian (Македонски) */ |
35 | | -$specialPageAliases['mk'] = array( |
36 | | - 'SemanticGlossaryBrowser' => array( 'Поимник' ), |
37 | | -); |
38 | | - |
39 | | -/** Nedersaksisch (Nedersaksisch) */ |
40 | | -$specialPageAliases['nds-nl'] = array( |
41 | | - 'SemanticGlossaryBrowser' => array( 'Woordelieste' ), |
42 | | -); |
43 | | - |
44 | | -/** Dutch (Nederlands) */ |
45 | | -$specialPageAliases['nl'] = array( |
46 | | - 'SemanticGlossaryBrowser' => array( 'Woordenlijst' ), |
47 | | -); |
48 | | - |
49 | | -/** Polish (Polski) */ |
50 | | -$specialPageAliases['pl'] = array( |
51 | | - 'SemanticGlossaryBrowser' => array( 'Słowniczek' ), |
52 | | -); |
53 | | - |
54 | | -/** |
55 | | - * For backwards compatibility with MediaWiki 1.15 and earlier. |
56 | | - */ |
57 | | -$aliases =& $specialPageAliases; |
\ No newline at end of file |
Index: trunk/extensions/SemanticGlossary/SemanticGlossaryBackend.php |
— | — | @@ -55,16 +55,16 @@ |
56 | 56 | // find next line |
57 | 57 | while ( !$ret && ( $resultline = $this->mQueryResult->getNext() ) ) { |
58 | 58 | |
59 | | - $term = $resultline[0]->getNextText( SMW_OUTPUT_HTML ); |
60 | | - $definition = $resultline[1]->getNextText( SMW_OUTPUT_HTML ); |
61 | | - $link = $resultline[2]->getNextText( SMW_OUTPUT_HTML ); |
| 59 | + $term = $resultline[0]->getNextText( SMW_OUTPUT_WIKI ); |
| 60 | + $definition = $resultline[1]->getNextText( SMW_OUTPUT_WIKI ); |
| 61 | + $link = $resultline[2]->getNextText( SMW_OUTPUT_WIKI ); |
62 | 62 | |
63 | 63 | // FIXME: By not checking for 2nd term defined on the same page some |
64 | 64 | // time could be saved. However, no message could then be generated. |
65 | 65 | // Introduce a setting? |
66 | | - $nextTerm = $resultline[0]->getNextText( SMW_OUTPUT_HTML ); |
67 | | - $nextDefinition = $resultline[1]->getNextText( SMW_OUTPUT_HTML ); |
68 | | - $nextLink = $resultline[2]->getNextText( SMW_OUTPUT_HTML ); |
| 66 | + $nextTerm = $resultline[0]->getNextText( SMW_OUTPUT_WIKI ); |
| 67 | + $nextDefinition = $resultline[1]->getNextText( SMW_OUTPUT_WIKI ); |
| 68 | + $nextLink = $resultline[2]->getNextText( SMW_OUTPUT_WIKI ); |
69 | 69 | |
70 | 70 | |
71 | 71 | // FIXME: SMW has a bug that right after storing data this data |
Index: trunk/extensions/SemanticGlossary/SemanticGlossary.i18n.php |
— | — | @@ -10,25 +10,8 @@ |
11 | 11 | */ |
12 | 12 | $messages['en'] = array( |
13 | 13 | 'semanticglossary-desc' => 'A glossary extension with a [http://semantic-mediawiki.org Semantic MediaWiki] backend', |
14 | | - 'semanticglossary-browsertitle' => 'Glossary', |
15 | | - 'semanticglossary-deleteselected' => 'Delete selected', |
16 | | - 'semanticglossary-savechanges' => 'Save changes', |
17 | | - 'semanticglossary-createnew' => 'Create new term', |
18 | 14 | |
19 | | - 'semanticglossary-termsdefined' => 'These are the terms defined in the wiki:', |
20 | | - 'semanticglossary-notermsdefined' => 'There are currently no terms defined in the wiki.', |
21 | | - 'semanticglossary-enternewterm' => 'You can enter a new term and definition here:', |
22 | | - |
23 | | - 'semanticglossary-messageheader' => 'Messages:', |
24 | | - 'semanticglossary-storedtermdefinedinarticle' => 'The term "$1" was originally defined in page [[$2]]. The definition was changed as required for now. However, as soon as the original page is edited again, the definition there takes precedence.', |
25 | | - 'semanticglossary-deletedtermdefinedinarticle' => 'The term "$1" was originally defined in page [[$2]]. The definition was deleted as required for now. However, as soon as the original page is edited again, the definition there takes precedence.', |
26 | | - 'semanticglossary-termdeleted' => 'Deleted $1.', |
27 | | - 'semanticglossary-termchanged' => 'Changed $1.', |
28 | | - 'semanticglossary-termadded' => 'Added $1.', |
29 | | - 'semanticglossary-storedtermdefinedtwice' => 'The page [[$1]] contains more than one property named $2. Will not store data for term "$3".', |
30 | 15 | 'semanticglossary-termdefinedtwice' => 'The page [[$1]] contains more than one term and/or more than one definition. The entries will not be available for the glossary.', |
31 | | - 'semanticglossary-brokensession' => 'Action not allowed. Broken session data.', |
32 | | - 'semanticglossary-norights' => 'Action not allowed. Insufficient rights.', |
33 | 16 | |
34 | 17 | 'semanticglossary-prop-glt' => 'Glossary-Term', |
35 | 18 | 'semanticglossary-prop-gld' => 'Glossary-Definition', |
— | — | @@ -43,10 +26,7 @@ |
44 | 27 | */ |
45 | 28 | $messages['qqq'] = array( |
46 | 29 | 'semanticglossary-desc' => '{{desc}}', |
47 | | - 'semanticglossary-deleteselected' => 'This is the label of a button.', |
48 | | - 'semanticglossary-savechanges' => 'This is the label of a button.', |
49 | | - 'semanticglossary-createnew' => 'This is the label of a button.', |
50 | | - 'semanticglossary-messageheader' => '{{Identical|Message}}', |
| 30 | + |
51 | 31 | 'semanticglossary-prop-glt' => 'This is the name of a [http://semantic-mediawiki.org/wiki/Property property] in the sense of [http://semantic-mediawiki.org/ Semantic MediaWiki].', |
52 | 32 | 'semanticglossary-prop-gld' => 'This is the name of a [http://semantic-mediawiki.org/wiki/Property property] in the sense of [http://semantic-mediawiki.org/ Semantic MediaWiki].', |
53 | 33 | 'semanticglossary-prop-gll' => 'This is the name of a [http://semantic-mediawiki.org/wiki/Property property] in the sense of [http://semantic-mediawiki.org/ Semantic MediaWiki].', |
Index: trunk/extensions/SemanticGlossary/SemanticGlossary.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * |
7 | 7 | * @defgroup SemanticGlossary Semantic Glossary |
8 | 8 | * @author Stephan Gambke |
9 | | - * @version 0.1 alpha |
| 9 | + * @version 0.1 |
10 | 10 | */ |
11 | 11 | |
12 | 12 | /** |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | /** |
35 | 35 | * The Semantic Glossary version |
36 | 36 | */ |
37 | | -define( 'SG_VERSION', '0.1 alpha' ); |
| 37 | +define( 'SG_VERSION', '0.1' ); |
38 | 38 | |
39 | 39 | // register the extension |
40 | 40 | $wgExtensionCredits[defined( 'SEMANTIC_EXTENSION_TYPE' ) ? 'semantic' : 'other'][] = array( |
— | — | @@ -54,30 +54,14 @@ |
55 | 55 | |
56 | 56 | // register message file |
57 | 57 | $wgExtensionMessagesFiles['SemanticGlossary'] = $dir . '/SemanticGlossary.i18n.php'; |
58 | | -$wgExtensionMessagesFiles['SemanticGlossaryAlias'] = $dir . '/SemanticGlossary.alias.php'; |
59 | 58 | |
60 | 59 | // register class files with the Autoloader |
61 | 60 | $wgAutoloadClasses['SemanticGlossaryBackend'] = $dir . '/SemanticGlossaryBackend.php'; |
62 | | -$wgAutoloadClasses['SpecialSemanticGlossaryBrowser'] = $dir . '/SpecialSemanticGlossaryBrowser.php'; |
63 | 61 | |
64 | | -// register Special pages |
65 | | -$wgSpecialPages['SemanticGlossaryBrowser'] = 'SpecialSemanticGlossaryBrowser'; |
66 | | -$wgSpecialPageGroups['SemanticGlossaryBrowser'] = 'other'; |
67 | | - |
68 | 62 | // register hook handlers |
69 | 63 | $wgHooks['smwInitProperties'][] = 'SemanticGlossaryRegisterProperties'; |
70 | 64 | $wgHooks['smwInitDatatypes'][] = 'SemanticGlossaryRegisterPropertyAliases'; |
71 | 65 | |
72 | | -// register resource modules with the Resource Loader |
73 | | -$wgResourceModules['ext.SemanticGlossary.Browser'] = array( |
74 | | - 'localBasePath' => $dir, |
75 | | - 'styles' => 'skins/SemanticGlossaryBrowser.css', |
76 | | - 'remoteExtPath' => 'SemanticGlossary' |
77 | | -); |
78 | | - |
79 | | -// Create new permission 'editglossary' and assign it to usergroup 'user' by default |
80 | | -$wgGroupPermissions['user']['editglossary'] = true; |
81 | | - |
82 | 66 | define( 'SG_PROP_GLT', 'Glossary-Term' ); |
83 | 67 | define( 'SG_PROP_GLD', 'Glossary-Definition' ); |
84 | 68 | define( 'SG_PROP_GLL', 'Glossary-Link' ); |