r14538 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14537‎ | r14538 | r14539 >
Date:14:18, 2 June 2006
Author:proes
Status:old
Tags:
Comment:
Improved appearance of suggestion links
Modified paths:
  • /trunk/extensions/Wikidata/WiktionaryZ/WiktionaryZ.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/forms.php (modified) (history)
  • /trunk/extensions/Wikidata/WiktionaryZ/tmp/suggest.css (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/WiktionaryZ/WiktionaryZ.php
@@ -158,14 +158,6 @@
159159
160160 }
161161
162 - function getExpressionForMeaningId($mid, $langcode) {
163 - $dbr =& wfGetDB(DB_SLAVE);
164 - $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";
165 - $sp_res=$dbr->query($sql);
166 - $sp_row=$dbr->fetchObject($sp_res);
167 - return $sp_row->spelling;
168 - }
169 -
170162 function saveForm($sectionArguments) {
171163 global
172164 $wgTitle;
@@ -485,7 +477,7 @@
486478
487479 function getAddRelationsFormFields($definedMeaningId) {
488480 return '<h4>Add relation</h4>
489 - <table>
 481+ <table class="wiki-data-table">
490482 <tr><th>Relation type</th><th>Other defined meaning</th></tr>
491483 <tr><td>' . $this->getRelationTypeSuggest($definedMeaningId) . '</td><td>' . $this->getDefinedMeaningSuggest($definedMeaningId) . '</td></tr>
492484 </table>';
@@ -609,7 +601,7 @@
610602 $att_res=$dbr->query("select member_mid from uw_collection_contents where collection_id=$cid and is_latest_set=1");
611603 while($att_row=$dbr->fetchObject($att_res)) {
612604 # fixme hardcoded English
613 - $att_name=$this->getExpressionForMid($att_row->member_mid, 85);
 605+ $att_name=$this->getExpressionForMeaningId($att_row->member_mid, 85);
614606 $atts[$att_row->member_mid]=$att_name;
615607 }
616608 }
@@ -622,22 +614,21 @@
623615 $col_res=$dbr->query("select collection_id,collection_mid from uw_collection_ns where collection_type=".$dbr->addQuotes($type)." and is_latest=1");
624616 while($col_row=$dbr->fetchObject($col_res)) {
625617 # fixme hardcoded English
626 - $collection_name=$this->getExpressionForMid($col_row->collection_mid,85);
 618+ $collection_name=$this->getExpressionForMeaningId($col_row->collection_mid,85);
627619 $typecollections[$collection_name]=$col_row->collection_id;
628620 }
629621 return $typecollections;
630622
631623 }
632624
633 - function getExpressionForMid($mid,$langcode) {
 625+ function getExpressionForMeaningId($mid, $langcode) {
634626 $dbr =& wfGetDB(DB_SLAVE);
635627 $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";
636628 $sp_res=$dbr->query($sql);
637629 $sp_row=$dbr->fetchObject($sp_res);
638630 return $sp_row->spelling;
639 - #return $sql;
640631 }
641 -
 632+
642633 function addRelationFromRequest($definedMeaningId) {
643634 global
644635 $wgRequest;
Index: trunk/extensions/Wikidata/WiktionaryZ/tmp/suggest.css
@@ -6,6 +6,26 @@
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+
1030 .suggestion-row {
1131 padding: 0px;
1232 margin: 0px;
Index: trunk/extensions/Wikidata/WiktionaryZ/forms.php
@@ -45,7 +45,7 @@
4646 global
4747 $dbr;
4848
49 - $result = '<div class="suggest"><input type="hidden" id="'. $name .'-suggest-query" value="'. $query .'"/><input type="hidden" id="'. $name .'" name="'. $name .'" value=""/><a id="'. $name .'-suggest-link" href="#'. $name .'-suggest-div" onclick="suggestLinkClicked(this);" title="Click to change selection">No selection</a></div>'.
 49+ $result = '<div class="suggest"><input type="hidden" id="'. $name .'-suggest-query" value="'. $query .'"/><input type="hidden" id="'. $name .'" name="'. $name .'" value=""/><a id="'. $name .'-suggest-link" class="suggest-link" href="#'. $name .'-suggest-div" onclick="suggestLinkClicked(this);" title="Click to change selection">No selection</a></div>'.
5050 '<div style="position: relative"><div id="'. $name .'-suggest-div" style="position: absolute; left: 0px; top: 0px; border: 1px solid #000000; display: none; background-color: white; padding: 4px">' .
5151 '<div><table><tr><td><input type="text" id="'. $name .'-suggest-text" autocomplete="off" onkeyup="suggestTextChanged(this)" style="width: 300px"></input></td><td><a id="'. $name .'-suggest-close" href="#'. $name . 'suggest-link" onclick="suggestCloseClicked(this)">[X]</a></td></tr></table></div>' .
5252 '<div><table id="'. $name .'-suggest-table"><tr><td></td></tr></table></div>'.

Status & tagging log