Index: trunk/extensions/Wikidata/WiktionaryZ/Editor.php |
— | — | @@ -89,6 +89,7 @@ |
90 | 90 | public function getUpdateAttribute(); |
91 | 91 | public function getAddAttribute(); |
92 | 92 | |
| 93 | + public function showsData($value); |
93 | 94 | public function view($idPath, $value); |
94 | 95 | public function edit($idPath, $value); |
95 | 96 | public function add($idPath); |
— | — | @@ -370,6 +371,10 @@ |
371 | 372 | |
372 | 373 | return $result; |
373 | 374 | } |
| 375 | + |
| 376 | + public function showsData($value) { |
| 377 | + return $value->getRecordCount() > 0; |
| 378 | + } |
374 | 379 | } |
375 | 380 | |
376 | 381 | class RecordSetTableEditor extends RecordSetEditor { |
— | — | @@ -588,6 +593,10 @@ |
589 | 594 | $idPath->popAttribute(); |
590 | 595 | } |
591 | 596 | } |
| 597 | + |
| 598 | + public function showsData($value) { |
| 599 | + return true; |
| 600 | + } |
592 | 601 | } |
593 | 602 | |
594 | 603 | class RecordTableCellEditor extends RecordEditor { |
— | — | @@ -662,6 +671,10 @@ |
663 | 672 | else |
664 | 673 | return $this->getViewHTML($idPath, $value); |
665 | 674 | } |
| 675 | + |
| 676 | + public function showsData($value) { |
| 677 | + return true; |
| 678 | + } |
666 | 679 | } |
667 | 680 | |
668 | 681 | class LanguageEditor extends ScalarEditor { |
— | — | @@ -954,10 +967,14 @@ |
955 | 968 | $attributeId = $idPath->getId(); |
956 | 969 | $expansionPrefix = $this->getExpansionPrefix($class, $attributeId); |
957 | 970 | $this->setExpansionByEditor($editor, $class); |
958 | | - $result .= '<li>'. |
959 | | - '<h'. $this->headerLevel .'><span id="collapse-'. $attributeId .'" class="toggle '. addCollapsablePrefixToClass($class) .'" onclick="toggle(this, event);">' . $expansionPrefix . ' ' . $attribute->name . '</span></h'. $this->headerLevel .'>' . |
960 | | - '<div id="collapsable-'. $attributeId . '" class="expand-' . $class . '">' . $editor->view($idPath, $value->getAttributeValue($attribute)) . '</div>' . |
961 | | - '</li>'; |
| 971 | + $attributeValue = $value->getAttributeValue($attribute); |
| 972 | + |
| 973 | + if ($editor->showsData($attributeValue)) |
| 974 | + $result .= '<li>'. |
| 975 | + '<h'. $this->headerLevel .'><span id="collapse-'. $attributeId .'" class="toggle '. addCollapsablePrefixToClass($class) .'" onclick="toggle(this, event);">' . $expansionPrefix . ' ' . $attribute->name . '</span></h'. $this->headerLevel .'>' . |
| 976 | + '<div id="collapsable-'. $attributeId . '" class="expand-' . $class . '">' . $editor->view($idPath, $attributeValue) . '</div>' . |
| 977 | + '</li>'; |
| 978 | + |
962 | 979 | $idPath->popAttribute(); |
963 | 980 | } |
964 | 981 | |
— | — | @@ -1176,6 +1193,10 @@ |
1177 | 1194 | public function add($idPath) { |
1178 | 1195 | return "New " . strtolower($this->attribute->name); |
1179 | 1196 | } |
| 1197 | + |
| 1198 | + public function showsData($value) { |
| 1199 | + return true; |
| 1200 | + } |
1180 | 1201 | } |
1181 | 1202 | |
1182 | 1203 | class RecordSpanEditor extends RecordEditor { |