r23950 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23949‎ | r23950 | r23951 >
Date:11:35, 10 July 2007
Author:proes
Status:old
Tags:
Comment:
Refactored RecordSetTableEditor::view() a bit
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Editor.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -753,12 +753,11 @@
754754 $objectIds = getUniqueIdsInRecordSet($recordSet, array($objectIdAttribute));
755755
756756 if (count($objectIds) > 0) {
757 - for ($i = 0; $i < count($objectIds); $i++) {
 757+ for ($i = 0; $i < count($objectIds); $i++)
758758 if (isset($objectIds[$i])) {
759759 $record = new ArrayRecord($objectAttributesRecordStructure);
760760 $objectAttributesRecords[$objectIds[$i]] = $record;
761761 }
762 - }
763762
764763 // Text attributes
765764 $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet($objectIds, $viewInformation);
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php
@@ -508,20 +508,19 @@
509509 return $result;
510510 }
511511
512 - public function view(IdStack $idPath, $value) {
 512+ public function viewHeader(IdStack $idPath, array $visibleColumnEditors) {
513513 $result = '<table id="'. $idPath->getId() .'" class="wiki-data-table">';
514 - $structure = $value->getStructure();
515 - $key = $value->getKey();
516 - $rowAttributes = $this->getRowAttributesText();
517 -
518 - if ($this->hideEmptyColumns)
519 - $visibleColumnEditors = $this->getColumnEditorsShowingData($this, $value);
520 - else
521 - $visibleColumnEditors = $this->getAllColumnEditors($this, $value);
522514
523515 foreach (getStructureAsTableHeaderRows($this->getTableStructure($this, $visibleColumnEditors), 0, $idPath) as $headerRow)
524516 $result .= '<tr>' . $headerRow . '</tr>'.EOL;
525 -
 517+
 518+ return $result;
 519+ }
 520+
 521+ public function viewRows(IdStack $idPath, $value, array $visibleColumnEditors) {
 522+ $result = "";
 523+ $rowAttributes = $this->getRowAttributesText();
 524+ $key = $value->getKey();
526525 $recordCount = $value->getRecordCount();
527526
528527 for ($i = 0; $i < $recordCount; $i++) {
@@ -534,8 +533,28 @@
535534
536535 $idPath->popKey();
537536 }
 537+
 538+ return $result;
 539+ }
 540+
 541+ public function viewFooter(IdStack $idPath, array $visibleColumnEditors) {
 542+ return '</table>' . EOL;
 543+ }
 544+
 545+ public function getVisibleColumnHeadersForView($value) {
 546+ if ($this->hideEmptyColumns)
 547+ return $this->getColumnEditorsShowingData($this, $value);
 548+ else
 549+ return $this->getAllColumnEditors($this, $value);
 550+ }
538551
539 - $result .= '</table>' . EOL;
 552+ public function view(IdStack $idPath, $value) {
 553+ $visibleColumnEditors = $this->getVisibleColumnHeadersForView($value);
 554+
 555+ $result =
 556+ $this->viewHeader($idPath, $visibleColumnEditors) .
 557+ $this->viewRows($idPath, $value, $visibleColumnEditors) .
 558+ $this->viewFooter($idPath, $visibleColumnEditors);
540559
541560 return $result;
542561 }

Status & tagging log