Ticket #582: jelix-trunk-#582.2.patch

File jelix-trunk-#582.2.patch, 5.3 kB (added by bibo, 8 months ago)

deuxieme version qui corrige un petit bug

  • lib/jelix/docs/ns/jforms_1.1.rng

    old new  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <grammar 
     2<grammar 
    33  xmlns="http://relaxng.org/ns/structure/1.0" 
    44  xmlns:ev="http://www.w3.org/2001/xml-events" 
    55  datatype="http://www.w3.org/2001/XMLSchema-datatypes" 
     
    136136       <optional><attribute name="maxsize"><data type="integer" /></attribute></optional> 
    137137       <!--<element name="storage"> 
    138138           <attribute name="type"><choice><value>file</value><value>blob</value></choice></attribute> 
    139            <attribute name="value" /> 
     139           <attribute name="value" /> 
    140140       </element> 
    141141       --> 
    142142     </element> 
    143143  </define> 
    144  
     144 
    145145  <define name="checkbox"> 
    146146     <element name="checkbox"> 
    147147       <ref name="control.common" /> 
     
    231231        <ref name="alert" /> 
    232232     </optional> 
    233233  </define> 
    234  
     234 
    235235  <define name="UI.attr.readonly"> 
    236236      <optional><attribute name="readonly"><choice><value>true</value><value>false</value></choice></attribute></optional> 
    237237  </define> 
     
    241241  <define name="UI.attr.defaultvalue"> 
    242242      <optional><attribute name="defaultvalue" /></optional> 
    243243  </define> 
    244  
     244 
    245245  <define name="attr.length"> 
    246246      <optional><attribute name="minlength"><data type="integer" /></attribute></optional> 
    247247      <optional><attribute name="maxlength"><data type="integer" /></attribute></optional> 
     
    319319                        <attribute name="criteriafrom" /> 
    320320                    </choice> 
    321321                </optional> 
     322                <optional><attribute name="profile" /></optional> 
    322323            </group> 
    323324            <attribute name="class" /> 
    324325        </choice> 
     
    393394      </define> 
    394395 
    395396  --> 
    396  
    397397 
     398 
    398399</grammar> 
  • lib/jelix/forms/jFormsCompiler_jf_1_1.class.php

    old new  
    101101            } 
    102102 
    103103            if(isset($attrs['dao'])) { 
     104                if ( isset($attrs['profile'])) 
     105                    $profile = '\''.$attrs['profile'].'\''; 
     106                else 
     107                    $profile = '\'\''; 
    104108                if(isset($attrs['valueproperty'])) { 
    105109                    $daovalue = $attrs['valueproperty']; 
    106110                } else 
     
    117121                else 
    118122                    $criteria=''; 
    119123 
    120                 $source[]='$ctrl->datasource = new jFormsDaoDatasource(\''.$attrs['dao'].'\',\''. 
     124                $source[]='$ctrl->datasource = new jFormsDaoDatasource(\''.$attrs['dao'].'\','.$profile.',\''. 
    121125                                $attrs['method'].'\',\''.$attrs['labelproperty'].'\',\''.$daovalue.'\''.$criteria.');'; 
    122126                if($controltype == 'submit'){ 
    123127                    $source[]='$ctrl->standalone=false;'; 
  • lib/jelix/forms/jFormsDatasource.class.php

    old new  
    33* @package     jelix 
    44* @subpackage  forms 
    55* @author      Laurent Jouanneau 
    6 * @contributor 
     6* @contributor Dominique Papin 
    77* @copyright   2006-2007 Laurent Jouanneau 
     8* @copyright   2008 Dominique Papin 
    89* @link        http://www.jelix.org 
    910* @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file 
    1011*/ 
     
    1718 */ 
    1819interface jIFormsDatasource { 
    1920    /** 
    20      * load and returns data to fill a control. The returned array should be 
     21     * load and returns data to fill a control. The returned array should be 
    2122     * an associative array  key => label 
    2223     * @param jFormsBase $form  the form 
    2324     * @return array the data 
     
    2627 
    2728    /** 
    2829     * Return the label corresponding to the given key 
    29      * @param string $key the key 
     30     * @param string $key the key 
    3031     * @return string the label 
    3132     */ 
    3233    public function getLabel($key); 
     
    8586 
    8687    protected $dao = null; 
    8788 
    88     function __construct ($selector ,$method , $label, $key, $criteria=null, $criteriaFrom=null){ 
    89         $this->selector  = $selector; 
     89    function __construct ($selector, $profile, $method , $label, $key, $criteria=null, $criteriaFrom=null){ 
     90        $this->selector  = $selector; 
     91        $this->profile = $profile; 
    9092        $this->method = $method ; 
    9193        $this->labelProperty = $label; 
    9294        $this->criteria = $criteria; 
    9395        $this->criteriaFrom = $criteriaFrom; 
    9496        if($key == ''){ 
    95             $rec = jDao::createRecord($this->selector); 
     97            $rec = jDao::createRecord($this->selector, $this->profile); 
    9698            $pfields = $rec->getPrimaryKeyNames(); 
    9799            $key = $pfields[0]; 
    98100        } 
     
    101103 
    102104    public function getData($form){ 
    103105        if($this->dao === null) 
    104             $this->dao = jDao::get($this->selector); 
     106            $this->dao = jDao::get($this->selector, $this->profile); 
    105107        if($this->criteria !== null) { 
    106108            $found = $this->dao->{$this->method}($this->criteria); 
    107109        } else if ($this->criteriaFrom !== null) { 
     
    126128    } 
    127129 
    128130} 
    129  
Download in other formats: Original Format