public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['generators']['child']['component']['link'] = 'Kwc_Basic_TextMailTxt_Mail_Text_Link_Component';
     $ret['ownModel'] = 'Kwc_Basic_TextMailTxt_Mail_Text_TestModel';
     return $ret;
 }
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['rootElementClass'] = 'kwfUp-webStandard webSuccess';
     $ret['componentName'] = trlKwfStatic('Text on successful submit');
     $ret['defaultText'] = trlKwfStatic('The form has been submitted successfully.');
     return $ret;
 }
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['ownModel'] = 'Kwc_Trl_TextImage_TextImage_Text_TestModel';
     $ret['generators']['child']['model'] = 'Kwc_Trl_TextImage_TextImage_Text_ChildComponentsModel';
     $ret['generators']['child']['component'] = array('image' => null, 'link' => null, 'download' => null);
     return $ret;
 }
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['ownModel'] = 'Kwc_Basic_TextConvertLinkOnlyExtern_TestModel';
     $ret['generators']['child']['component'] = array();
     $ret['generators']['child']['component']['link'] = 'Kwc_Basic_TextConvertLinkOnlyExtern_LinkExtern_Component';
     return $ret;
 }
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['ownModel'] = 'Kwc_ImageResponsive_CreatesImgElement_Components_TextImage_Text_Model';
     $ret['stylesModel'] = 'Kwc_ImageResponsive_CreatesImgElement_Components_TextImage_Text_TestStylesModel';
     $ret['generators']['child']['model'] = 'Kwc_ImageResponsive_CreatesImgElement_Components_TextImage_Text_ChildComponentsModel';
     $ret['generators']['child']['component'] = array('image' => null, 'link' => null, 'download' => null);
     return $ret;
 }
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['ownModel'] = 'Kwc_Basic_Text_TestModel';
     $ret['stylesModel'] = 'Kwc_Basic_Text_TestStylesModel';
     $ret['generators']['child']['component']['link'] = 'Kwc_Basic_Text_Link_TestComponent';
     $ret['generators']['child']['component']['image'] = 'Kwc_Basic_Text_Image_TestComponent';
     $ret['generators']['child']['component']['download'] = 'Kwc_Basic_Text_Download_TestComponent';
     return $ret;
 }
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['ownModel'] = 'Kwc_Basic_TextSessionModel_TestModel';
     $ret['childModel'] = 'Kwc_Basic_TextSessionModel_TestChildComponentsModel';
     $ret['stylesModel'] = 'Kwc_Basic_TextSessionModel_TestStylesModel';
     $ret['generators']['child']['component']['link'] = 'Kwc_Basic_TextSessionModel_Link_Component';
     $ret['generators']['child']['component']['image'] = false;
     $ret['generators']['child']['component']['download'] = false;
     return $ret;
 }
 public function onStylesRowUpdate(Kwf_Events_Event_Row_Updated $e)
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('uses_styles', true);
     $s->where(new Kwf_Model_Select_Expr_Like('content', '%class="style' . $e->row->id . '"%'));
     $rows = Kwc_Basic_Text_Component::createOwnModel($this->_class)->export(Kwf_Model_Interface::FORMAT_ARRAY, $s, array('columns' => array('component_id')));
     foreach ($rows as $row) {
         foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($row['component_id']) as $c) {
             if ($c->componentClass == $this->_class) {
                 $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
             }
         }
     }
 }
Beispiel #9
0
 public function testCreatesLinkFromOtherComponentId()
 {
     $c = $this->_root->getComponentById(1005)->getComponent();
     $row = $c->getRow();
     $html = '<p><a href="1007-l1">foo</a></p>';
     $row->content = $html;
     $row->save();
     $m = Kwc_Basic_Text_Component::createChildModel($c->getData()->componentClass);
     $rows = $m->getRows($m->select()->whereEquals('component_id', '1005'));
     $this->assertEquals(1, count($rows));
     $row = $rows->current();
     $this->assertEquals('link', $row->component);
     $this->assertEquals('1', $row->nr);
     $m = Kwf_Model_Abstract::getInstance('Kwc_Basic_TextConvertLinkOnlyExtern_LinkExtern_TestModel');
     $rows = $m->getRows($m->select()->whereEquals('component_id', '1005-l1'));
     $this->assertEquals(1, count($rows));
     $row = $rows->current();
     $this->assertEquals('http://vivid.com', $row->target);
 }
