r23729 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23728‎ | r23729 | r23730 >
Date:11:11, 5 July 2007
Author:proes
Status:old
Tags:
Comment:
* Added hook for property to column filters on view page
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/PropertyToColumnFilter.php (added) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/PropertyToColumnFilter.php
@@ -0,0 +1,15 @@
 2+<?php
 3+
 4+class PropertyToColumnFilter {
 5+ public $identifier; // The identifier of the attribute that will be created
 6+ public $caption; // The caption of the attribute that will be created
 7+ public $attributeIDs; // Array containing the defined meaning ids of the attributes that should be filtered
 8+
 9+ public function __construct($identifier, $caption, array $attributeIDs) {
 10+ $this->identifier = $identifier;
 11+ $this->caption = $caption;
 12+ $this->attributeIDs = $attributeIDs;
 13+ }
 14+}
 15+
 16+?>
Property changes on: trunk/extensions/Wikidata/OmegaWiki/PropertyToColumnFilter.php
___________________________________________________________________
Added: svn:eol-style
117 + native
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -16,7 +16,8 @@
1717 protected $possiblySynonymousRelationTypeId = 0; // Put this relation type in a special section "Possibly synonymous"
1818 protected $showLanguageSelector = true; // Show language selector at the top of each wiki data page
1919 protected $showClassicPageTitles = true; // Show classic page titles instead of prettier page titles
20 -
 20+
 21+ protected $propertyToColumnFilters = array();
2122 protected $viewInformation;
2223
2324 // Show a panel to select expressions from available data-sets
@@ -25,8 +26,9 @@
2627 public function __construct() {
2728 global
2829 $wgFilterLanguageId, $wgShowLanguageSelector,
29 - $wgShowClassicPageTitles, $wgPossiblySynonymousRelationTypeId;
30 -
 30+ $wgShowClassicPageTitles, $wgPossiblySynonymousRelationTypeId,
 31+ $wgPropertyToColumnFilters;
 32+
3133 if (isset($wgFilterLanguageId))
3234 $this->filterLanguageId = $wgFilterLanguageId;
3335
@@ -37,7 +39,10 @@
3840 $this->showClassicPageTitles = $wgShowClassicPageTitles;
3941
4042 if (isset($wgPossiblySynonymousRelationTypeId))
41 - $this->possiblySynonymousRelationTypeId = $wgPossiblySynonymousRelationTypeId;
 43+ $this->possiblySynonymousRelationTypeId = $wgPossiblySynonymousRelationTypeId;
 44+
 45+ if (isset($wgPropertyToColumnFilters))
 46+ $this->propertyToColumnFilters = $wgPropertyToColumnFilters;
4247 }
4348
4449 function getLanguageSelector() {
@@ -89,6 +94,7 @@
9095 $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
9196 $viewInformation->showRecordLifeSpan = false;
9297 $viewInformation->queryTransactionInformation = $this->queryTransactionInformation;
 98+ $viewInformation->setPropertyToColumnFilters($this->propertyToColumnFilters);
9399
94100 $this->viewInformation = $viewInformation;
95101
Index: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php
@@ -15,8 +15,10 @@
1616 public $filterLanguageId;
1717 public $possiblySynonymousRelationTypeId;
1818 public $queryTransactionInformation;
19 - public $showRecordLifeSpan;
20 -
 19+ public $showRecordLifeSpan;
 20+
 21+ protected $propertyToColumnFilters;
 22+
2123 public function __construct() {
2224 $this->filterLanguageId = 0;
2325 $this->possiblySynonymousRelationTypeId = 0;
@@ -31,6 +33,10 @@
3234 public function filterOnLanguage() {
3335 return $this->filterLanguageId != 0;
3436 }
 37+
 38+ public function setPropertyToColumnFilters(array $propertyToColumnFilters) {
 39+ $this->propertyToColumnFilters = $propertyToColumnFilters;
 40+ }
3541 }
3642
3743 ?>
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -118,7 +118,6 @@
119119 $wgDefinedMeaningPageTitlePrefix = "";
120120 $wgExpressionPageTitlePrefix = "Multiple meanings";
121121
122 -
123122 // Search page
124123
125124 global
@@ -132,3 +131,20 @@
133132 $wgShowSearchWithinExternalIdentifiersOption = true;
134133 $wgShowSearchWithinWordsOption = true;
135134
 135+// Annotation to column filtering
 136+
 137+require_once("PropertyToColumnFilter.php");
 138+
 139+global
 140+ $wgPropertyToColumnFilters;
 141+
 142+/**
 143+ * $wgPropertyToColumnFilters is an array of property to column filters
 144+ *
 145+ * Example:
 146+ * $wgPropertyToColumnFilters = array(
 147+ * new PropertyToColumnFilter("references", "References", array(1000, 2000, 3000)) // Defined meaning ids are the attribute ids to filter
 148+ * )
 149+ *
 150+ */
 151+$wgPropertyToColumnFilters = array();

Status & tagging log