Index: trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php |
— | — | @@ -84,12 +84,16 @@ |
85 | 85 | } |
86 | 86 | } |
87 | 87 | } else { // build simple text |
| 88 | + $numNonDateProperties = 0; |
| 89 | + // cycle through a 'row', which is the page |
| 90 | + // name (the first field) plus all its |
| 91 | + // properties |
88 | 92 | foreach ( $row as $i => $field ) { |
89 | 93 | $pr = $field->getPrintRequest(); |
90 | | - if ( $i == 2 ) |
91 | | - $text .= " ("; |
92 | | - elseif ( $i > 2 ) |
93 | | - $text .= ", "; |
| 94 | + // a property can have more than one |
| 95 | + // value - cycle through all the values |
| 96 | + // for this property |
| 97 | + $textForProperty = ''; |
94 | 98 | while ( ( $object = $field->getNextObject() ) !== false ) { |
95 | 99 | if ( $object->getTypeID() == '_dat' ) { |
96 | 100 | // don't add date values to the display |
— | — | @@ -97,30 +101,42 @@ |
98 | 102 | if ( $i == 0 ) { |
99 | 103 | $title = Title::newFromText( $object->getShortWikiText( false ) ); |
100 | 104 | } else { |
| 105 | + $numNonDateProperties++; |
101 | 106 | // handling of "headers=" param |
102 | 107 | if ( $this->mShowHeaders == SMW_HEADERS_SHOW ) { |
103 | | - $text .= $pr->getHTMLText( $skin ) . " "; |
| 108 | + $textForProperty .= $pr->getHTMLText( $skin ) . " "; |
104 | 109 | } elseif ( $this->mShowHeaders == SMW_HEADERS_PLAIN ) { |
105 | | - $text .= $pr->getLabel() . " "; |
| 110 | + $textForProperty .= $pr->getLabel() . " "; |
106 | 111 | } |
107 | 112 | // if $this->mShowHeaders == SMW_HEADERS_HIDE, print nothing |
108 | 113 | // handling of "link=" param |
109 | 114 | if ( $this->mLinkOthers ) { |
110 | | - $text .= $object->getLongText( $outputmode, $skin ); |
| 115 | + $textForProperty .= $object->getLongText( $outputmode, $skin ); |
111 | 116 | } else { |
112 | | - $text .= $object->getWikiValue(); |
| 117 | + $textForProperty .= $object->getWikiValue(); |
113 | 118 | } |
114 | 119 | } |
115 | 120 | } else { |
116 | | - $text .= $pr->getHTMLText( $skin ) . " " . $object->getShortText( $outputmode, $skin ); |
| 121 | + $numNonDateProperties++; |
| 122 | + $textForProperty .= $pr->getHTMLText( $skin ) . " " . $object->getShortText( $outputmode, $skin ); |
117 | 123 | } |
118 | 124 | if ( $pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_dat' ) { |
119 | 125 | $dates[] = SRFCalendar::formatDateStr( $object ); |
120 | 126 | } |
121 | 127 | } |
| 128 | + // add the text for this property to |
| 129 | + // the main text, adding on parentheses |
| 130 | + // or commas as needed |
| 131 | + if ( $numNonDateProperties == 1 ) { |
| 132 | + $text .= " ("; |
| 133 | + } elseif ( $numNonDateProperties > 1 ) { |
| 134 | + $text .= ", "; |
| 135 | + } |
| 136 | + $text .= $textForProperty; |
122 | 137 | } |
123 | | - if ( $i > 1 ) |
| 138 | + if ( $numNonDateProperties > 0 ) { |
124 | 139 | $text .= ")"; |
| 140 | + } |
125 | 141 | } |
126 | 142 | if ( count( $dates ) > 0 ) { |
127 | 143 | // handle the 'color=' value, whether it came |