Changeset 841
- Timestamp:
- 03/25/08 18:47:36 (8 months ago)
- Files:
-
- trunk/build/manifests/jelix-lib.mn (modified) (1 diff)
- trunk/build/manifests/jelix-lib.mn (modified) (1 diff)
- trunk/build/manifests/jelix-lib.mn (modified) (1 diff)
- trunk/lib/jelix-www/wymeditor/config (added)
- trunk/lib/jelix-www/wymeditor/config (added)
- trunk/lib/jelix-www/wymeditor/config (added)
- trunk/lib/jelix-www/wymeditor/config/simple.js (added)
- trunk/lib/jelix-www/wymeditor/config/simple.js (added)
- trunk/lib/jelix-www/wymeditor/config/simple.js (added)
- trunk/lib/jelix/core/defaultconfig.ini.php (modified) (2 diffs)
- trunk/lib/jelix/core/defaultconfig.ini.php (modified) (2 diffs)
- trunk/lib/jelix/core/defaultconfig.ini.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (3 diffs)
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (3 diffs)
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (3 diffs)
- trunk/lib/jelix/forms/jFormsCompiler.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsCompiler.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsCompiler.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (1 diff)
- trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (1 diff)
- trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (1 diff)
- trunk/lib/jelix/plugins/tpl/html/block.form.php (modified) (1 diff)
- trunk/lib/jelix/plugins/tpl/html/block.form.php (modified) (1 diff)
- trunk/lib/jelix/plugins/tpl/html/block.form.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html_cli.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html_cli.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html_cli.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php (modified) (1 diff)
- trunk/testapp/modules/testapp/forms/sample.form.xml (modified) (2 diffs)
- trunk/testapp/modules/testapp/forms/sample.form.xml (modified) (2 diffs)
- trunk/testapp/modules/testapp/forms/sample.form.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/jelix-lib.mn
r840 r841 561 561 screen.css 562 562 icons.png 563 cd lib/jelix-www/wymeditor/config 564 c simple.js 563 565 cd lib/jelix-www/jquery 564 566 GPL-LICENSE.txt trunk/build/manifests/jelix-lib.mn
r840 r841 561 561 screen.css 562 562 icons.png 563 cd lib/jelix-www/wymeditor/config 564 c simple.js 563 565 cd lib/jelix-www/jquery 564 566 GPL-LICENSE.txt trunk/build/manifests/jelix-lib.mn
r840 r841 561 561 screen.css 562 562 icons.png 563 cd lib/jelix-www/wymeditor/config 564 c simple.js 563 565 cd lib/jelix-www/jquery 564 566 GPL-LICENSE.txt trunk/lib/jelix/core/defaultconfig.ini.php
r838 r841 134 134 ; jelix-www, or copy its content in yourapp/www/ (with a name like 'jelix' for example) 135 135 ; 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] 136 137 jelixWWWPath = "jelix/" 137 138 … … 217 218 ; dao_selector = "jelix~jsession" 218 219 ; dao_db_profile = "" 220 221 222 [htmleditors] 223 wymeditor = jelix/wymeditor/jquery.wymeditor.js 224 wymeditor.config.simple = jelix/wymeditor/config/simple.js 225 wymeditor.skin.default = jelix/wymeditor/skins/default/screen.css 226 trunk/lib/jelix/core/defaultconfig.ini.php
r838 r841 134 134 ; jelix-www, or copy its content in yourapp/www/ (with a name like 'jelix' for example) 135 135 ; 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] 136 137 jelixWWWPath = "jelix/" 137 138 … … 217 218 ; dao_selector = "jelix~jsession" 218 219 ; dao_db_profile = "" 220 221 222 [htmleditors] 223 wymeditor = jelix/wymeditor/jquery.wymeditor.js 224 wymeditor.config.simple = jelix/wymeditor/config/simple.js 225 wymeditor.skin.default = jelix/wymeditor/skins/default/screen.css 226 trunk/lib/jelix/core/defaultconfig.ini.php
r838 r841 134 134 ; jelix-www, or copy its content in yourapp/www/ (with a name like 'jelix' for example) 135 135 ; 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] 136 137 jelixWWWPath = "jelix/" 137 138 … … 217 218 ; dao_selector = "jelix~jsession" 218 219 ; dao_db_profile = "" 220 221 222 [htmleditors] 223 wymeditor = jelix/wymeditor/jquery.wymeditor.js 224 wymeditor.config.simple = jelix/wymeditor/config/simple.js 225 wymeditor.skin.default = jelix/wymeditor/skins/default/screen.css 226 trunk/lib/jelix/forms/jFormsBase.class.php
r839 r841 72 72 */ 73 73 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(); 74 82 75 83 /** … … 499 507 public function getHiddens(){ return $this->_hiddens; } 500 508 509 /** 510 * @return array of jFormsControl objects 511 */ 512 public function getHtmlEditors(){ return $this->_htmleditors; } 513 501 514 /** 502 515 * @return array of jFormsControl objects … … 608 621 else if($control->type =='hidden') 609 622 $this->_hiddens [$control->ref] = $control; 623 else if($control->type == 'htmleditor') 624 $this->_htmleditors [$control->ref] = $control; 610 625 611 626 if(!isset($this->_container->data[$control->ref])){ trunk/lib/jelix/forms/jFormsBase.class.php
r839 r841 72 72 */ 73 73 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(); 74 82 75 83 /** … … 499 507 public function getHiddens(){ return $this->_hiddens; } 500 508 509 /** 510 * @return array of jFormsControl objects 511 */ 512 public function getHtmlEditors(){ return $this->_htmleditors; } 513 501 514 /** 502 515 * @return array of jFormsControl objects … … 608 621 else if($control->type =='hidden') 609 622 $this->_hiddens [$control->ref] = $control; 623 else if($control->type == 'htmleditor') 624 $this->_htmleditors [$control->ref] = $control; 610 625 611 626 if(!isset($this->_container->data[$control->ref])){ trunk/lib/jelix/forms/jFormsBase.class.php
r839 r841 72 72 */ 73 73 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(); 74 82 75 83 /** … … 499 507 public function getHiddens(){ return $this->_hiddens; } 500 508 509 /** 510 * @return array of jFormsControl objects 511 */ 512 public function getHtmlEditors(){ return $this->_htmleditors; } 513 501 514 /** 502 515 * @return array of jFormsControl objects … … 608 621 else if($control->type =='hidden') 609 622 $this->_hiddens [$control->ref] = $control; 623 else if($control->type == 'htmleditor') 624 $this->_htmleditors [$control->ref] = $control; 610 625 611 626 if(!isset($this->_container->data[$control->ref])){ trunk/lib/jelix/forms/jFormsCompiler.class.php
r840 r841 180 180 unset($attributes['type']); 181 181 } 182 $this->_generateTextareaHtmlEditor($source, $control, $attributes); 183 } 184 185 protected function _generateTextareaHtmlEditor(&$source, $control, &$attributes) { 182 186 $this->attrReadonly($source, $attributes); 183 187 $this->attrRequired($source, $attributes); … … 206 210 $source[]='$ctrl->cols='.$cols.';'; 207 211 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']); 208 230 } 209 231 } trunk/lib/jelix/forms/jFormsCompiler.class.php
r840 r841 180 180 unset($attributes['type']); 181 181 } 182 $this->_generateTextareaHtmlEditor($source, $control, $attributes); 183 } 184 185 protected function _generateTextareaHtmlEditor(&$source, $control, &$attributes) { 182 186 $this->attrReadonly($source, $attributes); 183 187 $this->attrRequired($source, $attributes); … … 206 210 $source[]='$ctrl->cols='.$cols.';'; 207 211 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']); 208 230 } 209 231 } trunk/lib/jelix/forms/jFormsCompiler.class.php
r840 r841 180 180 unset($attributes['type']); 181 181 } 182 $this->_generateTextareaHtmlEditor($source, $control, $attributes); 183 } 184 185 protected function _generateTextareaHtmlEditor(&$source, $control, &$attributes) { 182 186 $this->attrReadonly($source, $attributes); 183 187 $this->attrRequired($source, $attributes); … … 206 210 $source[]='$ctrl->cols='.$cols.';'; 207 211 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']); 208 230 } 209 231 } trunk/lib/jelix/forms/jFormsControl.class.php
r840 r841 82 82 * @package jelix 83 83 * @subpackage forms 84 * @since 1.1 85 */ 86 class 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 84 103 */ 85 104 class jFormsControlSecret extends jFormsControl { … … 222 241 * @package jelix 223 242 * @subpackage forms 243 * @since 1.1 224 244 */ 225 245 class jFormsControlCaptcha extends jFormsControl { trunk/lib/jelix/forms/jFormsControl.class.php
r840 r841 82 82 * @package jelix 83 83 * @subpackage forms 84 * @since 1.1 85 */ 86 class 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 84 103 */ 85 104 class jFormsControlSecret extends jFormsControl { … … 222 241 * @package jelix 223 242 * @subpackage forms 243 * @since 1.1 224 244 */ 225 245 class jFormsControlCaptcha extends jFormsControl { trunk/lib/jelix/forms/jFormsControl.class.php
r840 r841 82 82 * @package jelix 83 83 * @subpackage forms 84 * @since 1.1 85 */ 86 class 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 84 103 */ 85 104 class jFormsControlSecret extends jFormsControl { … … 222 241 * @package jelix 223 242 * @subpackage forms 243 * @since 1.1 224 244 */ 225 245 class jFormsControlCaptcha extends jFormsControl { trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r840 r841 213 213 echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 214 214 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; 215 226 case 'secret': 216 227 case 'secretconfirm': trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r840 r841 213 213 echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 214 214 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; 215 226 case 'secret': 216 227 case 'secretconfirm': trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r840 r841 213 213 echo '<textarea',$id,$readonly,$hint,$class,$rows,'>',htmlspecialchars($value),'</textarea>'; 214 214 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; 215 226 case 'secret': 216 227 case 'secretconfirm': trunk/lib/jelix/plugins/tpl/html/block.form.php
r839 r841 67 67 $t->_privateVars[\'__displayed_ctrl\'] = array(); 68 68 '; 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; 70 if($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 } 72 88 } 73 89 '); trunk/lib/jelix/plugins/tpl/html/block.form.php
r839 r841 67 67 $t->_privateVars[\'__displayed_ctrl\'] = array(); 68 68 '; 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; 70 if($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 } 72 88 } 73 89 '); trunk/lib/jelix/plugins/tpl/html/block.form.php
r839 r841 67 67 $t->_privateVars[\'__displayed_ctrl\'] = array(); 68 68 '; 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; 70 if($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 } 72 88 } 73 89 '); trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html_cli.php
r840 r841 298 298 <label>captcha</label> 299 299 </captcha>', 300 72=>'<htmleditor ref="contenu" xmlns="http://jelix.org/ns/forms/1.0"> 301 <label>Texte</label> 302 </htmleditor>', 300 303 ); 301 304 … … 670 673 $ctrl->label=\'captcha\'; 671 674 $this->addControl($ctrl);', 675 72=>'$ctrl= new jFormsControlhtmleditor(\'contenu\'); 676 $ctrl->label=\'Texte\'; 677 $this->addControl($ctrl);', 672 678 ); 673 679 … … 1041 1047 71=>'$label = \'captcha\'; 1042 1048 $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";', 1052 72=>'$label = \'Texte\'; 1053 $js.="jForms.tControl = new jFormsControl(\'contenu\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 1043 1054 $js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 1044 1055 $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 298 298 <label>captcha</label> 299 299 </captcha>', 300 72=>'<htmleditor ref="contenu" xmlns="http://jelix.org/ns/forms/1.0"> 301 <label>Texte</label> 302 </htmleditor>', 300 303 ); 301 304 … … 670 673 $ctrl->label=\'captcha\'; 671 674 $this->addControl($ctrl);', 675 72=>'$ctrl= new jFormsControlhtmleditor(\'contenu\'); 676 $ctrl->label=\'Texte\'; 677 $this->addControl($ctrl);', 672 678 ); 673 679 … … 1041 1047 71=>'$label = \'captcha\'; 1042 1048 $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";', 1052 72=>'$label = \'Texte\'; 1053 $js.="jForms.tControl = new jFormsControl(\'contenu\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 1043 1054 $js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 1044 1055 $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 298 298 <label>captcha</label> 299 299 </captcha>', 300 72=>'<htmleditor ref="contenu" xmlns="http://jelix.org/ns/forms/1.0"> 301 <label>Texte</label> 302 </htmleditor>', 300 303 ); 301 304 … … 670 673 $ctrl->label=\'captcha\'; 671 674 $this->addControl($ctrl);', 675 72=>'$ctrl= new jFormsControlhtmleditor(\'contenu\'); 676 $ctrl->label=\'Texte\'; 677 $this->addControl($ctrl);', 672 678 ); 673 679 … … 1041 1047 71=>'$label = \'captcha\'; 1042 1048 $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";', 1052 72=>'$label = \'Texte\'; 1053 $js.="jForms.tControl = new jFormsControl(\'contenu\', \'".str_replace("\'","\\\'",$label)."\', \'string\');\n"; 1043 1054 $js.="jForms.tControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 1044 1055 $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 730 730 $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); 731 731 } 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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></textarea>', $out); 763 764 } 732 765 } 733 766 trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php
r840 r841 730 730 $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); 731 731 } 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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></textarea>', $out); 763 764 } 732 765 } 733 766 trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php
r840 r841 730 730 $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); 731 731 } 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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></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"><p>Ceci est un contenu</p></textarea>', $out); 763 764 } 732 765 } 733 766 trunk/testapp/modules/testapp/forms/sample.form.xml
r840 r841 47 47 <label>Your address</label> 48 48 </textarea> 49 <textarea ref="description" type="html"> 49 50 <htmleditor ref="description"> 50 51 <label>Description in html</label> 51 </textarea> 52 </htmleditor> 53 52 54 <checkboxes ref="objets" required="true"> 53 55 <label>Vous avez </label> … … 76 78 <label>Filtre antispam</label> 77 79 </captcha> 78 80 79 81 <reset ref="cancel"> 80 82 <label>Annuler</label> trunk/testapp/modules/testapp/forms/sample.form.xml
