Changeset 877

Show
Ignore:
Timestamp:
04/12/08 17:15:23 (8 months ago)
Author:
laurentj
Message:

ticket #518: added the possibility to set the visibility of a form's field in a controller
- made also improvements in jForms: template plugins for jforms are now almost independant from the builder
- fixed a typo in some properties files for crud

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_EN/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-1.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.ISO-8859-15.properties

    r791 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/core-modules/jelix/locales/en_US/crud.UTF-8.properties

    r571 r877  
    77link.view.record = View 
    88link.create.record = Create a new record 
    9 link.edit.record = Edite 
     9link.edit.record = Edit 
    1010link.delete.record = Delete 
    1111 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r861 r877  
    133133        $this->_modifiedControls=array(); 
    134134        foreach($this->_controls as $name=>$ctrl){ 
     135            if(!$this->_container->isActivated($name)) 
     136                continue; 
    135137            $value = $req->getParam($name); 
    136138            //@todo à prevoir un meilleur test, pour les formulaires sur plusieurs pages 
     
    173175        $this->_container->errors = array(); 
    174176        foreach($this->_controls as $name=>$ctrl){ 
     177            if(!$this->_container->isActivated($name)) 
     178                continue; 
    175179            $err = $ctrl->check($this); 
    176180            if($err !== null) 
     
    298302        return compact("daorec", "dao", "toInsert"); 
    299303    } 
    300          
    301          
     304 
    302305    /** 
    303306     * save data using a dao. 
     
    505508     * @deprecated since 1.1 
    506509     */ 
    507     public function getDatas(){ return $this->_container->data; } 
     510    public function getDatas(){ 
     511        trigger_error('jFormsBase::getDatas is deprecated, use getAllData instead',E_USER_NOTICE); 
     512        return $this->_container->data; 
     513    } 
     514 
     515    /** 
     516     * deactivate (or reactivate) a control 
     517     * When a control is deactivated, it is not displayes anymore in the output form 
     518     * @param string $name  the name of the control 
     519     * @param boolean $deactivation   TRUE to deactivate, or FALSE to reactivate 
     520     */ 
     521    public function deactivate($name, $deactivation=true) { 
     522        if($deactivation) { 
     523            $this->_container->deactivate($name); 
     524        } 
     525        else { 
     526            $this->_container->deactivate($name, false); 
     527        } 
     528    } 
     529 
     530    /** 
     531    * check if a control is activated 
     532    * @param $name the control name 
     533    * @return boolean true if it is activated 
     534    */ 
     535    public function isActivated($name) { 
     536        return $this->_container->isActivated($name); 
     537    } 
     538 
    508539    /** 
    509540     * @return jFormsDataContainer 
     
    563594    /** 
    564595     * @param string $buildertype  the type name of a form builder 
    565      * @param string $action action selector where form will be submit 
    566      * @param array $actionParams  parameters for the action 
    567596     * @return jFormsBuilderBase 
    568597     */ 
    569     public function getBuilder($buildertype, $action, $actionParams){ 
     598    public function getBuilder($buildertype){ 
    570599        if(isset($this->_builders[$buildertype])){ 
     600            if(isset($this->_builders[$buildertype]['inst'])) 
     601                return $this->_builders[$buildertype]['inst']; 
    571602            include_once(JELIX_LIB_PATH.'forms/jFormsBuilderBase.class.php'); 
    572603            include_once ($this->_builders[$buildertype][0]); 
    573604            $c =  $this->_builders[$buildertype][1]; 
    574             return new $c($this, $action, $actionParams); 
     605            $o = $this->_builders[$buildertype]['inst'] = new $c($this); 
     606            return $o; 
    575607        }else{ 
    576608            throw new jExceptionForms('jelix~formserr.invalid.form.builder', array($buildertype, $this->_sel)); 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r861 r877  
    133133        $this->_modifiedControls=array(); 
    134134        foreach($this->_controls as $name=>$ctrl){ 
     135            if(!$this->_container->isActivated($name)) 
     136                continue; 
    135137            $value = $req->getParam($name); 
    136138            //@todo à prevoir un meilleur test, pour les formulaires sur plusieurs pages 
     
    173175        $this->_container->errors = array(); 
    174176        foreach($this->_controls as $name=>$ctrl){ 
     177            if(!$this->_container->isActivated($name)) 
     178                continue; 
    175179            $err = $ctrl->check($this); 
    176180            if($err !== null) 
     
    298302        return compact("daorec", "dao", "toInsert"); 
    299303    } 
    300          
    301          
     304 
    302305    /** 
    303306     * save data using a dao. 
     
    505508     * @deprecated since 1.1 
    506509     */ 
    507     public function getDatas(){ return $this->_container->data; } 
     510    public function getDatas(){ 
     511        trigger_error('jFormsBase::getDatas is deprecated, use getAllData instead',E_USER_NOTICE); 
     512        return $this->_container->data; 
     513    } 
     514 
     515    /** 
     516     * deactivate (or reactivate) a control 
     517     * When a control is deactivated, it is not displayes anymore in the output form 
     518     * @param string $name  the name of the control 
     519     * @param boolean $deactivation   TRUE to deactivate, or FALSE to reactivate 
     520     */ 
     521    public function deactivate($name, $deactivation=true) { 
     522        if($deactivation) { 
     523            $this->_container->deactivate($name); 
     524        } 
     525        else { 
     526            $this->_container->deactivate($name, false); 
     527        } 
     528    } 
     529 
     530    /** 
     531    * check if a control is activated 
     532    * @param $name the control name 
     533    * @return boolean true if it is activated 
     534    */ 
     535    public function isActivated($name) { 
     536        return $this->_container->isActivated($name); 
     537    } 
     538 
    508539    /** 
    509540     * @return jFormsDataContainer 
     
    563594    /** 
    564595     * @param string $buildertype  the type name of a form builder 
    565      * @param string $action action selector where form will be submit 
    566      * @param array $actionParams  parameters for the action 
    567596     * @return jFormsBuilderBase 
    568597     */ 
    569     public function getBuilder($buildertype, $action, $actionParams){ 
     598    public function getBuilder($buildertype){ 
    570599        if(isset($this->_builders[$buildertype])){ 
     600            if(isset($this->_builders[$buildertype]['inst'])) 
     601                return $this->_builders[$buildertype]['inst']; 
    571602            include_once(JELIX_LIB_PATH.'forms/jFormsBuilderBase.class.php'); 
    572603            include_once ($this->_builders[$buildertype][0]); 
    573604            $c =  $this->_builders[$buildertype][1]; 
    574             return new $c($this, $action, $actionParams); 
     605            $o = $this->_builders[$buildertype]['inst'] = new $c($this); 
     606            return $o; 
    575607        }else{ 
    576608            throw new jExceptionForms('jelix~formserr.invalid.form.builder', array($buildertype, $this->_sel)); 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r861 r877  
    133133        $this->_modifiedControls=array(); 
    134134        foreach($this->_controls as $name=>$ctrl){ 
     135            if(!$this->_container->isActivated($name)) 
     136                continue; 
    135137            $value = $req->getParam($name); 
    136138            //@todo à prevoir un meilleur test, pour les formulaires sur plusieurs pages 
     
    173175        $this->_container->errors = array(); 
    174176        foreach($this->_controls as $name=>$ctrl){ 
     177            if(!$this->_container->isActivated($name)) 
     178                continue; 
    175179            $err = $ctrl->check($this); 
    176180            if($err !== null) 
     
    298302        return compact("daorec", "dao", "toInsert"); 
    299303    } 
    300          
    301          
     304 
    302305    /** 
    303306     * save data using a dao. 
     
    505508     * @deprecated since 1.1 
    506509     */ 
    507     public function getDatas(){ return $this->_container->data; } 
     510    public function getDatas(){ 
     511        trigger_error('jFormsBase::getDatas is deprecated, use getAllData instead',E_USER_NOTICE); 
     512        return $this->_container->data; 
     513    } 
     514 
     515    /** 
     516     * deactivate (or reactivate) a control 
     517     * When a control is deactivated, it is not displayes anymore in the output form 
     518     * @param string $name  the name of the control 
     519     * @param boolean $deactivation   TRUE to deactivate, or FALSE to reactivate 
     520     */ 
     521    public function deactivate($name, $deactivation=true) { 
     522        if($deactivation) { 
     523            $this->_container->deactivate($name); 
     524        } 
     525        else { 
     526            $this->_container->deactivate($name, false); 
     527        } 
     528    } 
     529 
     530    /** 
     531    * check if a control is activated 
     532    * @param $name the control name 
     533    * @return boolean true if it is activated 
     534    */ 
     535    public function isActivated($name) { 
     536        return $this->_container->isActivated($name); 
     537    } 
     538 
    508539    /** 
    509540     * @return jFormsDataContainer 
     
    563594    /** 
    564595     * @param string $buildertype  the type name of a form builder 
    565      * @param string $action action selector where form will be submit 
    566      * @param array $actionParams  parameters for the action 
    567596     * @return jFormsBuilderBase 
    568597     */ 
    569     public function getBuilder($buildertype, $action, $actionParams){ 
     598    public function getBuilder($buildertype){ 
    570599        if(isset($this->_builders[$buildertype])){ 
     600            if(isset($this->_builders[$buildertype]['inst'])) 
     601                return $this->_builders[$buildertype]['inst']; 
    571602            include_once(JELIX_LIB_PATH.'forms/jFormsBuilderBase.class.php'); 
    572603            include_once ($this->_builders[$buildertype][0]); 
    573604            $c =  $this->_builders[$buildertype][1]; 
    574             return new $c($this, $action, $actionParams); 
     605            $o = $this->_builders[$buildertype]['inst'] = new $c($this); 
     606            return $o; 
    575607        }else{ 
    576608            throw new jExceptionForms('jelix~formserr.invalid.form.builder', array($buildertype, $this->_sel)); 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r861 r877  
    133133        $this->_modifiedControls=array(); 
    134134        foreach($this->_controls as $name=>$ctrl){ 
     135            if(!$this->_container->isActivated($name)) 
     136                continue; 
    135137            $value = $req->getParam($name); 
    136138            //@todo à prevoir un meilleur test, pour les formulaires sur plusieurs pages 
     
    173175        $this->_container->errors = array(); 
    174176        foreach($this->_controls as $name=>$ctrl){ 
     177            if(!$this->_container->isActivated($name)) 
     178                continue; 
    175179            $err = $ctrl->check($this); 
    176180            if($err !== null) 
     
    298302        return compact("daorec", "dao", "toInsert"); 
    299303    } 
    300          
    301          
     304 
    302305    /** 
    303306     * save data using a dao. 
     
    505508     * @deprecated since 1.1 
    506509     */ 
    507     public function getDatas(){ return $this->_container->data; } 
     510    public function getDatas(){ 
     511        trigger_error('jFormsBase::getDatas is deprecated, use getAllData instead',E_USER_NOTICE); 
     512        return $this->_container->data; 
     513    } 
     514 
     515    /** 
     516     * deactivate (or reactivate) a control 
     517     * When a control is deactivated, it is not displayes anymore in the output form 
     518     * @param string $name  the name of the control 
     519     * @param boolean $deactivation   TRUE to deactivate, or FALSE to reactivate 
     520     */ 
     521    public function deactivate($name, $deactivation=true) { 
     522        if($deactivation) { 
     523            $this->_container->deactivate($name); 
     524        } 
     525        else { 
     526            $this->_container->deactivate($name, false); 
     527        } 
     528    } 
     529 
     530    /** 
     531    * check if a control is activated 
     532    * @param $name the control name 
     533    * @return boolean true if it is activated 
     534    */ 
     535    public function isActivated($name) { 
     536        return $this->_container->isActivated($name); 
     537    } 
     538 
    508539    /** 
    509540     * @return jFormsDataContainer 
     
    563594    /** 
    564595     * @param string $buildertype  the type name of a form builder 
    565      * @param string $action action selector where form will be submit 
    566      * @param array $actionParams  parameters for the action 
    567596     * @return jFormsBuilderBase 
    568597     */ 
    569     public function getBuilder($buildertype, $action, $actionParams){ 
     598    public function getBuilder($buildertype){ 
    570599        if(isset($this->_builders[$buildertype])){ 
     600            if(isset($this->_builders[$buildertype]['inst'])) 
     601                return $this->_builders[$buildertype]['inst']; 
    571602            include_once(JELIX_LIB_PATH.'forms/jFormsBuilderBase.class.php'); 
    572603            include_once ($this->_builders[$buildertype][0]); 
    573604            $c =  $this->_builders[$buildertype][1]; 
    574             return new $c($this, $action, $actionParams); 
     605            $o = $this->_builders[$buildertype]['inst'] = new $c($this); 
     606            return $o; 
    575607        }else{ 
    576608            throw new jExceptionForms('jelix~formserr.invalid.form.builder', array($buildertype, $this->_sel)); 
  • trunk/lib/jelix/forms/jFormsBuilderBase.class.php

    r836 r877  
    4646    /** 
    4747     * @param jFormsBase $form a form object 
     48     */ 
     49    public function __construct($form){ 
     50        $this->_form = $form; 
     51    } 
     52 
     53    /** 
    4854     * @param string $action action selector where form will be submit 
    4955