Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWiki.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | $spelling = $wgTitle->getText(); |
31 | 31 | |
32 | 32 | $wgOut->addHTML( |
33 | | - getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, $this->shouldShowAuthorities)->view( |
| 33 | + getExpressionsEditor($spelling, $this->viewInformation)->view( |
34 | 34 | $this->getIdStack(), |
35 | 35 | getExpressionsRecordSet($spelling, $this->viewInformation) |
36 | 36 | ) |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | $spelling = $wgTitle->getText(); |
49 | 49 | |
50 | 50 | $wgOut->addHTML( |
51 | | - getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view( |
| 51 | + getExpressionsEditor($spelling, $this->viewInformation)->view( |
52 | 52 | $this->getIdStack(), |
53 | 53 | getExpressionsRecordSet($spelling, $this->viewInformation) |
54 | 54 | ) |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | |
67 | 67 | $spelling = $wgTitle->getText(); |
68 | 68 | |
69 | | - getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save( |
| 69 | + getExpressionsEditor($spelling, $this->viewInformation)->save( |
70 | 70 | $this->getIdStack(), |
71 | 71 | getExpressionsRecordSet($spelling, $this->viewInformation) |
72 | 72 | ); |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | $spelling = $wgTitle->getText(); |
83 | 83 | |
84 | 84 | $wgOut->addHTML( |
85 | | - getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->edit( |
| 85 | + getExpressionsEditor($spelling, $this->viewInformation)->edit( |
86 | 86 | $this->getIdStack(), |
87 | 87 | getExpressionsRecordSet($spelling, $this->viewInformation) |
88 | 88 | ) |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php |
— | — | @@ -46,12 +46,16 @@ |
47 | 47 | } |
48 | 48 | |
49 | 49 | /*horrible cannibalised hack. Use at own risk*/ |
| 50 | + /* Sorry, don't know what horrible cannibalised hacks are. Therefore I cannot update code properly. |
| 51 | + * Please check if it still works correctly. Peter-Jan Roes. |
| 52 | + */ |
50 | 53 | public function save() { |
51 | 54 | initializeOmegaWikiAttributes($this->filterLanguageId != 0, false); |
52 | | - initializeObjectAttributeEditors($this->filterLanguageId, false); |
| 55 | + initializeObjectAttributeEditors($this->viewInformation); |
| 56 | + |
53 | 57 | $definedMeaningId = $this->getDefinedMeaningID(); |
54 | 58 | |
55 | | - getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save( |
| 59 | + getDefinedMeaningEditor($this->viewInformation)->save( |
56 | 60 | $this->getIdStack($definedMeaningId), |
57 | 61 | $this->getRecord() |
58 | 62 | ); |
Index: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php |
— | — | @@ -2,8 +2,8 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * ViewInformation is used to capture various settings that influence the way a page will be viewed |
6 | | - * depending on different use case scenarios. For instance, by specifying a filterLanguageId a page |
7 | | - * with be filtered entirely on one language, collapsing record sets to records where appropiate. |
| 6 | + * depending on different use case scenarios. For instance, by specifying a filterLanguageId, a page |
| 7 | + * will be filtered entirely on one language, collapsing record sets to records where appropiate. |
8 | 8 | * |
9 | 9 | * A ViewInformation can be constructed based on various conditions. The language filtering for instance |
10 | 10 | * could be an application wide setting, or a setting that can be controlled by the user. Functions that |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -398,6 +398,7 @@ |
399 | 399 | class RecordSetTableEditor extends RecordSetEditor { |
400 | 400 | protected $rowHTMLAttributes = array(); |
401 | 401 | protected $repeatInput = false; |
| 402 | + protected $hideEmptyColumns = true; |
402 | 403 | |
403 | 404 | protected function getRowAttributesText() { |
404 | 405 | $result = array(); |
— | — | @@ -473,7 +474,11 @@ |
474 | 475 | $structure = $value->getStructure(); |
475 | 476 | $key = $value->getKey(); |
476 | 477 | $rowAttributes = $this->getRowAttributesText(); |
477 | | - $visibleColumnEditors = $this->getColumnEditorsShowingData($this, $value); |
| 478 | + |
| 479 | + if ($this->hideEmptyColumns) |
| 480 | + $visibleColumnEditors = $this->getColumnEditorsShowingData($this, $value); |
| 481 | + else |
| 482 | + $visibleColumnEditors = $this->getAllColumnEditors($this, $value); |
478 | 483 | |
479 | 484 | foreach (getStructureAsTableHeaderRows($this->getTableStructure($this, $visibleColumnEditors), 0, $idPath) as $headerRow) |
480 | 485 | $result .= '<tr>' . $headerRow . '</tr>'.EOL; |
— | — | @@ -614,6 +619,10 @@ |
615 | 620 | |
616 | 621 | return new Structure($attributes); |
617 | 622 | } |
| 623 | + |
| 624 | + public function setHideEmptyColumns($hideEmptyColumns) { |
| 625 | + $this->hideEmptyColumns = $hideEmptyColumns; |
| 626 | + } |
618 | 627 | } |
619 | 628 | |
620 | 629 | abstract class RecordEditor extends DefaultEditor { |
— | — | @@ -1144,7 +1153,7 @@ |
1145 | 1154 | protected $attributesLevelName; |
1146 | 1155 | protected $objectIdFetcher; |
1147 | 1156 | |
1148 | | - public function __construct($attribute, $permissionController, $isAddField, $attributesLevelName, $objectIdFetcher) { |
| 1157 | + public function __construct($attribute, $permissionController, $isAddField, $attributesLevelName, Fetcher $objectIdFetcher) { |
1149 | 1158 | parent::__construct($attribute, $permissionController, $isAddField); |
1150 | 1159 | |
1151 | 1160 | $this->attributesLevelName = $attributesLevelName; |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php |
— | — | @@ -30,8 +30,7 @@ |
31 | 31 | $dmModel=new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
32 | 32 | |
33 | 33 | $wgOut->addHTML( |
34 | | - getDefinedMeaningEditor( |
35 | | - $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, $this->shouldShowAuthorities)->view( |
| 34 | + getDefinedMeaningEditor($this->viewInformation)->view( |
36 | 35 | $this->getIdStack($definedMeaningId), |
37 | 36 | $dmModel->getRecord() |
38 | 37 | ) |
— | — | @@ -51,7 +50,7 @@ |
52 | 51 | $dmModel = new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
53 | 52 | |
54 | 53 | $wgOut->addHTML( |
55 | | - getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->edit( |
| 54 | + getDefinedMeaningEditor($this->viewInformation)->edit( |
56 | 55 | $this->getIdStack($definedMeaningId), |
57 | 56 | $dmModel->getRecord() |
58 | 57 | ) |
— | — | @@ -68,7 +67,7 @@ |
69 | 68 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
70 | 69 | $dmModel=new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
71 | 70 | $wgOut->addHTML( |
72 | | - getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view( |
| 71 | + getDefinedMeaningEditor($this->viewInformation)->view( |
73 | 72 | new IdStack("defined-meaning"), |
74 | 73 | $dmModel->getRecord() |
75 | 74 | ) |
— | — | @@ -98,10 +97,10 @@ |
99 | 98 | parent::save($referenceQueryTransactionInformation); |
100 | 99 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
101 | 100 | |
102 | | - $dmModel =new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
| 101 | + $dmModel = new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
103 | 102 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
104 | 103 | |
105 | | - getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save( |
| 104 | + getDefinedMeaningEditor($this->viewInformation)->save( |
106 | 105 | $this->getIdStack($definedMeaningId), |
107 | 106 | $dmModel->getRecord() |
108 | 107 | ); |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php |
— | — | @@ -84,10 +84,13 @@ |
85 | 85 | $classMembershipAttribute = new Attribute(null, $wgClassMembershipAttributeName, $classMembershipStructure); |
86 | 86 | |
87 | 87 | global |
88 | | - $possiblySynonymousIdAttribute, $possiblySynonymousAttribute, $wgPossibleSynonymAttributeName, $possiblySynonymousStructure, $possiblySynonymousAttribute, $wgPossiblySynonymousAttributeName, $wgPossiblySynonymousAttributeId; |
| 88 | + $possiblySynonymousIdAttribute, |
| 89 | + $possibleSynonymAttribute, |
| 90 | + $wgPossibleSynonymAttributeName, $possiblySynonymousStructure, $possiblySynonymousAttribute, |
| 91 | + $wgPossiblySynonymousAttributeName, $wgPossiblySynonymousAttributeId; |
89 | 92 | |
90 | 93 | $possiblySynonymousIdAttribute = new Attribute("possibly-synonymous-id", "Possibly synonymous id", "integer"); |
91 | | - $possiblySynonymousAttribute = new Attribute("possible-synonym", $wgPossibleSynonymAttributeName, $definedMeaningReferenceStructure); |
| 94 | + $possibleSynonymAttribute = new Attribute("possible-synonym", $wgPossibleSynonymAttributeName, $definedMeaningReferenceStructure); |
92 | 95 | $possiblySynonymousStructure = new Structure("possibly-synonymous", $possiblySynonymousIdAttribute, $possiblySynonymousAttribute); |
93 | 96 | $possiblySynonymousAttribute = new Attribute(null, $wgPossiblySynonymousAttributeName, $possiblySynonymousStructure); |
94 | 97 | |
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php |
— | — | @@ -88,8 +88,6 @@ |
89 | 89 | |
90 | 90 | $wgOut->setPageTitle($title); |
91 | 91 | |
92 | | - initializeOmegaWikiAttributes($this->filterLanguageId != 0); |
93 | | - initializeObjectAttributeEditors($this->filterLanguageId, false); |
94 | 92 | $this->queryTransactionInformation = new QueryLatestTransactionInformation(); |
95 | 93 | |
96 | 94 | $viewInformation = new ViewInformation(); |
— | — | @@ -100,6 +98,9 @@ |
101 | 99 | $viewInformation->queryTransactionInformation = $this->queryTransactionInformation; |
102 | 100 | |
103 | 101 | $this->viewInformation = $viewInformation; |
| 102 | + |
| 103 | + initializeOmegaWikiAttributes($this->filterLanguageId != 0); |
| 104 | + initializeObjectAttributeEditors($viewInformation); |
104 | 105 | } |
105 | 106 | |
106 | 107 | protected function getDataSetPanel() { |
— | — | @@ -125,15 +126,15 @@ |
126 | 127 | } |
127 | 128 | |
128 | 129 | protected function save($referenceQueryTransactionInformation) { |
129 | | - initializeOmegaWikiAttributes($this->filterLanguageId != 0, false); |
130 | | - initializeObjectAttributeEditors($this->filterLanguageId, false); |
131 | | - |
132 | 130 | $viewInformation = new ViewInformation(); |
133 | 131 | $viewInformation->filterLanguageId = $this->filterLanguageId; |
134 | 132 | $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
135 | 133 | $viewInformation->queryTransactionInformation = $referenceQueryTransactionInformation; |
136 | 134 | |
137 | 135 | $this->viewInformation = $viewInformation; |
| 136 | + |
| 137 | + initializeOmegaWikiAttributes($this->filterLanguageId != 0, false); |
| 138 | + initializeObjectAttributeEditors($this->viewInformation); |
138 | 139 | } |
139 | 140 | |
140 | 141 | public function saveWithinTransaction() { |
— | — | @@ -178,9 +179,6 @@ |
179 | 180 | if ($this->showLanguageSelector) |
180 | 181 | $wgOut->addHTML($this->getLanguageSelector()); |
181 | 182 | |
182 | | - initializeOmegaWikiAttributes($this->filterLanguageId != 0, false); |
183 | | - initializeObjectAttributeEditors($this->filterLanguageId, false, false); |
184 | | - |
185 | 183 | $viewInformation = new ViewInformation(); |
186 | 184 | $viewInformation->filterLanguageId = $this->filterLanguageId; |
187 | 185 | $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
— | — | @@ -190,6 +188,9 @@ |
191 | 189 | |
192 | 190 | $this->viewInformation = $viewInformation; |
193 | 191 | |
| 192 | + initializeOmegaWikiAttributes($this->filterLanguageId != 0, false); |
| 193 | + initializeObjectAttributeEditors($this->viewInformation); |
| 194 | + |
194 | 195 | return true; |
195 | 196 | } |
196 | 197 | |
— | — | @@ -235,17 +236,17 @@ |
236 | 237 | 'history' |
237 | 238 | )); |
238 | 239 | |
239 | | - initializeOmegaWikiAttributes($this->filterLanguageId != 0, true); |
240 | | - initializeObjectAttributeEditors($this->filterLanguageId, $this->showRecordLifeSpan, false); |
241 | | - |
242 | 240 | $viewInformation = new ViewInformation(); |
243 | 241 | $viewInformation->filterLanguageId = $this->filterLanguageId; |
244 | 242 | $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
245 | 243 | $viewInformation->showRecordLifeSpan = $this->showRecordLifeSpan; |
246 | | - $viewInformation->showAuthority = $this->shouldShowAuthorities; |
| 244 | + $viewInformation->showAuthority = false; |
247 | 245 | $viewInformation->queryTransactionInformation = $this->queryTransactionInformation; |
248 | 246 | |
249 | 247 | $this->viewInformation = $viewInformation; |
| 248 | + |
| 249 | + initializeOmegaWikiAttributes($this->filterLanguageId != 0, true); |
| 250 | + initializeObjectAttributeEditors($viewInformation); |
250 | 251 | } |
251 | 252 | |
252 | 253 | protected function outputEditHeader() { |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php |
— | — | @@ -6,9 +6,9 @@ |
7 | 7 | require_once('Fetcher.php'); |
8 | 8 | require_once('WikiDataGlobals.php'); |
9 | 9 | require_once('GotoSourceTemplate.php'); |
| 10 | +require_once('ViewInformation.php'); |
10 | 11 | |
11 | | -function initializeObjectAttributeEditors($filterLanguageId, $showRecordLifeSpan) { |
12 | | - $showAuthority=false; |
| 12 | +function initializeObjectAttributeEditors(ViewInformation $viewInformation) { |
13 | 13 | global |
14 | 14 | $objectAttributesAttribute, $definedMeaningAttributesAttribute, |
15 | 15 | $definedMeaningObjectAttributesEditor, $definedMeaningIdAttribute, |
— | — | @@ -34,18 +34,18 @@ |
35 | 35 | $translatedTextValueObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5); |
36 | 36 | $optionValueObjectAttributesEditor = new RecordUnorderedListEditor($objectAttributesAttribute, 5); |
37 | 37 | |
38 | | - setObjectAttributesEditor($definedMeaningObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $definedMeaningIdAttribute), $definedMeaningMeaningName, new ObjectIdFetcher(0, $definedMeaningIdAttribute)); |
39 | | - setObjectAttributesEditor($definitionObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new DefinitionObjectIdFetcher(0, $definedMeaningIdAttribute), $definitionMeaningName, new ObjectIdFetcher(0, $definedMeaningIdAttribute)); |
40 | | - setObjectAttributesEditor($synonymsAndTranslationsObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $syntransIdAttribute), $synTransMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
41 | | - setObjectAttributesEditor($possiblySynonymousObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $possiblySynonymousIdAttribute), $relationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
42 | | - setObjectAttributesEditor($relationsObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $relationIdAttribute), $relationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
43 | | - setObjectAttributesEditor($textValueObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $textAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
44 | | - setObjectAttributesEditor($urlValueObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $textAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
45 | | - setObjectAttributesEditor($translatedTextValueObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $translatedTextAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
46 | | - setObjectAttributesEditor($optionValueObjectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, new ObjectIdFetcher(0, $optionAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 38 | + setObjectAttributesEditor($definedMeaningObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $definedMeaningIdAttribute), $definedMeaningMeaningName, new ObjectIdFetcher(0, $definedMeaningIdAttribute)); |
| 39 | + setObjectAttributesEditor($definitionObjectAttributesEditor, $viewInformation, new DefinitionObjectIdFetcher(0, $definedMeaningIdAttribute), $definitionMeaningName, new ObjectIdFetcher(0, $definedMeaningIdAttribute)); |
| 40 | + setObjectAttributesEditor($synonymsAndTranslationsObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $syntransIdAttribute), $synTransMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 41 | + setObjectAttributesEditor($possiblySynonymousObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $possiblySynonymousIdAttribute), $relationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 42 | + setObjectAttributesEditor($relationsObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $relationIdAttribute), $relationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 43 | + setObjectAttributesEditor($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $textAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 44 | + setObjectAttributesEditor($urlValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $textAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 45 | + setObjectAttributesEditor($translatedTextValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $translatedTextAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
| 46 | + setObjectAttributesEditor($optionValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $optionAttributeIdAttribute), $annotationMeaningName, new ObjectIdFetcher(1, $definedMeaningIdAttribute)); |
47 | 47 | } |
48 | 48 | |
49 | | -function getTransactionEditor($attribute) { |
| 49 | +function getTransactionEditor(Attribute $attribute) { |
50 | 50 | global |
51 | 51 | $userAttribute, $timestampAttribute; |
52 | 52 | |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | return $transactionEditor; |
58 | 58 | } |
59 | 59 | |
60 | | -function createTableLifeSpanEditor($attribute) { |
| 60 | +function createTableLifeSpanEditor(Attribute $attribute) { |
61 | 61 | global |
62 | 62 | $addTransactionAttribute, $removeTransactionAttribute; |
63 | 63 | |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | return $result; |
69 | 69 | } |
70 | 70 | |
71 | | -function addTableLifeSpanEditor($editor, $showRecordLifeSpan) { |
| 71 | +function addTableLifeSpanEditor(Editor $editor, $showRecordLifeSpan) { |
72 | 72 | global |
73 | 73 | $recordLifeSpanAttribute, $addTransactionAttribute, $removeTransactionAttribute, $wgRequest; |
74 | 74 | |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | $editor->addEditor(createTableLifeSpanEditor($recordLifeSpanAttribute)); |
77 | 77 | } |
78 | 78 | |
79 | | -function addTableAuthorityEditor($editor, $showAuthority) { |
| 79 | +function addTableAuthorityEditor(Editor $editor, $showAuthority) { |
80 | 80 | global |
81 | 81 | $authorityAttribute; |
82 | 82 | |
— | — | @@ -83,38 +83,38 @@ |
84 | 84 | $editor->addEditor(createShortTextViewer($authorityAttribute)); |
85 | 85 | } |
86 | 86 | |
87 | | -function addTableMetadataEditors($editor, $showRecordLifeSpan) { |
88 | | - addTableLifeSpanEditor($editor, $showRecordLifeSpan); |
| 87 | +function addTableMetadataEditors($editor, ViewInformation $viewInformation) { |
| 88 | + addTableLifeSpanEditor($editor, $viewInformation->showRecordLifeSpan); |
89 | 89 | } |
90 | 90 | |
91 | | -function getDefinitionEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority) { |
| 91 | +function getDefinitionEditor(ViewInformation $viewInformation) { |
92 | 92 | global |
93 | 93 | $definitionAttribute, $translatedTextAttribute, $definitionObjectAttributesEditor, $wgPopupAnnotationName; |
94 | 94 | |
95 | | - if ($filterLanguageId == 0) |
| 95 | + if ($viewInformation->filterLanguageId == 0) |
96 | 96 | $controller = new DefinedMeaningDefinitionController(); |
97 | 97 | else |
98 | | - $controller = new DefinedMeaningFilteredDefinitionController($filterLanguageId); |
| 98 | + $controller = new DefinedMeaningFilteredDefinitionController($viewInformation->filterLanguageId); |
99 | 99 | |
100 | 100 | $editor = new RecordDivListEditor($definitionAttribute); |
101 | | - $editor->addEditor(getTranslatedTextEditor($translatedTextAttribute, $controller, $filterLanguageId, $showRecordLifeSpan)); |
| 101 | + $editor->addEditor(getTranslatedTextEditor($translatedTextAttribute, $controller, $viewInformation)); |
102 | 102 | $editor->addEditor(new PopUpEditor($definitionObjectAttributesEditor, $wgPopupAnnotationName)); |
103 | 103 | |
104 | 104 | return $editor; |
105 | 105 | } |
106 | 106 | |
107 | | -function getTranslatedTextEditor($attribute, $controller, $filterLanguageId, $showRecordLifeSpan) { |
| 107 | +function getTranslatedTextEditor(Attribute $attribute, UpdateController $controller, ViewInformation $viewInformation) { |
108 | 108 | global |
109 | 109 | $languageAttribute, $textAttribute; |
110 | 110 | |
111 | | - if ($filterLanguageId == 0 || $showRecordLifeSpan) { |
| 111 | + if ($viewInformation->filterLanguageId == 0 || $viewInformation->showRecordLifeSpan) { |
112 | 112 | $editor = new RecordSetTableEditor($attribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, true, $controller); |
113 | 113 | |
114 | | - if ($filterLanguageId == 0) |
| 114 | + if ($viewInformation->filterLanguageId == 0) |
115 | 115 | $editor->addEditor(new LanguageEditor($languageAttribute, new SimplePermissionController(false), true)); |
116 | 116 | |
117 | 117 | $editor->addEditor(new TextEditor($textAttribute, new SimplePermissionController(true), true)); |
118 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 118 | + addTableMetadataEditors($editor, $viewInformation); |
119 | 119 | } |
120 | 120 | else |
121 | 121 | $editor = new TextEditor($attribute, new SimplePermissionController(true), true, false, 0, $controller); |
— | — | @@ -122,36 +122,45 @@ |
123 | 123 | return $editor; |
124 | 124 | } |
125 | 125 | |
126 | | -function setObjectAttributesEditor($objectAttributesEditor, $filterLanguageId, $showRecordLifeSpan, $showAuthority, $objectIdFetcher, $levelDefinedMeaningName, $dmObjectIdFetcher) { |
127 | | - $objectAttributesEditor->addEditor(getTextAttributeValuesEditor($showRecordLifeSpan, $showAuthority, new TextAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
128 | | - $objectAttributesEditor->addEditor(getTranslatedTextAttributeValuesEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority, new TranslatedTextAttributeValuesController($objectIdFetcher, $filterLanguageId), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
129 | | - $objectAttributesEditor->addEditor(getURLAttributeValuesEditor($showRecordLifeSpan, $showAuthority, new URLAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
130 | | - $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($showRecordLifeSpan, $showAuthority, new OptionAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
| 126 | +function setObjectAttributesEditor(Editor $objectAttributesEditor, ViewInformation $viewInformation, Fetcher $objectIdFetcher, $levelDefinedMeaningName, Fetcher $dmObjectIdFetcher) { |
| 127 | + $objectAttributesEditor->addEditor(getTextAttributeValuesEditor($viewInformation, new TextAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
| 128 | + $objectAttributesEditor->addEditor(getTranslatedTextAttributeValuesEditor($viewInformation, new TranslatedTextAttributeValuesController($objectIdFetcher, $viewInformation->filterLanguageId), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
| 129 | + $objectAttributesEditor->addEditor(getURLAttributeValuesEditor($viewInformation, new URLAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
| 130 | + $objectAttributesEditor->addEditor(getOptionAttributeValuesEditor($viewInformation, new OptionAttributeValuesController($objectIdFetcher), $levelDefinedMeaningName, $dmObjectIdFetcher)); |
131 | 131 | } |
132 | 132 | |
133 | | -function getAlternativeDefinitionsEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority) { |
| 133 | +function getAlternativeDefinitionsEditor(ViewInformation $viewInformation) { |
134 | 134 | global |
135 | 135 | $alternativeDefinitionsAttribute, $alternativeDefinitionAttribute, $sourceAttribute; |
136 | 136 | |
137 | | - if ($filterLanguageId == 0) |
| 137 | + if ($viewInformation->filterLanguageId == 0) |
138 | 138 | $alternativeDefinitionController = new DefinedMeaningAlternativeDefinitionController(); |
139 | 139 | else |
140 | | - $alternativeDefinitionController = new DefinedMeaningFilteredAlternativeDefinitionController($filterLanguageId); |
| 140 | + $alternativeDefinitionController = new DefinedMeaningFilteredAlternativeDefinitionController($viewInformation); |
141 | 141 | |
142 | | - $editor = new RecordSetTableEditor($alternativeDefinitionsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningAlternativeDefinitionsController($filterLanguageId)); |
143 | | - $editor->addEditor(getTranslatedTextEditor($alternativeDefinitionAttribute, $alternativeDefinitionController, $filterLanguageId, $showRecordLifeSpan)); |
| 142 | + $editor = new RecordSetTableEditor( |
| 143 | + $alternativeDefinitionsAttribute, |
| 144 | + new SimplePermissionController(true), |
| 145 | + new ShowEditFieldChecker(true), |
| 146 | + new AllowAddController(true), |
| 147 | + true, |
| 148 | + false, |
| 149 | + new DefinedMeaningAlternativeDefinitionsController($viewInformation->filterLanguageId) |
| 150 | + ); |
| 151 | + |
| 152 | + $editor->addEditor(getTranslatedTextEditor($alternativeDefinitionAttribute, $alternativeDefinitionController, $viewInformation)); |
144 | 153 | $editor->addEditor(new DefinedMeaningReferenceEditor($sourceAttribute, new SimplePermissionController(false), true)); |
145 | 154 | |
146 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 155 | + addTableMetadataEditors($editor, $viewInformation); |
147 | 156 | |
148 | 157 | return $editor; |
149 | 158 | } |
150 | 159 | |
151 | | -function getExpressionTableCellEditor($attribute, $filterLanguageId) { |
| 160 | +function getExpressionTableCellEditor(Attribute $attribute, ViewInformation $viewInformation) { |
152 | 161 | global |
153 | 162 | $languageAttribute, $spellingAttribute; |
154 | 163 | |
155 | | - if ($filterLanguageId == 0) { |
| 164 | + if ($viewInformation->filterLanguageId == 0) { |
156 | 165 | $editor = new RecordTableCellEditor($attribute); |
157 | 166 | $editor->addEditor(new LanguageEditor($languageAttribute, new SimplePermissionController(false), true)); |
158 | 167 | $editor->addEditor(new SpellingEditor($spellingAttribute, new SimplePermissionController(false), true)); |
— | — | @@ -162,7 +171,7 @@ |
163 | 172 | return $editor; |
164 | 173 | } |
165 | 174 | |
166 | | -function getClassAttributesEditor($showRecordLifeSpan, $showAuthority) { |
| 175 | +function getClassAttributesEditor(ViewInformation $viewInformation) { |
167 | 176 | global |
168 | 177 | $definedMeaningIdAttribute, $classAttributesAttribute, $classAttributeLevelAttribute, $classAttributeAttributeAttribute, $classAttributeTypeAttribute; |
169 | 178 | |
— | — | @@ -172,27 +181,36 @@ |
173 | 182 | $tableEditor->addEditor(new ClassAttributesTypeEditor($classAttributeTypeAttribute, new SimplePermissionController(false), true)); |
174 | 183 | $tableEditor->addEditor(new PopupEditor(getOptionAttributeOptionsEditor(), 'Options')); |
175 | 184 | |
176 | | - addTableMetadataEditors($tableEditor, $showRecordLifeSpan); |
| 185 | + addTableMetadataEditors($tableEditor, $viewInformation); |
177 | 186 | |
178 | 187 | return $tableEditor; |
179 | 188 | } |
180 | 189 | |
181 | | -function getSynonymsAndTranslationsEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority) { |
| 190 | +function getSynonymsAndTranslationsEditor(ViewInformation $viewInformation) { |
182 | 191 | global |
183 | 192 | $synonymsAndTranslationsAttribute, $identicalMeaningAttribute, $expressionIdAttribute, |
184 | 193 | $expressionAttribute, $synonymsAndTranslationsObjectAttributesEditor, $wgPopupAnnotationName; |
185 | 194 | |
186 | | - $tableEditor = new RecordSetTableEditor($synonymsAndTranslationsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new SynonymTranslationController($filterLanguageId)); |
187 | | - $tableEditor->addEditor(getExpressionTableCellEditor($expressionAttribute, $filterLanguageId)); |
| 195 | + $tableEditor = new RecordSetTableEditor( |
| 196 | + $synonymsAndTranslationsAttribute, |
| 197 | + new SimplePermissionController(true), |
| 198 | + new ShowEditFieldChecker(true), |
| 199 | + new AllowAddController(true), |
| 200 | + true, |
| 201 | + false, |
| 202 | + new SynonymTranslationController($viewInformation->filterLanguageId) |
| 203 | + ); |
| 204 | + |
| 205 | + $tableEditor->addEditor(getExpressionTableCellEditor($expressionAttribute, $viewInformation)); |
188 | 206 | $tableEditor->addEditor(new BooleanEditor($identicalMeaningAttribute, new SimplePermissionController(true), true, true)); |
189 | 207 | $tableEditor->addEditor(new PopUpEditor($synonymsAndTranslationsObjectAttributesEditor, $wgPopupAnnotationName)); |
190 | 208 | |
191 | | - addTableMetadataEditors($tableEditor, $showRecordLifeSpan); |
| 209 | + addTableMetadataEditors($tableEditor, $viewInformation); |
192 | 210 | |
193 | 211 | return $tableEditor; |
194 | 212 | } |
195 | 213 | |
196 | | -function getDefinedMeaningRelationsEditor($showRecordLifeSpan, $showAuthority) { |
| 214 | +function getDefinedMeaningRelationsEditor(ViewInformation $viewInformation) { |
197 | 215 | global |
198 | 216 | $relationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, |
199 | 217 | $relationsObjectAttributesEditor, $wgPopupAnnotationName; |
— | — | @@ -202,12 +220,12 @@ |
203 | 221 | $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true)); |
204 | 222 | $editor->addEditor(new PopUpEditor($relationsObjectAttributesEditor, $wgPopupAnnotationName)); |
205 | 223 | |
206 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 224 | + addTableMetadataEditors($editor, $viewInformation); |
207 | 225 | |
208 | 226 | return $editor; |
209 | 227 | } |
210 | 228 | |
211 | | -function getDefinedMeaningReciprocalRelationsEditor($showRecordLifeSpan, $showAuthority) { |
| 229 | +function getDefinedMeaningReciprocalRelationsEditor(ViewInformation $viewInformation) { |
212 | 230 | global |
213 | 231 | $reciprocalRelationsAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, |
214 | 232 | $relationsObjectAttributesEditor, $wgPopupAnnotationName; |
— | — | @@ -217,24 +235,24 @@ |
218 | 236 | $editor->addEditor(new RelationTypeReferenceEditor($relationTypeAttribute, new SimplePermissionController(false), true)); |
219 | 237 | $editor->addEditor(new PopUpEditor($relationsObjectAttributesEditor, $wgPopupAnnotationName)); |
220 | 238 | |
221 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 239 | + addTableMetadataEditors($editor, $viewInformation); |
222 | 240 | |
223 | 241 | return $editor; |
224 | 242 | } |
225 | 243 | |
226 | | -function getDefinedMeaningClassMembershipEditor($showRecordLifeSpan, $showAuthority) { |
| 244 | +function getDefinedMeaningClassMembershipEditor(ViewInformation $viewInformation) { |
227 | 245 | global |
228 | 246 | $classMembershipAttribute, $classAttribute; |
229 | 247 | |
230 | 248 | $editor = new RecordSetTableEditor($classMembershipAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningClassMembershipController()); |
231 | 249 | $editor->addEditor(new ClassReferenceEditor($classAttribute, new SimplePermissionController(false), true)); |
232 | 250 | |
233 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 251 | + addTableMetadataEditors($editor, $viewInformation); |
234 | 252 | |
235 | 253 | return $editor; |
236 | 254 | } |
237 | 255 | |
238 | | -function getGroupedRelationTypeEditor($groupedRelationsAttribute, $groupedRelationIdAttribute, $otherDefinedMeaningAttribute, $relationTypeId, $showRecordLifeSpan, $showAuthority, $objectAttributesEditor) { |
| 256 | +function getGroupedRelationTypeEditor(Attribute $groupedRelationsAttribute, Attribute $groupedRelationIdAttribute, Attribute $otherDefinedMeaningAttribute, $relationTypeId, ViewInformation $viewInformation, Editor $objectAttributesEditor) { |
239 | 257 | global |
240 | 258 | $wgPopupAnnotationName; |
241 | 259 | |
— | — | @@ -253,12 +271,12 @@ |
254 | 272 | if ($objectAttributesEditor != null) |
255 | 273 | $editor->addEditor(new PopUpEditor($objectAttributesEditor, $wgPopupAnnotationName)); |
256 | 274 | |
257 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 275 | + addTableMetadataEditors($editor, $viewInformation); |
258 | 276 | |
259 | 277 | return $editor; |
260 | 278 | } |
261 | 279 | |
262 | | -function getDefinedMeaningCollectionMembershipEditor($showRecordLifeSpan, $showAuthority) { |
| 280 | +function getDefinedMeaningCollectionMembershipEditor(ViewInformation $viewInformation) { |
263 | 281 | global |
264 | 282 | $collectionMembershipAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute, |
265 | 283 | $gotoSourceAttribute, $wgGotoSourceTemplates; |
— | — | @@ -270,12 +288,12 @@ |
271 | 289 | if (count($wgGotoSourceTemplates) > 0) |
272 | 290 | $editor->addEditor(new GotoSourceEditor($gotoSourceAttribute, new SimplePermissionController(true), true)); |
273 | 291 | |
274 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 292 | + addTableMetadataEditors($editor, $viewInformation); |
275 | 293 | |
276 | 294 | return $editor; |
277 | 295 | } |
278 | 296 | |
279 | | -function getTextAttributeValuesEditor($showRecordLifeSpan, $showAuthority, $controller, $levelDefinedMeaningName, $objectIdFetcher) { |
| 297 | +function getTextAttributeValuesEditor(ViewInformation $viewInformation, $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
280 | 298 | global |
281 | 299 | $textAttributeAttribute, $textAttribute, $textAttributeValuesAttribute, $textValueObjectAttributesEditor, |
282 | 300 | $wgPopupAnnotationName; |
— | — | @@ -285,12 +303,12 @@ |
286 | 304 | $editor->addEditor(new TextEditor($textAttribute, new SimplePermissionController(true), true)); |
287 | 305 | $editor->addEditor(new PopUpEditor($textValueObjectAttributesEditor, $wgPopupAnnotationName)); |
288 | 306 | |
289 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 307 | + addTableMetadataEditors($editor, $viewInformation); |
290 | 308 | |
291 | 309 | return $editor; |
292 | 310 | } |
293 | 311 | |
294 | | -function getURLAttributeValuesEditor($showRecordLifeSpan, $showAuthority, $controller, $levelDefinedMeaningName, $objectIdFetcher) { |
| 312 | +function getURLAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
295 | 313 | global |
296 | 314 | $urlAttributeAttribute, $urlAttribute, $urlAttributeValuesAttribute, $urlValueObjectAttributesEditor, |
297 | 315 | $wgPopupAnnotationName; |
— | — | @@ -300,32 +318,32 @@ |
301 | 319 | $editor->addEditor(new URLEditor($urlAttribute, new SimplePermissionController(true), true)); |
302 | 320 | $editor->addEditor(new PopUpEditor($urlValueObjectAttributesEditor, $wgPopupAnnotationName)); |
303 | 321 | |
304 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 322 | + addTableMetadataEditors($editor, $viewInformation); |
305 | 323 | |
306 | 324 | return $editor; |
307 | 325 | } |
308 | 326 | |
309 | | -function getTranslatedTextAttributeValuesEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority, $controller, $levelDefinedMeaningName, $objectIdFetcher) { |
| 327 | +function getTranslatedTextAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
310 | 328 | global |
311 | 329 | $translatedTextAttributeAttribute, $translatedTextValueAttribute, $translatedTextAttributeValuesAttribute, |
312 | 330 | $translatedTextValueObjectAttributesEditor, $wgPopupAnnotationName; |
313 | 331 | |
314 | | - if ($filterLanguageId == 0) |
| 332 | + if ($viewInformation->filterLanguageId == 0) |
315 | 333 | $translatedTextAttributeValueController = new TranslatedTextAttributeValueController(); |
316 | 334 | else |
317 | | - $translatedTextAttributeValueController = new FilteredTranslatedTextAttributeValueController($filterLanguageId); |
| 335 | + $translatedTextAttributeValueController = new FilteredTranslatedTextAttributeValueController($viewInformation->filterLanguageId); |
318 | 336 | |
319 | 337 | $editor = new RecordSetTableEditor($translatedTextAttributeValuesAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, $controller); |
320 | 338 | $editor->addEditor(new TranslatedTextAttributeEditor($translatedTextAttributeAttribute, new SimplePermissionController(false), true, $levelDefinedMeaningName, $objectIdFetcher)); |
321 | | - $editor->addEditor(getTranslatedTextEditor($translatedTextValueAttribute, $translatedTextAttributeValueController, $filterLanguageId, $showRecordLifeSpan)); |
| 339 | + $editor->addEditor(getTranslatedTextEditor($translatedTextValueAttribute, $translatedTextAttributeValueController, $viewInformation)); |
322 | 340 | $editor->addEditor(new PopUpEditor($translatedTextValueObjectAttributesEditor, $wgPopupAnnotationName)); |
323 | 341 | |
324 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 342 | + addTableMetadataEditors($editor, $viewInformation); |
325 | 343 | |
326 | 344 | return $editor; |
327 | 345 | } |
328 | 346 | |
329 | | -function getOptionAttributeValuesEditor($showRecordLifeSpan, $showAuthority, $controller, $levelDefinedMeaningName, $objectIdFetcher) { |
| 347 | +function getOptionAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, Fetcher $objectIdFetcher) { |
330 | 348 | global |
331 | 349 | $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeValuesAttribute, |
332 | 350 | $optionValueObjectAttributesEditor, $wgPopupAnnotationName; |
— | — | @@ -336,7 +354,7 @@ |
337 | 355 | $editor->addEditor(new OptionSelectEditor($optionAttributeOptionAttribute, new SimplePermissionController(false), true)); |
338 | 356 | $editor->addEditor(new PopUpEditor($optionValueObjectAttributesEditor, $wgPopupAnnotationName)); |
339 | 357 | |
340 | | - addTableMetadataEditors($editor, $showRecordLifeSpan); |
| 358 | + addTableMetadataEditors($editor, $viewInformation); |
341 | 359 | |
342 | 360 | return $editor; |
343 | 361 | } |
— | — | @@ -352,39 +370,49 @@ |
353 | 371 | return $editor; |
354 | 372 | } |
355 | 373 | |
356 | | -function getExpressionMeaningsEditor($attribute, $allowAdd, $filterLanguageId, $possiblySynonymousRelationTypeId, $showRecordLifeSpan, $showAuthority) { |
| 374 | +function getExpressionMeaningsEditor(Attribute $attribute, $allowAdd, ViewInformation $viewInformation) { |
357 | 375 | global |
358 | 376 | $definedMeaningIdAttribute; |
359 | 377 | |
360 | | - $definedMeaningEditor = getDefinedMeaningEditor($filterLanguageId, $possiblySynonymousRelationTypeId, $showRecordLifeSpan, $showAuthority); |
| 378 | + $definedMeaningEditor = getDefinedMeaningEditor($viewInformation); |
361 | 379 | |
362 | 380 | $definedMeaningCaptionEditor = new DefinedMeaningHeaderEditor($definedMeaningIdAttribute, new SimplePermissionController(false), true, 75); |
363 | 381 | $definedMeaningCaptionEditor->setAddText("New exact meaning"); |
364 | 382 | |
365 | | - $expressionMeaningsEditor = new RecordSetListEditor($attribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController($allowAdd), false, $allowAdd, new ExpressionMeaningController($filterLanguageId), 3, false); |
| 383 | + $expressionMeaningsEditor = new RecordSetListEditor($attribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController($allowAdd), false, $allowAdd, new ExpressionMeaningController($viewInformation->filterLanguageId), 3, false); |
366 | 384 | $expressionMeaningsEditor->setCaptionEditor($definedMeaningCaptionEditor); |
367 | 385 | $expressionMeaningsEditor->setValueEditor($definedMeaningEditor); |
368 | 386 | |
369 | 387 | return $expressionMeaningsEditor; |
370 | 388 | } |
371 | 389 | |
372 | | -function getExpressionsEditor($spelling, $filterLanguageId, $possiblySynonymousRelationTypeId, $showRecordLifeSpan, $showAuthority) { |
| 390 | +function getExpressionsEditor($spelling, ViewInformation $viewInformation) { |
373 | 391 | global |
374 | 392 | $expressionMeaningsAttribute, $expressionExactMeaningsAttribute, $expressionApproximateMeaningsAttribute, $expressionAttribute, $languageAttribute, $expressionsAttribute; |
375 | 393 | |
376 | 394 | $expressionMeaningsRecordEditor = new RecordUnorderedListEditor($expressionMeaningsAttribute, 3); |
377 | 395 | |
378 | | - $exactMeaningsEditor = getExpressionMeaningsEditor($expressionExactMeaningsAttribute, true, $filterLanguageId, $possiblySynonymousRelationTypeId, $showRecordLifeSpan, $showAuthority); |
| 396 | + $exactMeaningsEditor = getExpressionMeaningsEditor($expressionExactMeaningsAttribute, true, $viewInformation); |
379 | 397 | $expressionMeaningsRecordEditor->addEditor($exactMeaningsEditor); |
380 | | - $expressionMeaningsRecordEditor->addEditor(getExpressionMeaningsEditor($expressionApproximateMeaningsAttribute, false, $filterLanguageId, $possiblySynonymousRelationTypeId, $showRecordLifeSpan, $showAuthority)); |
| 398 | + $expressionMeaningsRecordEditor->addEditor(getExpressionMeaningsEditor($expressionApproximateMeaningsAttribute, false, $viewInformation)); |
381 | 399 | |
382 | 400 | $expressionMeaningsRecordEditor->expandEditor($exactMeaningsEditor); |
383 | 401 | |
384 | | - if ($filterLanguageId == 0) { |
| 402 | + if ($viewInformation->filterLanguageId == 0) { |
385 | 403 | $expressionEditor = new RecordSpanEditor($expressionAttribute, ': ', ' - '); |
386 | 404 | $expressionEditor->addEditor(new LanguageEditor($languageAttribute, new SimplePermissionController(false), true)); |
387 | 405 | |
388 | | - $expressionsEditor = new RecordSetListEditor($expressionsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), false, false, new ExpressionController($spelling, $filterLanguageId), 2, true); |
| 406 | + $expressionsEditor = new RecordSetListEditor( |
| 407 | + $expressionsAttribute, |
| 408 | + new SimplePermissionController(true), |
| 409 | + new ShowEditFieldChecker(true), |
| 410 | + new AllowAddController(true), |
| 411 | + false, |
| 412 | + false, |
| 413 | + new ExpressionController($spelling, $viewInformation->filterLanguageId), |
| 414 | + 2, |
| 415 | + true |
| 416 | + ); |
389 | 417 | $expressionsEditor->setCaptionEditor($expressionEditor); |
390 | 418 | $expressionsEditor->setValueEditor($expressionMeaningsRecordEditor); |
391 | 419 | } |
— | — | @@ -392,7 +420,15 @@ |
393 | 421 | $expressionEditor = new RecordSubRecordEditor($expressionAttribute); |
394 | 422 | $expressionEditor->setSubRecordEditor($expressionMeaningsRecordEditor); |
395 | 423 | |
396 | | - $expressionsEditor = new RecordSetFirstRecordEditor($expressionsAttribute, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), false, false, new ExpressionController($spelling, $filterLanguageId)); |
| 424 | + $expressionsEditor = new RecordSetFirstRecordEditor( |
| 425 | + $expressionsAttribute, |
| 426 | + new SimplePermissionController(true), |
| 427 | + new ShowEditFieldChecker(true), |
| 428 | + new AllowAddController(true), |
| 429 | + false, |
| 430 | + false, |
| 431 | + new ExpressionController($spelling, $viewInformation->filterLanguageId) |
| 432 | + ); |
397 | 433 | $expressionsEditor->setRecordEditor($expressionEditor); |
398 | 434 | } |
399 | 435 | |
— | — | @@ -413,27 +449,27 @@ |
414 | 450 | } |
415 | 451 | } |
416 | 452 | |
417 | | -function getDefinedMeaningEditor($filterLanguageId, $possiblySynonymousRelationTypeId, $showRecordLifeSpan, $showAuthority) { |
| 453 | +function getDefinedMeaningEditor(ViewInformation $viewInformation) { |
418 | 454 | global |
419 | 455 | $wdDefinedMeaningAttributesOrder, |
420 | 456 | $definedMeaningAttribute, $possiblySynonymousIdAttribute, $possiblySynonymousAttribute, |
421 | 457 | $possibleSynonymAttribute, $definedMeaningObjectAttributesEditor, $possiblySynonymousObjectAttributesEditor; |
422 | 458 | |
423 | | - $definitionEditor = getDefinitionEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority); |
424 | | - $alternativeDefinitionsEditor = getAlternativeDefinitionsEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority); |
425 | | - $classAttributesEditor = getClassAttributesEditor($showRecordLifeSpan, $showAuthority); |
426 | | - $synonymsAndTranslationsEditor = getSynonymsAndTranslationsEditor($filterLanguageId, $showRecordLifeSpan, $showAuthority); |
427 | | - $relationsEditor = getDefinedMeaningRelationsEditor($showRecordLifeSpan, $showAuthority); |
428 | | - $reciprocalRelationsEditor = getDefinedMeaningReciprocalRelationsEditor($showRecordLifeSpan, $showAuthority); |
429 | | - $classMembershipEditor = getDefinedMeaningClassMembershipEditor($showRecordLifeSpan, $showAuthority); |
430 | | - $collectionMembershipEditor = getDefinedMeaningCollectionMembershipEditor($showRecordLifeSpan, $showAuthority); |
| 459 | + $definitionEditor = getDefinitionEditor($viewInformation); |
| 460 | + $alternativeDefinitionsEditor = getAlternativeDefinitionsEditor($viewInformation); |
| 461 | + $classAttributesEditor = getClassAttributesEditor($viewInformation); |
| 462 | + $synonymsAndTranslationsEditor = getSynonymsAndTranslationsEditor($viewInformation); |
| 463 | + $relationsEditor = getDefinedMeaningRelationsEditor($viewInformation); |
| 464 | + $reciprocalRelationsEditor = getDefinedMeaningReciprocalRelationsEditor($viewInformation); |
| 465 | + $classMembershipEditor = getDefinedMeaningClassMembershipEditor($viewInformation); |
| 466 | + $collectionMembershipEditor = getDefinedMeaningCollectionMembershipEditor($viewInformation); |
| 467 | + |
431 | 468 | $possiblySynonymousEditor = getGroupedRelationTypeEditor( |
432 | 469 | $possiblySynonymousAttribute, |
433 | 470 | $possiblySynonymousIdAttribute, |
434 | 471 | $possibleSynonymAttribute, |
435 | | - $possiblySynonymousRelationTypeId, |
436 | | - $showRecordLifeSpan, |
437 | | - $showAuthority, |
| 472 | + $viewInformation->possiblySynonymousRelationTypeId, |
| 473 | + $viewInformation, |
438 | 474 | $possiblySynonymousObjectAttributesEditor |
439 | 475 | ); |
440 | 476 | |
— | — | @@ -448,7 +484,7 @@ |
449 | 485 | $availableEditors->addEditor($collectionMembershipEditor); |
450 | 486 | $availableEditors->addEditor($definedMeaningObjectAttributesEditor); |
451 | 487 | |
452 | | - if ($possiblySynonymousRelationTypeId != 0) |
| 488 | + if ($viewInformation->possiblySynonymousRelationTypeId != 0) |
453 | 489 | $availableEditors->addEditor($possiblySynonymousEditor); |
454 | 490 | |
455 | 491 | $definedMeaningEditor = new RecordUnorderedListEditor($definedMeaningAttribute, 4); |
— | — | @@ -467,7 +503,15 @@ |
468 | 504 | } |
469 | 505 | |
470 | 506 | function createTableViewer($attribute) { |
471 | | - return new RecordSetTableEditor($attribute, new SimplePermissionController(false), new ShowEditFieldChecker(true), new AllowAddController(false), false, false, null); |
| 507 | + return new RecordSetTableEditor( |
| 508 | + $attribute, |
| 509 | + new SimplePermissionController(false), |
| 510 | + new ShowEditFieldChecker(true), |
| 511 | + new AllowAddController(false), |
| 512 | + false, |
| 513 | + false, |
| 514 | + null |
| 515 | + ); |
472 | 516 | } |
473 | 517 | |
474 | 518 | function createLanguageViewer($attribute) { |
— | — | @@ -498,6 +542,7 @@ |
499 | 543 | |
500 | 544 | function createSuggestionsTableViewer($attribute) { |
501 | 545 | $result = createTableViewer($attribute); |
| 546 | + $result->setHideEmptyColumns(false); |
502 | 547 | $result->setRowHTMLAttributes(array( |
503 | 548 | "class" => "suggestion-row", |
504 | 549 | "onclick" => "suggestRowClicked(event, this)", |
— | — | @@ -523,3 +568,4 @@ |
524 | 569 | return $result; |
525 | 570 | } |
526 | 571 | |
| 572 | +?> |
\ No newline at end of file |