Changeset 1156
- Timestamp:
- 11/08/08 17:38:34 (2 months ago)
- Files:
-
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (5 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (1 diff)
- trunk/lib/jelix/forms/jFormsDataContainer.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/forms/jFormsBase.class.php
r1138 r1156 105 105 106 106 /** 107 * list of modified controls108 * keys are name of control, value is the old value of the control109 * @var array110 */111 protected $modifiedControls = array();112 /**113 107 * the form selector 114 108 * @var string … … 139 133 public function initFromRequest(){ 140 134 $req = $GLOBALS['gJCoord']->request; 141 $this->modifiedControls=array();142 135 foreach($this->rootControls as $name=>$ctrl){ 143 136 if(!$this->container->isActivated($name) || $this->container->isReadOnly($name)) … … 450 443 } 451 444 452 453 function setModifiedFlag($name){454 $this->modifiedControls[$name] = $this->container->data[$name];455 }456 457 458 445 /** 459 446 * deactivate (or reactivate) a control … … 492 479 } 493 480 494 495 481 /** 496 482 * @return jFormsDataContainer … … 533 519 public function getHtmlEditors(){ return $this->htmleditors; } 534 520 535 /** 521 /** 522 * call this method after initilization of the form, in order to track 523 * modified controls 524 * @since 1.1 525 */ 526 public function resetModifiedControlsList(){ 527 $this->container->originalData = $this->container->data; 528 } 529 530 /** 536 531 * @return array key=control id, value=old value 537 532 * @since 1.1 538 533 */ 539 public function getModifiedControls(){ return $this->modifiedControls; } 534 public function getModifiedControls(){ 535 if(count($this->container->originalData)) 536 return array_diff($this->container->originalData, $this->container->data); 537 else 538 return $this->container->data; 539 } 540 540 541 541 /** trunk/lib/jelix/forms/jFormsControl.class.php
r1149 r1156 82 82 83 83 function setData($value) { 84 if($this->container->data[$this->ref] != $value)85 $this->form->setModifiedFlag($this->ref);86 84 $this->container->data[$this->ref] = $value; 87 85 } trunk/lib/jelix/forms/jFormsDataContainer.class.php
r1030 r1156 21 21 */ 22 22 public $data = array(); 23 23 24 /** 25 * contains data provided by the user in each controls 26 * @var array 27 * @see jFormsBase::getModifiedControls() 28 * @see jFormsBase::resetModifiedControlsList() 29 */ 30 public $originalData = array(); 31 24 32 /** 25 33 * internal use. Used by controls object to store some private data. (captcha for example)
