r34853 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34852‎ | r34853 | r34854 >
Date:12:45, 15 May 2008
Author:siebrand
Status:old
Tags:
Comment:
* update messages, add proper i18n file header, replace curly quotes in English
* fix identation and alignment (especially ImageTagPage.php looks very peculiar...)
Modified paths:
  • /trunk/extensions/ImageTagging/ImageTagPage.php (modified) (history)
  • /trunk/extensions/ImageTagging/ImageTagging.i18n.php (modified) (history)
  • /trunk/extensions/ImageTagging/SpecialTaggedImages.php (modified) (history)
  • /trunk/extensions/ImageTagging/img_success.css (modified) (history)
  • /trunk/extensions/ImageTagging/img_tagging.css (modified) (history)

Diff [purge]

Index: trunk/extensions/ImageTagging/ImageTagPage.php
@@ -1,23 +1,25 @@
22 <?php
33 /**
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+ * 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+ */
 11+
1112 $wgHooks['UnknownAction'][] = 'addTag';
1213 $wgHooks['UnknownAction'][] = 'removeTag';
1314 $wgHooks['UnknownAction'][] = 'tagSearch';
1415
1516 $wgExtensionFunctions[] = 'wfImageTagPageSetup';
1617 $wgExtensionCredits['other'][] = array(
17 - 'name' => 'Image Tagging',
18 - 'author' => 'Wikia, Inc. (Tristan Harris, Tomasz Klim)',
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',
 18+ 'name' => 'Image Tagging',
 19+ 'author' => 'Wikia, Inc. (Tristan Harris, Tomasz Klim)',
 20+ 'version' => 1.0,
 21+ 'url' => 'http://www.mediawiki.org/wiki/Extension:ImageTagging',
 22+ 'description' => 'Lets a user select regions of an embedded image and associate an article with that region',
 23+ 'descriptionmsg' => 'imagetagging-desc',
2224 );
2325
2426 // other hooks to try: 'ParserAfterTidy', ...
@@ -34,204 +36,203 @@
3537 ********************/
3638
3739 function wfCheckArticleImageTags($outputPage, $text) {
38 - global $wgOut, $wgDBname, $wgTitle;
 40+ global $wgOut, $wgDBname, $wgTitle;
3941
40 - if ( $outputPage->isArticle() ) {
41 - $db =& wfGetDB(DB_SLAVE);
42 - $res = $db->query("SELECT article_tag, tag_rect, unique_id, COUNT(article_tag) AS count FROM ".
43 - $db->tableName('imagetags').
44 - " WHERE article_tag='" . addslashes($wgTitle->getText()). "' GROUP BY article_tag" );
 42+ if ( $outputPage->isArticle() ) {
 43+ $db =& wfGetDB(DB_SLAVE);
 44+ $res = $db->query("SELECT article_tag, tag_rect, unique_id, COUNT(article_tag) AS count FROM ".
 45+ $db->tableName('imagetags').
 46+ " WHERE article_tag='" . addslashes($wgTitle->getText()). "' GROUP BY article_tag" );
4547
46 - if ($o = $db->fetchObject($res)) {
47 - $taggedImagesObj = Title::newFromText('TaggedImages', NS_SPECIAL);
48 - $titleText = $wgTitle->getText();
 48+ if ($o = $db->fetchObject($res)) {
 49+ $taggedImagesObj = Title::newFromText('TaggedImages', NS_SPECIAL);
 50+ $titleText = $wgTitle->getText();
4951
50 - $wgOut->addHTML('
51 - <a href="' . $taggedImagesObj->getLocalUrl('q='.$titleText) . '">
52 - <span style="position:absolute;
53 - z-index:1;
54 - border:none;
55 - background:none;
56 - right:30px;
57 - top:3.7em;
58 - float:right;
59 - margin:0.0em;
60 - padding:0.0em;
61 - line-height:1.7em; /*1.5em*/
62 - text-align:right;
63 - text-indent:0;
64 - font-size:100%;
65 - text-transform:none;
66 - white-space:nowrap;" id="coordinates" class="plainlinksneverexpand">
67 - ' . wfMsg('imagetagging-imagetag-seemoreimages', $titleText, $o->count) .
68 - '</span></a>');
69 - }
70 - }
71 - return true;
 52+ $wgOut->addHTML('
 53+ <a href="' . $taggedImagesObj->getLocalUrl('q='.$titleText) . '">
 54+ <span style="position:absolute;
 55+ z-index:1;
 56+ border:none;
 57+ background:none;
 58+ right:30px;
 59+ top:3.7em;
 60+ float:right;
 61+ margin:0.0em;
 62+ padding:0.0em;
 63+ line-height:1.7em; /*1.5em*/
 64+ text-align:right;
 65+ text-indent:0;
 66+ font-size:100%;
 67+ text-transform:none;
 68+ white-space:nowrap;" id="coordinates" class="plainlinksneverexpand">
 69+ ' . wfMsg('imagetagging-imagetag-seemoreimages', $titleText, $o->count) .
 70+ '</span></a>');
 71+ }
 72+ }
 73+ return true;
7274 }
7375
7476 // TKL 2006-03-07: it doesn't work in new MediaWiki, modification required in includes/Wiki.php (class name change only)
75 -// $wgNamespaceTemplates[NS_IMAGE] = 'ImageTagPage';
 77+// $wgNamespaceTemplates[NS_IMAGE] = 'ImageTagPage';
