Changeset 404
- Timestamp:
- 03/19/07 23:49:18 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/websites/xml/stubXMLPageElement.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/xml/stubXMLProcessor.php (modified) (2 diffs)
- trunk/src/main/resources/xsl/stub.xsl (modified) (4 diffs)
- trunk/src/test/php/net/stubbles/websites/xml/stubXMLProcessorTestCase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/xml/stubXMLPageElement.php
r267 r404 16 16 interface stubXMLPageElement extends stubPageElement 17 17 { 18 // intentionally empty 18 /** 19 * returns a list of form values 20 * 21 * @param stubRequest $request 22 * @return array<string,string> 23 */ 24 public function getFormValues(stubRequest $request); 19 25 } 20 26 ?> trunk/src/main/php/net/stubbles/websites/xml/stubXMLProcessor.php
r369 r404 53 53 $this->writeSessionValues($xmlStreamWriter); 54 54 $prefixRequest = new stubRequestPrefixDecorator($this->request, ''); 55 $formValues = array(); 55 56 foreach ($elements as $name => $element) { 56 57 $prefixRequest->setPrefix($name); … … 61 62 $data = $element->process($prefixRequest, $this->session, $this->response); 62 63 $xmlSerializer->serialize($data, $xmlStreamWriter, array(stubXMLSerializer::OPT_ROOT_TAG => $name)); 64 if ($element instanceof stubXMLPageElement) { 65 $formValues[$name] = $element->getFormValues($prefixRequest); 66 } 63 67 } 68 $xmlSerializer->serialize($formValues, $xmlStreamWriter, array(stubXMLSerializer::OPT_ROOT_TAG => 'forms')); 64 69 $this->writeRequestValues($xmlStreamWriter, $xmlSerializer); 65 70 trunk/src/main/resources/xsl/stub.xsl
r403 r404 255 255 </xsl:attribute> 256 256 <xsl:copy-of select="@*[local-name() != 'id' and local-name() != 'name' and local-name() != 'mandatory']"/> 257 <ixsl:attribute name="value"> 258 <ixsl:if> 259 <xsl:attribute name="test"> 260 <xsl:text>/document/forms/</xsl:text> 261 <xsl:value-of select="$id"/> 262 <xsl:text>/</xsl:text> 263 <xsl:value-of select="@name"/> 264 </xsl:attribute> 265 <ixsl:value-of> 266 <xsl:attribute name="select"> 267 <xsl:text>/document/forms/</xsl:text> 268 <xsl:value-of select="$id"/> 269 <xsl:text>/</xsl:text> 270 <xsl:value-of select="@name"/> 271 </xsl:attribute> 272 </ixsl:value-of> 273 </ixsl:if> 274 </ixsl:attribute> 257 275 </input> 258 276 </xsl:when> … … 272 290 <xsl:apply-templates select="node()"> 273 291 <xsl:with-param name="id" select="@id"/> 292 <xsl:with-param name="name" select="@name"/> 274 293 </xsl:apply-templates> 275 294 </select> … … 289 308 <xsl:copy-of select="@*[local-name() != 'id' and local-name() != 'name' and local-name() != 'mandatory' and local-name() != 'type']"/> 290 309 <xsl:apply-templates select="text()"/> 310 <ixsl:if> 311 <xsl:attribute name="test"> 312 <xsl:text>/document/forms/</xsl:text> 313 <xsl:value-of select="$id"/> 314 <xsl:text>/</xsl:text> 315 <xsl:value-of select="@name"/> 316 </xsl:attribute> 317 <ixsl:value-of> 318 <xsl:attribute name="select"> 319 <xsl:text>/document/forms/</xsl:text> 320 <xsl:value-of select="$id"/> 321 <xsl:text>/</xsl:text> 322 <xsl:value-of select="@name"/> 323 </xsl:attribute> 324 </ixsl:value-of> 325 </ixsl:if> 291 326 </textarea> 292 327 </xsl:when> … … 347 382 <xsl:template match="stub:option" name="stub:option"> 348 383 <xsl:param name="id" select="@id"/> 384 <xsl:param name="name" select="@name"/> 349 385 <option> 350 386 <xsl:copy-of select="@*"/> 351 387 <xsl:apply-templates select="text()"/> 388 <ixsl:if> 389 <xsl:attribute name="test"> 390 <xsl:text>/document/forms/</xsl:text> 391 <xsl:value-of select="$id"/> 392 <xsl:text>/</xsl:text> 393 <xsl:value-of select="$name"/> 394 </xsl:attribute> 395 <ixsl:attribute name="selected"> 396 <ixsl:value-of> 397 <xsl:text>selected</xsl:text> 398 </ixsl:value-of> 399 </ixsl:attribute> 400 </ixsl:if> 352 401 </option> 353 402 </xsl:template> trunk/src/test/php/net/stubbles/websites/xml/stubXMLProcessorTestCase.php
r317 r404 124 124 $this->mockXMLStreamWriter->expectCallcount('writeStartElement', 4); 125 125 $this->mockXMLStreamWriter->expectCallcount('writeEndElement', 4); 126 $this->mockXMLSerializer->expect Never('serialize');126 $this->mockXMLSerializer->expectOnce('serialize'); 127 127 $return = $this->xmlProcessor->process(); 128 128 $this->assertReference($this->xmlProcessor, $return);
