Changeset 2936
- Timestamp:
- 12/06/06 14:47:16 (3 years ago)
- Files:
-
- trunk/lib/filter/sfFillInFormFilter.class.php (modified) (1 diff)
- trunk/lib/util/sfFillInForm.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/filter/sfFillInFormFilter.class.php
r2677 r2936 44 44 45 45 // fill in 46 $content = $fillInForm->fillIn($response->getContent(), $this->getParameter('name'), $this->getParameter('id'), $request->getParameterHolder()->getAll()); 46 $method = $this->getParameter('content_type', preg_match('/xh?ml/', $response->getHttpHeader('Content-Type')) ? 'fillInXml' : 'fillInHtml'); 47 $content = $fillInForm->$method($response->getContent(), $this->getParameter('name'), $this->getParameter('id'), $request->getParameterHolder()->getAll()); 47 48 48 49 $response->setContent($content); trunk/lib/util/sfFillInForm.class.php
r2678 r2936 41 41 } 42 42 43 public function fillIn ($html, $formName, $formId, $values)43 public function fillInHtml($html, $formName, $formId, $values) 44 44 { 45 45 $dom = new DomDocument('1.0', sfConfig::get('sf_charset', 'UTF-8')); … … 51 51 } 52 52 53 public function fillInXml($xml, $formName, $formId, $values) 54 { 55 $dom = new DomDocument('1.0', sfConfig::get('sf_charset', 'UTF-8')); 56 @$dom->loadXML($xml); 57 58 $dom = $this->fillInDom($dom, $formName, $formId, $values); 59 60 return $dom->saveXML(); 61 } 62 53 63 public function fillInDom($dom, $formName, $formId, $values) 54 64 { … … 79 89 if (!$form) 80 90 { 81 throw new sfException(sprintf('The form "%s" cannot be found', $formName ? $formName : $formId)); 91 if (!$formName && !$formId) 92 { 93 throw new sfException('No form found in this page'); 94 } 95 else 96 { 97 throw new sfException(sprintf('The form "%s" cannot be found', $formName ? $formName : $formId)); 98 } 82 99 } 83 100