Beispiel #10
0
 public function __construct($name, $class, $id = null)
 {
     $this->setModel(Kwc_Basic_Text_Component::createOwnModel($class));
     parent::__construct($name, $class, $id);
     $field = new Kwf_Form_Field_HtmlEditor('content', trlKwf('Text'));
     $field->setData(new Kwf_Data_Kwc_ComponentIds('content'));
     $field->setHideLabel(true);
     $ignoreSettings = array('tablename', 'componentName', 'default', 'assets', 'assetsAdmin', 'placeholder', 'plugins');
     $c = strpos($class, '.') ? substr($class, 0, strpos($class, '.')) : $class;
     foreach (call_user_func(array($c, 'getSettings')) as $key => $val) {
         if (!in_array($key, $ignoreSettings)) {
             $method = 'set' . ucfirst($key);
             $field->{$method}($val);
         }
     }
     $generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
     $classes = $generators['child']['component'];
     if ($classes['link']) {
         $cfg = new Kwf_Component_Abstract_ExtConfig_Form($classes['link']);
         $c = $cfg->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
         $field->setLinkComponentConfig($c['form']);
     }
     if ($classes['image']) {
         $c = Kwc_Admin::getInstance($classes['image'])->getExtConfig();
         $field->setImageComponentConfig($c['form']);
     }
     if ($classes['download']) {
         $c = Kwc_Admin::getInstance($classes['download'])->getExtConfig();
         $field->setDownloadComponentConfig($c['form']);
     }
     if (Kwc_Abstract::getSetting($this->getClass(), 'enableStylesEditor')) {
         $admin = Kwc_Admin::getInstance($class);
         $field->setStylesEditorConfig(array('xtype' => 'kwc.basic.text.styleseditor', 'blockStyleUrl' => $admin->getControllerUrl('BlockStyle'), 'inlineStyleUrl' => $admin->getControllerUrl('InlineStyle'), 'masterStyleUrl' => $admin->getControllerUrl('MasterStyle')));
     }
     $t = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($class, 'stylesModel'));
     $field->setStyles($t->getStyles());
     $field->setComponentClass($class);
     $field->setControllerUrl(Kwc_Admin::getInstance($class)->getControllerUrl());
     $this->fields->add($field);
     $this->setAssetsPackage(Kwf_Assets_Package_Default::getInstance('Frontend'));
 }
 protected function _getModel()
 {
     return Kwc_Basic_Text_Component::createChildModel($this->_class);
 }
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['generators']['child']['component']['link'] = 'Kwc_Newsletter_Detail_Mail_Paragraphs_LinkTag_Component';
     return $ret;
 }
 public function testCreatesImageComponentx()
 {
     $uploadsModel = Kwf_Model_Abstract::getInstance('Kwc_Basic_Text_Image_UploadsModel');
     $upload1 = $uploadsModel->getRows()->current();
     $c = $this->_root->getComponentById(1008)->getComponent();
     $row = $c->getRow();
     $html = '<p><img src="http://www.vivid-planet.com/assets/web/images/structure/logo.png" /></p>';
     $html = $row->tidy($html);
     $this->assertRegExp("#^<p>\n  <img src=\"/kwf/kwctest/Kwc_Basic_Text_Root/media/Kwc_Basic_Text_Image_TestComponent/1008-i1/dh-100-[0-9a-z]+/[0-9a-z]+/[0-9]+/logo.png\" width=\"100\" height=\"100\" />\n</p>\$#ms", $html);
     $cc = array_values($c->getData()->getChildComponents());
     $this->assertEquals(1, count($cc));
     $this->assertEquals('1008-i1', current($cc)->componentId);
     $m = Kwc_Basic_Text_Component::createChildModel($c->getData()->componentClass);
     $rows = $m->getRows($m->select()->whereEquals('component_id', '1008'));
     $this->assertEquals(1, count($rows));
     $row = $rows->current();
     $this->assertEquals('image', $row->component);
     $this->assertEquals('1', $row->nr);
     $s = new Kwf_Model_Select();
     $s->whereNotEquals('id', $upload1->id);
     $upload2 = $uploadsModel->getRows($s)->current();
     $this->assertEquals('image/png', $upload2->mime_type);
     $this->assertEquals('png', $upload2->extension);
     $this->assertEquals('logo', $upload2->filename);
     $this->assertEquals(file_get_contents($upload2->getFileSource()), file_get_contents('http://www.vivid-planet.com/assets/web/images/structure/logo.png'));
     $m = Kwf_Model_Abstract::getInstance('Kwc_Basic_Text_Image_TestModel');
     $rows = $m->getRows($m->select()->whereEquals('component_id', '1008-i1'));
     $this->assertEquals(1, count($rows));
     $row = $rows->current();
     $this->assertEquals($upload2->id, $row->kwf_upload_id);
 }
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['ownModel'] = 'Kwc_Trl_Text_Text_TestModel';
     return $ret;
 }
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['ownModel'] = 'Kwc_List_ChildPages_Teaser_TeaserImage_Text_Model';
     return $ret;
 }