r22848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22847‎ | r22848 | r22849 >
Date:19:06, 8 June 2007
Author:ivanlanin
Status:old
Tags:
Comment:
* Add PicturePopup to i18n.db and SpecialTranslate
* Add minipreview-no_category_gallery message for MiniPreview
Modified paths:
  • /trunk/extensions/MiniPreview/MiniPreview.i18n.php (modified) (history)
  • /trunk/extensions/MiniPreview/MiniPreview.php (modified) (history)
  • /trunk/extensions/PicturePopup/PicturePopup.i18n.php (modified) (history)
  • /trunk/extensions/Translate/SpecialTranslate.php (modified) (history)
  • /trunk/extensions/Translate/SpecialTranslate_exts.php (modified) (history)
  • /trunk/extensions/i18n.db (modified) (history)

Diff [purge]

Index: trunk/extensions/MiniPreview/MiniPreview.i18n.php
@@ -13,5 +13,6 @@
1414 * PD-
1515 * Self
1616 ' ;
 17+$messages['minipreview-no_category_gallery'] = "No categories or galleries!";
1718
1819 ?>
\ No newline at end of file
Index: trunk/extensions/MiniPreview/MiniPreview.php
@@ -1,7 +1,7 @@
22 <?php
33
44 /**
5 - * MiniPreview displays, next to an image, small previews
 5+ * MiniPreview displays, next to an image, small previews
66 * of other images in the same categories or displayed on the same pages
77 *
88 * @addtogroup Extensions
@@ -9,7 +9,7 @@
1010 * @copyright � 2007 Magnus Manske
1111 * @licence GNU General Public Licence 2.0 or later
1212 */
13 -
 13+
