Index: trunk/WikiWord/WikiWord/src/main/php/search/wikipics.php |
— | — | @@ -18,8 +18,11 @@ |
19 | 19 | <ul class="<?php print $class; ?>"> |
20 | 20 | <?php |
21 | 21 | foreach ($concepts as $c) { |
| 22 | + $link = getConceptDetailsLink($langs, $c); |
| 23 | + if (!$link) continue; |
| 24 | + |
22 | 25 | ?><li><?php |
23 | | - print getConceptDetailsLink($langs, $c); |
| 26 | + print $link; |
24 | 27 | |
25 | 28 | $i += 1; |
26 | 29 | if ($i >= $limit) break; |
— | — | @@ -164,13 +167,13 @@ |
165 | 168 | foreach ( $img['tags'] as $tag ) { |
166 | 169 | foreach ( $wwLabelPatterns as $pattern => $label ) { |
167 | 170 | if ( preg_match($pattern, $tag) ) { |
168 | | - $labels[$label] = 1; |
| 171 | + $labels[$label] = "<span title=\"".htmlspecialchars($tag)."\">".htmlspecialchars($label)."</span>"; |
169 | 172 | break; |
170 | 173 | } |
171 | 174 | } |
172 | 175 | } |
173 | 176 | |
174 | | - $labels = array_keys($labels); |
| 177 | + $labels = array_values($labels); |
175 | 178 | return $labels; |
176 | 179 | } |
177 | 180 | |
— | — | @@ -186,6 +189,8 @@ |
187 | 190 | global $utils; |
188 | 191 | |
189 | 192 | $name = $utils->pickLocal($concept['name'], $langs); |
| 193 | + if ( $name === false || $name === null) return false; |
| 194 | + |
190 | 195 | $name = str_replace("_", " ", $name); |
191 | 196 | $score = @$concept['score']; |
192 | 197 | |
— | — | @@ -247,6 +252,7 @@ |
248 | 253 | <ul class="<?php print htmlspecialchars($class); ?>"> |
249 | 254 | <?php |
250 | 255 | foreach ($items as $item) { |
| 256 | + if ( !$item ) continue; |
251 | 257 | if ( $escape ) $item = htmlspecialchars($item); |
252 | 258 | print "<li>" . trim($item) . "</li>"; |
253 | 259 | } |
— | — | @@ -391,7 +397,6 @@ |
392 | 398 | <td colspan="3"> |
393 | 399 | <h1 class="name <?php print "weight_$wclass"; ?>"><?php print getConceptDetailsLink($langs, $concept); ?>:</h1> |
394 | 400 | <p class="definition"><?php print htmlspecialchars($definition); ?></p> |
395 | | - <div class="wikipages"><strong class="label">Pages:</strong> <?php printConceptPageList( $langs, $concept, $lclass, $terse ? $wwMaxPreviewLinks : $wwMaxDetailLinks ) ?></div> |
396 | 401 | </td> |
397 | 402 | </tr> |
398 | 403 | |
— | — | @@ -448,6 +453,15 @@ |
449 | 454 | </tr> |
450 | 455 | <?php } ?> |
451 | 456 | |
| 457 | + <?php if (!$terse && @$concept['pages']) { ?> |
| 458 | + <tr class="row_pages"> |
| 459 | + <td class="cell_pages wikipages" colspan="3"> |
| 460 | + <strong class="label">Wiki pages:</strong> <?php $more = printConceptPageList( $langs, $concept, $lclass, $terse ? $wwMaxPreviewLinks : $wwMaxDetailLinks ); ?> |
| 461 | + <?php if ($terse && $more) print " <strong class=\"more\">[" . getConceptDetailsLink($langs, $concept, "more...") . "]</strong>"; ?> |
| 462 | + </td> |
| 463 | + </tr> |
| 464 | + <?php } ?> |
| 465 | + |
452 | 466 | <tr class="row_blank"> |
453 | 467 | <td class="cell_blank" colspan="3"> |
454 | 468 | |
— | — | @@ -514,6 +528,8 @@ |
515 | 529 | |
516 | 530 | $lang = $languages[0]; |
517 | 531 | |
| 532 | +$allLanguages = array_keys($wwLanguages); |
| 533 | + |
518 | 534 | $profiling['thesaurus'] = 0; |
519 | 535 | $profiling['pics'] = 0; |
520 | 536 | |
— | — | @@ -522,11 +538,11 @@ |
523 | 539 | try { |
524 | 540 | if ($lang && $conceptId) { |
525 | 541 | $mode = "concept"; |
526 | | - $result = $thesaurus->getConceptInfo($conceptId, $languages); |
| 542 | + $result = $thesaurus->getConceptInfo($conceptId, $allLanguages); |
527 | 543 | if ( $result ) $result = array( $result ); //hack |
528 | 544 | } else if ($lang && $term) { |
529 | 545 | $mode = "term"; |
530 | | - $result = $thesaurus->getConceptsForTerm($lang, $term, $languages, $norm, $limit); |
| 546 | + $result = $thesaurus->getConceptsForTerm($lang, $term, $allLanguages, $norm, $limit); |
531 | 547 | } |
532 | 548 | } catch (Exception $e) { |
533 | 549 | $error = $e->getMessage(); |
— | — | @@ -580,7 +596,7 @@ |
581 | 597 | |
582 | 598 | .row_images td { vertical-align: bottom; } |
583 | 599 | |
584 | | - .row_related td, .row_category, .row_narrower { font-size: small; background-color: #F0F7F9; } |
| 600 | + .row_related td, .row_category, .row_narrower, .row_pages { font-size: small; background-color: #F0F7F9; } |
585 | 601 | .row_blank td { font-size: small; } |
586 | 602 | |
587 | 603 | /* |
Index: trunk/WikiWord/WikiWord/src/main/php/common/wwimages.php |
— | — | @@ -410,6 +410,7 @@ |
411 | 411 | $images = new ImageCollection(); |
412 | 412 | |
413 | 413 | $globalImageList = $this->getImagesOnPagesGlobally($pages); //use wikis for $wwLanguages only |
| 414 | + |
414 | 415 | //TODO: sanity limit on number of images. $max * 5 ? |
415 | 416 | $globalImageUsage = $this->getGlobalUsageCounts($globalImageList, ".*wiki"); //use all wikipedias |
416 | 417 | |
— | — | @@ -417,7 +418,7 @@ |
418 | 419 | $m = @$usage['*max*']; |
419 | 420 | if ( $m >= $wwFrequentImageThreshold ) continue; |
420 | 421 | |
421 | | - foreach ($usage as $wiki => $c) { |
| 422 | + foreach ($usage as $wiki => $c) { //FIXME: only count usage on *RELEVANT* pages. |
422 | 423 | $images->addImageUsage($image, $wiki.":*", "article", 1); |
423 | 424 | } |
424 | 425 | } |
Index: trunk/WikiWord/WikiWord/src/main/php/config.sample.php |
— | — | @@ -42,28 +42,35 @@ |
43 | 43 | $wwFrequentImageThreshold = 10; |
44 | 44 | |
45 | 45 | $wwTagScores = array( |
46 | | - 'Category:Featured_pictures_on_Wikimedia_Commons' => 3, |
47 | | - 'Category:Featured_pictures_on_Wikipedia,_German' => 3, |
| 46 | + 'Category:Featured_pictures_on_Wikimedia_Commons' => 10, |
| 47 | + 'Category:Featured_pictures_on_Wikipedia,_German' => 10, |
48 | 48 | |
49 | | - 'Template:Former_featured_picture' => 2.8, |
| 49 | + 'Template:Former_featured_picture' => 6, |
50 | 50 | |
51 | | - 'Template:Media_of_the_day' => 2.5, |
52 | | - 'Template:Picture_of_the_day' => 2.5, |
| 51 | + 'Template:Media_of_the_day' => 10, |
| 52 | + 'Template:Picture_of_the_day' => 10, |
53 | 53 | |
54 | | - 'Category:Quality_images' => 2.0, |
| 54 | + 'Category:Quality_images' => 8, |
55 | 55 | |
56 | | - 'Category:Valued_image' => 1.4, |
57 | | - 'Category:Former_valued_images' => 1.3, |
58 | | - 'Category:Images_used_in_valued_image_sets' => 1.2, |
| 56 | + 'Category:Valued_image' => 8, |
| 57 | + 'Category:Former_valued_images' => 6, |
| 58 | + 'Category:Images_used_in_valued_image_sets' => 7, |
59 | 59 | |
60 | | - 'assessment:Media_of_the_day' => 2.5, |
61 | | - 'assessment:Picture_of_the_day' => 2.5, |
62 | | - 'assessment:Quality_image' => 2.0, |
63 | | - 'assessment:Featured_picture' => 3.0, |
| 60 | + 'assessment:Media_of_the_day' => 10, |
| 61 | + 'assessment:Picture_of_the_day' => 10, |
| 62 | + 'assessment:Picture_of_the_week' => 15, |
| 63 | + 'assessment:Picture_of_the_month' => 20, |
| 64 | + 'assessment:Picture_of_the_year' => 25, |
| 65 | + 'assessment:Quality_image' => 8, |
| 66 | + 'assessment:Featured_picture' => 15, |
64 | 67 | ); |
65 | 68 | |
| 69 | + |
66 | 70 | $wwLabelPatterns = array( |
67 | 71 | '/^assessment:.*_of_the_day([-_].*|$)/' => "PotD", |
| 72 | + '/^assessment:.*_of_the_week([-_].*|$)/' => "PotW", |
| 73 | + '/^assessment:.*_of_the_month([-_].*|$)/' => "PotM", |
| 74 | + '/^assessment:.*_of_the_year([-_].*|$)/' => "PotY", |
68 | 75 | '/^assessment:(Featured|Former_featured_picture).*/' => 'FP', |
69 | 76 | '/^assessment:Quiality.*/' => 'QI', |
70 | 77 | '/^assessment:(Valued|Former_valued_images|Images_used_in_valued_image_sets).*/' => 'VI', |