r14593 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14592‎ | r14593 | r14594 >
Date:09:31, 6 June 2006
Author:proes
Status:old
Tags:
Comment:
Display WiktionaryZ data in tables. Added possibility to add attributes. Improved style sheet for suggestions.
Modified paths:
  • /trunk/extensions/Wikidata/WiktionaryZ/Suggest.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/WiktionaryZ.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/forms.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/table.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/tmp/suggest.css (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/tmp/tables.css (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/type.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/wikidata.php (added) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/WiktionaryZ/WiktionaryZ.php
@@ -1,5 +1,6 @@
22 <?php
33
 4+require_once('wikidata.php');
45 require_once('Expression.php');
56 require_once('forms.php');
67 require_once('table.php');
@@ -34,7 +35,6 @@
3536 $synonymAndTranslationTables = $this->getSynonymAndTranslationTables($definedMeaningIds, $expressionId);
3637 $definedMeaningTexts = $this->getDefinedMeaningTexts($definedMeaningIds);
3738 $alternativeMeaningTexts = $this->getAlternativeMeaningTexts($definedMeaningIds);
38 - $definedMeaningRelations = $this->getDefinedMeaningRelations($definedMeaningIds);
3939
4040 $wgOut->addHTML($skin->editSectionLink($wgTitle, $expressionId));
4141 $wgOut->addHTML("<h2><i>Spelling</i>: $row->spelling - <i>Language:</i> ".$wgLanguageNames[$row->language_id]. "</h2>");
@@ -57,45 +57,11 @@
5858 }
5959
6060 $wgOut->addHTML('<div class="wiki-data-blocks">');
61 - $wgOut->addHTML('<div class="wiki-data-block">');
62 - $wgOut->addHTML('<h4>Translations and synonyms</h4>');
63 - $wgOut->addHTML(getTableAsHTML($synonymAndTranslationTables[$definedMeaningId]));
64 - $wgOut->addHTML('</div>');
65 -
66 - $wgOut->addHTML('<div class="wiki-data-block">');
67 - $wgOut->addHTML('<h4>Relations</h4>');
68 - $relations = $definedMeaningRelations[$definedMeaningId];
69 - foreach($relations as $type => $rellist) {
70 - $wgOut->addHTML("<p>$typenames[$type]:</p>");
71 - $wgOut->addHTML("<ul>");
72 - foreach($rellist as $rel) {
73 - $rs_res=$dbr->query("SELECT expression_id from uw_defined_meaning where defined_meaning_id=".$rel." LIMIT 1");
74 - $rs_row=$dbr->fetchObject($rs_res);
75 - if($rs_row->expression_id) {
76 - $li_res=$dbr->query("SELECT spelling from uw_expression_ns where expression_id=".$rs_row->expression_id);
77 - $li_row=$dbr->fetchObject($li_res);
78 - $wgOut->addHTML("<li>". $skin->makeLink("WiktionaryZ:".$li_row->spelling, $li_row->spelling) ."</li>");
79 - }
80 - }
81 - $wgOut->addHTML("</ul>");
82 - }
83 - $wgOut->addHTML('</div>');
 61+ addWikiDataBlock("Translations and synonyms", getTableAsHTML($synonymAndTranslationTables[$definedMeaningId]));
 62+ addWikiDataBlock("Relations", getTableAsHTML($this->getDefinedMeaningRelationsTable($definedMeaningId)));
 63+ addWikiDataBlock("Attributes", getTableAsHTML($this->getDefinedMeaningAttributesTable($definedMeaningId)));
8464
85 - $wgOut->addHTML('<div class="wiki-data-block">');
86 - $wgOut->addHTML('<h4>Attributes</h4>');
87 - $attributes = $attributesPerDefinedMeaning[$definedMeaningId];
88 -
89 - if (count($attributes) > 0) {
90 - $wgOut->addHTML('<ul>');
91 - foreach($attributes as $attribute) {
92 - $attributeName = $attnames[$attribute];
93 - $wgOut->addHTML("<li>". $skin->makeLink("WiktionaryZ:".$attributeName, $attributeName) ."</li>");
94 - }
95 - $wgOut->addHTML('</ul>');
96 - }
97 -
9865 $wgOut->addHTML('</div>');
99 - $wgOut->addHTML('</div>');
10066 $wgOut->addHTML('<div class="clear-float"/>');
10167 $wgOut->addHTML('</li>');
10268 }
@@ -119,15 +85,15 @@
12086 }
12187
12288 function getRelationTypeSuggest($definedMeaningId) {
123 - return getSuggest("new-relation-type-$definedMeaningId",
124 - "relation-type",
125 - "member_mid", "spelling");
 89+ return getSuggest("new-relation-type-$definedMeaningId", "relation-type");
12690 }
12791
 92+ function getAttributeSuggest($definedMeaningId) {
 93+ return getSuggest("new-attribute-$definedMeaningId", "attribute");
 94+ }
 95+
