r22426 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22425‎ | r22426 | r22427 >
Date:14:07, 25 May 2007
Author:kim
Status:old
Tags:
Comment:
adding concept support in UI (halfway done)
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php
@@ -128,6 +128,36 @@
129129
130130 return $prefix . definedMeaningExpression($this->getDefinedMeaningIdFromTitle($wgTitle->getText()));
131131 }
 132+
 133+ public function getDefinedMeaningId() {
 134+ return $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
 135+ }
 136+ /** cut and paste getDataSetPanel with mods for Collection instead
 137+ * Potential refactor candidate!
 138+ */
 139+ protected function getConceptPanel() {
 140+ global $wgTitle, $wgUser;
 141+ $dm=$this->getDefinedMeaningId();
 142+ $dc=wdGetDataSetContext();
 143+ $ow_datasets="Concept Panel";
 144+
 145+ $html="<div class=\"dataset-panel\">";;
 146+ $html.="<table border=\"0\"><tr><th class=\"dataset-panel-heading\">$ow_datasets</th></tr>";
 147+ $dataSets=getDataSetsAssociatedByConcept($dm,$dc);
 148+ $sk=$wgUser->getSkin();
 149+ foreach ($dataSets as $dataset) {
 150+ $active=($dataset->getPrefix()==$dc->getPrefix());
 151+ $name=$dataset->fetchName();
 152+ $prefix=$dataset->getPrefix();
 153+
 154+ $class= $active ? 'dataset-panel-active' : 'dataset-panel-inactive';
 155+ $slot = $active ? "$name" : $sk->makeLinkObj($wgTitle,$name,"dataset=$prefix");
 156+ $html.="<tr><td class=\"$class\">$slot</td></tr>";
 157+ }
 158+ $html.="</table>";
 159+ $html.="</div>";
 160+ return $html;
 161+ }
132162 }
133163
134164 ?>
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php
@@ -1185,4 +1185,16 @@
11861186 return readConceptMapping($concept_id);
11871187 }
11881188
 1189+function &getDataSetsAssociatedByConcept($dm, $dc) {
 1190+ $map=getAssociatedByConcept($dm, $dc);
 1191+ $Sets=wdGetDataSets()
 1192+ $newSets=array();
 1193+ foreach ($map as $map_dc => $map_dm) {
 1194+ $dataset=$Sets[$map_dc];
 1195+ $dataset->setDefinedMeaningId($map_dm);
 1196+ $newSets[$map_dc]=$dataset
 1197+ }
 1198+ return $newSets;
 1199+}
 1200+
11891201 ?>