7678
7779 function addTag($action, $article) {
78 - if($action != 'addTag') return true;
 80+ if($action != 'addTag') return true;
7981
80 - global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser;
 82+ global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser;
8183
82 - wfProfileIn( __METHOD__ );
 84+ wfProfileIn( __METHOD__ );
8385
84 - $wgOut->setArticleBodyOnly(true);
 86+ $wgOut->setArticleBodyOnly(true);
8587
86 - $tagRect = $wgRequest->getText('rect');
87 - $tagName = $wgRequest->getText('tagName');
88 - $imgName = $wgRequest->getText('imgName');
89 - $userText = $wgUser->getName();
 88+ $tagRect = $wgRequest->getText('rect');
 89+ $tagName = $wgRequest->getText('tagName');
 90+ $imgName = $wgRequest->getText('imgName');
 91+ $userText = $wgUser->getName();
9092
91 - $tagRect = preg_replace( "/[\"'<>]/", "", $tagRect );
92 - $tagName = preg_replace( "/[\"'<>]/", "", $tagName );
93 - $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
 93+ $tagRect = preg_replace( "/[\"'<>]/", "", $tagRect );
 94+ $tagName = preg_replace( "/[\"'<>]/", "", $tagName );
 95+ $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
9496
95 - $img = Image::newFromName($imgName);
96 - if ($img) {
97 - $imgTitle = $img->getTitle();
 97+ $img = Image::newFromName($imgName);
 98+ if ($img) {
 99+ $imgTitle = $img->getTitle();
98100
99 - wfPurgeTitle($imgTitle);
 101+ wfPurgeTitle($imgTitle);
100102
101 - $db =& wfGetDB(DB_MASTER);
102 - $db->insert('imagetags',
103 - array(
104 - 'img_page_id' => 0,
105 - 'img_name' => $imgName,
106 - 'article_tag' => $tagName,
107 - 'tag_rect' => $tagRect,
108 - 'user_text' => $userText)
109 - );
 103+ $db =& wfGetDB(DB_MASTER);
 104+ $db->insert('imagetags',
 105+ array(
 106+ 'img_page_id' => 0,
 107+ 'img_name' => $imgName,
 108+ 'article_tag' => $tagName,
 109+ 'tag_rect' => $tagRect,
 110+ 'user_text' => $userText)
 111+ );
110112
111 - $wgOut->clearHTML();
112 - $wgOut->addHTML("<!-- added tag for image $imgName to database! -->");
113 - $wgOut->addHTML( wfGetImageTags($img, $imgName) );
 113+ $wgOut->clearHTML();
 114+ $wgOut->addHTML("<!-- added tag for image $imgName to database! -->");
 115+ $wgOut->addHTML( wfGetImageTags($img, $imgName) );
114116
115 - $logPage = new LogPage( 'tag' );
116 - $link = basename( $img->title->getLocalURL() );
117 - $logComment = wfMsg('imagetagging-log-tagged', $link, $imgName, $tagName, $userText);
118 - $logPage->addEntry( 'tag', $imgTitle, $logComment);
 117+ $logPage = new LogPage( 'tag' );
 118+ $link = basename( $img->title->getLocalURL() );
 119+ $logComment = wfMsg('imagetagging-log-tagged', $link, $imgName, $tagName, $userText);
 120+ $logPage->addEntry( 'tag', $imgTitle, $logComment);
119121
120 - $enotif = new EmailNotification;
121 - $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false);
122 - } else {
123 - $wgOut->clearHTML();
124 - $wgOut->addHTML("<!-- ERROR: img named $imgName -->
125 - <script type='text/javascript'>
126 - alert(\"Error adding tag!\");
127 - </script>");
128 - }
129 -
130 - wfProfileOut( __METHOD__ );
131 - return false;
 122+ $enotif = new EmailNotification;
 123+ $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false);
 124+ } else {
 125+ $wgOut->clearHTML();
 126+ $wgOut->addHTML("<!-- ERROR: img named $imgName -->
 127+ <script type='text/javascript'>
 128+ alert(\"Error adding tag!\");
 129+ </script>");
 130+ }
 131+ wfProfileOut( __METHOD__ );
 132+ return false;
132133 }
133134
134135 function removeTag($action, $article) {
135 - if ($action != 'removeTag') return true;
 136+ if ($action != 'removeTag') return true;
136137
137 - global $wgRequest, $wgTitle, $wgOut, $wgDBname, $wgUser;
 138+ global $wgRequest, $wgTitle, $wgOut, $wgDBname, $wgUser;
138139
139 - wfProfileIn( __METHOD__ );
 140+ wfProfileIn( __METHOD__ );
140141
141 - $wgOut->setArticleBodyOnly(true);
 142+ $wgOut->setArticleBodyOnly(true);
142143
143 - $tagID = $wgRequest->getVal('tagID');
144 - $tagName = $wgRequest->getText('tagName');
145 - $imgName = $wgRequest->getText('imgName');
146 - $userText = $wgUser->getName();
 144+ $tagID = $wgRequest->getVal('tagID');
 145+ $tagName = $wgRequest->getText('tagName');
 146+ $imgName = $wgRequest->getText('imgName');
 147+ $userText = $wgUser->getName();
147148
148 - $tagID = preg_replace( "/[\"'<>]/", "", $tagID );
149 - $tagName = preg_replace( "/[\"'<>]/", "", $tagName );
150 - $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
 149+ $tagID = preg_replace( "/[\"'<>]/", "", $tagID );
 150+ $tagName = preg_replace( "/[\"'<>]/", "", $tagName );
 151+ $imgName = preg_replace( "/[\"'<>]/", "", $imgName );
151152
152 - $img = Image::newFromName($imgName);
153 - if ($img) {
154 - $imgTitle = $img->getTitle();
 153+ $img = Image::newFromName($imgName);
 154+ if ($img) {
 155+ $imgTitle = $img->getTitle();
155156
156 - wfPurgeTitle($imgTitle);
 157+ wfPurgeTitle($imgTitle);
157158
158 - $db =& wfGetDB(DB_MASTER);
159 - $db->delete('imagetags', array('unique_id' => $tagID));
 159+ $db =& wfGetDB(DB_MASTER);
 160+ $db->delete('imagetags', array('unique_id' => $tagID));
160161
161 - $wgOut->clearHTML();
162 - $wgOut->addHTML("<!-- removed tag to database! -->");
163 - $wgOut->addHTML( wfGetImageTags($img, $imgName) );
 162+ $wgOut->clearHTML();
 163+ $wgOut->addHTML("<!-- removed tag to database! -->");
 164+ $wgOut->addHTML( wfGetImageTags($img, $imgName) );
164165
165 - $logPage = new LogPage( 'tag' );
166 - $logComment = wfMsg('imagetagging-logentry', $tagName, $userText);
167 - $logPage->addEntry( 'tag', $imgTitle, $logComment);
 166+ $logPage = new LogPage( 'tag' );
 167+ $logComment = wfMsg('imagetagging-logentry', $tagName, $userText);
 168+ $logPage->addEntry( 'tag', $imgTitle, $logComment);
168169
169 - $enotif = new EmailNotification;
170 - $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false);
171 - } else {
172 - $wgOut->clearHTML();
173 - $wgOut->addHTML("<!-- ERROR: img named $imgName -->
174 - <script type='text/javascript'>
175 - alert(\"Error removing tag!\");
176 - </script>");
177 - }
 170+ $enotif = new EmailNotification;
 171+ $enotif->notifyOnPageChange($wgUser, $imgTitle, wfTimestampNow(), $logComment, false);
 172+ } else {
 173+ $wgOut->clearHTML();
 174+ $wgOut->addHTML("<!-- ERROR: img named $imgName -->
 175+ <script type='text/javascript'>
 176+ alert(\"Error removing tag!\");
 177+ </script>");
 178+ }
178179
179 - wfProfileOut( __METHOD__ );
180 - return false;
 180+ wfProfileOut( __METHOD__ );
 181+ return false;
181182 }
182183
183184 function tagSearch($action, $article) {
184 - if($action != 'tagSearch') return true;
 185+ if($action != 'tagSearch') return true;
185186
186 - global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser;
 187+ global $wgRequest, $wgTitle, $wgDBname, $wgOut, $wgUser;
187188
188 - wfProfileIn( __METHOD__ );
 189+ wfProfileIn( __METHOD__ );
189190
190 - $wgOut->setArticleBodyOnly(true);
 191+ $wgOut->setArticleBodyOnly(true);
191192
192 - $query = $wgRequest->getText('q');
193 - $query = preg_replace( "/[\"'<>]/", "", $query );
 193+ $query = $wgRequest->getText('q');
 194+ $query = preg_replace( "/[\"'<>]/", "", $query );
194195
195 - $search = SearchEngine::create();
196 - $search->setLimitOffset( 10, 0 );
197 - $search->setNamespaces( array(NS_MAIN) );
198 - $search->showRedirects = true;
199 - $titleMatches = $search->searchTitle( $query );
 196+ $search = SearchEngine::create();
 197+ $search->setLimitOffset( 10, 0 );
 198+ $search->setNamespaces( array(NS_MAIN) );
 199+ $search->showRedirects = true;
 200+ $titleMatches = $search->searchTitle( $query );
200201
201 - $numResults = ( $titleMatches ? $titleMatches->numRows() : 0 );
202 - if ( $numResults > 0 )
203 - $wgOut->addHTML(wfTagSearchShowMatches($titleMatches));
 202+ $numResults = ( $titleMatches ? $titleMatches->numRows() : 0 );
 203+ if ( $numResults > 0 )
 204+ $wgOut->addHTML(wfTagSearchShowMatches($titleMatches));
204205
205 - #echo "numResults: " . $numResults . ", query: " . $query;
 206+ #echo "numResults: " . $numResults . ", query: " . $query;
206207
207 - wfProfileOut( __METHOD__ );
208 - return false;
 208+ wfProfileOut( __METHOD__ );
 209+ return false;
209210 }
210211
211212 /**
212213 * @param SearchResultSet $matches
213214 * @param string $terms partial regexp for highlighting terms
214 - */
215 - function wfTagSearchShowMatches( &$matches ) {
216 - global $wgContLang;
 215+ */
 216+function wfTagSearchShowMatches( &$matches ) {
 217+ global $wgContLang;
217218
218 - wfProfileIn( __METHOD__ );
 219+ wfProfileIn( __METHOD__ );
219220
220 - $tm = $wgContLang->convertForSearchResult( $matches->termMatches() );
221 - $terms = implode( '|', $tm );
 221+ $tm = $wgContLang->convertForSearchResult( $matches->termMatches() );
 222+ $terms = implode( '|', $tm );
222223
223 - $out = "<searchresults>\n";
 224+ $out = "<searchresults>\n";
224225
225 - while( $result = $matches->next() ) {
226 - $out .= wfTagSearchHitXML( $result, $terms );
227 - }
228 - $out .= "</searchresults>\n";
 226+ while( $result = $matches->next() ) {
 227+ $out .= wfTagSearchHitXML( $result, $terms );
 228+ }
 229+ $out .= "</searchresults>\n";
229230
230 - // convert the whole thing to desired language variant
231 - $out = $wgContLang->convert( $out );
 231+ // convert the whole thing to desired language variant
 232+ $out = $wgContLang->convert( $out );
232233
233 - wfProfileOut( __METHOD__ );
234 - return $out;
235 - }
 234+ wfProfileOut( __METHOD__ );
 235+ return $out;
 236+}
236237
237238 /**
238239 * Format a single hit result
@@ -239,143 +240,142 @@
240241 * @param string $terms partial regexp for highlighting terms
241242 */
242243 function wfTagSearchHitXML( $result, $terms ) {
243 - global $wgUser, $wgContLang;
 244+ global $wgUser, $wgContLang;
244245
245 - wfProfileIn( __METHOD__ );
 246+ wfProfileIn( __METHOD__ );
246247
247 - $t = $result->getTitle();
248 - if( is_null( $t ) ) {
249 - wfProfileOut( __METHOD__ );
250 - return "<!-- Broken link in search result -->\n";
251 - }
252 - $sk =& $wgUser->getSkin();
 248+ $t = $result->getTitle();
 249+ if( is_null( $t ) ) {
 250+ wfProfileOut( __METHOD__ );
 251+ return "<!-- Broken link in search result -->\n";
 252+ }
 253+ $sk =& $wgUser->getSkin();
253254
254 - $contextlines = 5;
255 - $contextchars = 50;
 255+ $contextlines = 5;
 256+ $contextchars = 50;
256257
257 - $link = $sk->makeKnownLinkObj( $t );
258 - $revision = Revision::newFromTitle( $t );
259 - $text = $revision->getText();
 258+ $link = $sk->makeKnownLinkObj( $t );
 259+ $revision = Revision::newFromTitle( $t );
 260+ $text = $revision->getText();
260261
261 - $lines = explode( "\n", $text );
 262+ $lines = explode( "\n", $text );
262263
263 - $max = intval( $contextchars ) + 1;
264 - $pat1 = "/(.*)($terms)(.{0,$max})/i";
 264+ $max = intval( $contextchars ) + 1;
 265+ $pat1 = "/(.*)($terms)(.{0,$max})/i";
265266
266 - $lineno = 0;
 267+ $lineno = 0;
267268
268 - $extract = '';
269 - foreach ( $lines as $line ) {
270 - if ( 0 == $contextlines ) {
271 - break;
272 - }
273 - ++$lineno;
274 - if ( ! preg_match( $pat1, $line, $m ) ) {
275 - continue;
276 - }
277 - $contextlines--;
278 - $pre = $wgContLang->truncate( $m[1], -$contextchars, '...' );
 269+ $extract = '';
 270+ foreach ( $lines as $line ) {
 271+ if ( 0 == $contextlines ) {
 272+ break;
 273+ }
 274+ ++$lineno;
 275+ if ( ! preg_match( $pat1, $line, $m ) ) {
 276+ continue;
 277+ }
 278+ $contextlines--;
 279+ $pre = $wgContLang->truncate( $m[1], -$contextchars, '...' );
279280
280 - if ( count( $m ) < 3 ) {
281 - $post = '';
282 - } else {
283 - $post = $wgContLang->truncate( $m[3], $contextchars, '...' );
284 - }
 281+ if ( count( $m ) < 3 ) {
 282+ $post = '';
 283+ } else {
 284+ $post = $wgContLang->truncate( $m[3], $contextchars, '...' );
 285+ }
285286
286 - $found = $m[2];
 287+ $found = $m[2];
287288
288 - $line = htmlspecialchars( $pre . $found . $post );
289 - $pat2 = '/(' . $terms . ")/i";
290 - $line = preg_replace( $pat2, "<span class='searchmatch'>\\1</span>", $line );
 289+ $line = htmlspecialchars( $pre . $found . $post );
 290+ $pat2 = '/(' . $terms . ")/i";
 291+ $line = preg_replace( $pat2, "<span class='searchmatch'>\\1</span>", $line );
291292
292 - $extract .= "<br /><small>{$lineno}: {$line}</small>\n";
293 - }
 293+ $extract .= "<br /><small>{$lineno}: {$line}</small>\n";
 294+ }
294295
295 - wfProfileOut( __METHOD__ );
296 - return "<result>\n<link>{$link}</link>\n<context>{$extract}</context>\n</result>\n";
 296+ wfProfileOut( __METHOD__ );
 297+ return "<result>\n<link>{$link}</link>\n<context>{$extract}</context>\n</result>\n";
297298 }
298299
299300 function wfPurgeTitle($title) {
300 - global $wgUseSquid;
 301+ global $wgUseSquid;
301302
302 - wfProfileIn( __METHOD__ );
 303+ wfProfileIn( __METHOD__ );
303304
304 - $title->invalidateCache();
 305+ $title->invalidateCache();
305306
306 - if ( $wgUseSquid ) {
307 - // Commit the transaction before the purge is sent
308 - $dbw =& wfGetDB( DB_MASTER );
309 - $dbw->immediateCommit();
 307+ if ( $wgUseSquid ) {
 308+ // Commit the transaction before the purge is sent
 309+ $dbw =& wfGetDB( DB_MASTER );
 310+ $dbw->immediateCommit();
310311
311 - // Send purge
312 - $update = SquidUpdate::newSimplePurge( $title );
313 - $update->doUpdate();
314 - }
 312+ // Send purge
 313+ $update = SquidUpdate::newSimplePurge( $title );
 314+ $update->doUpdate();
 315+ }
315316
316 - wfProfileOut( __METHOD__ );
 317+ wfProfileOut( __METHOD__ );
317318 }
318319
319320 function wfGetImageTags($img, $imgName) {
320 - global $wgDBname;
321 - global $wgUser;
322 - global $wgOut;
 321+ global $wgDBname;
 322+ global $wgUser;
 323+ global $wgOut;
323324
324 - wfProfileIn( __METHOD__ );
 325+ wfProfileIn( __METHOD__ );
325326
326 - $sk = $wgUser->getSkin();
327 - $db =& wfGetDB(DB_SLAVE);
328 - $db->selectDB($wgDBname);
329 - $res = $db->select(
330 - array("imagetags"),
331 - array("article_tag", "tag_rect", "unique_id"),
332 - array("img_name" => $imgName),
 327+ $sk = $wgUser->getSkin();
 328+ $db =& wfGetDB(DB_SLAVE);
 329+ $db->selectDB($wgDBname);
 330+ $res = $db->select(
 331+ array("imagetags"),
 332+ array("article_tag", "tag_rect", "unique_id"),
 333+ array("img_name" => $imgName),
333334 __METHOD__ );
334335
335 - $html = '';
336 - $wgOut->addHTML("<!-- this many image tags: " . count($res) . " from img " . $img->name . " -->");
337 - while ($o = $db->fetchObject($res)) {
338 - if ( strlen($html) > 0 )
339 - $html .= ', ';
 336+ $html = '';
 337+ $wgOut->addHTML("<!-- this many image tags: " . count($res) . " from img " . $img->name . " -->");
 338+ while ($o = $db->fetchObject($res)) {
 339+ if ( strlen($html) > 0 )
 340+ $html .= ', ';
340341
341 - $wgOut->addHTML("<!-- tag rect: " . $o->tag_rect . ", tag title: " . $o->article_tag . ", unique_id: " . $o->unique_id . "-->");
 342+ $wgOut->addHTML("<!-- tag rect: " . $o->tag_rect . ", tag title: " . $o->article_tag . ", unique_id: " . $o->unique_id . "-->");
342343
343 - $span = '<span id="' . $o->article_tag . '-tag" onmouseout="hideTagBox()" onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)">';
 344+ $span = '<span id="' . $o->article_tag . '-tag" onmouseout="hideTagBox()" onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)">';
344345
345 - #echo "article tag: " . $o->article_tag . "\n";
346 - $articleTitle = Title::newFromText($o->article_tag);
 346+ #echo "article tag: " . $o->article_tag . "\n";
 347+ $articleTitle = Title::newFromText($o->article_tag);
347348
348 - #$articleLink = '<a href="' . $articleTitle->escapeFullURL() . '" onmouseout="hideTagBox()">' . $o->article_tag . '</a>';
349 - $articleLink = $sk->makeLinkObj($articleTitle);
 349+ #$articleLink = '<a href="' . $articleTitle->escapeFullURL() . '" onmouseout="hideTagBox()">' . $o->article_tag . '</a>';
 350+ $articleLink = $sk->makeLinkObj($articleTitle);
350351
351 - $specialImagesTitle = Title::newFromText("Special:TaggedImages");
 352+ $specialImagesTitle = Title::newFromText("Special:TaggedImages");
352353
353 - $imagesLink = '<a onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)" onmouseout="hideTagBox()" href="' . $specialImagesTitle->escapeFullURL("q=".$o->article_tag) . '">' . wfMsgHtml('imagetagging-images') . '</a>';
 354+ $imagesLink = '<a onmouseover="tagBoxPercent(' . $o->tag_rect . ', false)" onmouseout="hideTagBox()" href="' . $specialImagesTitle->escapeFullURL("q=".$o->article_tag) . '">' . wfMsgHtml('imagetagging-images') . '</a>';
354355
355 - $removeLink = '<a href="#" onclick="removeTag(' . $o->unique_id . ', this, \'' . addslashes( $o->article_tag ) . '\'); return false;">' . wfMsgHtml('imagetagging-removetag') . '</a>';
 356+ $removeLink = '<a href="#" onclick="removeTag(' . $o->unique_id . ', this, \'' . addslashes( $o->article_tag ) . '\'); return false;">' . wfMsgHtml('imagetagging-removetag') . '</a>';
356357
357 - $html .= $span . $articleLink . ' (' . $imagesLink . ' | ' . $removeLink . ')</span>';
358 - }
359 - $db->freeResult($res);
 358+ $html .= $span . $articleLink . ' (' . $imagesLink . ' | ' . $removeLink . ')</span>';
 359+ }
 360+ $db->freeResult($res);
360361
361 - if ( $html )
362 - $html = wfMsg('imagetagging-inthisimage', $html);
 362+ if ( $html )
 363+ $html = wfMsg('imagetagging-inthisimage', $html);
363364
364 - wfProfileOut( __METHOD__ );
365 - return $html;
 365+ wfProfileOut( __METHOD__ );
 366+ return $html;
366367 }
367368
368 -
369369 function wfArticleFromTitle( &$title, &$article ) {
370 - global $wgUser;
 370+ global $wgUser;
371371
372 - wfProfileIn( __METHOD__ );
 372+ wfProfileIn( __METHOD__ );
373373
374 - if ( NS_IMAGE == $title->getNamespace() && !$wgUser->isBlocked() ) {
375 - $article = new ImageTagPage( $title );
376 - }
 374+ if ( NS_IMAGE == $title->getNamespace() && !$wgUser->isBlocked() ) {
 375+ $article = new ImageTagPage( $title );
 376+ }
377377
378 - wfProfileOut( __METHOD__ );
379 - return true;
 378+ wfProfileOut( __METHOD__ );
 379+ return true;
380380 }
381381
382382 function wfImageTagPageSetup() {
@@ -384,146 +384,146 @@
385385 $wgLogTypes[] = 'tag';
386386 wfLoadExtensionMessages('ImageTagging');
387387
388 -class ImageTagPage extends ImagePage {
389 - function openShowImage() {
390 - global $wgOut, $wgUser, $wgServer, $wgStyleVersion, $wgJsMimeType, $wgScriptPath;
 388+ class ImageTagPage extends ImagePage {
 389+ function openShowImage() {
 390+ global $wgOut, $wgUser, $wgServer, $wgStyleVersion, $wgJsMimeType, $wgScriptPath;
391391
392 - wfProfileIn( __METHOD__ );
 392+ wfProfileIn( __METHOD__ );
393393
394 - global $wgJsMimeType, $wgScriptPath;
395 - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/img_tagging.js?$wgStyleVersion\"></script>\n" );
396 - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/json.js?$wgStyleVersion\"></script>\n" );
 394+ global $wgJsMimeType, $wgScriptPath;
 395+ $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/img_tagging.js?$wgStyleVersion\"></script>\n" );
 396+ $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/ImageTagging/json.js?$wgStyleVersion\"></script>\n" );
397397
398 - $imgName = $this->getTitle()->getText();
399 - $wgOut->addHTML("<input type='hidden' value='$imgName' id='imgName' />");
400 - $wgOut->addHTML("<input type='hidden' value='$wgScriptPath/extensions/ImageTagging' id='imgPath' />");
 398+ $imgName = $this->getTitle()->getText();
 399+ $wgOut->addHTML("<input type='hidden' value='$imgName' id='imgName' />");
 400+ $wgOut->addHTML("<input type='hidden' value='$wgScriptPath/extensions/ImageTagging' id='imgPath' />");
401401
402 - if ( $wgUser->isLoggedIn() )
403 - $wgOut->addHTML("<input type='hidden' value='1' id='userLoggedIn'/>");
404 -
405 - if ( $wgUser->isAllowed('edit') &&
406 - $this->mTitle->userCanEdit() &&
407 - ( $this->mTitle->isProtected('edit') == false || in_array( 'sysop', $wgUser->getGroups() ) ) )
408 - $wgOut->addHTML("<input type='hidden' value='1' id='canEditPage'/>");
 402+ if ( $wgUser->isLoggedIn() )
 403+ $wgOut->addHTML("<input type='hidden' value='1' id='userLoggedIn'/>");
409404
410 - $this->modifiedImagePageOpenShowImage();
 405+ if ( $wgUser->isAllowed('edit') &&
 406+ $this->mTitle->userCanEdit() &&
 407+ ( $this->mTitle->isProtected('edit') == false || in_array( 'sysop', $wgUser->getGroups() ) ) )
 408+ $wgOut->addHTML("<input type='hidden' value='1' id='canEditPage'/>");
411409
412 - if ( $this->img->exists() ) {
413 - $tagList = wfGetImageTags($this->img, $imgName);
 410+ $this->modifiedImagePageOpenShowImage();
414411
415 - #if ( $tagList )
416 - $wgOut->addHTML("<div id='tagListDiv'><span id='tagList'>$tagList</span></div>");
417 - }
 412+ if ( $this->img->exists() ) {
 413+ $tagList = wfGetImageTags($this->img, $imgName);
418414
419 - wfProfileOut( __METHOD__ );
420 - }
 415+ #if ( $tagList )
 416+ $wgOut->addHTML("<div id='tagListDiv'><span id='tagList'>$tagList</span></div>");
 417+ }
421418
422 - function modifiedImagePageOpenShowImage() {
423 - global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgUseImageResize;
 419+ wfProfileOut( __METHOD__ );
 420+ }
424421
425 - wfProfileIn( __METHOD__ );
 422+ function modifiedImagePageOpenShowImage() {
 423+ global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgUseImageResize;
426424
427 - $full_url = $this->img->getURL();
428 - $anchoropen = '';
429 - $anchorclose = '';
 425+ wfProfileIn( __METHOD__ );
430426
431 - if( $wgUser->getOption( 'imagesize' ) == '' ) {
432 - $sizeSel = User::getDefaultOption( 'imagesize' );
433 - } else {
434 - $sizeSel = intval( $wgUser->getOption( 'imagesize' ) );
435 - }
436 - if( !isset( $wgImageLimits[$sizeSel] ) ) {
437 - $sizeSel = User::getDefaultOption( 'imagesize' );
438 - }
439 - $max = $wgImageLimits[$sizeSel];
440 - $maxWidth = $max[0];
441 - $maxHeight = $max[1];
442 - $maxWidth = 600;
443 - $maxHeight = 460;
444 - $sk = $wgUser->getSkin();
 427+ $full_url = $this->img->getURL();
 428+ $anchoropen = '';
 429+ $anchorclose = '';
445430
446 - if ( $this->img->exists() ) {
447 - # image
448 - $width = $this->img->getWidth();
449 - $height = $this->img->getHeight();
450 - $showLink = false;
 431+ if( $wgUser->getOption( 'imagesize' ) == '' ) {
 432+ $sizeSel = User::getDefaultOption( 'imagesize' );
 433+ } else {
 434+ $sizeSel = intval( $wgUser->getOption( 'imagesize' ) );
 435+ }
 436+ if( !isset( $wgImageLimits[$sizeSel] ) ) {
 437+ $sizeSel = User::getDefaultOption( 'imagesize' );
 438+ }
 439+ $max = $wgImageLimits[$sizeSel];
 440+ $maxWidth = $max[0];
 441+ $maxHeight = $max[1];
 442+ $maxWidth = 600;
 443+ $maxHeight = 460;
 444+ $sk = $wgUser->getSkin();
451445
452 - if ( $this->img->allowInlineDisplay() and $width and $height) {
 446+ if ( $this->img->exists() ) {
453447 # image
 448+ $width = $this->img->getWidth();
 449+ $height = $this->img->getHeight();
 450+ $showLink = false;
454451
455 - # "Download high res version" link below the image
456 - $msg = wfMsgHtml('show-big-image', $width, $height, intval( $this->img->getSize()/1024 ) );
 452+ if ( $this->img->allowInlineDisplay() and $width and $height) {
 453+ # image
457454
458 - # We'll show a thumbnail of this image
459 - if ( $width > $maxWidth || $height > $maxHeight ) {
460 - # Calculate the thumbnail size.
461 - # First case, the limiting factor is the width, not the height.
462 - if ( $width / $height >= $maxWidth / $maxHeight ) {
463 - $height = round( $height * $maxWidth / $width);
464 - $width = $maxWidth;
465 - # Note that $height <= $maxHeight now.
466 - } else {
467 - $newwidth = floor( $width * $maxHeight / $height);
468 - $height = round( $height * $newwidth / $width );
469 - $width = $newwidth;
470 - # Note that $height <= $maxHeight now, but might not be identical
471 - # because of rounding.
472 - }
 455+ # "Download high res version" link below the image
 456+ $msg = wfMsgHtml('show-big-image', $width, $height, intval( $this->img->getSize()/1024 ) );
473457
474 - if( $wgUseImageResize ) {
475 - $thumbnail = $this->img->getThumbnail( $width );
476 - if ( $thumbnail == null ) {
 458+ # We'll show a thumbnail of this image
 459+ if ( $width > $maxWidth || $height > $maxHeight ) {
 460+ # Calculate the thumbnail size.
 461+ # First case, the limiting factor is the width, not the height.
 462+ if ( $width / $height >= $maxWidth / $maxHeight ) {
 463+ $height = round( $height * $maxWidth / $width);
 464+ $width = $maxWidth;
 465+ # Note that $height <= $maxHeight now.
 466+ } else {
 467+ $newwidth = floor( $width * $maxHeight / $height);
 468+ $height = round( $height * $newwidth / $width );
 469+ $width = $newwidth;
 470+ # Note that $height <= $maxHeight now, but might not be identical
 471+ # because of rounding.
 472+ }
 473+
 474+ if( $wgUseImageResize ) {
 475+ $thumbnail = $this->img->getThumbnail( $width );
 476+ if ( $thumbnail == null ) {
 477+ $url = $this->img->getViewURL();
 478+ } else {
 479+ $url = $thumbnail->getURL();
 480+ }
 481+ } else {
 482+ # No resize ability? Show the full image, but scale
 483+ # it down in the browser so it fits on the page.
477484 $url = $this->img->getViewURL();
 485+ }
 486+ $anchoropen = "<a href=\"{$full_url}\">";
 487+ $anchorclose = "</a><br />";
 488+ if( $this->img->mustRender() ) {
 489+ $showLink = true;
478490 } else {
479 - $url = $thumbnail->getURL();
 491+ $anchorclose .= "\n$anchoropen{$msg}</a>";
480492 }
481493 } else {
482 - # No resize ability? Show the full image, but scale
483 - # it down in the browser so it fits on the page.
484494 $url = $this->img->getViewURL();
485 - }
486 - $anchoropen = "<a href=\"{$full_url}\">";
487 - $anchorclose = "</a><br />";
488 - if( $this->img->mustRender() ) {
489495 $showLink = true;
490 - } else {
491 - $anchorclose .= "\n$anchoropen{$msg}</a>";
492496 }
 497+
 498+ //$anchoropen = '';
 499+ //$anchorclose = '';
 500+ // $width = 'auto'; //'100%';
 501+ // $height = 'auto'; //'100%';
 502+ $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
 503+ "<img border=\"0\" src=\"{$url}\" width=\"{$width}\" height=\"{$height}\" style=\"max-width: {$maxWidth}px;\" alt=\"" .
 504+ htmlspecialchars( $wgRequest->getVal( 'image' ) ).'" />' .
 505+ $anchoropen . $anchorclose . '</div>' );
493506 } else {
494 - $url = $this->img->getViewURL();
495 - $showLink = true;
496 - }
 507+ #if direct link is allowed but it's not a renderable image, show an icon.
 508+ if ($this->img->isSafeFile()) {
 509+ $icon= $this->img->iconThumb();
497510
498 - //$anchoropen = '';
499 - //$anchorclose = '';
500 -// $width = 'auto'; //'100%';
501 -// $height = 'auto'; //'100%';
502 - $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
503 - "<img border=\"0\" src=\"{$url}\" width=\"{$width}\" height=\"{$height}\" style=\"max-width: {$maxWidth}px;\" alt=\"" .
504 - htmlspecialchars( $wgRequest->getVal( 'image' ) ).'" />' .
505 - $anchoropen . $anchorclose . '</div>' );
506 - } else {
507 - #if direct link is allowed but it's not a renderable image, show an icon.
508 - if ($this->img->isSafeFile()) {
509 - $icon= $this->img->iconThumb();
 511+ $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
 512+ $icon->toHtml() .
 513+ '</a></div>' );
 514+ }
510515
511 - $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
512 - $icon->toHtml() .
513 - '</a></div>' );
 516+ $showLink = true;
514517 }
515518
516 - $showLink = true;
517 - }
 519+ if ($showLink) {
 520+ $filename = wfEscapeWikiText( $this->img->getName() );
 521+ $info = wfMsg( 'file-info',
 522+ $sk->formatSize( $this->img->getSize() ),
 523+ $this->img->getMimeType() );
518524
519 - if ($showLink) {
520 - $filename = wfEscapeWikiText( $this->img->getName() );
521 - $info = wfMsg( 'file-info',
522 - $sk->formatSize( $this->img->getSize() ),
523 - $this->img->getMimeType() );
524 -
525 - if (!$this->img->isSafeFile()) {
526 - $warning = wfMsg( 'mediawarning' );
527 - $wgOut->addWikiText( <<<END
 525+ if (!$this->img->isSafeFile()) {
 526+ $warning = wfMsg( 'mediawarning' );
 527+ $wgOut->addWikiText( <<<END
528528 <div class="fullMedia">
529529 <span class="dangerousLink">[[Media:$filename|$filename]]</span>
530530 <span class="fileInfo"> ($info)</span>
@@ -538,85 +538,83 @@
539539 [[Media:$filename|$filename]] <span class="fileInfo"> ($info)</span>
540540 </div>
541541 END
542 - );
 542+ );
 543+ }
543544 }
544 - }
545545
546 - if($this->img->fromSharedDirectory) {
547 - $this->printSharedImageText();
 546+ if($this->img->fromSharedDirectory) {
 547+ $this->printSharedImageText();
 548+ }
 549+ } else {
 550+ # Image does not exist
 551+
 552+ $title = Title::makeTitle( NS_SPECIAL, 'Upload' );
 553+ $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
 554+ 'wpDestFile=' . urlencode( $this->img->getName() ) );
 555+ $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
548556 }
549 - } else {
550 - # Image does not exist
551557
552 - $title = Title::makeTitle( NS_SPECIAL, 'Upload' );
553 - $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
554 - 'wpDestFile=' . urlencode( $this->img->getName() ) );
555 - $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
 558+ wfProfileOut( __METHOD__ );
556559 }
557560
558 - wfProfileOut( __METHOD__ );
559 - }
 561+ /**
 562+ * Create the TOC
 563+ *
 564+ * @access private
 565+ *
 566+ * @param bool $metadata Whether or not to show the metadata link
 567+ * @return string
 568+ */
 569+ function showTOC( $metadata ) {
 570+ global $wgLang, $wgUser;
560571
 572+ $r = '<ul id="filetoc">
 573+ <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li>
 574+ <li><a href="#filehistory">' . wfMsgHtml( 'imagetagging-imghistory' ) . '</a></li>
 575+ <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
 576+ ($metadata ? '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
 577+ <li><a href="javascript:addImageTags()">' . wfMsgHtml( 'imagetagging-addimagetag' ) . '</a>'. wfMsg('imagetagging-new') .'</li>'
 578+ . '</ul>';
561579
 580+ $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>';
562581
563 -/**
564 - * Create the TOC
565 - *
566 - * @access private
567 - *
568 - * @param bool $metadata Whether or not to show the metadata link
569 - * @return string
570 - */
571 - function showTOC( $metadata ) {
572 - global $wgLang, $wgUser;
 582+ $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'>
573583
574 - $r = '<ul id="filetoc">
575 -<li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li>
576 -<li><a href="#filehistory">' . wfMsgHtml( 'imagetagging-imghistory' ) . '</a></li>
577 -<li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' .
578 - ($metadata ? '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . '
579 -<li><a href="javascript:addImageTags()">' . wfMsgHtml( 'imagetagging-addimagetag' ) . '</a>'. wfMsg('imagetagging-new') .'</li>'
580 -. '</ul>';
 584+ <span style='position: absolute; left: 4px; top: 6px;'>". wfMsg('imagetagging-article') ."</span>
581585
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>';
 586+ <!-- TAH: don't use the popup just yet
 587+ <select name='tagType'>
 588+ <option selected>Article</option>
 589+ <option>Category</option>
 590+ </select>
 591+ -->";
583592
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'>
 593+ $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()'/>";
 594+ $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()'/>";
585595
586 -<span style='position: absolute; left: 4px; top: 6px;'>". wfMsg('imagetagging-article') ."</span>
 596+ $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);' />";
587597
588 -<!-- TAH: don't use the popup just yet
589 -<select name='tagType'>
590 -<option selected>Article</option>
591 -<option>Category</option>
592 -</select>
 598+ $r .= '</div>';
593599
594 - $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()'/>";
595 - $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()'/>";
 600+ $r .= '<div id="popup" style="position:absolute; background-color: #eeeeee; top: 0px; left: 0px; z-index:3; visibility:hidden;"></div>';
596601
597 - $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);' />";
 602+ #$r .= '</div>';
598603
599 - $r .= '</div>';
 604+ // TAH: adding this to grab edit tokens from javascript
 605+ $token = $wgUser->editToken();
 606+ $r .= "<input type=\"hidden\" value=\"$token\" name=\"wpEditToken\" id=\"wpEditToken\" />\n";
 607+ $r .= "<input type=\"hidden\" id=\"addingtagmessage\" value=\"" . wfMsg('imagetagging-addingtag') . "\">\n";
 608+ $r .= "<input type=\"hidden\" id=\"removingtagmessage\" value=\"" . wfMsg('imagetagging-removingtag') . "\">\n";
 609+ $r .= "<input type=\"hidden\" id=\"addtagsuccessmessage\" value=\"" . wfMsg('imagetagging-addtagsuccess') . "\">\n";
 610+ $r .= "<input type=\"hidden\" id=\"removetagsuccessmessage\" value=\"" . wfMsg('imagetagging-removetagsuccess') . "\">\n";
600611
601 - $r .= '<div id="popup" style="position:absolute; background-color: #eeeeee; top: 0px; left: 0px; z-index:3; visibility:hidden;"></div>';
 612+ $r .= "<input type=\"hidden\" id=\"oneactionatatimemessage\" value=\"" . wfMsg('imagetagging-oneactionatatimemessage') . "\">\n";
 613+ $r .= "<input type=\"hidden\" id=\"canteditneedloginmessage\" value=\"" . wfMsg('imagetagging-canteditneedloginmessage') . "\">\n";
 614+ $r .= "<input type=\"hidden\" id=\"canteditothermessage\" value=\"" . wfMsg('imagetagging-canteditothermessage') . "\">\n";
 615+ $r .= "<input type=\"hidden\" id=\"oneuniquetagmessage\" value=\"" . wfMsg('imagetagging-oneuniquetagmessage') . "\">\n";
602616
603 - #$r .= '</div>';
 617+ return $r;
 618+ }
 619+ }
604620
605 - // TAH: adding this to grab edit tokens from javascript
606 - $token = $wgUser->editToken();
607 - $r .= "<input type=\"hidden\" value=\"$token\" name=\"wpEditToken\" id=\"wpEditToken\" />\n";
608 - $r .= "<input type=\"hidden\" id=\"addingtagmessage\" value=\"" . wfMsg('imagetagging-addingtag') . "\">\n";
609 - $r .= "<input type=\"hidden\" id=\"removingtagmessage\" value=\"" . wfMsg('imagetagging-removingtag') . "\">\n";
610 - $r .= "<input type=\"hidden\" id=\"addtagsuccessmessage\" value=\"" . wfMsg('imagetagging-addtagsuccess') . "\">\n";
611 - $r .= "<input type=\"hidden\" id=\"removetagsuccessmessage\" value=\"" . wfMsg('imagetagging-removetagsuccess') . "\">\n";
612 -
613 - $r .= "<input type=\"hidden\" id=\"oneactionatatimemessage\" value=\"" . wfMsg('imagetagging-oneactionatatimemessage') . "\">\n";
614 - $r .= "<input type=\"hidden\" id=\"canteditneedloginmessage\" value=\"" . wfMsg('imagetagging-canteditneedloginmessage') . "\">\n";
615 - $r .= "<input type=\"hidden\" id=\"canteditothermessage\" value=\"" . wfMsg('imagetagging-canteditothermessage') . "\">\n";
616 - $r .= "<input type=\"hidden\" id=\"oneuniquetagmessage\" value=\"" . wfMsg('imagetagging-oneuniquetagmessage') . "\">\n";
617 -
618 - return $r;
619 - }
620621 }
621 -
622 -}
Index: trunk/extensions/ImageTagging/img_tagging.css
@@ -22,7 +22,7 @@
2323
2424 #toppager a:hover, #bottompager a:hover {
2525 text-decoration: none; }
26 -
 26+
2727 #toppager b {
2828 border-bottom: solid 2px #3B5998; }
2929
Index: trunk/extensions/ImageTagging/ImageTagging.i18n.php
@@ -1,37 +1,46 @@
22 <?php
 3+/**
 4+ * Internationalisation file for extension ImageTagging.
 5+ *
 6+ * @addtogroup Extensions
 7+ */
38
 9+
410 $messages = array();
511
612 /** English
7 - * @author Tomasz Klim
8 - * @author Tristan Harris
9 - */
 13+ * @author Tomasz Klim
 14+ * @author Tristan Harris
 15+ */
1016 $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 &#8220;$1&#8221; ($2)',
34 - 'imagetagging-taggedimages-title' => 'Images of \'$1\'',
35 - 'imagetagging-taggedimages-displaying' => 'Displaying $1 - $2 of $3 images of &#8220;$4&#8221;',
36 - 'imagetagging-taggedimages-total' => '&#8220;$1&#8221; image(s) total',
37 - 'imagetagging-taggedimages' => 'Tagged Images',
 17+ 'imagetagging-addimagetag' => 'Tag this Image',
 18+ 'imagetagging-article' => 'Page:',
 19+ 'imagetagging-articletotag' => 'Page to tag',
 20+ 'imagetagging-imghistory' => 'History',
 21+ 'imagetagging-images' => 'images',
 22+ 'imagetagging-inthisimage' => 'In this image: $1',
 23+ 'imagetagging-logentry' => 'Removed tag to page [[$1]] by $2',
 24+ 'imagetagging-log-tagged' => 'Image [[$1|$2]] was tagged to page [[$3]] by $4',
 25+ 'imagetagging-new' => '<sup><span style="color:red">New!</span></sup>',
 26+ 'imagetagging-removetag' => 'remove tag',
 27+ 'imagetagging-done-button' => 'Done tagging',
 28+ 'imagetagging-tag-button' => 'Tag',
 29+ 'imagetagging-tagcancel-button' => 'Cancel',
 30+ 'imagetagging-tagging-instructions' => 'Click on people or things in the image to tag them.',
 31+ 'imagetagging-addingtag' => 'Adding tag…',
 32+ 'imagetagging-removingtag' => 'removing tag…',
 33+ 'imagetagging-addtagsuccess' => 'Added tag.',
 34+ 'imagetagging-removetagsuccess' => 'Removed tag.',
 35+ 'imagetagging-oneactionatatimemessage' => 'Removed tag.',
 36+ 'imagetagging-canteditneedloginmessage' => 'You cannot edit this page.
 37+It may be because you need to login to tag images.
 38+Do you want to login now?',
 39+ 'imagetagging-oneactionatatimemessage' => 'Only one tagging action at a time is allowed.
 40+Please wait for the existing action to complete.',
 41+ 'imagetagging-oneuniquetagmessage' => 'This image already has a tag with this name.',
 42+ 'imagetagging-imagetag-seemoreimages' => 'See more images of "$1" ($2)',
 43+ 'imagetagging-taggedimages-title' => 'Images of "$1"',
 44+ 'imagetagging-taggedimages-displaying' => 'Displaying $1 - $2 of $3 images of "$4"',
 45+ 'imagetagging-taggedimages-total' => '"$1"; image(s) total',
 46+ 'imagetagging-taggedimages' => 'Tagged Images',
3847 );
Index: trunk/extensions/ImageTagging/SpecialTaggedImages.php
@@ -16,228 +16,225 @@
1717 */
1818 class TaggedImages extends SpecialPage {
1919
20 - var $mQuery, $mImages;
 20+ var $mQuery, $mImages;
2121
22 - /**
23 - * Create a new tagged images object.
24 - */
 22+ /**
 23+ * Create a new tagged images object.
 24+ */
2525 function TaggedImages() {
26 - global $wgLang, $wgAllowRealName, $wgRequest, $wgOut;
 26+ global $wgLang, $wgAllowRealName, $wgRequest, $wgOut;
2727
28 - $wgOut->addScript("<style type=\"text/css\">/*<![CDATA[*/ @import \"$GLOBALS[wgScriptPath]/extensions/ImageTagging/img_tagging.css?$GLOBALS[wgStyleVersion]\"; /*]]>*/</style>\n");
 28+ $wgOut->addScript("<style type=\"text/css\">/*<![CDATA[*/ @import \"$GLOBALS[wgScriptPath]/extensions/ImageTagging/img_tagging.css?$GLOBALS[wgStyleVersion]\"; /*]]>*/</style>\n");
2929
30 - $this->mQuery = preg_replace( "/[\"'<>]/", "", $wgRequest->getText('q') );
31 - $this->mStartPage = preg_replace( "/[\"'<>]/", "", $wgRequest->getVal('page') );
32 - $this->mCount = 0;
33 - if ( ! $this->mStartPage )
34 - $this->mStartPage = 0;
35 - $this->mImages = array();
36 -
37 - SpecialPage::SpecialPage('TaggedImages');
38 - }
39 -
40 - /**
41 - * Start doing stuff
42 - * @access public
43 - */
44 - function execute() {
45 - global $wgDBname, $wgOut;
 30+ $this->mQuery = preg_replace( "/[\"'<>]/", "", $wgRequest->getText('q') );
 31+ $this->mStartPage = preg_replace( "/[\"'<>]/", "", $wgRequest->getVal('page') );
 32+ $this->mCount = 0;
 33+ if ( ! $this->mStartPage )
 34+ $this->mStartPage = 0;
 35+ $this->mImages = array();
4636
47 - wfProfileIn( __METHOD__ );
 37+ SpecialPage::SpecialPage('TaggedImages');
 38+ }
4839
49 - $db =& wfGetDB(DB_SLAVE);
 40+ /**
 41+ * Start doing stuff
 42+ * @access public
 43+ */
 44+ function execute() {
 45+ global $wgDBname, $wgOut;
5046
51 - $WHERECLAUSE = '';
52 - if ($this->mQuery) {
53 - $WHERECLAUSE = " WHERE article_tag='$this->mQuery'";
54 - }
 47+ wfProfileIn( __METHOD__ );
5548
56 - $imagetable = $db->tableName( 'image' );
57 - $imagetagstable = $db->tableName( 'imagetags' );
 49+ $db =& wfGetDB(DB_SLAVE);
5850
59 - $SQL = "SELECT img_name, img_timestamp FROM $imagetable WHERE img_name IN (SELECT img_name FROM $imagetagstable $WHERECLAUSE) ORDER BY img_timestamp DESC";
 51+ $WHERECLAUSE = '';
 52+ if ($this->mQuery) {
 53+ $WHERECLAUSE = " WHERE article_tag='$this->mQuery'";
 54+ }
6055
61 - $SQL = $db->LimitResult($SQL, TAGGEDIMGS_PER_PAGE, $this->mStartPage * TAGGEDIMGS_PER_PAGE);
 56+ $imagetable = $db->tableName( 'image' );
 57+ $imagetagstable = $db->tableName( 'imagetags' );
6258
63 - $res = $db->query($SQL);
64 - while ($o = $db->fetchObject($res)) {
65 - $img = Image::newFromName($o->img_name);
66 - $this->add($img, '');
67 - }
68 - $db->freeResult($res);
 59+ $SQL = "SELECT img_name, img_timestamp FROM $imagetable WHERE img_name IN (SELECT img_name FROM $imagetagstable $WHERECLAUSE) ORDER BY img_timestamp DESC";
6960
70 - $res = $db->query("SELECT COUNT(img_name) as img_count FROM $imagetagstable".
71 - ( $this->mQuery ? " WHERE article_tag='" . $this->mQuery . "'" : "" ) .
72 - " GROUP BY article_tag");
73 - if ( $o = $db->fetchObject($res) ) {
74 - $this->mCount = $o->img_count;
75 - }
76 - $db->freeResult($res);
 61+ $SQL = $db->LimitResult($SQL, TAGGEDIMGS_PER_PAGE, $this->mStartPage * TAGGEDIMGS_PER_PAGE);
7762
78 - $wgOut->setPageTitle( wfMsg('imagetagging-taggedimages-title', $this->mQuery ? $this->mQuery : "all" ) );
79 - $wgOut->setRobotpolicy('noindex,nofollow');
80 - $wgOut->addHTML($this->toHTML());
 63+ $res = $db->query($SQL);
 64+ while ($o = $db->fetchObject($res)) {
 65+ $img = Image::newFromName($o->img_name);
 66+ $this->add($img, '');
 67+ }
 68+ $db->freeResult($res);
8169
82 - wfProfileOut( __METHOD__ );
83 - }
 70+ $res = $db->query("SELECT COUNT(img_name) as img_count FROM $imagetagstable".
 71+ ( $this->mQuery ? " WHERE article_tag='" . $this->mQuery . "'" : "" ) .
 72+ " GROUP BY article_tag");
 73+ if ( $o = $db->fetchObject($res) ) {
 74+ $this->mCount = $o->img_count;
 75+ }
 76+ $db->freeResult($res);
8477
85 - /**
86 - * Add an image to the gallery.
87 - *
88 - * @param Image $image Image object that is added to the gallery
89 - * @param string $html Additional HTML text to be shown. The name and size of the image are always shown.
90 - */
91 - function add( $image, $html='' ) {
92 - $this->mImages[] = array( &$image, $html );
93 - }
 78+ $wgOut->setPageTitle( wfMsg('imagetagging-taggedimages-title', $this->mQuery ? $this->mQuery : "all" ) );
 79+ $wgOut->setRobotpolicy('noindex,nofollow');
 80+ $wgOut->addHTML($this->toHTML());
9481
95 - /**
96 - * Add an image at the beginning of the gallery.
97 - *
98 - * @param Image $image Image object that is added to the gallery
99 - * @param string $html Additional HTML text to be shown. The name and size of the image are always shown.
100 - */
101 - function insert( $image, $html='' ) {
102 - array_unshift( $this->mImages, array( &$image, $html ) );
103 - }
 82+ wfProfileOut( __METHOD__ );
 83+ }