1414 if( !defined( 'MEDIAWIKI' ) ) {
1515 echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
1616 die( 1 );
@@ -37,9 +37,9 @@
3838 * Register extension setup hook and credits
3939 */
4040 $wgExtensionFunctions[] = 'efMiniPreview';
41 -$wgExtensionCredits['parserhook'][] = array(
42 - 'name' => 'MiniPreview',
43 - 'author' => 'Magnus Manske',
 41+$wgExtensionCredits['parserhook'][] = array(
 42+ 'name' => 'MiniPreview',
 43+ 'author' => 'Magnus Manske',
4444 'url' => 'http://www.mediawiki.org/wiki/Extension:MiniPreview',
4545 'description' => 'MiniPreview displays, next to an image, small previews of other images in the same categories or displayed on the same pages',
4646 );
@@ -59,15 +59,15 @@
6060 global $wgMiniPreviewThumbnailSize, $wgMiniPreviewExtPath, $wgScriptPath;
6161 global $wgMiniPreviewShowCategories, $wgMiniPreviewShowGalleries;
6262 global $wgMiniPreviewMaxCategories, $wgMiniPreviewMaxGalleries, $wgMiniPreviewMaxTotal;
63 -
 63+
6464 if ( !$wgMiniPreviewEnabled ) return ;
65 -
 65+
6666 # Register CSS
67 - $output->addLink(
68 - array(
69 - 'rel' => 'stylesheet',
70 - 'type' => 'text/css',
71 - 'href' => $wgScriptPath . $wgMiniPreviewExtPath . '/MiniPreview.css'
 67+ $output->addLink(
 68+ array(
 69+ 'rel' => 'stylesheet',
 70+ 'type' => 'text/css',
 71+ 'href' => $wgScriptPath . $wgMiniPreviewExtPath . '/MiniPreview.css'
7272 ) ) ;
7373
7474 $previews = array(); # Will contain objects, each having $entry[0] as BEFORE and $entry[1] as AFTER file
@@ -81,8 +81,8 @@
8282 $line = trim ( substr ( $line , 1 ) ) ;
8383 $ignore_categories[] = $line;
8484 }
85 -
8685
 86+
8787 # Run categories
8888 if ( $wgMiniPreviewShowCategories ) {
8989 $categories_timestamps = wfMiniPreviewGetImageCategories( $imagePage );
@@ -100,7 +100,7 @@
101101 $previews[] = wfMiniPreviewGetPreviewForCategory ( $category , $timestamp , $imagePage );
102102 }
103103 }
104 -
 104+
105105 # Run galleries
106106 if ( $wgMiniPreviewShowGalleries ) {
107107 $cnt = 0;
@@ -129,7 +129,7 @@
130130 'style' => "float:right;clear:right" ) ) ;
131131
132132 if ( count ( $previews ) == 0 ) { # No results
133 - $html .= "No categories or galleries!" ;
 133+ $html .= wfMiniPreviewMessage ( 'minipreview-no_category_gallery' ) ;
134134 } else {
135135 $last_type = $previews[0]->from_category;
136136 foreach ( $previews AS $p ) {
@@ -148,7 +148,7 @@
149149 $html .= wfMiniPreviewGetThumbnail ( $p->entry[1] , $image_data ) ;
150150
151151 $html .= wfOpenElement( 'td' );
152 - $html .= wfOpenElement( 'div', array(
 152+ $html .= wfOpenElement( 'div', array(
153153 'style' => "width:{$wgMiniPreviewThumbnailSize}px;height:{$wgMiniPreviewThumbnailSize}px;",
154154 'class' => 'MiniPreview_count' ));
155155 $html .= wfMiniPreviewMessage ( 'minipreview-files_in_'.$mode , array("<b>".$p->image_count."</b>") );
@@ -165,12 +165,12 @@
166166
167167 function wfMiniPreviewGetThumbnail ( $entry , &$image_data ) {
168168 global $wgMiniPreviewThumbnailSize;
169 -
 169+
170170 $divclass = ( $entry->id == 0 ) ? 'MiniPreview_no_thumb' : 'MiniPreview_thumb' ;
171 -
 171+
172172 $ret = '';
173173 $ret .= wfOpenElement( 'td' );
174 - $ret .= wfOpenElement( 'div', array(
 174+ $ret .= wfOpenElement( 'div', array(
175175 'style' => "width:{$wgMiniPreviewThumbnailSize}px;height:{$wgMiniPreviewThumbnailSize}px;overflow:hidden",
176176 'class' => $divclass ));
177177
@@ -198,11 +198,11 @@
199199 $style .= "top:" . floor($o) . "px;";
200200 $style .= "left:" . floor($o) . "px;";
201201 }
202 -
 202+
203203 $thumb_url = $image_data[$entry->title]->createThumb( $tw );
204204 $image_url = $image_data[$entry->title]->getTitle()->getLocalURL();
205205 $image_name = $image_data[$entry->title]->getTitle()->getText();
206 -
 206+
207207 $ret .= wfOpenElement ( 'a' , array ( 'href' => $image_url ));
208208 $ret .= wfElement ( 'img' , array ( 'border' => '0', 'style' => $style, 'src' => $thumb_url , 'alt' => $image_name ));
209209 $ret .= wfCloseElement ( 'a' );
@@ -220,12 +220,12 @@
221221 $res = $dbr->select(
222222 array( 'page', 'categorylinks' ),
223223 array( 'cl_to', 'cl_timestamp' ),
224 - array(
 224+ array(
225225 'cl_from = page_id',
226226 'page_namespace' => '6', # Image page only
227227 'page_title' => $imagePage->mTitle->getDBKey() )
228228 );
229 -
 229+
230230 $ret = array();
231231 while( $x = $dbr->fetchObject ( $res ) ) {
232232 $ret[$x->cl_to] = $x->cl_timestamp;
@@ -241,12 +241,12 @@
242242 $res = $dbr->select(
243243 array( 'page', 'imagelinks' ),
244244 array( 'il_from' , 'page_title' ),
245 - array(
 245+ array(
246246 'page_id = il_from',
247247 'page_namespace' => $wgMiniPreviewGalleryNamespace,
248248 'il_to' => $imagePage->mTitle->getDBKey() )
249249 );
250 -
 250+
251251 $ret = array();
252252 while( $x = $dbr->fetchObject ( $res ) ) {
253253 $ret[$x->il_from] = $x->page_title ;
@@ -265,12 +265,12 @@
266266 $ret->entry = array();
267267
268268 $dbr = wfGetDB( DB_SLAVE );
269 -
 269+
270270 # Get the image BEFORE the current one (according to timestamp)
271271 $res = $dbr->select(
272272 array( 'page', 'categorylinks' ),
273273 array( 'page_title', 'page_id'),
274 - array(
 274+ array(
275275 'cl_to' => $category , # Same category as current one
276276 'cl_timestamp < ' . $dbr->addQuotes( $timestamp ), # Timestamp is before the current one
277277 'page_id = cl_from',
@@ -284,12 +284,12 @@
285285 $ret->entry[0]->id = $x->page_id ;
286286 } else $ret->entry[0]->id = 0 ;
287287 $dbr->freeResult( $res );
288 -
 288+
289289 # Get the image AFTER the current one (according to timestamp)
290290 $res = $dbr->select(
291291 array( 'page', 'categorylinks' ),
292292 array( 'page_id', 'page_title' ),
293 - array(
 293+ array(
294294 'cl_to' => $category , # Same category as current one
295295 'cl_timestamp > ' . $dbr->addQuotes( $timestamp ), # Timestamp is after the current one
296296 'page_id = cl_from',
@@ -303,12 +303,12 @@
304304 $ret->entry[1]->id = $x->page_id ;
305305 } else $ret->entry[1]->id = 0 ;
306306 $dbr->freeResult( $res );
307 -
 307+
308308 # Get total image count for this category
309309 $res = $dbr->select(
310310 array( 'page', 'categorylinks' ),
311311 array( 'count(*) AS cnt' ),
312 - array(
 312+ array(
313313 'cl_to' => $category,
314314 'page_id = cl_from',
315315 'page_namespace=6' # Images only
@@ -328,14 +328,14 @@
329329 $ret->from_gallery = true;
330330 $ret->source_title = $title;
331331 $ret->entry = array();
332 -
 332+
333333 $dbr = wfGetDB( DB_SLAVE );
334334
335335 # Get the image BEFORE the current one (according to title)
336336 $res = $dbr->select(
337337 array( 'page', 'imagelinks' ),
338338 array( 'il_from', 'page_id', 'max(il_to) AS maxto' ),
339 - array(
 339+ array(
340340 'il_from' => $id, # Same page
341341 'il_to < ' . $dbr->addQuotes( $imagePage->getTitle()->getDBKey() ), # Title comes before the current one
342342 'page_title = il_to',
@@ -354,7 +354,7 @@
355355 $res = $dbr->select(
356356 array( 'page', 'imagelinks' ),
357357 array( 'il_from', 'page_id', 'min(il_to) AS minto' ),
358 - array(
 358+ array(
359359 'il_from' => $id, # Same page
360360 'il_to > ' . $dbr->addQuotes( $imagePage->mTitle->getDBKey() ), # Title comes after the current one
361361 'page_title = il_to',
@@ -401,13 +401,13 @@
402402 function wfMiniPreviewLoadMessages() {
403403 global $wgLang;
404404 $messages = array();
405 -
 405+
406406 $f= dirname( __FILE__ ) . '/MiniPreview.i18n.php';
407407 include( $f );
408 -
 408+
409409 $f= dirname( __FILE__ ) . '/MiniPreview.i18n.' . $wgLang->getCode() . '.php';
410410 if ( file_exists( $f ) ) include( $f );
411 -
 411+
412412 return $messages;
413413 }
414414
Index: trunk/extensions/Translate/SpecialTranslate.php
@@ -54,6 +54,7 @@
5555 'ext-minimumnamelength' => 'MinimumNameLengthMessageClass',
5656 'ext-newuserlog' => 'NewuserLogMessageClass',
5757 'ext-patroller' => 'PatrollerMessageClass',
 58+'ext-picturepopup' => 'PicturePopupMessageClass',
5859 'ext-renameuser' => 'RenameUserMessageClass',
5960 'ext-sitematrix' => 'SiteMatrixMessageClass',
6061 'ext-translate' => 'TranslateMessageClass',
Index: trunk/extensions/Translate/SpecialTranslate_exts.php
@@ -568,6 +568,19 @@
569569 protected $exportEnd = '),';
570570 }
571571
 572+class PicturePopupMessageClass extends ExtensionMessageClass {
 573+ protected $label = 'Extension: PicturePopup';
 574+ protected $id = 'ext-picturepopup';
 575+
 576+ protected $functionName = 'efPicturePopupMessages';
 577+ protected $messageFile = 'PicturePopup/PicturePopup.i18n.php';
 578+
 579+ protected $exportStart = '\'$CODE\' => array(';
 580+ protected $exportPrefix= '';
 581+ protected $exportLineP = '';
 582+ protected $exportEnd = '),';
 583+}
 584+
572585 class RenameUserMessageClass extends ExtensionMessageClass {
573586 protected $label = 'Extension: Rename User';
574587 protected $id = 'ext-renameuser';
Index: trunk/extensions/PicturePopup/PicturePopup.i18n.php
@@ -20,6 +20,17 @@
2121 'picturepopup_invalid_icon' => 'License template has missing or invalid imageLicenseIcon element',
2222 ),
2323
 24+/* Indonesian */
 25+'id' => array(
 26+ 'picturepopup_invalid_title' => 'Judul gambar tak sah',
 27+ 'picturepopup_no_license' => 'Gambar tak memiliki tag lisensi',
 28+ 'picturepopup_no_image' => 'Gambar tak ditemukan',
 29+ 'picturepopup_no_license_list' => 'Daftar lisensi tak valid atau tak ditemukan',
 30+ 'picturepopup_license_list' => 'Project:Tag hak cipta gambar',
 31+ 'picturepopup_no_license_text' => 'Templat lisensi tak memiliki elemen dengan id=imageLicenseText',
 32+ 'picturepopup_invalid_icon' => 'Templat lisensi tak memiliki atau memiliki elemen imageLicenseIcon tak sah',
 33+),
 34+
2435 /* Kazakh Cyrillic */
2536 'kk-kz' => array(
2637 'picturepopup_invalid_title' => 'Сурет атауы жарамсыз ',
Index: trunk/extensions/i18n.db
@@ -82,6 +82,7 @@
8383 ./Newuserlog/Newuserlog.i18n.php wgNewuserlogMessages
8484 ./Oversight/HideRevision.i18n.php efHideRevisionMessages
8585 ./Patroller/Patroller.i18n.php efPatrollerMessages
 86+./PicturePopup/PicturePopup.i18n.php efPicturePopupMessages
8687 ./ProfileMonitor/ProfileMonitor.i18n.php efProfileMonitorMessages
8788 ./Quiz/Quiz.i18n.php wgQuizMessages
8889 ./Renameuser/SpecialRenameuser.i18n.php wgRenameuserMessages

Status & tagging log