12896 function getDefinedMeaningSuggest($definedMeaningId) {
129 - return getSuggest("new-relation-other-meaning-$definedMeaningId",
130 - "defined-meaning",
131 - "member_mid", "spelling");
 97+ return getSuggest("new-relation-other-meaning-$definedMeaningId", "defined-meaning");
13298 }
13399
134100 function getRelationTypes() {
@@ -206,9 +172,12 @@
207173 $this->setText($textId, $definition);
208174 }
209175
210 - $this->addTranslatedDefinitionFromRequest($definedMeaningId, $definedMeaningTextId, getRevisionForExpressionId($expressionId), array_keys($translatedContents));
 176+ if (count($translatedContents))
 177+ $this->addTranslatedDefinitionFromRequest($definedMeaningId, $definedMeaningTextId, getRevisionForExpressionId($expressionId), array_keys($translatedContents));
 178+
211179 $this->addSynonymsOrTranslationsFromRequest($definedMeaningId);
212180 $this->addRelationFromRequest($definedMeaningId);
 181+ $this->addAttributeFromRequest($definedMeaningId);
213182 }
214183
215184 function edit() {
@@ -302,20 +271,18 @@
303272 getTextArea("definition-$textId", $this->getText($textId)));
304273 }
305274
306 - $wgOut->addHTML('<div><i>Translate into</i>: '.
307 - $this->getLanguageSelect("translated-definition-language-$definedMeaningId", array_keys($translatedContents)).'</div>'.
308 - getTextArea("translated-definition-$definedMeaningId"));
 275+ if (count($translatedContents) > 0) {
 276+ $wgOut->addHTML('<div><i>Translate into</i>: '.
 277+ $this->getLanguageSelect("translated-definition-language-$definedMeaningId", array_keys($translatedContents)).'</div>'.
 278+ getTextArea("translated-definition-$definedMeaningId"));
 279+ }
309280
310281 $wgOut->addHTML('<div class="wiki-data-blocks">');
311 - $wgOut->addHTML('<div class="wiki-data-block">');
312 - $wgOut->addHTML('<h4>Translations and synonyms</h4>');
313 - $wgOut->addHTML(getTableAsEditHTML($synonymAndTranslationTable, "add-translation-synonym-$definedMeaningId", $this->getAddTranslationsAndSynonymsRowFields($definedMeaningId), true));
 282+ addWikiDataBlock("Translations and synonyms", getTableAsEditHTML($synonymAndTranslationTable, "add-translation-synonym-$definedMeaningId", $this->getAddTranslationsAndSynonymsRowFields($definedMeaningId), true));
 283+ addWikiDataBlock("Relations", getTableAsEditHTML($this->getDefinedMeaningRelationsTable($definedMeaningId), "", array($this->getRelationTypeSuggest($definedMeaningId), $this->getDefinedMeaningSuggest($definedMeaningId)), false));
 284+ addWikiDataBlock("Attributes", getTableAsEditHTML($this->getDefinedMeaningAttributesTable($definedMeaningId), "", array($this->getAttributeSuggest($definedMeaningId)), false));
314285 $wgOut->addHTML('</div>');
315 -
316 - $wgOut->addHTML('<div class="wiki-data-block">');
317 - $wgOut->addHTML($this->getAddRelationsFormFields($definedMeaningId));
318 - $wgOut->addHTML('</div>');
319 - $wgOut->addHTML('</div>');
 286+