10484
 85+ /**
 86+ * Add an image to the gallery.
 87+ *
 88+ * @param Image $image Image object that is added to the gallery
 89+ * @param string $html Additional HTML text to be shown. The name and size of the image are always shown.
 90+ */
 91+ function add( $image, $html='' ) {
 92+ $this->mImages[] = array( &$image, $html );
 93+ }
10594
106 - /**
107 - * isEmpty() returns true if the gallery contains no images
108 - */
109 - function isEmpty() {
110 - return empty( $this->mImages );
111 - }
 95+ /**
 96+ * Add an image at the beginning of the gallery.
 97+ *
 98+ * @param Image $image Image object that is added to the gallery
 99+ * @param string $html Additional HTML text to be shown. The name and size of the image are always shown.
 100+ */
 101+ function insert( $image, $html='' ) {
 102+ array_unshift( $this->mImages, array( &$image, $html ) );
 103+ }
112104
113 - function pagerStatusHTML() {
114 - wfProfileIn( __METHOD__ );
 105+ /**
 106+ * isEmpty() returns true if the gallery contains no images
 107+ */
 108+ function isEmpty() {
 109+ return empty( $this->mImages );
 110+ }
115111
116 - $numPages = $this->mCount / TAGGEDIMGS_PER_PAGE;
 112+ function pagerStatusHTML() {
 113+ wfProfileIn( __METHOD__ );
117114
118 - if (!$this->mQuery) $this->mQuery = "all";
 115+ $numPages = $this->mCount / TAGGEDIMGS_PER_PAGE;
119116
120 - $queryTitle = Title::newFromText($this->mQuery, NS_MAIN);
 117+ if (!$this->mQuery) $this->mQuery = "all";
121118
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>');
 119+ $queryTitle = Title::newFromText($this->mQuery, NS_MAIN);
123120
124 - wfProfileOut( __METHOD__ );
125 - return $html;
126 - }
 121+ $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>');
127122
128 - function pageNoLink($pageNum, $pageText, $hrefPrefix, $cur) {
129 - if ( $cur == false )
130 - $html = '<a href="'. $hrefPrefix . $pageNum . '">' . $pageText . '</a>';
131 - else
132 - $html = '<b>' . $pageText . '</b>';
 123+ wfProfileOut( __METHOD__ );
 124+ return $html;
 125+ }
133126
134 - $html .= '&nbsp;';
135 - return $html;
136 - }
 127+ function pageNoLink($pageNum, $pageText, $hrefPrefix, $cur) {
 128+ if ( $cur == false )
 129+ $html = '<a href="'. $hrefPrefix . $pageNum . '">' . $pageText . '</a>';
 130+ else
 131+ $html = '<b>' . $pageText . '</b>';
137132
138 - function pagerHTML($topBottom) {
139 - global $wgOut;
 133+ $html .= '&nbsp;';
 134+ return $html;
 135+ }
140136
141 - $titleObj = Title::makeTitle( NS_SPECIAL, 'TaggedImages' );
 137+ function pagerHTML($topBottom) {
 138+ global $wgOut;
142139
143 - $maxPages = 5; // 5 real pagers
144 - $numPages = ceil($this->mCount / TAGGEDIMGS_PER_PAGE);
 140+ $titleObj = Title::makeTitle( NS_SPECIAL, 'TaggedImages' );
145141
146 - if ( $numPages <= 1 ) return '';
 142+ $maxPages = 5; // 5 real pagers
 143+ $numPages = ceil($this->mCount / TAGGEDIMGS_PER_PAGE);
147144
148 - $html = '<span id="{$topBottom}pager" class="pager" style="float: right; text-align: right; right: 30px;">';
 145+ if ( $numPages <= 1 ) return '';
149146
150 - $hrefPrefix = $titleObj->escapeLocalURL("q=" . $this->mQuery . "&page=");
 147+ $html = '<span id="{$topBottom}pager" class="pager" style="float: right; text-align: right; right: 30px;">';
151148
152 - // build prev button
153 - if ( $this->mStartPage - 1 >= 0 ) {
154 - $html .= $this->pageNoLink($this->mStartPage-1, wfMsg('allpagesprev'), $hrefPrefix, false);
155 - }
 149+ $hrefPrefix = $titleObj->escapeLocalURL("q=" . $this->mQuery . "&page=");
156150
157 - // build page # buttons
158 - for ( $i=$this->mStartPage-2; $i < $this->mStartPage + $maxPages; $i++ ) {
159 - if ( $i >= $numPages ) break;
160 - if ( $i < 0 ) continue;
 151+ // build prev button
 152+ if ( $this->mStartPage - 1 >= 0 ) {
 153+ $html .= $this->pageNoLink($this->mStartPage-1, wfMsg('allpagesprev'), $hrefPrefix, false);
 154+ }
161155
162 - $html .= $this->pageNoLink($i, $i+1, $hrefPrefix, ($this->mStartPage == $i));
163 - }
 156+ // build page # buttons
 157+ for ( $i=$this->mStartPage-2; $i < $this->mStartPage + $maxPages; $i++ ) {
 158+ if ( $i >= $numPages ) break;
 159+ if ( $i < 0 ) continue;
164160
165 - // build next button
166 - if ( $this->mStartPage < $numPages-1 ) {
167 - $html .= $this->pageNoLink($this->mStartPage+1, wfMsg('allpagesnext'), $hrefPrefix, false);
168 - }
 161+ $html .= $this->pageNoLink($i, $i+1, $hrefPrefix, ($this->mStartPage == $i));
 162+ }
169163
170 - $html .= '</span>';
 164+ // build next button
 165+ if ( $this->mStartPage < $numPages-1 ) {
 166+ $html .= $this->pageNoLink($this->mStartPage+1, wfMsg('allpagesnext'), $hrefPrefix, false);
 167+ }
171168
172 - return $html;
173 - }
 169+ $html .= '</span>';
174170
175 - /**
176 - * Return a HTML representation of the image gallery
177 - *
178 - * For each image in the gallery, display
179 - * - a thumbnail
180 - * - the image name
181 - * - the additional text provided when adding the image
182 - * - the size of the image
183 - *
184 - */
185 - function toHTML() {
186 - global $wgLang, $wgUser;
187 - global $wgOut;
 171+ return $html;
 172+ }
188173
189 - $sk = $wgUser->getSkin();
 174+ /**
 175+ * Return a HTML representation of the image gallery
 176+ *
 177+ * For each image in the gallery, display
 178+ * - a thumbnail
 179+ * - the image name
 180+ * - the additional text provided when adding the image
 181+ * - the size of the image
 182+ *
 183+ */
 184+ function toHTML() {
 185+ global $wgLang, $wgUser, $wgOut;
190186
191 - $s = '<div>';
192 - $s .= $this->pagerStatusHTML();
193 - $s .= $this->pagerHTML('top');
194 - $s .= '</div>';
 187+ $sk = $wgUser->getSkin();
195188
196 - $s .= '<table class="gallery" cellspacing="0" cellpadding="0">';
197 - $i = 0;
198 - foreach ( $this->mImages as $pair ) {
199 - $img =& $pair[0];
200 - $text = $pair[1];
 189+ $s = '<div>';
 190+ $s .= $this->pagerStatusHTML();
 191+ $s .= $this->pagerHTML('top');
 192+ $s .= '</div>';
201193
202 - $name = $img->getName();
203 - $nt = $img->getTitle();
 194+ $s .= '<table class="gallery" cellspacing="0" cellpadding="0">';
 195+ $i = 0;
 196+ foreach ( $this->mImages as $pair ) {
 197+ $img =& $pair[0];
 198+ $text = $pair[1];
204199
205 - // Not an image. Just print the name and skip.
206 - if ( $nt->getNamespace() != NS_IMAGE ) {
207 - $s .= '<td><div class="gallerybox" style="height: 152px;">' .
208 - htmlspecialchars( $nt->getText() ) . '</div></td>' . (($i%4==3) ? "</tr>\n" : '');
209 - $i++;
210 - continue;
211 - }
 200+ $name = $img->getName();
 201+ $nt = $img->getTitle();
212202
213 - // TODO
214 - // $ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
 203+ // Not an image. Just print the name and skip.
 204+ if ( $nt->getNamespace() != NS_IMAGE ) {
 205+ $s .= '<td><div class="gallerybox" style="height: 152px;">' .
 206+ htmlspecialchars( $nt->getText() ) . '</div></td>' . (($i%4==3) ? "</tr>\n" : '');
 207+ $i++;
 208+ continue;
 209+ }
215210
216 - $nb = '';
217 - $textlink = $this->mShowFilename ?
 211+ // TODO
 212+ // $ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
 213+
 214+ $nb = '';
 215+ $textlink = $this->mShowFilename ?
218216 $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
219217 '';
220218
221 - $s .= ($i%4==0) ? '<tr>' : '';
222 - $thumb = $img->getThumbnail( 120, 120 );
223 - $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
224 - $s .= '<td><div class="gallerybox">' . '<div class="thumb" style="padding: ' . $vpad . 'px 0;">';
 219+ $s .= ($i%4==0) ? '<tr>' : '';
 220+ $thumb = $img->getThumbnail( 120, 120 );
 221+ $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
 222+ $s .= '<td><div class="gallerybox">' . '<div class="thumb" style="padding: ' . $vpad . 'px 0;">';
225223
226 - # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltivdy which
227 - # in version 4.8.6 generated crackpot html in its absence, see:
228 - # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
229 - $s .= $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div><div class="gallerytext">' . "\n" .
230 - $textlink . $text . $nb .
231 - '</div>';
232 - $s .= "</div></td>\n";
233 - $s .= ($i%4==3) ? '</tr>' : '';
234 - $i++;
 224+ # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltivdy which
 225+ # in version 4.8.6 generated crackpot html in its absence, see:
 226+ # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
 227+ $s .= $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div><div class="gallerytext">' . "\n" .
 228+ $textlink . $text . $nb .
 229+ '</div>';
 230+ $s .= "</div></td>\n";
 231+ $s .= ($i%4==3) ? '</tr>' : '';
 232+ $i++;
 233+ }
 234+ if ( $i %4 != 0 ) {
 235+ $s .= "</tr>\n";
 236+ }
 237+ $s .= '</table>';
 238+ $s .= $this->pagerHTML('bottom');
 239+ return $s;
235240 }
236 - if ( $i %4 != 0 ) {
237 - $s .= "</tr>\n";
238 - }
239 - $s .= '</table>';
240 - $s .= $this->pagerHTML('bottom');
241 - return $s;
242 - }
243 -
244241 } //class
Index: trunk/extensions/ImageTagging/img_success.css
@@ -8,8 +8,8 @@
99 position: relative;
1010 border:1px solid #bbbbbb;
1111 width:450px;
12 - height: 32px;
13 - padding:5px;
 12+ height: 32px;
 13+ padding:5px;
1414 }
1515
1616 #alignControls {
@@ -47,7 +47,7 @@
4848 position: absolute;
4949 top: 10px;
5050 left: 6px;
51 -}
 51+}
5252
5353 #thumbSizeValue {
5454 position: absolute;
@@ -60,8 +60,8 @@
6161 padding:5px;
6262 width: 450px;
6363 }
64 -
6564
 65+
6666 html>body #slider { left:44px; }
6767 #wrapper {
6868 width:450px;

Status & tagging log