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 |
1 | 17 | + native |
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php |
— | — | @@ -16,7 +16,8 @@ |
17 | 17 | protected $possiblySynonymousRelationTypeId = 0; // Put this relation type in a special section "Possibly synonymous" |
18 | 18 | protected $showLanguageSelector = true; // Show language selector at the top of each wiki data page |
19 | 19 | protected $showClassicPageTitles = true; // Show classic page titles instead of prettier page titles |
20 | | - |
| 20 | + |
| 21 | + protected $propertyToColumnFilters = array(); |
21 | 22 | protected $viewInformation; |
22 | 23 | |
23 | 24 | // Show a panel to select expressions from available data-sets |
— | — | @@ -25,8 +26,9 @@ |
26 | 27 | public function __construct() { |
27 | 28 | global |
28 | 29 | $wgFilterLanguageId, $wgShowLanguageSelector, |
29 | | - $wgShowClassicPageTitles, $wgPossiblySynonymousRelationTypeId; |
30 | | - |
| 30 | + $wgShowClassicPageTitles, $wgPossiblySynonymousRelationTypeId, |
| 31 | + $wgPropertyToColumnFilters; |
| 32 | + |
31 | 33 | if (isset($wgFilterLanguageId)) |
32 | 34 | $this->filterLanguageId = $wgFilterLanguageId; |
33 | 35 | |
— | — | @@ -37,7 +39,10 @@ |
38 | 40 | $this->showClassicPageTitles = $wgShowClassicPageTitles; |
39 | 41 | |
40 | 42 | if (isset($wgPossiblySynonymousRelationTypeId)) |
41 | | - $this->possiblySynonymousRelationTypeId = $wgPossiblySynonymousRelationTypeId; |
| 43 | + $this->possiblySynonymousRelationTypeId = $wgPossiblySynonymousRelationTypeId; |
| 44 | + |
| 45 | + if (isset($wgPropertyToColumnFilters)) |
| 46 | + $this->propertyToColumnFilters = $wgPropertyToColumnFilters; |
42 | 47 | } |
43 | 48 | |
44 | 49 | function getLanguageSelector() { |
— | — | @@ -89,6 +94,7 @@ |
90 | 95 | $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
91 | 96 | $viewInformation->showRecordLifeSpan = false; |
92 | 97 | $viewInformation->queryTransactionInformation = $this->queryTransactionInformation; |
| 98 | + $viewInformation->setPropertyToColumnFilters($this->propertyToColumnFilters); |
93 | 99 | |
94 | 100 | $this->viewInformation = $viewInformation; |
95 | 101 | |
Index: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php |
— | — | @@ -15,8 +15,10 @@ |
16 | 16 | public $filterLanguageId; |
17 | 17 | public $possiblySynonymousRelationTypeId; |
18 | 18 | public $queryTransactionInformation; |
19 | | - public $showRecordLifeSpan; |
20 | | - |
| 19 | + public $showRecordLifeSpan; |
| 20 | + |
| 21 | + protected $propertyToColumnFilters; |
| 22 | + |
21 | 23 | public function __construct() { |
22 | 24 | $this->filterLanguageId = 0; |
23 | 25 | $this->possiblySynonymousRelationTypeId = 0; |
— | — | @@ -31,6 +33,10 @@ |
32 | 34 | public function filterOnLanguage() { |
33 | 35 | return $this->filterLanguageId != 0; |
34 | 36 | } |
| 37 | + |
| 38 | + public function setPropertyToColumnFilters(array $propertyToColumnFilters) { |
| 39 | + $this->propertyToColumnFilters = $propertyToColumnFilters; |
| 40 | + } |
35 | 41 | } |
36 | 42 | |
37 | 43 | ?> |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php |
— | — | @@ -118,7 +118,6 @@ |
119 | 119 | $wgDefinedMeaningPageTitlePrefix = ""; |
120 | 120 | $wgExpressionPageTitlePrefix = "Multiple meanings"; |
121 | 121 | |
122 | | - |
123 | 122 | // Search page |
124 | 123 | |
125 | 124 | global |
— | — | @@ -132,3 +131,20 @@ |
133 | 132 | $wgShowSearchWithinExternalIdentifiersOption = true; |
134 | 133 | $wgShowSearchWithinWordsOption = true; |
135 | 134 | |
| 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(); |