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 _getConfig() { $ret = parent::_getConfig(); $ret['form']['xtype'] = 'kwc.listwitheditbutton'; $generators = Kwc_Abstract::getSetting($this->_class, 'generators'); $cls = $generators['child']['component']; if (is_array($cls)) { $cls = current($cls); } $admin = Kwc_Admin::getInstance($cls); $ret['form']['componentConfigs'] = array(); foreach ($admin->getExtConfig() as $k => $cfg) { $ret['form']['componentConfigs'][$cls . '-' . $k] = $cfg; $ret['form']['editComponents'][] = array('componentClass' => $cls, 'type' => $k); } $ret['form']['needsComponentPanel'] = true; return $ret; }
protected function _getConfig() { $ret = parent::_getConfig(); $mailClass = Kwc_Abstract::getChildComponentClass($this->_class, 'mail'); $mailContentClass = Kwc_Abstract::getChildComponentClass($mailClass, 'content'); $cfg = Kwc_Admin::getInstance($mailContentClass)->getExtConfig(); $configs = array(); $editComponents = array(); $mainType = null; foreach ($cfg as $key => $c) { $configs[$mailContentClass . '-' . $key] = $c; $editComponents[] = array('componentClass' => $mailContentClass, 'type' => $key); if (!$mainType) { $mainType = $key; } } $ret['form'] = array_merge($ret['form'], array('xtype' => 'kwc.newsletter.detail.tabpanel', 'tabs' => array('settings' => array('xtype' => 'kwf.autoform', 'controllerUrl' => $this->getControllerUrl(), 'title' => trlKwf('Settings')), 'mail' => array('xtype' => 'kwf.component', 'componentEditUrl' => '/admin/component/edit', 'mainComponentClass' => $mailContentClass, 'componentIdSuffix' => '_mail-content', 'componentConfigs' => $configs, 'mainEditComponents' => $editComponents, 'mainType' => $mainType, 'title' => trlKwf('Mail')), 'preview' => array('xtype' => 'kwc.newsletter.detail.preview', 'controllerUrl' => $this->getControllerUrl('Preview'), 'subscribersControllerUrl' => $this->getControllerUrl('Subscribers'), 'authedUserEmail' => Kwf_Registry::get('userModel')->getAuthedUser() ? Kwf_Registry::get('userModel')->getAuthedUser()->email : '', 'title' => trlKwf('Preview'), 'recipientSources' => $this->_getRecipientSources()), 'mailing' => array('xtype' => 'kwc.newsletter.recipients', 'title' => trlKwf('Mailing'), 'recipientsPanel' => array('title' => trlKwf('Add/Remove Subscriber to Queue'), 'controllerUrl' => $this->getControllerUrl('Recipients'), 'region' => 'center', 'xtype' => 'kwc.newsletter.recipients.grid'), 'recipientsQueuePanel' => array('title' => trlKwf('Queue'), 'controllerUrl' => $this->getControllerUrl('Mailing'), 'region' => 'east', 'width' => 500, 'xtype' => 'kwc.newsletter.recipients.queue'), 'mailingPanel' => array('title' => trlKwf('Mailing'), 'region' => 'south', 'controllerUrl' => $this->getControllerUrl('Mailing'), 'formControllerUrl' => $this->getControllerUrl('MailingForm'), 'xtype' => 'kwc.newsletter.startNewsletter')), 'statistics' => array('xtype' => 'kwf.autogrid', 'controllerUrl' => $this->getControllerUrl('Statistics'), 'title' => trlKwf('Statistics'))))); return $ret; }
protected function _getConfig() { $ret = parent::_getConfig(); $ret['form']['title'] = trlKwf('Background Settings'); return $ret; }