320287 $wgOut->addHTML('<div class="clear-float"/>');
321288 }
322289
@@ -425,6 +392,33 @@
426393 return $result;
427394 }
428395
 396+ function getDefinedMeaningRelationsTable($definedMeaningId) {
 397+ $attributes = array(new Attribute("Relation type", "defined-meaning"), new Attribute("Other defined meaning", "defined-meaning"));
 398+ $table = new ArrayTable($attributes);
 399+
 400+ $dbr =& wfGetDB(DB_SLAVE);
 401+ $queryResult = $dbr->query("SELECT relationtype_mid, meaning2_mid from uw_meaning_relations where meaning1_mid=$definedMeaningId and relationtype_mid!=0 and is_latest_set=1 ORDER BY relationtype_mid");
 402+
 403+ while($definedMeaningRelation = $dbr->fetchObject($queryResult))
 404+ $table->addRow(array($this->getExpressionForMeaningId($definedMeaningRelation->relationtype_mid, 85),
 405+ $this->getExpressionForMeaningId($definedMeaningRelation->meaning2_mid, 85)));
 406+
 407+ return $table;
 408+ }
 409+
 410+ function getDefinedMeaningAttributesTable($definedMeaningId) {
 411+ $attributes = array(new Attribute("Attribute", "defined-meaning"));
 412+ $table = new ArrayTable($attributes);
 413+
 414+ $dbr =& wfGetDB(DB_SLAVE);
 415+ $queryResult = $dbr->query("SELECT relationtype_mid, meaning2_mid from uw_meaning_relations where meaning1_mid=$definedMeaningId and relationtype_mid=0 and is_latest_set=1");
 416+
 417+ while($attribute = $dbr->fetchObject($queryResult))
 418+ $table->addRow(array($this->getExpressionForMeaningId($attribute->meaning2_mid, 85)));
 419+
 420+ return $table;
 421+ }
 422+
429423 function getDefinedMeaningRelations($definedMeaningIds) {
430424 $dbr =& wfGetDB(DB_SLAVE);
431425 $definedMeaningRelations = array();
@@ -475,14 +469,6 @@
476470 return array($this->getLanguageSelect("language-$definedMeaningId"), getTextBox("spelling-$definedMeaningId"), getCheckBox("endemic-meaning-$definedMeaningId", true));
477471 }
478472
479 - function getAddRelationsFormFields($definedMeaningId) {
480 - return '<h4>Add relation</h4>
481 - <table class="wiki-data-table">
482 - <tr><th>Relation type</th><th>Other defined meaning</th></tr>
483 - <tr><td>' . $this->getRelationTypeSuggest($definedMeaningId) . '</td><td>' . $this->getDefinedMeaningSuggest($definedMeaningId) . '</td></tr>
484 - </table>';
485 - }
486 -
487473 function getTranslationIdsForDefinedMeaning($definedMeaningId) {
488474 $dbr =& wfGetDB(DB_SLAVE);
489475 $queryResult = $dbr->query("SELECT * from text where old_id=$textId");
@@ -622,11 +608,26 @@
623609 }
624610
625611 function getExpressionForMeaningId($mid, $langcode) {
 612+// $dbr =& wfGetDB(DB_SLAVE);
 613+// $sql="SELECT spelling from uw_syntrans,uw_expression_ns where defined_meaning_id=".$mid." and uw_expression_ns.expression_id=uw_syntrans.expression_id and uw_expression_ns.language_id=".$langcode." limit 1";
 614+// $sp_res=$dbr->query($sql);
 615+// $sp_row=$dbr->fetchObject($sp_res);
 616+// return $sp_row->spelling;
 617+ $expressions = $this->getExpressionsForDefinedMeaningIds(array($mid));
 618+ return $expressions[$mid];
 619+ }
 620+
 621+ # Fixme, the following function only returns English expressions
 622+ # Should be expressions in the language of preference, with an appropriate fallback scheme
 623+ function getExpressionsForDefinedMeaningIds($definedMeaningIds) {
626624 $dbr =& wfGetDB(DB_SLAVE);
627 - $sql="SELECT spelling from uw_syntrans,uw_expression_ns where defined_meaning_id=".$mid." and uw_expression_ns.expression_id=uw_syntrans.expression_id and uw_expression_ns.language_id=".$langcode." limit 1";
628 - $sp_res=$dbr->query($sql);
629 - $sp_row=$dbr->fetchObject($sp_res);
630 - return $sp_row->spelling;
 625+ $queryResult = $dbr->query("SELECT defined_meaning_id, spelling from uw_syntrans, uw_expression_ns where defined_meaning_id in (". implode(",", $definedMeaningIds) . ") and uw_expression_ns.expression_id=uw_syntrans.expression_id and uw_expression_ns.language_id=85");
 626+ $expressions = array();
 627+
 628+ while ($expression = $dbr->fetchObject($queryResult))
 629+ $expressions[$expression->defined_meaning_id] = $expression->spelling;
 630+
 631+ return $expressions;
631632 }
632633
633634 function addRelationFromRequest($definedMeaningId) {
@@ -640,6 +641,16 @@
641642 $this->addRelation($definedMeaningId, $relationTypeId, $otherDefinedMeaningId);
642643 }
643644
 645+ function addAttributeFromRequest($definedMeaningId) {
 646+ global
 647+ $wgRequest;
 648+
 649+ $attributeId = $wgRequest->getInt("new-attribute-$definedMeaningId");
 650+
 651+ if ($attributeId != 0)
 652+ $this->addRelation($definedMeaningId, 0, $attributeId);
 653+ }
 654+
