public function preDispatch() { $this->getHelper('viewRenderer')->setNoController(true); $this->getHelper('viewRenderer')->setViewScriptPathNoControllerSpec('user/:action.:suffix'); if (!$this->_getParam('user') && $this->getRequest()->getActionName() != 'error') { $code = $this->_getParam('code'); if (!preg_match('#^(.*)-(\\w*)$#', $code, $m)) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe the URL wasn't copied completely?")); $this->forward('error'); } else { $userId = $m[1]; $code = $m[2]; $userModel = Kwf_Registry::get('userModel'); $user = $userModel->getRow($userId); $this->getRequest()->setParam('user', $user); if (!$user) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe the URL wasn't copied completely?")); $this->forward('error'); } else { if (!$user->validateActivationToken($code) && $user->isActivated()) { $this->getRequest()->setParam('errorMessage', trlKwf("This account has already been activated.")); $this->forward('error'); } else { if (!$user->validateActivationToken($code)) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe your account has already been activated, the URL was not copied completely, or the password has already been set?")); $this->forward('error'); } } } } } $this->view->dep = Kwf_Assets_Package_Default::getAdminMainInstance(); parent::preDispatch(); }
public function __construct($name, $class, $id = null) { parent::__construct($name, $class, $id); $this->setXtype('Kwc.Basic.DownloadTag'); $this->fields->add(new Kwf_Form_Field_File('File', trlKwf('File')))->setDirectory('BasicDownloadTag')->setAllowOnlyImages(false)->setAllowBlank(false); $this->fields->add(new Kwf_Form_Field_TextField('filename', trlKwf('Filename')))->setVtype('alphanum')->setAutoFillWithFilename('filename')->setHelpText(trlKwf('Enter the name (without file extension), the file should get when downloading it.'))->setWidth(300)->setAllowBlank(false); }
protected function _getRecipient() { $rs = $this->_getMailComponent()->getRecipientSources(); $recipientId = $this->_getParam('recipientId'); if (!$recipientId) { $component = Kwf_Component_Data_Root::getInstance()->getComponentById($this->_getParam('componentId'), array('ignoreVisible' => true)); $source = reset($rs); $model = Kwf_Model_Abstract::getInstance($source['model']); $select = $model->select(); if ($model->hasColumn('newsletter_component_id')) { $select->whereEquals('newsletter_component_id', $component->parent->componentId); } if (isset($source['select'])) { $select->merge($source['select']); } $row = $model->getRow($select); if (!$row) { throw new Kwf_Exception_Client(trlKwf('Preview cannot be shown because it needs at least one recipient of this newsletter')); } $recipientId = $row->id; } $select = new Kwf_Model_Select(); $select->whereEquals('id', $recipientId); $subscribeModelKey = $this->_getParam('subscribeModelKey'); if (!$subscribeModelKey) { $subscribeModelKey = current(array_keys($rs)); } $model = $rs[$subscribeModelKey]['model']; $row = Kwf_Model_Abstract::getInstance($model)->getRow($select); return $row; }
protected function _getErrorMessage($type) { if ($type == Kwc_User_Activate_Form_Component::ERROR_ALREADY_ACTIVATED || $type == Kwc_User_Activate_Form_Component::ERROR_CODE_WRONG) { return trlKwf('Maybe you have already set your password, or the link was not copied correct out of the email.'); } return parent::_getErrorMessage($type); }
protected function _beforeDelete(Kwf_Model_Row_Interface $row) { parent::_beforeDelete($row); if ($this->_model->countRows($this->_getSelect()) <= $row->total_columns) { throw new Kwf_Exception_Client(trlKwf('It is not possible to delete a column in first row')); } }
protected function _showForm() { $this->view->formName = $this->_form->getName(); $this->view->method = 'post'; $this->view->submitButtonText = trlKwf('Submit'); $this->view->action = ''; $values = $this->_form->load(null, $this->_getParam('formPostData')); $this->view->form = $this->_form->getTemplateVars($values, '', $this->view->formName . '_'); $errors = $this->_getParam('formErrors'); if (!$errors) { $errors = array(); } $dec = new Kwc_Form_Decorator_Label(); $this->view->form = $dec->processItem($this->view->form, $errors); $this->view->errors = Kwf_Form::formatValidationErrors($errors); $this->view->errorsHtml = ''; if ($this->view->errors) { $this->view->errorsHtml .= '<div class="kwfUp-webStandard kwfUp-kwcFormError kwfUp-webFormError">'; $this->view->errorsHtml .= '<p class="error">' . trlKwf('An error has occurred') . ':</p>'; $this->view->errorsHtml .= '<ul>'; foreach ($this->view->errors as $error) { $this->view->errorsHtml .= '<li>' . htmlspecialchars($error) . '</li>'; } $this->view->errorsHtml .= '</ul>'; $this->view->errorsHtml .= '</div>'; } }
protected function _getConfig() { $ret = parent::_getConfig(); $config = $this->_getStandardConfig('kwf.autoform', 'Settings', trlKwf('Blog Settings'), new Kwf_Asset('wrench_orange')); $ret['settings'] = $config; return $ret; }
protected function _initColumns() { $this->_filters = array('text' => array('type' => 'TextField')); $this->_columns->add(new Kwf_Grid_Column('lastname', trlKwf('Lastname'), 140)); $this->_columns->add(new Kwf_Grid_Column('firstname', trlKwf('Firstname'))); $this->_columns->add(new Kwf_Grid_Column_Checkbox('visible', trlKwf('Active'), 40)); }
protected function _initColumns() { $this->_filters = array('text' => array('type' => 'TextField')); #$companyModel = Kwf_Model_Abstract::getInstance('Companies'); #$companySelect = $companyModel->select()->whereEquals('Hidden', '0'); #$docTypeModel = Kwf_Model_Abstract::getInstance('Linkdata'); #$docTypeSelect = $docTypeModel->select()->whereEquals('name', 'Типы документов'); #$this->_columns->add(new Kwf_Grid_Column('typeId', trlKwf('Type'))) #->setEditor(new Kwf_Form_Field_Select('typeId', trlKwf('Type'))) #->setValues($docTypeModel) #->setSelect($docTypeSelect) #->setWidth(400) #->setAllowBlank(false); $this->_columns->add(new Kwf_Grid_Column_Button('edit')); $this->_columns->add(new Kwf_Grid_Column('typeName', 'Тип проверки'))->setWidth(200); $this->_columns->add(new Kwf_Grid_Column('number', 'Номер документа'))->setWidth(200); $this->_columns->add(new Kwf_Grid_Column_Date('startDate', trlKwf('Doc Start Date'))); $this->_columns->add(new Kwf_Grid_Column_Date('endDate', trlKwf('Doc End Date')))->setRenderer('docCheckDate'); $this->_columns->add(new Kwf_Grid_Column('gradeName', trlKwf('Note')))->setWidth(300)->setRenderer('checkGrade'); #$this->_columns->add(new Kwf_Grid_Column_Image('Picture', trlKwf('Image'), 'Picture'))->setMaxHeight(300)->setWidth(250); #$select = new Kwf_Form_Field_Select(); #$select->setValues($companyModel); #$select->setSelect($companySelect); #$this->_columns->add(new Kwf_Grid_Column('companyId', trlKwf('Spec Doc company'))) #->setEditor($select) #->setType('string') #->setShowDataIndex('Name'); }
protected function _initColumns() { $this->_filters = array('text' => array('type' => 'TextField')); $this->_columns->add(new Kwf_Grid_Column('name', trlKwf('Title'), 100)); $this->_columns->add(new Kwf_Grid_Column('responsibleName', trlKwf('Responsible')))->setWidth(200); $this->_columns->add(new Kwf_Grid_Column('phone', trlKwf('Phone')))->setWidth(100); }
protected function _initFields() { parent::_initFields(); $this->fields->add(new Kwf_Form_Field_NumberField('width', trlKwf('Width')))->setComment('px')->setWidth(50)->setAllowNegative(false)->setAllowDecimal(false); $this->fields->add(new Kwf_Form_Field_TextField('default_value', trlKwf('Default Value'))); $this->fields->add(new Kwf_Form_Field_Select('vtype', trlKwf('Validator')))->setShowNoSelection(true)->setEmptyText(trlKwf('none'))->setValues(array('email' => trlKwf('E-Mail'), 'url' => trlKwf('Url'), 'alpha' => trlKwf('Alpha'), 'alphanum' => trlKwf('Alphanumeric'))); }
protected function _getDisclaimerText() { $disclaimerText = array(); $disclaimerText[''] = trlKwf('None'); $disclaimerText['de'] = trlKwf('Germany'); return $disclaimerText; }
public function testConnectionMoreRequests() { $this->open('/kwf/test/kwf_connection_test'); $this->waitForConnections(); sleep(2); $this->click("//button[text()='testC']"); $this->waitForConnections(); $this->click("//div[contains(text(),'timeoutError')]/../../../..//button[text()='" . trlKwf("Retry") . "']"); $this->waitForConnections(); $this->click("//div[contains(text(),'timeoutError')]/../../../..//button[text()='" . trlKwf("Retry") . "']"); $this->waitForConnections(); $this->click("//div[contains(text(),'timeoutError')]/../../../..//button[text()='" . trlKwf("Retry") . "']"); $this->waitForConnections(); $this->click("//*[contains(text(),'exceptionError')]/../../../../..//button[text()='" . trlKwf("Retry") . "']"); $this->waitForConnections(); $this->click("//*[contains(text(),'exceptionError')]/../../../../..//button[text()='" . trlKwf("Retry") . "']"); $this->waitForConnections(); $this->click("//*[contains(text(),'exceptionError')]/../../../../..//button[text()='" . trlKwf("Retry") . "']"); $this->waitForConnections(); $this->click("//*[contains(text(),'exceptionError')]/../../../../..//button[text()='" . trlKwf("Retry") . "']"); $this->waitForConnections(); $this->click("//*[contains(text(),'exceptionError')]/../../../../..//button[text()='" . trlKwf("Abort") . "']"); $this->waitForConnections(); $this->click("//div[contains(text(),'timeoutError')]/../../../..//button[text()='" . trlKwf("Abort") . "']"); $this->waitForConnections(); $this->open('/kwf/test/kwf_connection_test/get-timeouts'); $count = $this->getText('//body'); $this->assertEquals(4, $count); $this->open('/kwf/test/kwf_connection_test/get-exceptions'); $count = $this->getText('//body'); $this->assertEquals(5, $count); }
protected function _initFields() { parent::_initFields(); $userEditForm = $this->fields->add(new $this->_userDataFormName('user')); $userEditForm->setIdTemplate('{0}'); $root = Kwf_Component_Data_Root::getInstance(); if ($root) { $userDirectory = $root->getComponentByClass('Kwc_User_Directory_Component'); } if ($root && isset($userDirectory) && $userDirectory) { $detailClass = Kwc_Abstract::getChildComponentClass($userDirectory->componentClass, 'detail'); $userEditForm->addUserForms($detailClass, array('general')); $userEditForm->fields['firstname']->setAllowBlank(true); $userEditForm->fields['lastname']->setAllowBlank(true); } else { $this->fields->add(new Kwc_User_Detail_General_Form('general', null))->setIdTemplate('{0}'); } $config = Zend_Registry::get('config'); $authedUser = Kwf_Registry::get('userModel')->getAuthedUser(); if (isset($authedUser->language) && $config->languages) { $data = array(); foreach ($config->languages as $key => $value) { $data[$key] = $value; } $this->fields->add(new Kwf_Form_Field_Select('language', trlKwf('Language')))->setValues($data); } }
protected function _initFields() { parent::_initFields(); $this->add(new Kwf_Form_Field_Checkbox('visible', trlKwf('Visible'))); $form = Kwc_Abstract_Form::createChildComponentForm($this->getClass(), "-child", 'child'); $this->add($form); }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $name = $this->getFieldName(); $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); //todo: escapen $ret['id'] = $idPrefix . $name . $fieldNamePostfix; if ($this->getShowText()) { throw new Kwf_Exception("ShowField shows a field of a row, but no static text set by 'setShowText'. Use Kwf_Form_Field_Panel instead."); } $ret['html'] = ' '; if (isset($values[$name]) && $values[$name] != '') { $v = $values[$name]; if ($this->getTpl() == '{value:nl2br}') { $v = nl2br($v); } else { if ($this->getTpl() == '{value:localizedDatetime}') { $date = new Kwf_Date($v); $v = $date->format(trlKwf('Y-m-d H:i')); } else { if ($this->getTpl() == '{value:localizedDate}') { $date = new Kwf_Date($v); $v = $date->format(trlKwf('Y-m-d')); } } } $ret['html'] = '<span class="fieldContent">' . $v . '</span>'; } return $ret; }
protected function _initColumns() { parent::_initColumns(); $this->_columns->add(new Kwf_Grid_Column('recipient', trlKwf('Recipient'), 200)); $this->_columns->add(new Kwf_Grid_Column_Datetime('date', trlKwf('Date'), 100)); $this->_columns->add(new Kwf_Grid_Column('ip', trlKwf('IP-Address'), 100)); }
protected function _initColumns() { $this->_filters = array('text' => array('type' => 'TextField')); $this->_columns->add(new Kwf_Grid_Column('Number', trlKwf('Number'), 100)); $this->_columns->add(new Kwf_Grid_Column_Date('StartDate', trlKwf('Start Date'), 100)); $this->_columns->add(new Kwf_Grid_Column_Date('EndDate', trlKwf('End Date'), 100)); }
protected function _initFields() { parent::_initFields(); $showDirectoryClass = Kwc_Abstract::getSetting($this->getClass(), 'showDirectoryClass'); $hideDirectoryClasses = Kwc_Abstract::getSetting($this->getClass(), 'hideDirectoryClasses'); $cards = $this->add(new Kwf_Form_Container_Cards('source_component_id', trlKwf('Directory'))); $defaultCard = null; $categories = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Directories_Category_Directory_Component'); foreach ($categories as $category) { $itemDirectory = $category->parent; if (is_instance_of($itemDirectory->componentClass, $showDirectoryClass)) { foreach ($hideDirectoryClasses as $c) { if (is_instance_of($itemDirectory->componentClass, $c)) { continue 2; } } $categoriesModel = $category->getComponent()->getChildModel(); $select = $categoriesModel->select()->whereEquals('component_id', $category->componentId); $values = array(); foreach ($categoriesModel->getRows($select) as $row) { $values[$row->id] = $row->name; } $card = $cards->add(); $card->setTitle($category->parent->getTitle()); $card->setName($category->componentId); if (!$defaultCard) { $defaultCard = $category->componentId; } $model = Kwf_Model_Abstract::getInstance('Kwc_Directories_Category_ShowCategories_Model'); $card->add(new Kwf_Form_Field_MultiCheckboxLegacy($model, trlKwf('Categories')))->setValues($values)->setReferences(array('columns' => array('component_id'), 'refColumns' => array('id')))->setColumnName('category_id'); } } $cards->setDefaultValue($defaultCard); }
protected function _initColumns() { parent::_initColumns(); $this->_columns->add(new Kwf_Grid_Column('id')); //shows editDialog $this->_columns->add(new Kwf_Grid_Column_Button('properties', ' ', 20))->setButtonIcon('/assets/silkicons/newspaper.png')->setTooltip(trlKwf('Properties')); if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) { $extConfigType = 'extConfig'; } else { if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) { $extConfigType = 'extConfigControllerIndex'; } } $extConfig = Kwf_Component_Abstract_ExtConfig_Abstract::getInstance($this->_getParam('class'), $extConfigType)->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT); $extConfig = $extConfig['items']; if (count($extConfig['countDetailClasses']) > 1 && !$this->_getModel()->hasColumn('component')) { throw new Kwf_Exception('If you have more than one detail-component your table has to have a column named "component"'); } $i = 0; foreach ($extConfig['contentEditComponents'] as $ec) { $name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($ec['componentClass'], 'componentName')); $icon = Kwc_Abstract::getSetting($ec['componentClass'], 'componentIcon'); $icon = new Kwf_Asset($icon); $this->_columns->add(new Kwc_Directories_Item_Directory_Trl_ControllerEditButton('edit_' . $i, ' ', 20))->setColumnType('editContent')->setEditComponentClass($ec['componentClass'])->setEditComponent($ec['component'])->setEditType($ec['type'])->setEditIdTemplate($ec['idTemplate'])->setEditComponentIdSuffix($ec['componentIdSuffix'])->setButtonIcon($icon->toString(array('arrow')))->setTooltip(trlKwf('Edit {0}', $name)); $i++; } }
protected function _initFields() { $this->add(new Kwf_Form_Field_TextField('text', trlKwf('Linktext')))->setWidth(300); $this->add(new Kwf_Form_Field_Panel('copy'))->setHideLabel(true)->setXtype('kwc.basic.link.trl.copybutton'); $this->add(new Kwf_Form_Field_ShowField('original_text', trlKwf('Original')))->setData(new Kwf_Data_Trl_OriginalComponent('text')); parent::_initFields(); }
public function __construct(Kwf_Model_Row_Interface $row) { $tpl = 'UserDeleted'; $subject = Zend_Registry::get('config')->application->name; $subject .= ' - ' . trlKwf('Account deleted'); parent::__construct($tpl, $subject, $row); }
protected function _initColumns() { parent::_initColumns(); $this->_columns->add(new Kwf_Grid_Column('name', trlKwf('Name'), 290)); $this->_columns->add(new Kwf_Grid_Column('settings_controller_url')); $this->_columns->add(new Kwf_Grid_Column('edit_components'))->setData(new Kwc_Mail_Editable_ComponentsController_EditComponentsData()); }
protected function _initFields() { parent::_initFields(); $this->setCreateMissingRow(true); $this->add(Kwc_Abstract_Form::createChildComponentForm($this->getClass(), '-linktext', 'linktext')); $this->add(new Kwf_Form_Field_Checkbox('start_opened', trlKwf('Start opened'))); }
protected function _initColumns() { $this->_columns->add(new Kwf_Grid_Column('title', trlKwf('Title'), 200)); $this->_columns->add(new Kwf_Grid_Column('current_price', trlKwf('Current Price'), 100))->setRenderer('euroMoney'); $this->_columns->add(new Kwf_Grid_Column_Visible()); parent::_initColumns(); }
public function __construct($name, $class) { parent::__construct($name, $class); $this->setLabelWidth(200); $this->fields->add(new Kwf_Form_Field_TextField('company', trlKwf('Company')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('name', trlKwf('Name')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('address', trlKwf('Address')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('zipcode', trlKwf('Zipcode')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('city', trlKwf('City')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('fon', trlKwf('Fon')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('fax', trlKwf('Fax')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('mobile', trlKwf('Mobile')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('email', trlKwf('EMail')))->setWidth(300)->setVtype('email'); $this->fields->add(new Kwf_Form_Field_TextField('website', trlKwf('Website')))->setWidth(300)->setVtype('url'); $this->fields->add(new Kwf_Form_Field_TextField('crn', trlKwf('Commercial register number')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('register_court', trlKwf('Register court')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('court', trlKwf('Court')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('uid_number', trlKwf('VAT identification number')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('bank_data', trlKwf('Bank data')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('bank_code', trlKwf('Bank code')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('account_number', trlKwf('Account number')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('iban', trlKwf('IBAN')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('bic_swift', trlKwf('BIC / SWIFT')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('dvr_number', trlKwf('Data handling register number')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('club_number_zvr', trlKwf('Clubnumber ZVR')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextArea('job_title', trlKwf('Job title')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('agency', trlKwf('Agency')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('employment_specification', trlKwf('Employment specification')))->setWidth(300); $this->fields->add(new Kwf_Form_Field_TextField('link_company_az', trlKwf('Entry at WK Austria')))->setWidth(300)->setVtype('url'); }
/** * MultiFields content fields. * * @return array $fields The fields that should be inserted. */ protected function _getMultiFieldsFieldset() { $fs = new Kwf_Form_Container_FieldSet(trlKwf('Paragraph {0}')); $fs->add(new Kwf_Form_Field_Checkbox('visible', trlKwf('Visible'))); $fs->add(new Kwf_Form_Field_SimpleAbstract('edit'))->setXtype('kwc.listeditbutton')->setLabelSeparator('')->setData(new Kwc_Abstract_List_FormWithEditButton_NoSaveData('id')); return $fs; }
protected function _initFields() { $modelName = Kwc_Abstract::getSetting($this->_getParam('class'), 'projectsModel'); $this->_form->setModel(Kwf_Model_Abstract::getInstance($modelName)); $this->_form->add(new Kwf_Form_Field_TextField('text', trlKwf('Text'))); $this->_form->add(new Kwf_Form_Field_Checkbox('visible', trlKwf('Visible'))); }
public function getStyles($ownStyles = false) { $styles = array(); $styles[] = array('id' => 'blockdefault', 'name' => trlKwf('Default'), 'tagName' => 'p', 'className' => false); $styles[] = array('id' => 'inlinedefault', 'name' => trlKwf('Normal'), 'tagName' => 'span', 'className' => false); $masterStyles = $this->getMasterStyles(); $styles = array_merge($styles, $masterStyles); $select = $this->select(); if ($ownStyles) { $select->whereEquals('ownStyles', $ownStyles); } else { $select->whereEquals('ownStyles', ''); } $select->order(new Zend_Db_Expr("ownStyles!=''")); $select->order('pos'); foreach ($this->getRows($select) as $row) { $selector = $row->tag . '.style' . $row->id; $name = $row->name; if ($row->ownStyles) { $name = '* ' . $name; } $styles[] = array('id' => 'style' . $row->id, 'name' => $name, 'tagName' => $row->tag, 'className' => 'style' . $row->id); } foreach ($styles as $k => $i) { if ($i['tagName'] == 'span') { $styles[$k]['type'] = 'inline'; } else { $styles[$k]['type'] = 'block'; } } return $styles; }
protected function _getMultiFieldsFieldset() { $fs = parent::_getMultiFieldsFieldset(); $fs->setTitle(trlKwf('Tab {0}')); $fs->prepend(new Kwf_Form_Field_TextField('title', trlKwf('Title'), 200))->setAllowBlank(false); return $fs; }