Exemplo n.º 1
0
 public function testFrozenHtmlGeneration()
 {
     $area = new HTML_QuickForm2_Element_Textarea('freezeMe');
     $area->setValue('Some string');
     $area->toggleFrozen(true);
     $this->assertRegExp('/Some string/', $area->__toString());
     $this->assertRegExp('!<input[^>]*type="hidden"[^>]*/>!', $area->__toString());
     $area->persistentFreeze(false);
     $this->assertRegExp('/Some string/', $area->__toString());
     $this->assertNotRegExp('!<input[^>]*type="hidden"[^>]*/>!', $area->__toString());
     $area->persistentFreeze(true);
     $area->setAttribute('disabled');
     $this->assertRegExp('/Some string/', $area->__toString());
     $this->assertNotRegExp('!<input[^>]*type="hidden"[^>]*/>!', $area->__toString());
 }
Exemplo n.º 2
0
    public function render(HTML_QuickForm2_Renderer $renderer)
    {
        $id = $this->getId();
        $url = REL_ROOT_URL . '/application/default/views/public/js/ckeditor/ckeditor.js';
        $renderer->getJavascriptBuilder()->addElementJavascript(<<<CUT
if (!window.CKEDITOR) {            
    var script = \$('<script type="text/javascript" src="{$url}"></' + 'script>');  
    \$('head').append(script);    
}
CUT
);
        if (!$this->dontInitMce) {
            $options = $this->mceOptions ? Am_Controller::getJson($this->mceOptions) : '{}';
            $renderer->getJavascriptBuilder()->addElementJavascript(<<<CUT
\$(function(){            
    initCkeditor('{$id}', {$options});
});
CUT
);
        }
        return parent::render($renderer);
    }