644655 function getSetIdForDefinedMeaningRelations($definedMeaningId) {
645656 $dbr =& wfGetDB(DB_SLAVE);
646657 $sql = "SELECT set_id from uw_meaning_relations where meaning1_mid=$definedMeaningId and is_latest_set=1 limit 1";
Index: trunk/extensions/Wikidata/WiktionaryZ/tmp/tables.css
@@ -4,53 +4,42 @@
55 skins/common/common.css
66 */
77
8 -/* Wikidata blocks */
9 -
10 -.clear-float {
11 - clear: both;
12 -}
13 -
14 -.wiki-data-blocks .wiki-data-block {
15 - display: inline;
16 - float: left;
17 - margin: 4px;
18 -}
19 -
20 -/* Wikidata tables */
21 -
22 -.wiki-data-table td, .wiki-data-table th {
23 - padding-top: 0px;
24 - padding-bottom: 0px;
25 - padding-left: 2px;
26 - padding-right: 2px;
27 - margin: 0px;
28 - border: none;
29 -}
30 -
31 -.wiki-data-table th {
32 - background-color: #EEEEEE;
33 -}
34 -
35 -.wiki-data-table td.column-odd {
36 - background-color: #F6F6F6;
37 -}
38 -
39 -.boolean {
40 - text-align: center;
41 -}
42 -
43 -.text {
44 - text-align: left;
45 -}
46 -
47 -.spelling {
48 - text-align: left;
49 -}
50 -
51 -.language {
52 - text-align: left;
53 -}
54 -
55 -td.language {
56 - font-style: italic;
 8+/* Wikidata blocks */
 9+
 10+.clear-float {
 11+ clear: both;
 12+}
 13+
 14+.wiki-data-blocks .wiki-data-block {
 15+ display: inline;
 16+ float: left;
 17+ margin: 4px;
 18+}
 19+
 20+/* Wikidata tables */
 21+
 22+.wiki-data-table td, .wiki-data-table th {
 23+ padding-top: 0px;
 24+ padding-bottom: 0px;
 25+ padding-left: 2px;
 26+ padding-right: 2px;
 27+ margin: 0px;
 28+ border: none;
 29+}
 30+
 31+.wiki-data-table th {
 32+ background-color: #EEEEEE;
 33+ text-align: left;
 34+}
 35+
 36+.wiki-data-table td.column-odd {
 37+ background-color: #F6F6F6;
 38+}
 39+
 40+.boolean {
 41+ text-align: center;
 42+}
 43+
 44+td.language {
 45+ font-style: italic;
5746 }
\ No newline at end of file
Index: trunk/extensions/Wikidata/WiktionaryZ/tmp/suggest.css
@@ -6,37 +6,38 @@
77
88 /* Suggestion control */
99
10 -.wiki-data-table td .suggest-link {
11 - display: block;
12 -}
13 -
14 -.suggest-link {
15 - border-width: 1px;
16 - border-style: solid;
17 - border-color: #7F9DB9;
18 - padding-left: 4px;
19 - padding-right: 4px;
20 - padding-top: 1px;
21 - padding-bottom: 0px;
22 -}
23 -
24 -.suggest-link, .suggest-link:hover, .suggest-link:active, .suggest-link:visited {
25 - color: #000000;
26 - text-decoration: none;
27 - white-space: nowrap;
28 -}
29 -
 10+.wiki-data-table td .suggest-link {
 11+ display: block;
 12+ background-color: #FFFFFF;
 13+}
 14+
 15+.suggest-link {
 16+ border-width: 1px;
 17+ border-style: solid;
 18+ border-color: #7F9DB9;
 19+ padding-left: 4px;
 20+ padding-right: 4px;
 21+ padding-top: px;
 22+ padding-bottom: 1px;
 23+}
 24+
 25+.suggest-link,.suggest-link:hover,.suggest-link:active,.suggest-link:visited {
 26+ color: #000000;
 27+ text-decoration: none;
 28+ white-space: nowrap;
 29+}
 30+
3031 .suggestion-row {
3132 padding: 0px;
3233 margin: 0px;
3334 }
3435
35 -.suggestion-row.active {
 36+.suggestion-row .active {
3637 background-color: #DDDDDD;
3738 cursor: pointer;
3839 }
3940
40 -.suggestion-row.inactive {
 41+.suggestion-row .inactive {
4142 background-color: #FFFFFF;
4243 }
4344
Index: trunk/extensions/Wikidata/WiktionaryZ/wikidata.php
@@ -0,0 +1,11 @@
 2+<?php
 3+ function addWikiDataBlock($title, $content) {
 4+ global
 5+ $wgOut;
 6+
 7+ $wgOut->addHTML('<div class="wiki-data-block">
 8+ <h4>'. $title . '</h4>'.
 9+ $content .
 10+ '</div>');
 11+ }
 12+?>
Index: trunk/extensions/Wikidata/WiktionaryZ/Suggest.php
@@ -22,17 +22,20 @@
2323 $searchCondition = "";
2424
2525 if ($query == 'relation-type')
26 - $sql = "select member_mid as row_id, expression1.spelling as relation, expression2.spelling as collection " .
27 - "from uw_collection_contents, uw_collection_ns, uw_syntrans syntrans1, uw_expression_ns expression1, uw_syntrans syntrans2, uw_expression_ns expression2 " .
28 - "where uw_collection_contents.collection_id=uw_collection_ns.collection_id and uw_collection_ns.collection_type='RELT' " .
29 -
30 - "and syntrans1.defined_meaning_id=uw_collection_contents.member_mid " .
31 - "and expression1.expression_id=syntrans1.expression_id and expression1.language_id=85 " .
32 -
33 - "and syntrans2.defined_meaning_id=uw_collection_ns.collection_mid " .
34 - "and expression2.expression_id=syntrans2.expression_id and expression2.language_id=85 " .
35 -
36 - "and uw_collection_contents.is_latest_set=1 ";
 26+// $sql = "select member_mid as row_id, expression1.spelling as relation, expression2.spelling as collection " .
 27+// "from uw_collection_contents, uw_collection_ns, uw_syntrans syntrans1, uw_expression_ns expression1, uw_syntrans syntrans2, uw_expression_ns expression2 " .
 28+// "where uw_collection_contents.collection_id=uw_collection_ns.collection_id and uw_collection_ns.collection_type='RELT' " .
 29+//
 30+// "and syntrans1.defined_meaning_id=uw_collection_contents.member_mid " .
 31+// "and expression1.expression_id=syntrans1.expression_id and expression1.language_id=85 " .
 32+//
 33+// "and syntrans2.defined_meaning_id=uw_collection_ns.collection_mid " .
 34+// "and expression2.expression_id=syntrans2.expression_id and expression2.language_id=85 " .
 35+//
 36+// "and uw_collection_contents.is_latest_set=1 ";
 37+ $sql = getSQLForCollectionOfType('RELT');
 38+ else if ($query == 'attribute')
 39+ $sql = getSQLForCollectionOfType('ATTR');
3740 else if ($query == 'defined-meaning')
3841 $sql = "select syntrans1.defined_meaning_id as row_id, expression1.spelling as relation ".
3942 "from uw_expression_ns expression1, uw_syntrans syntrans1 ".
@@ -49,4 +52,18 @@
5053 echo('<tr id="'. $row['row_id'] .'" class="suggestion-row inactive" onclick="suggestRowClicked(this)" onmouseover="mouseOverRow(this)" onmouseout="mouseOutRow(this)"><td>' . $row['relation'] . '</td><td>'. $row['collection'] .'</td></tr>');
5154
5255 echo('</table>');
 56+
 57+ function getSQLForCollectionOfType($collectionType) {
 58+ return "select member_mid as row_id, expression1.spelling as relation, expression2.spelling as collection " .
 59+ "from uw_collection_contents, uw_collection_ns, uw_syntrans syntrans1, uw_expression_ns expression1, uw_syntrans syntrans2, uw_expression_ns expression2 " .
 60+ "where uw_collection_contents.collection_id=uw_collection_ns.collection_id and uw_collection_ns.collection_type='$collectionType' " .
 61+
 62+ "and syntrans1.defined_meaning_id=uw_collection_contents.member_mid " .
 63+ "and expression1.expression_id=syntrans1.expression_id and expression1.language_id=85 " .
 64+
 65+ "and syntrans2.defined_meaning_id=uw_collection_ns.collection_mid " .
 66+ "and expression2.expression_id=syntrans2.expression_id and expression2.language_id=85 " .
 67+
 68+ "and uw_collection_contents.is_latest_set=1 ";
 69+ }
5370 ?>
Index: trunk/extensions/Wikidata/WiktionaryZ/type.php
@@ -34,6 +34,7 @@
3535 switch($type) {
3636 case "boolean": return booleanAsHTML($value);
3737 case "spelling": return spellingAsLink($value);
 38+ case "defined-meaning": return spellingAsLink($value);
3839 case "language": return languageIdAsText($value);
3940 default: return $value;
4041 }
Index: trunk/extensions/Wikidata/WiktionaryZ/forms.php
@@ -1,35 +1,28 @@
22 <?php
3 -/*
4 - * Created on May 5, 2006
5 - *
6 - * To change the template for this generated file go to
7 - * Window - Preferences - PHPeclipse - PHP - Code Templates
8 - */
 3+function getTextBox($name, $maximumLength = 255, $value = "") {
 4+ return '<input type="text" name="'. $name .'" value="'. $value .'" maxlength="'. $maximumLength .'"/>';
 5+}
96
10 - function getTextBox($name, $maximumLength = 255, $value = "") {
11 - return '<input type="text" name="'. $name .'" value="'. $value .'" maxlength="'. $maximumLength .'"/>';
12 - }
 7+function getTextArea($name, $text = "", $rows = 5, $columns = 80) {
 8+ return '<textarea name="'.$name. '" rows="'. $rows . '" cols="'. $columns . '">' . htmlspecialchars($text) . '</textarea>';
 9+}
1310
14 - function getTextArea($name, $text = "", $rows = 5, $columns = 80) {
15 - return '<textarea name="'.$name. '" rows="'. $rows . '" cols="'. $columns . '">' . htmlspecialchars($text) . '</textarea>';
16 - }
 11+function getCheckBox($name, $isChecked) {
 12+ if ($isChecked)
 13+ $checked = ' checked="checked"';
 14+ else
 15+ $checked = '';
1716
18 - function getCheckBox($name, $isChecked) {
19 - if ($isChecked)
20 - $checked = ' checked="checked"';
21 - else
22 - $checked = '';
23 -
24 - return '<input type="checkbox" name="'. $name .'"'. $checked . '/>';
25 - }
 17+ return '<input type="checkbox" name="'. $name .'"'. $checked . '/>';
 18+}
2619
27 - # $options is an array of [value => text] pairs
28 - function getSelect($name, $options, $selectedValue="") {
29 - $result = '<select name="'. $name . '">';
 20+# $options is an array of [value => text] pairs
 21+function getSelect($name, $options, $selectedValue="") {
 22+ $result = '<select name="'. $name . '">';
3023
31 - asort($options);
32 -
33 - foreach($options as $value => $text) {
 24+ asort($options);
 25+
 26+ foreach($options as $value => $text) {
3427 if ($value == $selectedValue)
3528 $selected = ' selected="selected"';
3629 else
@@ -37,11 +30,11 @@
3831
3932 $result .= '<option value="'. $value .'"'. $selected .'>'. htmlspecialchars($text) . '</option>';
4033 }
41 -
 34+
4235 return $result . '</select>';
4336 }
4437
45 -function getSuggest($name, $query, $idField, $labelField) {
 38+function getSuggest($name, $query) {
4639 global
4740 $dbr;
4841
Index: trunk/extensions/Wikidata/WiktionaryZ/table.php
@@ -106,19 +106,8 @@
107107
108108 $result .= '</tr>';
109109
110 - for($i = 0; $i < $tableModel->getRowCount(); $i++) {
111 -// $result .= '<tr>';
112 -// $j = 0;
113 -//
114 -// foreach($tableModel->getRow($i) as $cell) {
115 -// $type = $attributes[$j]->type;
116 -// $result .= '<td class="'. $type .' column-'. parityClass($j) . '">'. convertToHTML($cell, $type) . '</td>';
117 -// $j++;
118 -// }
119 -//
120 -// $result .= '</tr>';
 110+ for($i = 0; $i < $tableModel->getRowCount(); $i++)
121111 $result .= '<tr>' . getTableCellsAsHTML($attributes, convertValuesToHTML($attributes, $tableModel->getRow($i))) .'</tr>';
122 - }
123112
124113 $result .= '</table>';
125114

Status & tagging log