Changeset 841

Show
Ignore:
Timestamp:
03/25/08 18:47:36 (8 months ago)
Author:
laurentj
Message:

worked on ticket #215: implementation of <htmleditor> in jforms. Some unit tests are still bad...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/manifests/jelix-lib.mn

    r840 r841  
    561561  screen.css 
    562562  icons.png 
     563cd lib/jelix-www/wymeditor/config 
     564c simple.js 
    563565cd lib/jelix-www/jquery 
    564566  GPL-LICENSE.txt 
  • trunk/build/manifests/jelix-lib.mn

    r840 r841  
    561561  screen.css 
    562562  icons.png 
     563cd lib/jelix-www/wymeditor/config 
     564c simple.js 
    563565cd lib/jelix-www/jquery 
    564566  GPL-LICENSE.txt 
  • trunk/build/manifests/jelix-lib.mn

    r840 r841  
    561561  screen.css 
    562562  icons.png 
     563cd lib/jelix-www/wymeditor/config 
     564c simple.js 
    563565cd lib/jelix-www/jquery 
    564566  GPL-LICENSE.txt 
  • trunk/lib/jelix/core/defaultconfig.ini.php

    r838 r841  
    134134; jelix-www, or copy its content in yourapp/www/ (with a name like 'jelix' for example) 
    135135; so you should indicate the relative path of this link/directory to the basePath, or an absolute path. 
     136; if you change it, change also all pathes in [htmleditors] 
    136137jelixWWWPath = "jelix/" 
    137138 
     
    217218; dao_selector = "jelix~jsession" 
    218219; dao_db_profile = "" 
     220 
     221 
     222[htmleditors] 
     223wymeditor        = jelix/wymeditor/jquery.wymeditor.js 
     224wymeditor.config.simple = jelix/wymeditor/config/simple.js 
     225wymeditor.skin.default  = jelix/wymeditor/skins/default/screen.css 
     226 
  • trunk/lib/jelix/core/defaultconfig.ini.php

    r838 r841  
    134134; jelix-www, or copy its content in yourapp/www/ (with a name like 'jelix' for example) 
    135135; so you should indicate the relative path of this link/directory to the basePath, or an absolute path. 
     136; if you change it, change also all pathes in [htmleditors] 
    136137jelixWWWPath = "jelix/" 
    137138 
     
    217218; dao_selector = "jelix~jsession" 
    218219; dao_db_profile = "" 
     220 
     221 
     222[htmleditors] 
     223wymeditor        = jelix/wymeditor/jquery.wymeditor.js 
     224wymeditor.config.simple = jelix/wymeditor/config/simple.js 
     225wymeditor.skin.default  = jelix/wymeditor/skins/default/screen.css 
     226 
  • trunk/lib/jelix/core/defaultconfig.ini.php

    r838 r841  
    134134; jelix-www, or copy its content in yourapp/www/ (with a name like 'jelix' for example) 
    135135; so you should indicate the relative path of this link/directory to the basePath, or an absolute path. 
     136; if you change it, change also all pathes in [htmleditors] 
    136137jelixWWWPath = "jelix/" 
    137138 
     
    217218; dao_selector = "jelix~jsession" 
    218219; dao_db_profile = "" 
     220 
     221 
     222[htmleditors] 
     223wymeditor        = jelix/wymeditor/jquery.wymeditor.js 
     224wymeditor.config.simple = jelix/wymeditor/config/simple.js 
     225wymeditor.skin.default  = jelix/wymeditor/skins/default/screen.css 
     226 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r839 r841  
    7272     */ 
    7373    protected $_hiddens = array(); 
     74 
     75    /** 
     76     * List of htmleditorcontrols 
     77     * array of jFormsControl objects 
     78     * @var array 
     79     * @see jFormsControl 
     80     */ 
     81    protected $_htmleditors = array(); 
    7482 
    7583    /** 
     
    499507    public function getHiddens(){ return $this->_hiddens; } 
    500508 
     509     /** 
     510     * @return array of jFormsControl objects 
     511     */ 
     512    public function getHtmlEditors(){ return $this->_htmleditors; } 
     513 
    501514    /** 
    502515     * @return array of jFormsControl objects 
     
    608621        else if($control->type =='hidden') 
    609622            $this->_hiddens [$control->ref] = $control; 
     623        else if($control->type == 'htmleditor') 
     624            $this->_htmleditors [$control->ref] = $control; 
    610625 
    611626        if(!isset($this->_container->data[$control->ref])){ 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r839 r841  
    7272     */ 
    7373    protected $_hiddens = array(); 
     74 
     75    /** 
     76     * List of htmleditorcontrols 
     77     * array of jFormsControl objects 
     78     * @var array 
     79     * @see jFormsControl 
     80     */ 
     81    protected $_htmleditors = array(); 
    7482 
    7583    /** 
     
    499507    public function getHiddens(){ return $this->_hiddens; } 
    500508 
     509     /** 
     510     * @return array of jFormsControl objects 
     511     */ 
     512    public function getHtmlEditors(){ return $this->_htmleditors; } 
     513 
    501514    /** 
    502515     * @return array of jFormsControl objects 
     
    608621        else if($control->type =='hidden') 
    609622            $this->_hiddens [$control->ref] = $control; 
     623        else if($control->type == 'htmleditor') 
     624            $this->_htmleditors [$control->ref] = $control; 
    610625 
    611626        if(!isset($this->_container->data[$control->ref])){ 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r839 r841  
    7272     */ 
    7373    protected $_hiddens = array(); 
     74 
     75    /** 
     76     * List of htmleditorcontrols 
     77     * array of jFormsControl objects 
     78     * @var array 
     79     * @see jFormsControl 
     80     */ 
     81    protected $_htmleditors = array(); 
    7482 
    7583    /** 
     
    499507    public function getHiddens(){ return $this->_hiddens; } 
    500508 
     509     /** 
     510     * @return array of jFormsControl objects 
     511     */ 
     512    public function getHtmlEditors(){ return $this->_htmleditors; } 
     513 
    501514    /** 
    502515     * @return array of jFormsControl objects 
     
    608621        else if($control->type =='hidden') 
    609622            $this->_hiddens [$control->ref] = $control; 
     623        else if($control->type == 'htmleditor') 
     624            $this->_htmleditors [$control->ref] = $control; 
    610625 
    611626        if(!isset($this->_container->data[$control->ref])){ 
  • trunk/lib/jelix/forms/jFormsCompiler.class.php

    r840 r841  
    180180            unset($attributes['type']); 
    181181        } 
     182        $this->_generateTextareaHtmlEditor($source, $control, $attributes); 
     183    } 
     184 
     185    protected function _generateTextareaHtmlEditor(&$source, $control, &$attributes) { 
    182186        $this->attrReadonly($source, $attributes); 
    183187        $this->attrRequired($source, $attributes); 
     
    206210            $source[]='$ctrl->cols='.$cols.';'; 
    207211            unset($attributes['cols']); 
     212        } 
     213    } 
     214 
     215    protected function generateHtmleditor(&$source, $control, &$attributes) { 
     216        $this->_generateTextareaHtmlEditor($source, $control, $attributes); 
     217 
     218        if (isset($attributes['engine'])) { 
     219            $source[]='$ctrl->engine=\''.str_replace("'","\\'",$attributes['engine']).'\';'; 
     220            unset($attributes['engine']); 
     221        } 
     222 
     223        if (isset($attributes['config'])) { 
     224            $source[]='$ctrl->config=\''.str_replace("'","\\'",$attributes['config']).'\';'; 
     225            unset($attributes['config']); 
     226        } 
     227        if (isset($attributes['skin'])) { 
     228            $source[]='$ctrl->skin=\''.str_replace("'","\\'",$attributes['skin']).'\';'; 
     229            unset($attributes['skin']); 
    208230        } 
    209231    } 
  • trunk/lib/jelix/forms/jFormsCompiler.class.php

    r840 r841  
    180180            unset($attributes['type']); 
    181181        } 
     182        $this->_generateTextareaHtmlEditor($source, $control, $attributes); 
     183    } 
     184 
     185    protected function _generateTextareaHtmlEditor(&$source, $control, &$attributes) { 
    182186        $this->attrReadonly($source, $attributes); 
    183187        $this->attrRequired($source, $attributes); 
     
    206210            $source[]='$ctrl->cols='.$cols.';'; 
    207211            unset($attributes['cols']); 
     212        } 
     213    } 
     214 
     215    protected function generateHtmleditor(&$source, $control, &$attributes) { 
     216        $this->_generateTextareaHtmlEditor($source, $control, $attributes); 
     217 
     218        if (isset($attributes['engine'])) { 
     219            $source[]='$ctrl->engine=\''.str_replace("'","\\'",$attributes['engine']).'\';'; 
     220            unset($attributes['engine']); 
     221        } 
     222 
     223        if (isset($attributes['config'])) { 
     224            $source[]='$ctrl->config=\''.str_replace("'","\\'",$attributes['config']).'\';'; 
     225            unset($attributes['config']); 
     226        } 
     227        if (isset($attributes['skin'])) { 
     228            $source[]='$ctrl->skin=\''.str_replace("'","\\'",$attributes['skin']).'\';'; 
     229            unset($attributes['skin']); 
    208230        } 
    209231    } 
  • trunk/lib/jelix/forms/jFormsCompiler.class.php

    r840 r841  
    180180            unset($attributes['type']); 
    181181        } 
     182        $this->_generateTextareaHtmlEditor($source, $control, $attributes); 
     183    } 
     184 
     185    protected function _generateTextareaHtmlEditor(&$source, $control, &$attributes) { 
    182186        $this->attrReadonly($source, $attributes); 
    183187        $this->attrRequired($source, $attributes); 
     
    206210            $source[]='$ctrl->cols='.$cols.';'; 
    207211            unset($attributes['cols']); 
     212        } 
     213    } 
     214 
     215    protected function generateHtmleditor(&$source, $control, &$attributes) { 
     216        $this->_generateTextareaHtmlEditor($source, $control, $attributes); 
     217 
     218        if (isset($attributes['engine'])) { 
     219            $source[]='$ctrl->engine=\''.str_replace("'","\\'",$attributes['engine']).'\';'; 
     220            unset($attributes['engine']); 
     221        } 
     222 
     223        if (isset($attributes['config'])) { 
     224            $source[]='$ctrl->config=\''.str_replace("'","\\'",$attributes['config']).'\';'; 
     225            unset($attributes['config']); 
     226        } 
     227        if (isset($attributes['skin'])) { 
     228            $source[]='$ctrl->skin=\''.str_replace("'","\\'",$attributes['skin']).'\';'; 
     229            unset($attributes['skin']); 
    208230        } 
    209231    } 
  • trunk/lib/jelix/forms/jFormsControl.class.php

    r840 r841  
    8282 * @package     jelix 
    8383 * @subpackage  forms 
     84 * @since 1.1 
     85 */ 
     86class jFormsControlHtmlEditor extends jFormsControl { 
     87    public $type='htmleditor'; 
     88    public $rows=5; 
     89    public $cols=40; 
     90    public $engine='wymeditor'; 
     91    public $config='simple'; 
     92    public $skin='default'; 
     93    function __construct($ref){ 
     94        $this->ref = $ref; 
     95        $this->datatype = new jDatatypeHtml(); 
     96    } 
     97} 
     98 
     99/** 
     100 * 
     101 * @package     jelix 
     102 * @subpackage  forms 
    84103 */ 
    85104class jFormsControlSecret extends jFormsControl { 
     
    222241 * @package     jelix 
    223242 * @subpackage  forms 
     243 * @since 1.1 
    224244 */ 
    225245class jFormsControlCaptcha extends jFormsControl { 
  • trunk/lib/jelix/forms/jFormsControl.class.php

    r840 r841  
    8282 * @package     jelix 
    8383 * @subpackage  forms 
     84 * @since 1.1 
     85 */ 
     86class jFormsControlHtmlEditor extends jFormsControl { 
     87    public $type='htmleditor'; 
     88    public $rows=5; 
     89    public $cols=40; 
     90    public $engine='wymeditor'; 
     91    public $config='simple'; 
     92    public $skin='default'; 
     93    function __construct($ref){ 
     94        $this->ref = $ref; 
     95        $this->datatype = new jDatatypeHtml(); 
     96    } 
     97} 
     98 
     99/** 
     100 * 
     101 * @package     jelix 
     102 * @subpackage  forms 
    84103 */ 
    85104class jFormsControlSecret extends jFormsControl { 
     
    222241 * @package     jelix 
    223242 * @subpackage  forms 
     243 * @since 1.1 
    224244 */ 
    225245class jFormsControlCaptcha extends jFormsControl { 
  • trunk/lib/jelix/forms/jFormsControl.class.php

    r840 r841  
    8282 * @package     jelix 
    8383 * @subpackage  forms 
     84 * @since 1.1 
     85 */ 
     86class jFormsControlHtmlEditor extends jFormsControl { 
     87    public $type='htmleditor'; 
     88    public $rows=5; 
     89    public $cols=40; 
     90    public $engine='wymeditor'; 
     91    public $config='simple'; 
     92    public $skin='default'; 
     93    function __construct($ref){ 
     94        $this->ref = $ref; 
     95        $this->datatype = new jDatatypeHtml(); 
     96    } 
     97} 
     98 
     99/** 
     100 * 
     101 * @package     jelix 
     102 * @subpackage  forms 
    84103 */ 
    85104class jFormsControlSecret extends jFormsControl { 
     
    222241 * @package     jelix 
    223242 * @subpackage  forms 
     243 * @since 1.1 
    224244 */ 
    225245class jFormsControlCaptcha extends jFormsControl { 
  • trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php

    r840 r841  
    213213            echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 
    214214            break; 
     215        case 'htmleditor': 
     216            echo '<script type="text/javascript"> 
     217            //<![CDATA[ 
     218            jelix_',$ctrl->engine,'_',$ctrl->config.'("',$this->_name,'_',$ctrl->ref,'"); 
     219            //]]> 
     220            </script>'; 
     221 
     222            $value = $this->_form->getData($ctrl->ref); 
     223            $rows = ' rows="'.$ctrl->rows.'" cols="'.$ctrl->cols.'"'; 
     224            echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 
     225            break; 
    215226        case 'secret': 
    216227        case 'secretconfirm': 
  • trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php

    r840 r841  
    213213            echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 
    214214            break; 
     215        case 'htmleditor': 
     216            echo '<script type="text/javascript"> 
     217            //<![CDATA[ 
     218            jelix_',$ctrl->engine,'_',$ctrl->config.'("',$this->_name,'_',$ctrl->ref,'"); 
     219            //]]> 
     220            </script>'; 
     221 
     222            $value = $this->_form->getData($ctrl->ref); 
     223            $rows = ' rows="'.$ctrl->rows.'" cols="'.$ctrl->cols.'"'; 
     224            echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 
     225            break; 
    215226        case 'secret': 
    216227        case 'secretconfirm': 
  • trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php

    r840 r841  
    213213            echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 
    214214            break; 
     215        case 'htmleditor': 
     216            echo '<script type="text/javascript"> 
     217            //<![CDATA[ 
     218            jelix_',$ctrl->engine,'_',$ctrl->config.'("',$this->_name,'_',$ctrl->ref,'"); 
     219            //]]> 
     220            </script>'; 
     221 
     222            $value = $this->_form->getData($ctrl->ref); 
     223            $rows = ' rows="'.$ctrl->rows.'" cols="'.$ctrl->cols.'"'; 
     224            echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 
     225            break; 
    215226        case 'secret': 
    216227        case 'secretconfirm': 
  • trunk/lib/jelix/plugins/tpl/html/block.form.php

    r839 r841  
    6767$t->_privateVars[\'__displayed_ctrl\'] = array(); 
    6868'; 
    69     $compiler->addMetaContent('if($GLOBALS[\'gJCoord\']->response!= null){ 
    70     $GLOBALS[\'gJCoord\']->response->addJSLink($GLOBALS[\'gJConfig\']->urlengine[\'jelixWWWPath\'].\'js/jforms.js\'); 
    71     $GLOBALS[\'gJCoord\']->response->addCSSLink($GLOBALS[\'gJConfig\']->urlengine[\'jelixWWWPath\'].\'design/jform.css\'); 
     69    $compiler->addMetaContent('global $gJCoord, $gJConfig; 
     70if($gJCoord->response!= null){ 
     71    $www =$gJConfig->urlengine[\'jelixWWWPath\']; 
     72    $bp =$gJConfig->urlengine[\'basePath\']; 
     73    $gJCoord->response->addJSLink($www.\'js/jforms.js\'); 
     74    $gJCoord->response->addCSSLink($www.\'design/jform.css\'); 
     75    foreach($t->_vars as $k=>$v){ 
     76        if($v instanceof jFormsBase && count($edlist = $v->getHtmlEditors())) { 
     77            $gJCoord->response->addJSLink($www.\'jquery/jquery.js\'); 
     78            foreach($edlist as $ed) { 
     79                if(isset($gJConfig->htmleditors[$ed->engine])) 
     80                    $gJCoord->response->addJSLink($bp.$gJConfig->htmleditors[$ed->engine]); 
     81                if(isset($gJConfig->htmleditors[$ed->engine.\'.config.\'.$ed->config])) 
     82                    $gJCoord->response->addJSLink($bp.$gJConfig->htmleditors[$ed->engine.\'.config.\'.$ed->config]); 
     83                if(isset($gJConfig->htmleditors[$ed->engine.\'.skin.\'.$ed->skin])) 
     84                    $gJCoord->response->addCSSLink($bp.$gJConfig->htmleditors[$ed->engine.\'.skin.\'.$ed->skin]); 
     85            } 
     86        } 
     87    } 
    7288} 
    7389'); 
  • trunk/lib/jelix/plugins/tpl/html/block.form.php

    r839 r841  
    6767$t->_privateVars[\'__displayed_ctrl\'] = array(); 
    6868'; 
    69     $compiler->addMetaContent('if($GLOBALS[\'gJCoord\']->response!= null){ 
    70     $GLOBALS[\'gJCoord\']->response->addJSLink($GLOBALS[\'gJConfig\']->urlengine[\'jelixWWWPath\'].\'js/jforms.js\'); 
    71     $GLOBALS[\'gJCoord\']->response->addCSSLink($GLOBALS[\'gJConfig\']->urlengine[\'jelixWWWPath\'].\'design/jform.css\'); 
     69    $compiler->addMetaContent('global $gJCoord, $gJConfig; 
     70if($gJCoord->response!= null){ 
     71    $www =$gJConfig->urlengine[\'jelixWWWPath\']; 
     72    $bp =$gJConfig->urlengine[\'basePath\']; 
     73    $gJCoord->response->addJSLink($www.\'js/jforms.js\'); 
     74    $gJCoord->response->addCSSLink($www.\'design/jform.css\'); 
     75    foreach($t->_vars as $k=>$v){ 
     76        if($v instanceof jFormsBase && count($edlist = $v->getHtmlEditors())) { 
     77            $gJCoord->response->addJSLink($www.\'jquery/jquery.js\'); 
     78            foreach($edlist as $ed) { 
     79                if(isset($gJConfig->htmleditors[$ed->engine])) 
     80                    $gJCoord->response->addJSLink($bp.$gJConfig->htmleditors[$ed->engine]); 
     81                if(isset($gJConfig->htmleditors[$ed->engine.\'.config.\'.$ed->config])) 
     82                    $gJCoord->response->addJSLink($bp.$gJConfig->htmleditors[$ed->engine.\'.config.\'.$ed->config]); 
     83                if(isset($gJConfig->htmleditors[$ed->engine.\'.skin.\'.$ed->skin])) 
     84                    $gJCoord->response->addCSSLink($bp.$gJConfig->htmleditors[$ed->engine.\'.skin.\'.$ed->skin]); 
     85            } 
     86        } 
     87    } 
    7288} 
    7389'); 
  • trunk/lib/jelix/plugins/tpl/html/block.form.php

    r839 r841  
    6767$t->_privateVars[\'__displayed_ctrl\'] = array(); 
    6868'; 
    69     $compiler->addMetaContent('if($GLOBALS[\'gJCoord\']->response!= null){ 
    70     $GLOBALS[\'gJCoord\']->response->addJSLink($GLOBALS[\'gJConfig\']->urlengine[\'jelixWWWPath\'].\'js/jforms.js\'); 
    71     $GLOBALS[\'gJCoord\']->response->addCSSLink($GLOBALS[\'gJConfig\']->urlengine[\'jelixWWWPath\'].\'design/jform.css\'); 
     69    $compiler->addMetaContent('global $gJCoord, $gJConfig; 
     70if($gJCoord->response!= null){ 
     71    $www =$gJConfig->urlengine[\'jelixWWWPath\']; 
     72    $bp =$gJConfig->urlengine[\'basePath\']; 
     73    $gJCoord->response->addJSLink($www.\'js/jforms.js\'); 
     74    $gJCoord->response->addCSSLink($www.\'design/jform.css\'); 
     75    foreach($t->_vars as $k=>$v){ 
     76        if($v instanceof jFormsBase && count($edlist = $v->getHtmlEditors())) { 
     77            $gJCoord->response->addJSLink($www.\'jquery/jquery.js\'); 
     78            foreach($edlist as $ed) { 
     79                if(isset($gJConfig->htmleditors[$ed->engine])) 
     80                    $gJCoord->response->addJSLink($bp.$gJConfig->htmleditors[$ed->engine]); 
     81                if(isset($gJConfig->htmleditors[$ed->engine.\'.config.\'.$ed->config])) 
     82                    $gJCoord->response->addJSLink($bp.$gJConfig->htmleditors[$ed->engine.\'.config.\'.$ed->config]); 
     83                if(isset($gJConfig->htmleditors[$ed->engine.\'.skin.\'.$ed->skin])) 
     84                    $gJCoord->response->addCSSLink($bp.$gJConfig->htmleditors[$ed->engine.\'.skin.\'.$ed->skin]); 
     85            } 
     86        } 
     87    } 
    7288} 
    7389'); 
  • trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html_cli.php

    r840 r841  
    298298    <label>captcha</label> 
    299299</captcha>', 
     30072=>'<htmleditor ref="contenu" xmlns="http://jelix.org/ns/forms/1.0"> 
     301    <label>Texte</label> 
     302</htmleditor>', 
    300303    ); 
    301304 
     
    670673$ctrl->label=\'captcha\'; 
    671674$this->addControl($ctrl);', 
     67572=>'$ctrl= new jFormsControlhtmleditor(\'contenu\'); 
     676$ctrl->label=\'Texte\'; 
     677$this->addControl($ctrl);', 
    672678); 
    673679 
     
    1041104771=>'$label = \'captcha\'; 
    10421048$js.="jForms.tControl = new jFormsControl(\'cap\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 
     1049$js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 
     1050$js.="jForms.tControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 
     1051$js.="jForms.tForm.addControl( jForms.tControl);\n";', 
     105272=>'$label = \'Texte\'; 
     1053$js.="jForms.tControl = new jFormsControl(\'contenu\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 
    10431054$js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 
    10441055$js.="jForms.tControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 
  • trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html_cli.php

    r840 r841  
    298298    <label>captcha</label> 
    299299</captcha>', 
     30072=>'<htmleditor ref="contenu" xmlns="http://jelix.org/ns/forms/1.0"> 
     301    <label>Texte</label> 
     302</htmleditor>', 
    300303    ); 
    301304 
     
    670673$ctrl->label=\'captcha\'; 
    671674$this->addControl($ctrl);', 
     67572=>'$ctrl= new jFormsControlhtmleditor(\'contenu\'); 
     676$ctrl->label=\'Texte\'; 
     677$this->addControl($ctrl);', 
    672678); 
    673679 
     
    1041104771=>'$label = \'captcha\'; 
    10421048$js.="jForms.tControl = new jFormsControl(\'cap\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 
     1049$js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 
     1050$js.="jForms.tControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 
     1051$js.="jForms.tForm.addControl( jForms.tControl);\n";', 
     105272=>'$label = \'Texte\'; 
     1053$js.="jForms.tControl = new jFormsControl(\'contenu\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 
    10431054$js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 
    10441055$js.="jForms.tControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 
  • trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html_cli.php

    r840 r841  
    298298    <label>captcha</label> 
    299299</captcha>', 
     30072=>'<htmleditor ref="contenu" xmlns="http://jelix.org/ns/forms/1.0"> 
     301    <label>Texte</label> 
     302</htmleditor>', 
    300303    ); 
    301304 
     
    670673$ctrl->label=\'captcha\'; 
    671674$this->addControl($ctrl);', 
     67572=>'$ctrl= new jFormsControlhtmleditor(\'contenu\'); 
     676$ctrl->label=\'Texte\'; 
     677$this->addControl($ctrl);', 
    672678); 
    673679 
     
    1041104771=>'$label = \'captcha\'; 
    10421048$js.="jForms.tControl = new jFormsControl(\'cap\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 
     1049$js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 
     1050$js.="jForms.tControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 
     1051$js.="jForms.tForm.addControl( jForms.tControl);\n";', 
     105272=>'$label = \'Texte\'; 
     1053$js.="jForms.tControl = new jFormsControl(\'contenu\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 
    10431054$js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 
    10441055$js.="jForms.tControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 
  • trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php

    r840 r841  
    730730        $this->assertEqualOrDiff('<span class="jforms-captcha-question">'.htmlspecialchars($ctrl->question).'</span> <input type="text" name="cap" id="'.$this->formname.'_cap" title="ceci est un tooltip" value=""/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'cap\')">?</a></span>', $out); 
    731731    } 
     732 
     733    function testOutputHtmleditor(){ 
     734        $ctrl= new jFormsControlhtmleditor('contenu'); 
     735        $ctrl->label='Texte'; 
     736 
     737        ob_start();$this->builder->outputControlLabel($ctrl);$out = ob_get_clean(); 
     738        $this->assertEqualOrDiff('<label class="jforms-label" for="'.$this->formname.'_contenu">Texte</label>', $out); 
     739 
     740        $this->form->setData('contenu','<p>Ceci est un contenu</p>'); 
     741 
     742        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     743        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     744 
     745        $ctrl->readonly=true; 
     746        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     747        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     748 
     749        $ctrl->hint='ceci est un tooltip'; 
     750        ob_start();$this->builder->outputControlLabel($ctrl);$out = ob_get_clean(); 
     751        $this->assertEqualOrDiff('<label class="jforms-label" for="'.$this->formname.'_contenu" title="ceci est un tooltip">Texte</label>', $out); 
     752 
     753        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     754        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     755 
     756        $ctrl->rows=20; 
     757        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     758        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="20" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     759 
     760        $ctrl->cols=60; 
     761        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     762        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="20" cols="60">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     763 
     764    } 
    732765} 
    733766 
  • trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php

    r840 r841  
    730730        $this->assertEqualOrDiff('<span class="jforms-captcha-question">'.htmlspecialchars($ctrl->question).'</span> <input type="text" name="cap" id="'.$this->formname.'_cap" title="ceci est un tooltip" value=""/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'cap\')">?</a></span>', $out); 
    731731    } 
     732 
     733    function testOutputHtmleditor(){ 
     734        $ctrl= new jFormsControlhtmleditor('contenu'); 
     735        $ctrl->label='Texte'; 
     736 
     737        ob_start();$this->builder->outputControlLabel($ctrl);$out = ob_get_clean(); 
     738        $this->assertEqualOrDiff('<label class="jforms-label" for="'.$this->formname.'_contenu">Texte</label>', $out); 
     739 
     740        $this->form->setData('contenu','<p>Ceci est un contenu</p>'); 
     741 
     742        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     743        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     744 
     745        $ctrl->readonly=true; 
     746        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     747        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     748 
     749        $ctrl->hint='ceci est un tooltip'; 
     750        ob_start();$this->builder->outputControlLabel($ctrl);$out = ob_get_clean(); 
     751        $this->assertEqualOrDiff('<label class="jforms-label" for="'.$this->formname.'_contenu" title="ceci est un tooltip">Texte</label>', $out); 
     752 
     753        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     754        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     755 
     756        $ctrl->rows=20; 
     757        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     758        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="20" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     759 
     760        $ctrl->cols=60; 
     761        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     762        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="20" cols="60">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     763 
     764    } 
    732765} 
    733766 
  • trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php

    r840 r841  
    730730        $this->assertEqualOrDiff('<span class="jforms-captcha-question">'.htmlspecialchars($ctrl->question).'</span> <input type="text" name="cap" id="'.$this->formname.'_cap" title="ceci est un tooltip" value=""/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'cap\')">?</a></span>', $out); 
    731731    } 
     732 
     733    function testOutputHtmleditor(){ 
     734        $ctrl= new jFormsControlhtmleditor('contenu'); 
     735        $ctrl->label='Texte'; 
     736 
     737        ob_start();$this->builder->outputControlLabel($ctrl);$out = ob_get_clean(); 
     738        $this->assertEqualOrDiff('<label class="jforms-label" for="'.$this->formname.'_contenu">Texte</label>', $out); 
     739 
     740        $this->form->setData('contenu','<p>Ceci est un contenu</p>'); 
     741 
     742        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     743        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     744 
     745        $ctrl->readonly=true; 
     746        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     747        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     748 
     749        $ctrl->hint='ceci est un tooltip'; 
     750        ob_start();$this->builder->outputControlLabel($ctrl);$out = ob_get_clean(); 
     751        $this->assertEqualOrDiff('<label class="jforms-label" for="'.$this->formname.'_contenu" title="ceci est un tooltip">Texte</label>', $out); 
     752 
     753        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     754        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="5" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     755 
     756        $ctrl->rows=20; 
     757        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     758        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="20" cols="40">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     759 
     760        $ctrl->cols=60; 
     761        ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 
     762        $this->assertEqualOrDiff('<textarea name="contenu" id="'.$this->formname.'_contenu" readonly="readonly" title="ceci est un tooltip" rows="20" cols="60">&lt;p&gt;Ceci est un contenu&lt;/p&gt;</textarea>', $out); 
     763 
     764    } 
    732765} 
    733766 
  • trunk/testapp/modules/testapp/forms/sample.form.xml

    r840 r841  
    4747      <label>Your address</label> 
    4848  </textarea> 
    49   <textarea ref="description" type="html"> 
     49 
     50  <htmleditor ref="description"> 
    5051      <label>Description in html</label> 
    51   </textarea> 
     52  </htmleditor> 
     53 
    5254  <checkboxes ref="objets" required="true"> 
    5355      <label>Vous avez </label> 
     
    7678    <label>Filtre antispam</label> 
    7779  </captcha> 
    78    
     80 
    7981  <reset ref="cancel"> 
    8082    <label>Annuler</label> 
  • trunk/testapp/modules/testapp/forms/sample.form.xml