Index: trunk/WikiWord/WikiWord/src/main/php/search/wikipics.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | return $pics; |
44 | 44 | } |
45 | 45 | |
46 | | -function printConceptImageList($concept, $class = "tersetable", $columns = 5, $limit = false ) { |
| 46 | +function printConceptImageList($concept, $terse = false, $columns = 5, $limit = false ) { |
47 | 47 | global $utils, $wwThumbSize; |
48 | 48 | |
49 | 49 | if (!$concept) return false; |
— | — | @@ -52,17 +52,24 @@ |
53 | 53 | |
54 | 54 | if (!$images) return; |
55 | 55 | |
| 56 | + $class = $terse ? "terseImageTable" : ""; |
| 57 | + |
56 | 58 | $imgList = array_values($images); |
57 | 59 | |
| 60 | + $cw = $wwThumbSize + 32; //FIXME: magic number, use config! |
| 61 | + |
58 | 62 | ?> |
59 | | - <table class="imageTable <?php print $class; ?>" summary="images"> |
| 63 | + <table class="imageTable <?php print $class; ?>" summary="images" width="<?php print $columns*$cw; ?>"> |
| 64 | + <colgroup span="<?php print $columns; ?>" width="<?php print $cw; ?>"> |
| 65 | + </colgroup> |
| 66 | + |
60 | 67 | <?php |
61 | 68 | $i = 0; |
62 | 69 | $c = count($images); |
63 | 70 | if (!$limit || $limit > $c) $limit = $c; |
64 | 71 | |
65 | 72 | while ($i < $limit) { |
66 | | - $i = printConceptImageRow($imgList, $i, $limit, $columns); |
| 73 | + $i = printConceptImageRow($imgList, $i, $terse, $columns, $limit); |
67 | 74 | } |
68 | 75 | ?> |
69 | 76 | </table> |
— | — | @@ -71,10 +78,10 @@ |
72 | 79 | return $i < $c; |
73 | 80 | } |
74 | 81 | |
75 | | -function printConceptImageRow($images, $from, $limit, $columns = 5) { |
| 82 | +function printConceptImageRow($images, $from, $terse, $columns = 5, $limit = false) { |
76 | 83 | global $wwThumbSize, $utils; |
77 | 84 | |
78 | | - $cw = $wwThumbSize + 20; |
| 85 | + $cw = $wwThumbSize + 32; //FIXME: magic number, use config! |
79 | 86 | $cwcss = $cw . "px"; |
80 | 87 | |
81 | 88 | $to = $from + $columns; |
— | — | @@ -91,25 +98,82 @@ |
92 | 99 | |
93 | 100 | print "\n\t</tr>\n"; |
94 | 101 | |
95 | | - print "\t<tr class=\"imageMetaRow\">\n"; |
96 | | - |
97 | | - for ($i = $from; $i<$to; $i += 1) { |
98 | | - $img = $images[$i]; |
| 102 | + if (!$terse) { |
| 103 | + print "\t<tr class=\"imageMetaRow\">\n"; |
| 104 | + |
| 105 | + for ($i = $from; $i<$to; $i += 1) { |
| 106 | + $img = $images[$i]; |
99 | 107 | |
100 | | - $title = $img['name']; |
101 | | - $title = str_replace("_", " ", $title); |
102 | | - $title = preg_replace("/\\.[^.]+$/", "", $title); |
| 108 | + $title = $img['name']; |
| 109 | + $title = str_replace("_", " ", $title); |
| 110 | + $title = preg_replace("/\\.[^.]+$/", "", $title); |
103 | 111 | |
104 | | - print "\t\t<td class=\"imageMetaCell\" width=\"$cw\" align=\"left\" valign=\"top\" style=\"width: $cwcss\">"; |
105 | | - print "<div class=\"imageTitle\">" . htmlspecialchars( $title ) . "</div>"; |
106 | | - print "</td>\n"; |
| 112 | + $info = getImageInfo($img); |
| 113 | + $labels = getImageLabels($img); |
| 114 | + |
| 115 | + print "\t\t<td class=\"imageMetaCell\" width=\"$cw\" align=\"left\" valign=\"top\" style=\"width: $cwcss\">"; |
| 116 | + print "<div class=\"imageTitle\">" . htmlspecialchars( $title ) . "</div>"; |
| 117 | + |
| 118 | + if ($info) { |
| 119 | + print "<div class=\"imageInfo\">"; |
| 120 | + printList($info, false, "terselist"); |
| 121 | + print "</div>"; |
| 122 | + } |
| 123 | + |
| 124 | + if ($labels) { |
| 125 | + print "<div class=\"imageLabels\">"; |
| 126 | + printList($labels, false, "terselist"); |
| 127 | + print "</div>"; |
| 128 | + } |
| 129 | + |
| 130 | + print "</td>\n"; |
| 131 | + } |
| 132 | + |
| 133 | + print "\n\t</tr>\n"; |
107 | 134 | } |
108 | | - |
109 | | - print "\n\t</tr>\n"; |
110 | 135 | |
111 | 136 | return $to; |
112 | 137 | } |
113 | 138 | |
| 139 | +function getImageInfo($img) { |
| 140 | + if (empty($img['meta'])) return false; |
| 141 | + |
| 142 | + $info = array(); |
| 143 | + extract($img['meta']); |
| 144 | + |
| 145 | + $info[] = htmlspecialchars("$img_minor_mime"); |
| 146 | + |
| 147 | + if ( $img_media_type == "BITMAP" ) { |
| 148 | + $info[] = htmlspecialchars("{$img_width}x{$img_height}"); |
| 149 | + } |
| 150 | + |
| 151 | + if ( $img_size > 1024*1024 ) $info[] = htmlspecialchars(sprintf("%1.0fM", $img_size / 1024.0*1024.0)); |
| 152 | + else if ( $img_size > 1024 ) $info[] = htmlspecialchars(sprintf("%1.0fK", $img_size / 1024.0)); |
| 153 | + else $info[] = htmlspecialchars(sprintf("%dB", $img_size)); |
| 154 | + |
| 155 | + return $info; |
| 156 | +} |
| 157 | + |
| 158 | +function getImageLabels($img) { |
| 159 | + global $wwLabelPatterns; |
| 160 | + |
| 161 | + if (!$wwLabelPatterns || empty($img['tags'])) return false; |
| 162 | + |
| 163 | + $labels = array(); |
| 164 | + |
| 165 | + foreach ( $img['tags'] as $tag ) { |
| 166 | + foreach ( $wwLabelPatterns as $pattern => $label ) { |
| 167 | + if ( preg_match($pattern, $tag) ) { |
| 168 | + $labels[$label] = 1; |
| 169 | + break; |
| 170 | + } |
| 171 | + } |
| 172 | + } |
| 173 | + |
| 174 | + $labels = array_keys($labels); |
| 175 | + return $labels; |
| 176 | +} |
| 177 | + |
114 | 178 | function getConceptDetailsURL($langs, $concept) { |
115 | 179 | global $wwSelf; |
116 | 180 | |
— | — | @@ -184,7 +248,7 @@ |
185 | 249 | <?php |
186 | 250 | foreach ($items as $item) { |
187 | 251 | if ( $escape ) $item = htmlspecialchars($item); |
188 | | - print "\t\t<li>" . $item . "</li>\n"; |
| 252 | + print "<li>" . trim($item) . "</li>"; |
189 | 253 | } |
190 | 254 | ?> |
191 | 255 | </ul> |
— | — | @@ -232,10 +296,11 @@ |
233 | 297 | $related = array(); |
234 | 298 | if ( @$concept['similar'] ) $related += $concept['similar']; |
235 | 299 | if ( @$concept['related'] ) $related += $concept['related']; |
236 | | - if ( @$concept['narrower'] ) $related += $concept['narrower']; |
237 | 300 | |
238 | 301 | if (isset($concept['broader'])) $related = array_key_diff($related, $concept['broader']); |
| 302 | + if (isset($concept['narrower'])) $related = array_key_diff($related, $concept['narrower']); |
239 | 303 | |
| 304 | + sortConceptList($related); |
240 | 305 | return $related; |
241 | 306 | } |
242 | 307 | |
— | — | @@ -267,12 +332,55 @@ |
268 | 333 | else return "little"; |
269 | 334 | } |
270 | 335 | |
| 336 | +function stripSections(&$concepts) { |
| 337 | + foreach ($concepts as $k => $c) { |
| 338 | + foreach ($c['name'] as $l => $n) { |
| 339 | + if (preg_match('/#/', $n)) { |
| 340 | + unset($concepts[$k]); |
| 341 | + break; |
| 342 | + } |
| 343 | + } |
| 344 | + } |
| 345 | +} |
| 346 | + |
| 347 | +function compareConceptScoreAndName($a, $b) { |
| 348 | + if (isset($a['score']) && isset($b['score']) && $a['score'] != $b['score']) { |
| 349 | + if ( $a['score'] > $b['score'] ) return 1; |
| 350 | + else return -1; |
| 351 | + } else { |
| 352 | + if ( $a['name'] > $b['name'] ) return 1; //XXX: unicode collation?? |
| 353 | + else return -1; |
| 354 | + } |
| 355 | + |
| 356 | + return 0; |
| 357 | +} |
| 358 | + |
| 359 | +function sortConceptList(&$concepts) { |
| 360 | + usort($concepts, 'compareConceptScoreAndName'); |
| 361 | +} |
| 362 | + |
| 363 | +function mangleConcept(&$concept) { |
| 364 | + stripSections($concept['narrower']); |
| 365 | + |
| 366 | + sortConceptList($concept['narrower']); |
| 367 | + sortConceptList($concept['related']); |
| 368 | + sortConceptList($concept['similar']); |
| 369 | + sortConceptList($concept['broader']); |
| 370 | +} |
| 371 | + |
271 | 372 | function printConcept($concept, $langs, $terse = true) { |
272 | | - global $utils, $wwMaxPreviewImages, $wwMaxGalleryImages, $wwMaxPreviewLinks, $wwGalleryColumns; |
| 373 | + global $utils, $wwMaxPreviewImages, $wwMaxGalleryImages, $wwMaxPreviewLinks, $wwMaxDetailLinks, $wwGalleryColumns; |
273 | 374 | |
274 | 375 | extract( $concept ); |
275 | | - $wclass = getWeightClass($score); |
276 | | - $lclass = $terse ? "terselist" : "list"; |
| 376 | + if (@$score) $wclass = getWeightClass($score); |
| 377 | + else $wclass = ""; |
| 378 | + |
| 379 | + #$lclass = $terse ? "terselist" : "list"; |
| 380 | + $lclass = "terselist"; |
| 381 | + |
| 382 | + $name = $utils->pickLocal($concept['name'], $langs); |
| 383 | + $name = str_replace("_", " ", $name); |
| 384 | + |
277 | 385 | $gallery = getImagesAbout($concept, $terse ? $wwMaxPreviewImages*2 : $wwMaxGalleryImages+1 ); |
278 | 386 | |
279 | 387 | if (is_array($definition)) $definition = $utils->pickLocal($definition, $langs); |
— | — | @@ -289,14 +397,29 @@ |
290 | 398 | <tr class="row_images"> |
291 | 399 | <td class="cell_images" colspan="2"> |
292 | 400 | <?php |
293 | | - $more = printConceptImageList( $gallery, $terse ? "tersegallery" : "gallery", $wwGalleryColumns, $terse ? $wwMaxPreviewImages : $wwMaxGalleryImages ); |
| 401 | + if (!$gallery) print "<p class=\"notice\">No images found for concept <em>".htmlspecialchars($name)."</em>.</p>"; |
| 402 | + else $more = printConceptImageList( $gallery, $terse, $wwGalleryColumns, $terse ? $wwMaxPreviewImages : $wwMaxGalleryImages ); |
294 | 403 | ?> |
295 | 404 | </td> |
| 405 | + <?php if ($gallery) { ?> |
296 | 406 | <td class="cell_more_images" colspan="1" width="100%" style="vertical-align:bottom; padding: 1ex; font-size:normal;"> |
297 | | - <?php if ($terse && $more) print " <div><strong class=\"more\">[" . getConceptDetailsLink($langs, $concept, "more...") . "]</strong></div>"; ?> |
| 407 | + <?php if ($terse) print " <div><strong class=\"more\">[" . getConceptDetailsLink($langs, $concept, "more/details...") . "]</strong></div>"; ?> |
298 | 408 | </td> |
| 409 | + <?php } ?> |
299 | 410 | </tr> |
300 | 411 | |
| 412 | + <?php if (@$concept['narrower']) { ?> |
| 413 | + <tr class="row_narrower"> |
| 414 | + <td class="cell_related" colspan="3"> |
| 415 | + <strong class="label">Narrower:</strong> |
| 416 | + <?php |
| 417 | + $more = printConceptList( $langs, $concept['narrower'], $lclass, $terse ? $wwMaxPreviewLinks : $wwMaxDetailLinks ); |
| 418 | + ?> |
| 419 | + <?php if ($terse && $more) print " <strong class=\"more\">[" . getConceptDetailsLink($langs, $concept, "more...") . "]</strong>"; ?> |
| 420 | + </td> |
| 421 | + </tr> |
| 422 | + <?php } ?> |
| 423 | + |
301 | 424 | <?php |
302 | 425 | $related = getRelatedConceptList($concept); |
303 | 426 | if ($related) { |
— | — | @@ -339,13 +462,23 @@ |
340 | 463 | $term = @$_REQUEST['term']; |
341 | 464 | $lang = @$_REQUEST['lang']; |
342 | 465 | |
| 466 | +if ($term!==NULL && preg_match('/^\s*#(\d+)\s*$/', $term, $m)) { |
| 467 | + $conceptId = $m[1]; |
| 468 | + $term = NULL; |
| 469 | +} |
| 470 | + |
343 | 471 | if (!isset($wwSelf)) $wwSelf = @$_SERVER["PHP_SELF"]; |
344 | 472 | |
345 | 473 | $error = NULL; |
346 | 474 | |
347 | | -if ($lang && !isset($wwLanguages[$lang])) { |
348 | | - $lang = NULL; |
349 | | - $error = "bad language code: $lang"; |
| 475 | +if ($lang) { |
| 476 | + $ll = preg_split('![,;/|+]!', $lang); |
| 477 | + foreach ($ll as $l) { |
| 478 | + if (!isset($wwLanguages[$l]) && $l != "commons") { |
| 479 | + $error = "bad language code: $l"; |
| 480 | + $lang = NULL; |
| 481 | + } |
| 482 | + } |
350 | 483 | } |
351 | 484 | |
352 | 485 | if ($wwAPI) $thesaurus = new WWClient($wwAPI); |
— | — | @@ -365,6 +498,7 @@ |
366 | 499 | $limit = 20; |
367 | 500 | $norm = 1; |
368 | 501 | |
| 502 | +$mode = NULL; |
369 | 503 | $result = NULL; |
370 | 504 | |
371 | 505 | $languages = array( $lang, "en", "commons" ); #TODO: make the user define this list |
— | — | @@ -376,9 +510,11 @@ |
377 | 511 | $t = microtime(true); |
378 | 512 | try { |
379 | 513 | if ($lang && $conceptId) { |
| 514 | + $mode = "concept"; |
380 | 515 | $result = $thesaurus->getConceptInfo($conceptId, $lang); |
381 | 516 | if ( $result ) $result = array( $result ); //hack |
382 | 517 | } else if ($lang && $term) { |
| 518 | + $mode = "term"; |
383 | 519 | $result = $thesaurus->getConceptsForTerm($lang, $term, $languages, $norm, $limit); |
384 | 520 | } |
385 | 521 | } catch (Exception $e) { |
— | — | @@ -433,8 +569,7 @@ |
434 | 570 | |
435 | 571 | .row_images td { vertical-align: bottom; } |
436 | 572 | |
437 | | - .row_related td { font-size: small; background-color: #F0F7F9; } |
438 | | - .row_category td { font-size: small; background-color: #F0F7F9; } |
| 573 | + .row_related td, .row_category, .row_narrower { font-size: small; background-color: #F0F7F9; } |
439 | 574 | .row_blank td { font-size: small; } |
440 | 575 | |
441 | 576 | /* |
— | — | @@ -467,14 +602,21 @@ |
468 | 603 | |
469 | 604 | .imageTable td.imageCell { |
470 | 605 | vertical-align: bottom; |
471 | | - padding-top: 1em; |
| 606 | + padding-top: 0.5em; |
| 607 | + padding-right: 1em; |
| 608 | + font-size:33%; |
472 | 609 | } |
473 | | - .imageTable td.imageCell img { border: 1px solid; } |
474 | | - .imageTable td.imageCell, .imageTable td.imageMetaCell { |
| 610 | + |
| 611 | + .imageTable td.imageMetaCell { |
| 612 | + vertical-align: top; |
| 613 | + padding-bottom: 0.5em; |
| 614 | + padding-right: 1em; |
475 | 615 | font-size:small; |
476 | | - border-spacing: 1em 0; |
477 | | - margin: 1em; |
478 | 616 | } |
| 617 | + |
| 618 | + .imageTable td.imageCell img { border: 1px solid; } |
| 619 | + |
| 620 | + .imageInfo { color: #676767 } |
479 | 621 | </style> |
480 | 622 | </head> |
481 | 623 | <body> |
— | — | @@ -524,12 +666,17 @@ |
525 | 667 | if ($error) { |
526 | 668 | print "<p class=\"error\">".htmlspecialchars($error)."</p>"; |
527 | 669 | } |
| 670 | + |
| 671 | +if (!$result && $mode) { |
| 672 | + if ($mode=="concept") print "<p class=\"error\">".htmlspecialchars($error)."</p>"; |
| 673 | + else if ($mode=="term") print "<p class=\"notice\">No meanings found for term <em>".htmlspecialchars($term)."</em>.</p>"; |
| 674 | +} |
528 | 675 | ?> |
529 | 676 | |
530 | 677 | <?php |
531 | | -if ($result) { |
532 | | - if ( $conceptId ) $terse = false; |
533 | | - else $terse = true; |
| 678 | +if ($result && $mode) { |
| 679 | + if ( $mode == 'concept' ) $terse = false; |
| 680 | + else if ( $mode == 'term' ) $terse = true; |
534 | 681 | ?> |
535 | 682 | <table border="0" class="results" cellspacing="0" summary="search results"> |
536 | 683 | <?php |
— | — | @@ -540,6 +687,7 @@ |
541 | 688 | |
542 | 689 | ?> |
543 | 690 | <?php |
| 691 | + mangleConcept($row); |
544 | 692 | $continue= printConcept($row, $languages, $terse); |
545 | 693 | |
546 | 694 | if (!$continue) break; |
Index: trunk/WikiWord/WikiWord/src/main/php/common/wwclient.php |
— | — | @@ -103,6 +103,11 @@ |
104 | 104 | |
105 | 105 | $rs = $this->query( $param ); |
106 | 106 | |
| 107 | + if (!$rs) return $rs; |
| 108 | + if (!isset($rs['concept'])) throw new Exception("bad response, missing concept"); |
| 109 | + |
| 110 | + $rs = $rs['concept']; |
| 111 | + |
107 | 112 | if (!isset($rs['id'])) $rs['id'] = $id; |
108 | 113 | if (!isset($rs['lang'])) $rs['lang'] = $lang; |
109 | 114 | |
Index: trunk/WikiWord/WikiWord/src/main/php/common/wwimages.php |
— | — | @@ -74,6 +74,12 @@ |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
| 78 | + function addMeta($image, $meta) { |
| 79 | + if (isset($this->images[$image])) { |
| 80 | + $this->images[$image]['meta'] = $meta; |
| 81 | + } |
| 82 | + } |
| 83 | + |
78 | 84 | } |
79 | 85 | |
80 | 86 | class WWImages extends WWWikis { |
— | — | @@ -191,6 +197,29 @@ |
192 | 198 | return $list; |
193 | 199 | } |
194 | 200 | |
| 201 | + function queryMetaForImages($lang, $images) { |
| 202 | + if (!$images) return false; |
| 203 | + |
| 204 | + $image_table = $this->getWikiTableName($lang, "image"); |
| 205 | + |
| 206 | + $sql = "/* queryMetaForImages(" . $this->quote($lang) . ", " . $this->quoteSet($images) . ") */ "; |
| 207 | + |
| 208 | + $sql .= " SELECT img_name, img_size, img_width, img_height, img_media_type, img_major_mime, img_minor_mime, img_timestamp, img_sha1 "; |
| 209 | + $sql .= " FROM $image_table as T "; |
| 210 | + $sql .= " WHERE T.img_name IN " . $this->quoteSet($images); |
| 211 | + |
| 212 | + return $this->queryWiki($lang, $sql); |
| 213 | + } |
| 214 | + |
| 215 | + function getMetaForImages($lang, $images) { |
| 216 | + if (!$images) return array(); |
| 217 | + |
| 218 | + $rs = $this->queryMetaForImages($lang, $images); |
| 219 | + $list = WWUtils::slurpRows($rs, "img_name"); |
| 220 | + mysql_free_result($rs); |
| 221 | + return $list; |
| 222 | + } |
| 223 | + |
195 | 224 | function queryTemplatesOnImagePage($lang, $image) { |
196 | 225 | $page_table = $this->getWikiTableName($lang, "page"); |
197 | 226 | $templatelinks_table = $this->getWikiTableName($lang, "templatelinks"); |
— | — | @@ -394,6 +423,7 @@ |
395 | 424 | } |
396 | 425 | |
397 | 426 | if ($max && $images->size()>$max) { //short-cirquit, if we already reached the max |
| 427 | + $this->addImageMeta($images); |
398 | 428 | $this->addImageTags($images); |
399 | 429 | return $images->listImages($max); |
400 | 430 | } |
— | — | @@ -411,6 +441,7 @@ |
412 | 442 | } |
413 | 443 | } |
414 | 444 | |
| 445 | + $this->addImageMeta($images); |
415 | 446 | $this->addImageTags($images); |
416 | 447 | return $images->listImages($max); |
417 | 448 | } |
— | — | @@ -445,6 +476,18 @@ |
446 | 477 | } |
447 | 478 | } |
448 | 479 | |
| 480 | + function addImageMeta($images) { |
| 481 | + $img = array(); |
| 482 | + foreach ($images->images as $image) { |
| 483 | + $img[] = $image['name']; |
| 484 | + } |
| 485 | + |
| 486 | + $infoMap = $this->getMetaForImages('commons', $img); |
| 487 | + foreach ($infoMap as $image => $meta) { |
| 488 | + $images->addMeta($image, $meta, ""); |
| 489 | + } |
| 490 | + } |
| 491 | + |
449 | 492 | function getThumbnailURL($image, $width = 120, $height = NULL) { |
450 | 493 | global $wwThumbnailURL; |
451 | 494 | |
— | — | @@ -484,6 +527,8 @@ |
485 | 528 | |
486 | 529 | if (!@$title) $title = $name; |
487 | 530 | |
| 531 | + $alt = str_replace('_', ' ', $name); |
| 532 | + |
488 | 533 | $tags = ""; |
489 | 534 | if (isset($image['tags'])) { |
490 | 535 | foreach ($image['tags'] as $tag) { |
— | — | @@ -491,7 +536,7 @@ |
492 | 537 | } |
493 | 538 | } |
494 | 539 | |
495 | | - $html= "<img src=\"" . htmlspecialchars($thumb) . "\" alt=\"" . htmlspecialchars($title) . "\" border=\"0\"/>"; |
| 540 | + $html= "<img src=\"" . htmlspecialchars($thumb) . "\" alt=\"" . htmlspecialchars($alt) . "\" border=\"0\"/>"; |
496 | 541 | $html= "<a href=\"" . htmlspecialchars($page) . "\" title=\"" . htmlspecialchars($title) . " (score " . htmlspecialchars($image['score']) . ")\" class=\"thumb-link $tags\">$html</a>"; |
497 | 542 | |
498 | 543 | if (is_array($image)) { |
— | — | @@ -560,15 +605,39 @@ |
561 | 606 | } |
562 | 607 | |
563 | 608 | function getTagsForImages($lang, $images, $tagTable) { |
564 | | - return array("Quux", "Xyzzy"); |
| 609 | + $r = array(); |
| 610 | + foreach ($images as $img) { |
| 611 | + $r[$img] = array("assessment:Featured_picture", "license:Cc-by-sa"); |
| 612 | + } |
| 613 | + |
| 614 | + return $r; |
565 | 615 | } |
566 | 616 | |
| 617 | + function getMetaForImages($lang, $images) { |
| 618 | + $r = array(); |
| 619 | + foreach ($images as $img) { |
| 620 | + $r[$img] = array( |
| 621 | + 'img_name' => $img, |
| 622 | + 'img_size' => 123456, |
| 623 | + 'img_width' => 300, |
| 624 | + 'img_height' => 200, |
| 625 | + 'img_media_type' => 'BITMAP', |
| 626 | + 'img_major_mime' => 'image', |
| 627 | + 'img_minor_mime' => 'jpeg', |
| 628 | + 'img_timestamp' => '20090808132422', |
| 629 | + ); |
| 630 | + } |
| 631 | + |
| 632 | + return $r; |
| 633 | + } |
| 634 | + |
| 635 | + |
567 | 636 | function queryTemplatesOnImagePage($lang, $image) { |
568 | 637 | throw new Exception( __METHOD__ . " not implemented" ); |
569 | 638 | } |
570 | 639 | |
571 | 640 | function getTemplatesOnImagePage($lang, $image) { |
572 | | - return array("Quux", "Xyzzy"); |
| 641 | + return array("Cc-by-sa", "Featured_picture"); |
573 | 642 | } |
574 | 643 | |
575 | 644 | function queryCategoriesOfImagePage($lang, $image) { |
Index: trunk/WikiWord/WikiWord/src/main/php/config.sample.php |
— | — | @@ -60,4 +60,15 @@ |
61 | 61 | 'assessment:Picture_of_the_day' => 2.5, |
62 | 62 | 'assessment:Quality_image' => 2.0, |
63 | 63 | 'assessment:Featured_picture' => 3.0, |
| 64 | +); |
| 65 | + |
| 66 | +$wwLabelPatterns = array( |
| 67 | + '/^assessment:.*_of_the_day([-_].*|$)/' => "PotD", |
| 68 | + '/^assessment:(Featured|Former_featured_picture).*/' => 'FP', |
| 69 | + '/^assessment:Quiality.*/' => 'QI', |
| 70 | + '/^assessment:(Valued|Former_valued_images|Images_used_in_valued_image_sets).*/' => 'VI', |
| 71 | + '/^license:PD([-_].*|$)/' => 'PD', |
| 72 | + '/^license:GFDL([-_].*|$)/' => 'GFDL', |
| 73 | + '/^license:CC-BY-SA([-_].*|$)/i' => 'CC-BY-SA', |
| 74 | + '/^license:CC-BY([-_].*|$)/i' => 'BY', |
64 | 75 | ); |
\ No newline at end of file |