Index: trunk/extensions/ImageTagging/ImageTagPage.php |
— | — | @@ -1,5 +1,12 @@ |
2 | 2 | <?php |
3 | | - |
| 3 | +/** |
| 4 | + * ImageTagging extension by Wikia, Inc. |
| 5 | + * Lets a user select regions of an embedded image and associate an article with that region |
| 6 | + * |
| 7 | + * @author Tristan Harris |
| 8 | + * @author Tomasz Klim |
| 9 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 10 | + */ |
4 | 11 | $wgHooks['UnknownAction'][] = 'addTag'; |
5 | 12 | $wgHooks['UnknownAction'][] = 'removeTag'; |
6 | 13 | $wgHooks['UnknownAction'][] = 'tagSearch'; |
— | — | @@ -8,32 +15,28 @@ |
9 | 16 | $wgExtensionCredits['other'][] = array( |
10 | 17 | 'name' => 'Image Tagging', |
11 | 18 | 'author' => 'Wikia, Inc. (Tristan Harris, Tomasz Klim)', |
12 | | - //'version' => 1.0, |
13 | | - 'url' => 'http://www.wikia.com/wiki/Help:Image_tagging', |
14 | | - 'description' => 'Wikia Image Tagging', |
| 19 | + 'version' => 1.0, |
| 20 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:ImageTagging', |
| 21 | + 'description' => 'Lets a user select regions of an embedded image and associate an article with that region', |
15 | 22 | ); |
16 | 23 | |
17 | 24 | // other hooks to try: 'ParserAfterTidy', ... |
18 | 25 | #$wgHooks['OutputPageBeforeHTML'][] = 'wfCheckArticleImageTags'; |
19 | 26 | $wgHooks['ArticleFromTitle'][] = 'wfArticleFromTitle'; |
20 | 27 | |
21 | | - |
22 | 28 | $dir = dirname(__FILE__) . '/'; |
23 | 29 | $wgAutoloadClasses['TaggedImages'] = $dir . 'SpecialTaggedImages.php'; |
| 30 | +$wgExtensionMessagesFiles['ImageTagging'] = $dir . 'ImageTagging.i18n.php'; |
24 | 31 | $wgSpecialPages['TaggedImages'] = 'TaggedImages'; |
25 | 32 | |
26 | | - |
27 | | - |
28 | 33 | /******************** |
29 | 34 | * End Trie Handlers |
30 | 35 | ********************/ |
31 | 36 | |
32 | | -function wfCheckArticleImageTags($outputPage, $text) |
33 | | -{ |
| 37 | +function wfCheckArticleImageTags($outputPage, $text) { |
34 | 38 | global $wgOut, $wgDBname, $wgTitle; |
35 | 39 | |
36 | | - if ( $outputPage->isArticle() ) |
37 | | - { |
| 40 | + if ( $outputPage->isArticle() ) { |
38 | 41 | $db =& wfGetDB(DB_SLAVE); |
39 | 42 | $res = $db->query("SELECT article_tag, tag_rect, unique_id, COUNT(article_tag) AS count FROM ". |
40 | 43 | $db->tableName('imagetags'). |
— | — | @@ -60,19 +63,17 @@ |
61 | 64 | font-size:100%; |
62 | 65 | text-transform:none; |
63 | 66 | white-space:nowrap;" id="coordinates" class="plainlinksneverexpand"> |
64 | | - ' . wfMsg('imagetag_seemoreimages', $titleText, $o->count) . |
| 67 | + ' . wfMsg('imagetagging-imagetag-seemoreimages', $titleText, $o->count) . |
65 | 68 | '</span></a>'); |
66 | 69 | } |
67 | 70 | } |
68 | 71 | return true; |
69 | 72 | } |
70 | 73 | |
71 | | - |
72 | 74 | // TKL 2006-03-07: it doesn't work in new MediaWiki, modification required in includes/Wiki.php (class name change only) |
73 | 75 | // $wgNamespaceTemplates[NS_IMAGE] = 'ImageTagPage'; |
74 | 76 | |
75 | | -function addTag($action, $article) |
76 | | -{ |
| 77 | +function addTag($action, $article) { |
77 | 78 | if($action != 'addTag') return true; |
78 | 79 | |
79 | 80 | global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser; |
— | — | @@ -91,8 +92,7 @@ |
92 | 93 | $imgName = preg_replace( "/[\"'<>]/", "", $imgName ); |
93 | 94 | |
94 | 95 | $img = Image::newFromName($imgName); |
95 | | - if ($img) |
96 | | - { |
| 96 | + if ($img) { |
97 | 97 | $imgTitle = $img->getTitle(); |
98 | 98 | |
99 | 99 | wfPurgeTitle($imgTitle); |
— | — | @@ -113,13 +113,12 @@ |
114 | 114 | |
115 | 115 | $logPage = new LogPage( 'tag' ); |
116 | 116 | $link = basename( $img->title->getLocalURL() ); |
117 | | - $logComment = "Image [[$link|$imgName]] was tagged to article [[$tagName]] by $userText"; |
| 117 | + $logComment = wfMsg('imagetagging-log-tagged', $link, $imgName, $tagName, $userText); |
118 | 118 | $logPage->addEntry( 'tag', $imgTitle, $logComment); |
119 | 119 | |
120 | 120 | $enotif = new EmailNotification; |
121 | 121 | $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false); |
122 | | - } |
123 | | - else { |
| 122 | + } else { |
124 | 123 | $wgOut->clearHTML(); |
125 | 124 | $wgOut->addHTML("<!-- ERROR: img named $imgName --> |
126 | 125 | <script type='text/javascript'> |
— | — | @@ -131,9 +130,7 @@ |
132 | 131 | return false; |
133 | 132 | } |
134 | 133 | |
135 | | - |
136 | | -function removeTag($action, $article) |
137 | | -{ |
| 134 | +function removeTag($action, $article) { |
138 | 135 | if ($action != 'removeTag') return true; |
139 | 136 | |
140 | 137 | global $wgRequest, $wgTitle, $wgOut, $wgDBname, $wgUser; |
— | — | @@ -152,8 +149,7 @@ |
153 | 150 | $imgName = preg_replace( "/[\"'<>]/", "", $imgName ); |
154 | 151 | |
155 | 152 | $img = Image::newFromName($imgName); |
156 | | - if ($img) |
157 | | - { |
| 153 | + if ($img) { |
158 | 154 | $imgTitle = $img->getTitle(); |
159 | 155 | |
160 | 156 | wfPurgeTitle($imgTitle); |
— | — | @@ -166,13 +162,12 @@ |
167 | 163 | $wgOut->addHTML( wfGetImageTags($img, $imgName) ); |
168 | 164 | |
169 | 165 | $logPage = new LogPage( 'tag' ); |
170 | | - $logComment = "Removed tag to article [[$tagName]] by $userText"; |
| 166 | + $logComment = wfMsg('imagetagging-logentry', $tagName, $userText); |
171 | 167 | $logPage->addEntry( 'tag', $imgTitle, $logComment); |
172 | 168 | |
173 | 169 | $enotif = new EmailNotification; |
174 | 170 | $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false); |
175 | | - } |
176 | | - else { |
| 171 | + } else { |
177 | 172 | $wgOut->clearHTML(); |
178 | 173 | $wgOut->addHTML("<!-- ERROR: img named $imgName --> |
179 | 174 | <script type='text/javascript'> |
— | — | @@ -184,8 +179,7 @@ |
185 | 180 | return false; |
186 | 181 | } |
187 | 182 | |
188 | | -function tagSearch($action, $article) |
189 | | -{ |
| 183 | +function tagSearch($action, $article) { |
190 | 184 | if($action != 'tagSearch') return true; |
191 | 185 | |
192 | 186 | global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser; |
— | — | @@ -256,8 +250,8 @@ |
257 | 251 | } |
258 | 252 | $sk =& $wgUser->getSkin(); |
259 | 253 | |
260 | | - $contextlines=5; |
261 | | - $contextchars=50; |
| 254 | + $contextlines = 5; |
| 255 | + $contextchars = 50; |
262 | 256 | |
263 | 257 | $link = $sk->makeKnownLinkObj( $t ); |
264 | 258 | $revision = Revision::newFromTitle( $t ); |
— | — | @@ -301,8 +295,7 @@ |
302 | 296 | return "<result>\n<link>{$link}</link>\n<context>{$extract}</context>\n</result>\n"; |
303 | 297 | } |
304 | 298 | |
305 | | -function wfPurgeTitle($title) |
306 | | -{ |
| 299 | +function wfPurgeTitle($title) { |
307 | 300 | global $wgUseSquid; |
308 | 301 | |
309 | 302 | wfProfileIn( __METHOD__ ); |
— | — | @@ -322,7 +315,6 @@ |
323 | 316 | wfProfileOut( __METHOD__ ); |
324 | 317 | } |
325 | 318 | |
326 | | - |
327 | 319 | function wfGetImageTags($img, $imgName) { |
328 | 320 | global $wgDBname; |
329 | 321 | global $wgUser; |
— | — | @@ -357,16 +349,16 @@ |
358 | 350 | |
359 | 351 | $specialImagesTitle = Title::newFromText("Special:TaggedImages"); |
360 | 352 | |
361 | | - $imagesLink = '<a onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)" onmouseout="hideTagBox()" href="' . $specialImagesTitle->escapeFullURL("q=".$o->article_tag) . '">' . wfMsgHtml('images') . '</a>'; |
| 353 | + $imagesLink = '<a onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)" onmouseout="hideTagBox()" href="' . $specialImagesTitle->escapeFullURL("q=".$o->article_tag) . '">' . wfMsgHtml('imagetagging-images') . '</a>'; |
362 | 354 | |
363 | | - $removeLink = '<a href="#" onclick="removeTag(' . $o->unique_id . ', this, \'' . addslashes( $o->article_tag ) . '\'); return false;">' . wfMsgHtml('removetag') . '</a>'; |
| 355 | + $removeLink = '<a href="#" onclick="removeTag(' . $o->unique_id . ', this, \'' . addslashes( $o->article_tag ) . '\'); return false;">' . wfMsgHtml('imagetagging-removetag') . '</a>'; |
364 | 356 | |
365 | 357 | $html .= $span . $articleLink . ' (' . $imagesLink . ' | ' . $removeLink . ')</span>'; |
366 | 358 | } |
367 | 359 | $db->freeResult($res); |
368 | 360 | |
369 | 361 | if ( $html ) |
370 | | - $html = 'In this image: ' . $html; |
| 362 | + $html = wfMsg('imagetagging-inthisimage', $html); |
371 | 363 | |
372 | 364 | wfProfileOut( __METHOD__ ); |
373 | 365 | return $html; |
— | — | @@ -387,41 +379,24 @@ |
388 | 380 | } |
389 | 381 | |
390 | 382 | function wfImageTagPageSetup() { |
391 | | - global $wgMessageCache,$wgLogTypes; |
392 | | - $wgMessageCache->addMessage('addimagetag',"Tag this Image"); |
393 | | - $wgMessageCache->addMessage('images',"images"); |
394 | | - $wgMessageCache->addMessage('removetag', "remove tag"); |
395 | | - $wgMessageCache->addMessage('done_button', "Done Tagging"); |
396 | | - $wgMessageCache->addMessage('tag_button', "Tag"); |
397 | | - $wgMessageCache->addMessage('tagcancel_button', "Cancel"); |
398 | | - $wgMessageCache->addMessage('tagging_instructions', 'Click on people or things in the image to tag them. '); |
399 | | - $wgMessageCache->addMessage('addingtag', "Adding tag..."); |
400 | | - $wgMessageCache->addMessage('removingtag', "removing tag..."); |
401 | | - $wgMessageCache->addMessage('addtagsuccess', "Added tag."); |
402 | | - $wgMessageCache->addMessage('removetagsuccess', "Removed tag."); |
403 | | - $wgMessageCache->addMessage('oneactionatatimemessage', "Removed tag."); |
404 | | - $wgMessageCache->addMessage('canteditneedloginmessage', "You can't edit this page. It may be because you need to login to tag images. Do you want to login now?"); |
405 | | - $wgMessageCache->addMessage('oneactionatatimemessage', "Sorry, only one tagging action at a time. Please wait for the existing action to complete."); |
406 | | - $wgMessageCache->addMessage('oneuniquetagmessage', "Sorry, this image already has a tag with this name."); |
407 | | - $wgMessageCache->addMessage('imagetag_seemoreimages', 'See more images of “$1” ($2)'); |
408 | | - |
409 | | - $wgLogTypes[] = 'tag'; |
| 383 | + global $wgLogTypes; |
410 | 384 | |
411 | | -class ImageTagPage extends ImagePage |
412 | | -{ |
| 385 | + $wgLogTypes[] = 'tag'; |
| 386 | + wfLoadExtensionMessages('ImageTagging'); |
| 387 | + |
| 388 | +class ImageTagPage extends ImagePage { |
413 | 389 | function openShowImage() { |
414 | | - global $wgOut, $wgUser, $wgServer, $wgImageTaggingPath, $wgStyleVersion, $wgJsMimeType, $wgScriptPath; |
| 390 | + global $wgOut, $wgUser, $wgServer, $wgStyleVersion, $wgJsMimeType, $wgScriptPath; |
415 | 391 | |
416 | 392 | wfProfileIn( __METHOD__ ); |
417 | 393 | |
418 | | - |
419 | | - global $wgJsMimeType, $wgScriptPath ; |
| 394 | + global $wgJsMimeType, $wgScriptPath; |
420 | 395 | $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/img_tagging.js?$wgStyleVersion\"></script>\n" ); |
421 | 396 | $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/json.js?$wgStyleVersion\"></script>\n" ); |
422 | 397 | |
423 | 398 | $imgName = $this->getTitle()->getText(); |
424 | 399 | $wgOut->addHTML("<input type='hidden' value='$imgName' id='imgName' />"); |
425 | | - $wgOut->addHTML("<input type='hidden' value='$wgScriptPath/extensions/magTagging' id='imgPath' />"); |
| 400 | + $wgOut->addHTML("<input type='hidden' value='$wgScriptPath/extensions/ImageTagging' id='imgPath' />"); |
426 | 401 | |
427 | 402 | if ( $wgUser->isLoggedIn() ) |
428 | 403 | $wgOut->addHTML("<input type='hidden' value='1' id='userLoggedIn'/>"); |
— | — | @@ -584,7 +559,7 @@ |
585 | 560 | |
586 | 561 | |
587 | 562 | |
588 | | - /** |
| 563 | +/** |
589 | 564 | * Create the TOC |
590 | 565 | * |
591 | 566 | * @access private |
— | — | @@ -597,17 +572,17 @@ |
598 | 573 | |
599 | 574 | $r = '<ul id="filetoc"> |
600 | 575 | <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li> |
601 | | -<li><a href="#filehistory">' . wfMsgHtml( 'imghistory' ) . '</a></li> |
| 576 | +<li><a href="#filehistory">' . wfMsgHtml( 'imagetagging-imghistory' ) . '</a></li> |
602 | 577 | <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' . |
603 | 578 | ($metadata ? '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . ' |
604 | | -<li><a href="javascript:addImageTags()">' . wfMsgHtml( 'addimagetag' ) . '</a><sup><font color=red>New!</font></sup></li>' |
| 579 | +<li><a href="javascript:addImageTags()">' . wfMsgHtml( 'imagetagging-addimagetag' ) . '</a>'. wfMsg('imagetagging-new') .'</li>' |
605 | 580 | . '</ul>'; |
606 | 581 | |
607 | | - $r .= '<div id="tagStatusDiv" style="margin: 5px 5px 10px 5px; padding: 10px; border: solid 1px #ffe222; background: #fffbe2; display: none;"><table style="background-color: #fffbe2;"><tr><td width="450" height="30" align="center" style="padding-left: 20px;"><img src="/skins/common/progress-wheel.gif" id="progress_wheel" style="display:none;"><div id="tagging_message" style="background: #fffbe2;">' . wfMsgHtml('tagging_instructions') . '</td><td valign="middle"><input type="button" onclick="doneAddingTags();" id="done_tagging" name="done_tagging" value="' . wfMsgHtml('done_button') . '" /></div></td></tr></table></div>'; |
| 582 | + $r .= '<div id="tagStatusDiv" style="margin: 5px 5px 10px 5px; padding: 10px; border: solid 1px #ffe222; background: #fffbe2; display: none;"><table style="background-color: #fffbe2;"><tr><td width="450" height="30" align="center" style="padding-left: 20px;"><img src="/skins/common/progress-wheel.gif" id="progress_wheel" style="display:none;"><div id="tagging_message" style="background: #fffbe2;">' . wfMsgHtml('imagetagging-tagging-instructions') . '</td><td valign="middle"><input type="button" onclick="doneAddingTags();" id="done_tagging" name="done_tagging" value="' . wfMsgHtml('imagetagging-done-button') . '" /></div></td></tr></table></div>'; |
608 | 583 | |
609 | 584 | $r .= "<div style='position: absolute; font: verdana, sans-serif; top: 10px; left: 10px; display: none; width:284px; height:24px; padding: 4px 6px; background-color: #eeeeee; color: #444444; border: 2px solid #555555; z-index:2;' id='tagEditField'> |
610 | 585 | |
611 | | -<span style='position: absolute; left: 4px; top: 6px;'>Article:</span> |
| 586 | +<span style='position: absolute; left: 4px; top: 6px;'>". wfMsg('imagetagging-article') ."</span> |
612 | 587 | |
613 | 588 | <!-- TAH: don't use the popup just yet |
614 | 589 | <select name='tagType'> |
— | — | @@ -616,10 +591,10 @@ |
617 | 592 | </select> |
618 | 593 | -->"; |
619 | 594 | |
620 | | - $r .= "<input style='position: absolute; left: 189px; top: 6px; width: 39px; height: 20px;' type='submit' name='Tag' value='" . wfMsgHtml('tag_button') . "' onclick='submitTag()'/>"; |
621 | | - $r .= "<input style='position: absolute; left: 232px; top: 6px; width: 60px; height: 20px;' type='button' name='Cancel' value='" . wfMsgHtml('tagcancel_button') . "' onclick='hideTagBox()'/>"; |
| 595 | + $r .= "<input style='position: absolute; left: 189px; top: 6px; width: 39px; height: 20px;' type='submit' name='". wfMsgHtml('imagetagging-tag-button') ."' value='" . wfMsgHtml('imagetagging-tag-button') . "' onclick='submitTag()'/>"; |
| 596 | + $r .= "<input style='position: absolute; left: 232px; top: 6px; width: 60px; height: 20px;' type='button' name='" . wfMsgHtml('imagetagging-tagcancel-button') . "' value='" . wfMsgHtml('imagetagging-tagcancel-button') . "' onclick='hideTagBox()'/>"; |
622 | 597 | |
623 | | - $r .= "<input type='text' style='position: absolute; left: 46px; top: 6px; background-color:white; width: 140px; height:18px;' name='articleTag' id='articleTag' value='' title='Article to tag' onkeyup='typeTag(event);' />"; |
| 598 | + $r .= "<input type='text' style='position: absolute; left: 46px; top: 6px; background-color:white; width: 140px; height:18px;' name='articleTag' id='articleTag' value='' title='". wfMsgHtml('imagetagging-articletotag') ."' onkeyup='typeTag(event);' />"; |
624 | 599 | |
625 | 600 | $r .= '</div>'; |
626 | 601 | |
— | — | @@ -630,19 +605,18 @@ |
631 | 606 | // TAH: adding this to grab edit tokens from javascript |
632 | 607 | $token = $wgUser->editToken(); |
633 | 608 | $r .= "<input type=\"hidden\" value=\"$token\" name=\"wpEditToken\" id=\"wpEditToken\" />\n"; |
634 | | - $r .= "<input type=\"hidden\" id=\"addingtagmessage\" value=\"" . wfMsg('addingtag') . "\">\n"; |
635 | | - $r .= "<input type=\"hidden\" id=\"removingtagmessage\" value=\"" . wfMsg('removingtag') . "\">\n"; |
636 | | - $r .= "<input type=\"hidden\" id=\"addtagsuccessmessage\" value=\"" . wfMsg('addtagsuccess') . "\">\n"; |
637 | | - $r .= "<input type=\"hidden\" id=\"removetagsuccessmessage\" value=\"" . wfMsg('removetagsuccess') . "\">\n"; |
| 609 | + $r .= "<input type=\"hidden\" id=\"addingtagmessage\" value=\"" . wfMsg('imagetagging-addingtag') . "\">\n"; |
| 610 | + $r .= "<input type=\"hidden\" id=\"removingtagmessage\" value=\"" . wfMsg('imagetagging-removingtag') . "\">\n"; |
| 611 | + $r .= "<input type=\"hidden\" id=\"addtagsuccessmessage\" value=\"" . wfMsg('imagetagging-addtagsuccess') . "\">\n"; |
| 612 | + $r .= "<input type=\"hidden\" id=\"removetagsuccessmessage\" value=\"" . wfMsg('imagetagging-removetagsuccess') . "\">\n"; |
638 | 613 | |
639 | | - $r .= "<input type=\"hidden\" id=\"oneactionatatimemessage\" value=\"" . wfMsg('oneactionatatimemessage') . "\">\n"; |
640 | | - $r .= "<input type=\"hidden\" id=\"canteditneedloginmessage\" value=\"" . wfMsg('canteditneedloginmessage') . "\">\n"; |
641 | | - $r .= "<input type=\"hidden\" id=\"canteditothermessage\" value=\"" . wfMsg('canteditothermessage') . "\">\n"; |
642 | | - $r .= "<input type=\"hidden\" id=\"oneuniquetagmessage\" value=\"" . wfMsg('oneuniquetagmessage') . "\">\n"; |
| 614 | + $r .= "<input type=\"hidden\" id=\"oneactionatatimemessage\" value=\"" . wfMsg('imagetagging-oneactionatatimemessage') . "\">\n"; |
| 615 | + $r .= "<input type=\"hidden\" id=\"canteditneedloginmessage\" value=\"" . wfMsg('imagetagging-canteditneedloginmessage') . "\">\n"; |
| 616 | + $r .= "<input type=\"hidden\" id=\"canteditothermessage\" value=\"" . wfMsg('imagetagging-canteditothermessage') . "\">\n"; |
| 617 | + $r .= "<input type=\"hidden\" id=\"oneuniquetagmessage\" value=\"" . wfMsg('imagetagging-oneuniquetagmessage') . "\">\n"; |
643 | 618 | |
644 | 619 | return $r; |
645 | 620 | } |
646 | 621 | } |
647 | 622 | |
648 | 623 | } |
649 | | -?> |
Index: trunk/extensions/ImageTagging/ImageTagging.i18n.php |
— | — | @@ -0,0 +1,37 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$messages = array(); |
| 5 | + |
| 6 | +/** English |
| 7 | + * @author Tomasz Klim |
| 8 | + * @author Tristan Harris |
| 9 | + */ |
| 10 | +$messages['en'] = array( |
| 11 | + 'imagetagging-addimagetag' => 'Tag this Image', |
| 12 | + 'imagetagging-article' => 'Article:', |
| 13 | + 'imagetagging-articletotag' => 'Article to tag', |
| 14 | + 'imagetagging-imghistory' => 'History', |
| 15 | + 'imagetagging-images' => 'images', |
| 16 | + 'imagetagging-inthisimage' => 'In this image: $1', |
| 17 | + 'imagetagging-logentry' => 'Removed tag to article [[$1]] by $2', |
| 18 | + 'imagetagging-log-tagged' => 'Image [[$1|$2]] was tagged to article [[$3]] by $4', |
| 19 | + 'imagetagging-new' => '<sup><span style="color:red">New!</span></sup>', |
| 20 | + 'imagetagging-removetag' => 'remove tag', |
| 21 | + 'imagetagging-done-button' => 'Done Tagging', |
| 22 | + 'imagetagging-tag-button' => 'Tag', |
| 23 | + 'imagetagging-tagcancel-button' => 'Cancel', |
| 24 | + 'imagetagging-tagging-instructions' => 'Click on people or things in the image to tag them.', |
| 25 | + 'imagetagging-addingtag' => 'Adding tag...', |
| 26 | + 'imagetagging-removingtag' => 'removing tag...', |
| 27 | + 'imagetagging-addtagsuccess' => 'Added tag.', |
| 28 | + 'imagetagging-removetagsuccess' => 'Removed tag.', |
| 29 | + 'imagetagging-oneactionatatimemessage' => 'Removed tag.', |
| 30 | + 'imagetagging-canteditneedloginmessage' => 'You can\'t edit this page. It may be because you need to login to tag images. Do you want to login now?', |
| 31 | + 'imagetagging-oneactionatatimemessage' => 'Sorry, only one tagging action at a time. Please wait for the existing action to complete.', |
| 32 | + 'imagetagging-oneuniquetagmessage' => 'Sorry, this image already has a tag with this name.', |
| 33 | + 'imagetagging-imagetag-seemoreimages' => 'See more images of “$1” ($2)', |
| 34 | + 'imagetagging-taggedimages-title' => 'Images of \'$1\'', |
| 35 | + 'imagetagging-taggedimages-displaying' => 'Displaying $1 - $2 of $3 images of “$4”', |
| 36 | + 'imagetagging-taggedimages-total' => '“$1” image(s) total', |
| 37 | + 'imagetagging-taggedimages' => 'Tagged Images', |
| 38 | +); |
Property changes on: trunk/extensions/ImageTagging/ImageTagging.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 39 | + native |
Index: trunk/extensions/ImageTagging/SpecialTaggedImages.php |
— | — | @@ -7,38 +7,22 @@ |
8 | 8 | |
9 | 9 | define('TAGGEDIMGS_PER_PAGE', 12); |
10 | 10 | |
| 11 | +$wgSpecialPages['TaggedImages'] = 'TaggedImages'; |
11 | 12 | |
12 | | -$wgExtensionFunctions[] = 'wfSpecialTaggedImages'; |
13 | | - |
14 | | -function wfSpecialTaggedImages() { |
15 | | - global $wgMessageCache; |
16 | | - |
17 | | - $wgMessageCache->addMessage('taggedimages_title', 'Images of \'$1\''); |
18 | | - $wgMessageCache->addMessage('taggedimages_total', '“$1” image(s) total'); |
19 | | - $wgMessageCache->addMessage('taggedimages_displaying', 'Displaying $1 - $2 of $3 images of “$4”'); |
20 | | - $wgMessageCache->addMessage('taggedimages', 'Tagged Images'); |
21 | | - |
22 | | - SpecialPage::addPage( new TaggedImages ); |
23 | | -} |
24 | | - |
25 | 13 | /** |
26 | 14 | * Photos tagged gallery |
27 | 15 | * |
28 | 16 | * Add images to the gallery using add(), then render that list to HTML using toHTML(). |
29 | | - * |
30 | | - * @package MediaWiki |
31 | 17 | */ |
32 | | -class TaggedImages extends SpecialPage |
33 | | -{ |
| 18 | +class TaggedImages extends SpecialPage { |
| 19 | + |
34 | 20 | var $mQuery, $mImages; |
35 | 21 | |
36 | | - /** |
| 22 | + /** |
37 | 23 | * Create a new tagged images object. |
38 | 24 | */ |
39 | | - function TaggedImages() { |
40 | | - global $wgLang, $wgAllowRealName; |
41 | | - global $wgRequest; |
42 | | - global $wgOut; |
| 25 | + function TaggedImages() { |
| 26 | + global $wgLang, $wgAllowRealName, $wgRequest, $wgOut; |
43 | 27 | |
44 | 28 | $wgOut->addScript("<style type=\"text/css\">/*<![CDATA[*/ @import \"$GLOBALS[wgScriptPath]/extensions/ImageTagging/img_tagging.css?$GLOBALS[wgStyleVersion]\"; /*]]>*/</style>\n"); |
45 | 29 | |
— | — | @@ -49,16 +33,15 @@ |
50 | 34 | $this->mStartPage = 0; |
51 | 35 | $this->mImages = array(); |
52 | 36 | |
53 | | - SpecialPage::SpecialPage("TaggedImages"); |
| 37 | + SpecialPage::SpecialPage('TaggedImages'); |
54 | 38 | } |
55 | 39 | |
56 | | - /** |
| 40 | + /** |
57 | 41 | * Start doing stuff |
58 | 42 | * @access public |
59 | 43 | */ |
60 | | - function execute() { |
61 | | - global $wgDBname; |
62 | | - global $wgOut; |
| 44 | + function execute() { |
| 45 | + global $wgDBname, $wgOut; |
63 | 46 | |
64 | 47 | wfProfileIn( __METHOD__ ); |
65 | 48 | |
— | — | @@ -72,12 +55,7 @@ |
73 | 56 | $imagetable = $db->tableName( 'image' ); |
74 | 57 | $imagetagstable = $db->tableName( 'imagetags' ); |
75 | 58 | |
76 | | - $SQL = " |
77 | | -SELECT img_name, img_timestamp |
78 | | -FROM $imagetable |
79 | | -WHERE img_name IN |
80 | | - (SELECT img_name FROM $imagetagstable $WHERECLAUSE) |
81 | | -ORDER BY img_timestamp DESC"; |
| 59 | + $SQL = "SELECT img_name, img_timestamp FROM $imagetable WHERE img_name IN (SELECT img_name FROM $imagetagstable $WHERECLAUSE) ORDER BY img_timestamp DESC"; |
82 | 60 | |
83 | 61 | $SQL = $db->LimitResult($SQL, TAGGEDIMGS_PER_PAGE, $this->mStartPage * TAGGEDIMGS_PER_PAGE); |
84 | 62 | |
— | — | @@ -96,14 +74,14 @@ |
97 | 75 | } |
98 | 76 | $db->freeResult($res); |
99 | 77 | |
100 | | - $wgOut->setPageTitle( wfMsg('taggedimages_title', $this->mQuery ? $this->mQuery : "all" ) ); |
| 78 | + $wgOut->setPageTitle( wfMsg('imagetagging-taggedimages-title', $this->mQuery ? $this->mQuery : "all" ) ); |
101 | 79 | $wgOut->setRobotpolicy('noindex,nofollow'); |
102 | 80 | $wgOut->addHTML($this->toHTML()); |
103 | 81 | |
104 | 82 | wfProfileOut( __METHOD__ ); |
105 | 83 | } |
106 | 84 | |
107 | | - /** |
| 85 | + /** |
108 | 86 | * Add an image to the gallery. |
109 | 87 | * |
110 | 88 | * @param Image $image Image object that is added to the gallery |
— | — | @@ -113,7 +91,7 @@ |
114 | 92 | $this->mImages[] = array( &$image, $html ); |
115 | 93 | } |
116 | 94 | |
117 | | - /** |
| 95 | + /** |
118 | 96 | * Add an image at the beginning of the gallery. |
119 | 97 | * |
120 | 98 | * @param Image $image Image object that is added to the gallery |
— | — | @@ -124,7 +102,7 @@ |
125 | 103 | } |
126 | 104 | |
127 | 105 | |
128 | | - /** |
| 106 | + /** |
129 | 107 | * isEmpty() returns true if the gallery contains no images |
130 | 108 | */ |
131 | 109 | function isEmpty() { |
— | — | @@ -140,7 +118,7 @@ |
141 | 119 | |
142 | 120 | $queryTitle = Title::newFromText($this->mQuery, NS_MAIN); |
143 | 121 | |
144 | | - $html = wfMsg('taggedimages_displaying', $this->mStartPage*TAGGEDIMGS_PER_PAGE + 1, min(($this->mStartPage+1)*TAGGEDIMGS_PER_PAGE,$this->mCount), $this->mCount, '<a href="' . $queryTitle->getLocalURL() . '">' . $this->mQuery . '</a>'); |
| 122 | + $html = wfMsg('imagetagging-taggedimages-displaying', $this->mStartPage*TAGGEDIMGS_PER_PAGE + 1, min(($this->mStartPage+1)*TAGGEDIMGS_PER_PAGE,$this->mCount), $this->mCount, '<a href="' . $queryTitle->getLocalURL() . '">' . $this->mQuery . '</a>'); |
145 | 123 | |
146 | 124 | wfProfileOut( __METHOD__ ); |
147 | 125 | return $html; |
— | — | @@ -193,7 +171,7 @@ |
194 | 172 | return $html; |
195 | 173 | } |
196 | 174 | |
197 | | - /** |
| 175 | + /** |
198 | 176 | * Return a HTML representation of the image gallery |
199 | 177 | * |
200 | 178 | * For each image in the gallery, display |
— | — | @@ -263,6 +241,3 @@ |
264 | 242 | } |
265 | 243 | |
266 | 244 | } //class |
267 | | - |
268 | | - |
269 | | -?> |