[TASK] Refactoring for version 3.0
authorAlex Kellner <alexander.kellner@in2code.de>
Wed, 2 Sep 2015 15:55:08 +0000 (17:55 +0200)
committerAlex Kellner <alexander.kellner@in2code.de>
Wed, 2 Sep 2015 15:55:08 +0000 (17:55 +0200)
Added main models, controller, TCA

37 files changed:
Classes/Controller/ConditionController.php [new file with mode: 0644]
Classes/Domain/Model/Condition.php [new file with mode: 0644]
Classes/Domain/Model/ConditionContainer.php [new file with mode: 0644]
Classes/Domain/Model/Rule.php [new file with mode: 0644]
Classes/Domain/Repository/ConditionRepository.php [new file with mode: 0644]
Classes/Domain/Validator/InputValidator.php [deleted file]
Classes/UserFunc/GetPowermailFields.php [new file with mode: 0644]
Classes/Utility/ArrayUtility.php [new file with mode: 0644]
Classes/Utility/Div.php [deleted file]
Classes/Utility/Eid/ClearSessionEid.php [deleted file]
Classes/Utility/Eid/DeRequiredFieldEid.php [deleted file]
Classes/Utility/Eid/DeRequiredFieldsEid.php [deleted file]
Classes/Utility/Eid/DebugSessionEid.php [deleted file]
Classes/Utility/Eid/GetFieldlistEid.php [deleted file]
Classes/Utility/Eid/ReadSessionEid.php [deleted file]
Classes/Utility/Eid/RequiredFieldEid.php [deleted file]
Classes/Utility/Eid/RequiredFieldsEid.php [deleted file]
Classes/Utility/Eid/SaveInSessionEid.php [deleted file]
Classes/Utility/Tca/FieldlistingBackend.php [deleted file]
Configuration/TCA/Condition.php [deleted file]
Configuration/TCA/Rule.php [deleted file]
Configuration/TCA/tx_powermailcond_domain_model_condition.php [new file with mode: 0644]
Configuration/TCA/tx_powermailcond_domain_model_rule.php [new file with mode: 0644]
Configuration/TypoScript/setup.txt
Resources/Private/.htaccess [deleted file]
Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_condition.xml [deleted file]
Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_rule.xml [deleted file]
Resources/Private/Language/locallang_db.xml
Resources/Private/Templates/Condition/BuildCondition.html [new file with mode: 0644]
Resources/Public/Css/PowermailCond.css [deleted file]
Resources/Public/JavaScript/PowermailCondition.js [new file with mode: 0644]
Resources/Public/Js/PowermailCond.js [deleted file]
doc/manual.sxw [deleted file]
ext_emconf.php
ext_localconf.php
ext_tables.php
ext_tables.sql

diff --git a/Classes/Controller/ConditionController.php b/Classes/Controller/ConditionController.php
new file mode 100644 (file)
index 0000000..a7bbf44
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+namespace In2code\PowermailCond\Controller;
+
+use In2code\PowermailCond\Domain\Model\ConditionContainer;
+use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * ConditionController
+ *
+ * @package powermail_cond
+ * @license http://www.gnu.org/licenses/lgpl.html
+ *                     GNU Lesser General Public License, version 3 or later
+ */
+class ConditionController extends ActionController {
+
+       /**
+        * @var \In2code\Powermail\Domain\Repository\FormRepository
+        * @inject
+        */
+       protected $formRepository;
+
+       /**
+        * @var \In2code\PowermailCond\Domain\Repository\ConditionRepository
+        * @inject
+        */
+       protected $conditionRepository;
+
+       /**
+        * Build Condition for AJAX call
+        *
+        * @return void
+        */
+       public function buildConditionAction() {
+               $form = $this->formRepository->findByUid(154);
+               /** @var ConditionContainer $container */
+               $container = $this->objectManager->get(
+                       'In2code\\PowermailCond\\Domain\\Model\\ConditionContainer',
+                       $this->conditionRepository->findByForm($form)
+               );
+               \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($container, 'in2code: ' . __CLASS__ . ':' . __LINE__);
+//             $container->applyConditions($form);
+       }
+}
\ No newline at end of file
diff --git a/Classes/Domain/Model/Condition.php b/Classes/Domain/Model/Condition.php
new file mode 100644 (file)
index 0000000..81c95d3
--- /dev/null
@@ -0,0 +1,225 @@
+<?php
+namespace In2code\PowermailCond\Domain\Model;
+
+use In2code\Powermail\Domain\Model\Field;
+use In2code\Powermail\Domain\Model\Form;
+use In2code\Powermail\Domain\Model\Page;
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Condition Model
+ *
+ * @package powermail_cond
+ * @license http://www.gnu.org/licenses/lgpl.html
+ *                     GNU Lesser General Public License, version 3 or later
+ */
+class Condition extends AbstractEntity {
+
+       /**
+        * @var \In2code\Powermail\Domain\Repository\FieldRepository
+        * @inject
+        */
+       protected $fieldRepository;
+
+       /**
+        * @var \In2code\Powermail\Domain\Repository\PageRepository
+        * @inject
+        */
+       protected $pageRepository;
+
+       /**
+        * @var string
+        */
+       protected $title = '';
+
+       /**
+        * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\In2code\PowermailCond\Domain\Model\Rule>
+        */
+       protected $rules = NULL;
+
+       /**
+        * @var string
+        */
+       protected $targetField = '';
+
+       /**
+        * 0 hide
+        * 1 unhide
+        *
+        * @var int
+        */
+       protected $actions = 0;
+
+       /**
+        * @var string
+        */
+       protected $filterSelectField = '';
+
+       /**
+        * "OR"
+        * "AND"
+        *
+        * @var string
+        */
+       protected $conjunction = '';
+
+       /**
+        * @var \In2code\Powermail\Domain\Model\Form
+        */
+       protected $form = '';
+
+       /**
+        * @return string
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * @param string $title
+        * @return Condition
+        */
+       public function setTitle($title) {
+               $this->title = $title;
+               return $this;
+       }
+
+       /**
+        * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
+        */
+       public function getRules() {
+               return $this->rules;
+       }
+
+       /**
+        * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $rules
+        * @return Condition
+        */
+       public function setRules($rules) {
+               $this->rules = $rules;
+               return $this;
+       }
+
+       /**
+        * @return Field|Page|NULL
+        */
+       public function getTargetField() {
+               $targetField = $this->targetField;
+               if (is_numeric($targetField)) {
+                       return $this->fieldRepository->findByUid((int) $targetField);
+               }
+               if (stristr($targetField, 'fieldset:')) {
+                       return $this->pageRepository->findByUid((int) trim($targetField, 'fieldset:'));
+               }
+               return NULL;
+       }
+
+       /**
+        * @param string $targetField
+        * @return Condition
+        */
+       public function setTargetField($targetField) {
+               $this->targetField = $targetField;
+               return $this;
+       }
+
+       /**
+        * @return int
+        */
+       public function getActions() {
+               return $this->actions;
+       }
+
+       /**
+        * @param int $actions
+        * @return Condition
+        */
+       public function setActions($actions) {
+               $this->actions = $actions;
+               return $this;
+       }
+
+       /**
+        * @return string
+        */
+       public function getFilterSelectField() {
+               return $this->filterSelectField;
+       }
+
+       /**
+        * @param string $filterSelectField
+        * @return Condition
+        */
+       public function setFilterSelectField($filterSelectField) {
+               $this->filterSelectField = $filterSelectField;
+               return $this;
+       }
+
+       /**
+        * @return string
+        */
+       public function getConjunction() {
+               return $this->conjunction;
+       }
+
+       /**
+        * @param string $conjunction
+        * @return Condition
+        */
+       public function setConjunction($conjunction) {
+               $this->conjunction = $conjunction;
+               return $this;
+       }
+
+       /**
+        * @return Form
+        */
+       public function getForm() {
+               return $this->form;
+       }
+
+       /**
+        * @param Form $form
+        * @return Condition
+        */
+       public function setForm($form) {
+               $this->form = $form;
+               return $this;
+       }
+
+//     public function applies($form) {
+//             foreach ($this->rules as $rule) {
+//                     if ($rule->applies($form)) {
+//                             return true;
+//                     }
+//             }
+//             return false;
+//     }
+//     public function applyOnForm($form) {
+//             $this->doStuff($form);
+//     }
+}
\ No newline at end of file
diff --git a/Classes/Domain/Model/ConditionContainer.php b/Classes/Domain/Model/ConditionContainer.php
new file mode 100644 (file)
index 0000000..b484f2b
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+namespace In2code\PowermailCond\Domain\Model;
+
+use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Condition Model
+ *
+ * @package powermail_cond
+ * @license http://www.gnu.org/licenses/lgpl.html
+ *                     GNU Lesser General Public License, version 3 or later
+ */
+class ConditionContainer {
+
+       /**
+        * @var Condition[]
+        */
+       protected $conditions = array();
+
+
+       /**
+        * @var bool
+        */
+       protected $somethingChanged = TRUE;
+
+       /**
+        * @param array $conditions
+        */
+       public function __construct(QueryResult $conditions) {
+               $this->conditions = $conditions;
+       }
+
+       /**
+        * @param $form
+        */
+       public function applyConditions($form) {
+               while ($this->somethingChanged && $this->loop < 100) {
+                       $this->somethingChanged = FALSE;
+                       $this->loop++;
+                       foreach ($this->conditions as $condition) {
+                               while ($condition->applies($form)) {
+                                       $this->somethingChanged = TRUE;
+                                       $condition->applyOnForm($form);
+                               }
+                       }
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Domain/Model/Rule.php b/Classes/Domain/Model/Rule.php
new file mode 100644 (file)
index 0000000..aacd90b
--- /dev/null
@@ -0,0 +1,159 @@
+<?php
+namespace In2code\PowermailCond\Domain\Model;
+
+use In2code\Powermail\Domain\Model\Field;
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Rule Model
+ *
+ * @package powermail_cond
+ * @license http://www.gnu.org/licenses/lgpl.html
+ *                     GNU Lesser General Public License, version 3 or later
+ */
+class Rule extends AbstractEntity {
+
+       /**
+        * Internal title
+        *
+        * @var string
+        */
+       protected $title = '';
+
+       /**
+        * relation to start field
+        *
+        * @var \In2code\Powermail\Domain\Model\Field
+        */
+       protected $startField = '';
+
+       /**
+        * 0 is set
+        * 1 is not set
+        * 2 contains
+        * 3 contains not
+        * 4 is
+        * 5 is not
+        * 6 greater than
+        * 7 less than
+        * 8 contains value from field
+        * 9 contains not value from field
+        *
+        * @var int
+        */
+       protected $ops = 0;
+
+       /**
+        * @var string
+        */
+       protected $condString = '';
+
+       /**
+        * @var string
+        */
+       protected $equalField = '';
+
+       /**
+        * @return string
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * @param string $title
+        * @return Condition
+        */
+       public function setTitle($title) {
+               $this->title = $title;
+               return $this;
+       }
+
+       /**
+        * @return Field
+        */
+       public function getStartField() {
+               return $this->startField;
+       }
+
+       /**
+        * @param Field $startField
+        * @return Rule
+        */
+       public function setStartField($startField) {
+               $this->startField = $startField;
+               return $this;
+       }
+
+       /**
+        * @return int
+        */
+       public function getOps() {
+               return $this->ops;
+       }
+
+       /**
+        * @param int $ops
+        * @return Rule
+        */
+       public function setOps($ops) {
+               $this->ops = $ops;
+               return $this;
+       }
+
+       /**
+        * @return string
+        */
+       public function getCondString() {
+               return $this->condString;
+       }
+
+       /**
+        * @param string $condString
+        * @return Rule
+        */
+       public function setCondString($condString) {
+               $this->condString = $condString;
+               return $this;
+       }
+
+       /**
+        * @return string
+        */
+       public function getEqualField() {
+               return $this->equalField;
+       }
+
+       /**
+        * @param string $equalField
+        * @return Rule
+        */
+       public function setEqualField($equalField) {
+               $this->equalField = $equalField;
+               return $this;
+       }
+}
\ No newline at end of file
diff --git a/Classes/Domain/Repository/ConditionRepository.php b/Classes/Domain/Repository/ConditionRepository.php
new file mode 100644 (file)
index 0000000..d2fb524
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+namespace In2code\PowermailCond\Domain\Repository;
+
+use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
+use TYPO3\CMS\Extbase\Persistence\Repository;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 in2code GmbH <info@in2code.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * ConditionRepository
+ *
+ * @package powermail
+ * @license http://www.gnu.org/licenses/lgpl.html
+ *                     GNU Lesser General Public License, version 3 or later
+ */
+class ConditionRepository extends Repository {
+
+       /**
+        * General settings
+        *
+        * @return void
+        */
+       public function initializeObject() {
+               /** @var Typo3QuerySettings $querySettings */
+               $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
+               $querySettings->setRespectStoragePage(FALSE);
+               $querySettings->setRespectSysLanguage(FALSE);
+               $this->setDefaultQuerySettings($querySettings);
+       }
+}
\ No newline at end of file
diff --git a/Classes/Domain/Validator/InputValidator.php b/Classes/Domain/Validator/InputValidator.php
deleted file mode 100644 (file)
index 8c2739e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Domain\Validator;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility,
-       \In2code\Powermail\Domain\Model\Field;
-
-/**
- * Class InputValidator
- */
-class InputValidator extends \In2code\Powermail\Domain\Validator\InputValidator {
-
-       /**
-        * Form UID
-        *
-        * @var int
-        */
-       protected $formUid = 0;
-
-       /**
-        * Validation of given Params
-        *
-        * @param \In2code\Powermail\Domain\Model\Mail $mail
-        * @return bool
-        */
-       public function isValid($mail) {
-               $this->formUid = $mail->getForm()->getUid();
-               return parent::isValid($mail);
-       }
-
-       /**
-        * Validate a single field
-        *
-        * @param \In2code\Powermail\Domain\Model\Field $field
-        * @param \mixed $value
-        * @param $field
-        * @return void
-        */
-       protected function isValidField(Field $field, $value) {
-               /* @var $div \In2code\PowermailCond\Utility\Div */
-               $div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-               $sessionValues = $div->getAllSessionValuesFromForm($this->formUid, 'deRequiredFields');
-               if (array_key_exists('field_' . $field->getUid(), (array) $sessionValues)) {
-                       // stop process if this field is disabled
-                       return;
-               }
-
-               parent::isValidField($field, $value);
-       }
-}
\ No newline at end of file
diff --git a/Classes/UserFunc/GetPowermailFields.php b/Classes/UserFunc/GetPowermailFields.php
new file mode 100644 (file)
index 0000000..0337367
--- /dev/null
@@ -0,0 +1,259 @@
+<?php
+namespace In2code\PowermailCond\UserFunc;
+
+use In2code\PowermailCond\Utility\ArrayUtility;
+use TYPO3\CMS\Backend\Form\FormEngine;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * List powermail fields in Backend for powermail_cond rules
+ *
+ * @package powermail_cond
+ * @license http://www.gnu.org/licenses/lgpl.html
+ *                     GNU Lesser General Public License, version 3 or later
+ */
+class GetPowermailFields {
+
+       /**
+        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
+        */
+       protected $databaseConnection = NULL;
+
+       /**
+        * @var array
+        */
+       protected $params = array();
+
+       /**
+        * @var FormEngine
+        */
+       protected $formEngine = NULL;
+
+       /**
+        * @var int
+        */
+       protected $formUid = 0;
+
+       /**
+        * @var array
+        */
+       protected $defaultFieldTypes = array(
+               'input',
+               'textarea',
+               'select',
+               'radio',
+               'check'
+       );
+
+       /**
+        * show all fields in the backend
+        *
+        * @param array $params
+        * @param FormEngine $formEngine
+        * @return void
+        */
+       public function getFields(array &$params, FormEngine $formEngine) {
+               $this->initialize($params, $formEngine);
+               $this->addFieldsToParams();
+               $this->addFieldsetsToParams();
+       }
+
+       /**
+        * Add fields to params array
+        *
+        * @return void
+        */
+       protected function addFieldsToParams() {
+               $fields = $this->getFieldsFromForm();
+               $this->params['items'][] = array('powermail Fields', '--div--');
+               foreach ($fields as $properties) {
+                       $this->params['items'][] = array(
+                               $this->getLabelFromFieldProperties($properties),
+                               $properties['uid']
+                       );
+               }
+       }
+
+       /**
+        * Add fieldsets to Params
+        *
+        * @return void
+        */
+       protected function addFieldsetsToParams() {
+               if (empty($this->params['config']['itemsProcFunc_addFieldsets'])) {
+                       return;
+               }
+               $fieldsets = $this->getFieldsetsFromForm();
+               $this->params['items'][] = array('powermail Fieldsets', '--div--');
+               foreach ($fieldsets as $properties) {
+                       $this->params['items'][] = array(
+                               $properties['title'] . ' (' . $properties['uid'] . ')',
+                               'fieldset:' . $properties['uid']
+                       );
+               }
+       }
+
+       /**
+        * Get fields
+        *
+        * @return array
+        */
+       protected function getFieldsFromForm() {
+               $fields = array();
+               $select = 'f.uid, f.title, f.marker';
+               $from = '
+                       tx_powermail_domain_model_fields f
+                       left join tx_powermail_domain_model_pages p on f.pages = p.uid
+                       left join tx_powermail_domain_model_forms fo on p.forms = fo.uid
+               ';
+               $where = 'f.hidden = 0 and f.deleted = 0 and f.type in (' . $this->getDefaultFieldTypesForQuery() . ')';
+               if ($this->getFormUid() > 0) {
+                       $where .= ' and fo.uid = ' . $this->getFormUid();
+               }
+               $groupBy = '';
+               $orderBy = 'f.sorting';
+               $limit = 10000;
+               $res = $this->databaseConnection->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
+               if ($res) {
+                       while (($row = $this->databaseConnection->sql_fetch_assoc($res))) {
+                               $fields[] = $row;
+                       }
+               }
+               return $fields;
+       }
+
+       /**
+        * give me all fieldsets in an array
+        *
+        * @return array
+        */
+       protected function getFieldsetsFromForm() {
+               $fieldsets = array();
+               $select = 'uid, title';
+               $from = 'tx_powermail_domain_model_pages';
+               $where = 'forms = ' . $this->getFormUid() . ' AND hidden = 0 AND deleted = 0';
+               $groupBy = '';
+               $orderBy = 'sorting';
+               $limit = '';
+               $res = $this->databaseConnection->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
+               if ($res) {
+                       while (($row = $this->databaseConnection->sql_fetch_assoc($res))) {
+                               $fieldsets[] = $row;
+                       }
+               }
+               return $fieldsets;
+       }
+
+       /**
+        * Get Form Uid from Rule
+        *
+        * @param int $conditionUid
+        * @return int formUid
+        */
+       protected function getFormUidFromCondition($conditionUid) {
+               $select = 'form';
+               $from = 'tx_powermailcond_domain_model_condition';
+               $where = 'uid = ' . (int) $conditionUid . ' AND hidden = 0 AND deleted = 0';
+               $groupBy = '';
+               $orderBy = '';
+               $limit = 1;
+               $res = $this->databaseConnection->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
+               if ($res) {
+                       $row = $this->databaseConnection->sql_fetch_assoc($res);
+                       return (int) $row['form'];
+               }
+               return 0;
+       }
+
+       /**
+        * Build a label
+        *
+        * @param array $properties
+        * @return string
+        */
+       protected function getLabelFromFieldProperties(array $properties) {
+               return $this->formEngine->sL($properties['title']) . ', {' . $properties['marker'] . '}, uid' . $properties['uid'];
+       }
+
+       /**
+        * @param array $params
+        * @param FormEngine $formEngine
+        * @return void
+        */
+       protected function initialize(array &$params, FormEngine $formEngine) {
+               $this->databaseConnection = $GLOBALS['TYPO3_DB'];
+               $this->params = &$params;
+               $this->formEngine = $formEngine;
+               $this
+                       ->setFormUid()
+                       ->setDefaultFieldTypes();
+       }
+
+       /**
+        * @return GetPowermailFields
+        */
+       public function setFormUid() {
+               $formUid = (int) $this->params['row']['form'];
+               if (!empty($this->params['row']['conditions'])) {
+                       $formUid = $this->getFormUidFromCondition($this->params['row']['conditions']);
+               }
+               $this->formUid = $formUid;
+               return $this;
+       }
+
+       /**
+        * @return int
+        */
+       public function getFormUid() {
+               return $this->formUid;
+       }
+
+       /**
+        * @return GetPowermailFields
+        */
+       public function setDefaultFieldTypes() {
+               if (!empty($this->params['config']['itemsProcFuncValue'])) {
+                       $this->defaultFieldTypes = GeneralUtility::trimExplode(',', $this->params['config']['itemsProcFuncValue'], TRUE);
+               }
+               return $this;
+       }
+
+       /**
+        * @return array
+        */
+       public function getDefaultFieldTypes() {
+               return $this->defaultFieldTypes;
+       }
+
+       /**
+        * @return string
+        */
+       public function getDefaultFieldTypesForQuery() {
+               $fieldTypes = $this->getDefaultFieldTypes();
+               return ArrayUtility::getQuotedList($fieldTypes);
+       }
+}
\ No newline at end of file
diff --git a/Classes/Utility/ArrayUtility.php b/Classes/Utility/ArrayUtility.php
new file mode 100644 (file)
index 0000000..44f9624
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+namespace In2code\PowermailCond\Utility;
+
+use TYPO3\CMS\Extbase\Utility\ArrayUtility as ArrayUtilityExtbase;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2015 in2code.de
+ *  Alex Kellner <alexander.kellner@in2code.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Class ArrayUtility
+ *
+ * @package In2code\In2publish\Utility
+ */
+class ArrayUtility extends ArrayUtilityExtbase {
+
+       /**
+        * Get quoted list from array
+        *
+        * @return array
+        */
+       public static function getQuotedList(array $array) {
+               $list = '';
+               foreach ($array as $value) {
+                       $list .= '"' . $value . '",';
+               }
+               return trim($list, ',');
+       }
+}
diff --git a/Classes/Utility/Div.php b/Classes/Utility/Div.php
deleted file mode 100644 (file)
index 5c2c46c..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Div is a class for a collection of misc functions
- *
- * @package powermail_cond
- * @license http://www.gnu.org/licenses/lgpl.html
- *                     GNU Lesser General Public License, version 3 or later
- */
-class Div {
-
-       /**
-        * Extension Key
-        *
-        * @var string
-        */
-       public $extKey = 'powermail_cond';
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * Get Startfields
-        *
-        * @param       array   $conf: Configuration Array
-        * @return      array   $array: With all Startfields
-        */
-       public function getStartFields($conf) {
-               $array = array();
-               foreach ((array) $conf as $confLevel1) {
-                       foreach ((array) $confLevel1 as $confLevel2) {
-                               if (!empty($confLevel2['startField'])) {
-                                       $array[] = $confLevel2['startField'];
-                               }
-                       }
-               }
-               return $array;
-       }
-
-       /**
-        * get condition as array from current page
-        *
-        * @param int $formUid
-        * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj
-        * @return array $arr: Array with all conditions of the current page
-        */
-       public function getConditionsFromForm($formUid, $cObj) {
-               $arr = array();
-               $select = '
-                               tx_powermailcond_domain_model_condition.targetField, tx_powermailcond_domain_model_condition.actions,
-                               tx_powermailcond_domain_model_condition.conjunction,
-                               tx_powermailcond_domain_model_condition.filterSelectField, tx_powermailcond_domain_model_rule.startField,
-                               tx_powermailcond_domain_model_rule.ops,
-                               tx_powermailcond_domain_model_rule.condstring, tx_powermailcond_domain_model_rule.equalField
-               ';
-               $from = '
-                       tx_powermailcond_domain_model_condition
-                       LEFT JOIN tx_powermailcond_domain_model_rule ON
-                       tx_powermailcond_domain_model_condition.uid = tx_powermailcond_domain_model_rule.conditions
-               ';
-               $where = (intval($formUid) ? 'tx_powermailcond_domain_model_condition.form = ' . intval($formUid) : '1');
-               $where .= $cObj->enableFields('tx_powermailcond_domain_model_condition');
-               $where .= $cObj->enableFields('tx_powermailcond_domain_model_rule');
-               $groupBy = 'tx_powermailcond_domain_model_rule.uid';
-               $orderBy = '';
-               $limit = 1000;
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
-               if ($res) {
-                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
-                               $arr[$row['targetField']][] = $row;
-                       }
-               }
-               return $arr;
-       }
-
-       /**
-        * Get all fields in a commaseparated list from a fieldset uid
-        *
-        * @param integer $uid: Fieldset UID
-        * @param integer $formUid: UID of related form
-        * @return string $list: Commaseparated List with field uids
-        */
-       public function getFieldsFromFieldset($uid, $formUid) {
-               // if this uid don't contains fs (for fs123)
-               if (is_numeric($uid)) {
-                       return $uid;
-               }
-
-               $select = 'tx_powermail_domain_model_fields.uid';
-               $from = '
-                       tx_powermail_domain_model_pages
-                       LEFT JOIN tx_powermail_domain_model_fields ON tx_powermail_domain_model_pages.uid = tx_powermail_domain_model_fields.pages
-               ';
-               $where = 'tx_powermail_domain_model_pages.uid = ' . intval(str_replace('fieldset:', '', $uid));
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ($select, $from, $where, '', '', 1000);
-               if ($res) {
-                       $uids = '';
-                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
-                               $uids .= $row['uid'] . ';';
-                               // remove value from session of this field
-                               $this->saveValueToSession('', $formUid, $row['uid']);
-                       }
-               }
-
-               if (!isset($uids)) {
-                       return $uid;
-               }
-
-               // return without last ;
-               return $uid . ':' . substr($uids, 0, -1);
-       }
-
-       /**
-        * Get all fields in a commaseparated list from a fieldset uid
-        *
-        * @param int $formUid UID of related form
-        * @param string $prefix Prefix for session
-        * @return void
-        */
-       public function cleanfullSession($formUid = NULL, $prefix = 'fieldSession') {
-               if (intval($formUid) > 0) {
-                       $array = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey);
-                       $array[$prefix]['form_' . $formUid] = array();
-               } else {
-                       $array[$prefix] = array();
-               }
-               $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey, $array);
-               $GLOBALS['TSFE']->storeSessionData();
-       }
-
-       /**
-        * Save value to session and respect old entries
-        *
-        * @param string $value Value to store
-        * @param int $formUid Form uid
-        * @param int $fieldUid Field uid
-        * @param string $prefix Prefix for session
-        * @return void
-        */
-       public function saveValueToSession($value, $formUid, $fieldUid, $prefix = 'fieldSession') {
-               $formKey = 'form_' . intval($formUid);
-               $fieldKey = 'field_' . intval($fieldUid);
-               $session = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey);
-               if (!empty($value)) {
-                       $session[$prefix][$formKey][$fieldKey] = $value;
-               } else {
-                       unset($session[$prefix][$formKey][$fieldKey]);
-               }
-               $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey, $session);
-               $GLOBALS['TSFE']->storeSessionData();
-       }
-
-       /**
-        * Save value to session and respect old entries
-        *
-        * @param int $formUid Form uid
-        * @param int $fieldUid Field uid
-        * @param string $prefix Prefix for session
-        * @return void
-        */
-       public function removeValueFromSession($formUid, $fieldUid, $prefix = 'fieldSession') {
-               $formKey = 'form_' . intval($formUid);
-               $fieldKey = 'field_' . intval($fieldUid);
-
-               // get old session
-               $session = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey);
-               if (isset($session[$prefix][$formKey][$fieldKey])) {
-                       unset($session[$prefix][$formKey][$fieldKey]);
-
-                       // save again
-                       $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey, $session);
-                       $GLOBALS['TSFE']->storeSessionData();
-               }
-       }
-
-       /**
-        * Return all values from the session (could be used for debugging, etc..)
-        *
-        * @param int $formUid Form Uid
-        * @param string $prefix Prefix for session
-        * @return array $array with session values
-        */
-       public function getAllSessionValuesFromForm($formUid = NULL, $prefix = 'fieldSession') {
-               $formKey = 'form_' . intval($formUid);
-               $array = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey);
-
-               if (isset($array[$prefix][$formKey])) {
-                       return $array[$prefix][$formKey];
-               }
-               return $array[$prefix];
-       }
-}
\ No newline at end of file
diff --git a/Classes/Utility/Eid/ClearSessionEid.php b/Classes/Utility/Eid/ClearSessionEid.php
deleted file mode 100644 (file)
index 5d52d03..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Frontend\Utility\EidUtility;
-use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class is for reading values from session
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage EidClearSession
- */
-class ClearSessionEid {
-
-       /**
-        * The extension key
-        *
-        * @var string
-        */
-       public $extKey = 'powermail_cond';
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * Read values from session - example: 18:braun;17:rot;12:xd;11:fc;
-        *
-        * @return void
-        */
-       public function main() {
-               $GLOBALS['TSFE']->sesData = EidUtility::initFeUser();
-               $piVars = GeneralUtility::_GP($this->prefixId);
-               $form = intval($piVars['form']);
-               $this->div->cleanfullSession($form, 'fieldSession');
-               $this->div->cleanfullSession($form, 'deRequiredFields');
-       }
-
-       /**
-        * Initialize eID
-        *
-        * @param array $typo3ConfigurationVariables
-        */
-       public function __construct($typo3ConfigurationVariables) {
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $typo3ConfigurationVariables,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = EidUtility::initFeUser();
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-       }
-}
-/** @var \In2code\PowermailCond\Utility\Eid\ClearSessionEid $eid */
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\ClearSessionEid', $GLOBALS['TYPO3_CONF_VARS']);
-$eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/DeRequiredFieldEid.php b/Classes/Utility/Eid/DeRequiredFieldEid.php
deleted file mode 100644 (file)
index c7a23c2..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Store fields in session which should not be mandatory any more
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage DeRequiredFieldEid
- */
-class DeRequiredFieldEid {
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * save field in session to be stored for non-mandatory fields
-        *
-        * @return int Field Uid which was disabled
-        */
-       public function main() {
-               /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj */
-               $cObj = GeneralUtility::makeInstance('\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
-               $piVars = GeneralUtility::_GP($this->prefixId);
-               $formUid = intval($piVars['formUid']);
-               $fieldUid = intval($piVars['fieldUid']);
-               $conditions = $this->div->getConditionsFromForm($formUid, $cObj);
-
-               // only if this field was defined as targetField in conditions
-               if (array_key_exists($fieldUid, $conditions)) {
-                       // save single value in session
-                       $this->div->saveValueToSession('', $formUid, $fieldUid, 'deRequiredFields');
-                       return $fieldUid;
-               }
-
-               return 0;
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\DeRequiredFieldEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/DeRequiredFieldsEid.php b/Classes/Utility/Eid/DeRequiredFieldsEid.php
deleted file mode 100644 (file)
index 0d46ac4..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Store fields in session which should not be mandatory any more
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage DeRequiredFieldsEid
- */
-class DeRequiredFieldsEid {
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * save field in session to be stored for non-mandatory fields
-        *
-        * @return int Field Uid which was disabled
-        */
-       public function main() {
-               /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj */
-               $cObj = GeneralUtility::makeInstance('\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
-               $piVars = GeneralUtility::_GP($this->prefixId);
-               $formUid = intval($piVars['formUid']);
-               $fieldUids = explode(',', $piVars['fieldUids']);
-               $conditions = $this->div->getConditionsFromForm($formUid, $cObj);
-
-               foreach ($fieldUids as $fieldUid) {
-                       // only if this field was defined as targetField in conditions
-                       if (array_key_exists($fieldUid, $conditions)) {
-                               // save single value in session
-                               $this->div->saveValueToSession('', $formUid, $fieldUid, 'deRequiredFields');
-                       }
-               }
-
-               return htmlspecialchars($piVars['fieldUids']);
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\DeRequiredFieldsEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/DebugSessionEid.php b/Classes/Utility/Eid/DebugSessionEid.php
deleted file mode 100644 (file)
index 706c44b..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Debug Session values
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage DebugSessionEid
- */
-class DebugSessionEid {
-
-       /**
-        * Read values from session - example: 18:braun;17:rot;12:xd;11:fc;
-        *
-        * @return string
-        */
-       public function main() {
-               if (empty($GLOBALS['BE_USER']->user['uid'])) {
-                       return 'Please login into backend';
-               }
-
-               /* @var $div \In2code\PowermailCond\Utility\Div */
-               $div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-               $piVars = GeneralUtility::_GP('tx_powermailcond_pi1');
-               if (empty($piVars['formUid'])) {
-                       return 'tx_powermailcond_pi1[formUid] is missing';
-               }
-
-               $sessionForm = $div->getAllSessionValuesFromForm($piVars['formUid']);
-               $sessionDeRequiredFields = $div->getAllSessionValuesFromForm($piVars['formUid'], 'deRequiredFields');
-
-               \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($sessionForm, 'Values in Session');
-               \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($sessionDeRequiredFields, 'Disabled Required Fields');
-               return '';
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-               $GLOBALS['BE_USER'] = GeneralUtility::makeInstance('\TYPO3\CMS\Core\Authentication\BackendUserAuthentication');
-               $GLOBALS['BE_USER']->start();
-               $GLOBALS['BE_USER']->backendCheckLogin();
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\DebugSessionEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/GetFieldlistEid.php b/Classes/Utility/Eid/GetFieldlistEid.php
deleted file mode 100644 (file)
index 3b4a608..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class tells jQuery which field are allowed in which are not allowed
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage GetFieldlistEid
- */
-class GetFieldlistEid {
-
-       /**
-        * Prefix ID for Plugin Vars
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
-        */
-       protected $cObj;
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * Generates the output
-        *
-        * @return string
-        */
-       public function main() {
-               $this->cObj = GeneralUtility::makeInstance('\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
-               $conditions = $this->div->getConditionsFromForm($this->piVars['formUid'], $this->cObj);
-               $targetFields = $this->div->getStartFields($conditions);
-               if ($this->piVars['uid'] > 0 && !in_array($this->piVars['uid'], $targetFields)) {
-                       return 'nochange';
-               }
-
-               $content = '';
-               foreach ((array) $conditions as $conf) {
-                       $content .= $this->checkRules($conf) . ',';
-               }
-
-               // remove last ,
-               $content = rtrim($content, ',');
-               // remove double values
-               $content = GeneralUtility::uniqueList($content);
-
-               return $content;
-       }
-
-       /**
-        * Preflight function checks the rules
-        *              if there should be an action (show/hide) or not
-        *
-        * @param array $conf Configuration of current field
-        * @return boolean true:hide false:show(nothing)
-        */
-       protected function checkRules($conf) {
-               // start with 0
-               $do = 0;
-               $content = '';
-               $tmpConf = array();
-               if ($conf[0]['conjunction'] == 'AND') {
-                       // start with 1
-                       $do = 1;
-               }
-
-               // one loop for every rule of current target field
-               foreach ((array) $conf as $key => $subconf) {
-                       $subconf = NULL;
-
-                       // special case: hide a field from the beginning
-                       if ($conf[$key]['actions'] == 1) {
-                               // show
-                               $content .= $this->div->getFieldsFromFieldset($conf[$key]['targetField'], $this->piVars['formUid']) . ',';
-                       }
-
-                       // operations
-                       $act = 0;
-                       $startFieldSession = $this->session['field_' . $conf[$key]['startField']];
-                       // if second level
-                       if (is_array($startFieldSession)) {
-                               // get all values in a commaseparated list
-                               $startFieldSession = implode(',', $startFieldSession);
-                       }
-                       switch ($conf[$key]['ops']) {
-                               // "not empty"
-                               case 0:
-                                       // if start field value in session is not empty
-                                       if ($startFieldSession != '') {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "empty"
-                               case 1:
-                                       // if start field value in session is empty
-                                       if ($startFieldSession == '') {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "contains"
-                               case 2:
-                                       // if start field value in session contains condstring
-                                       if (stristr($startFieldSession, $conf[$key]['condstring'])) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "not contains"
-                               case 3:
-                                       // if start field value in session contains not condstring
-                                       if (!stristr($startFieldSession, $conf[$key]['condstring'])) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "is"
-                               case 4:
-                                       // if start field value in session === condstring
-                                       if ($startFieldSession === $conf[$key]['condstring']) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "is not"
-                               case 5:
-                                       // if start field value in session is not condstring
-                                       if ($startFieldSession !== $conf[$key]['condstring']) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "is greater than"
-                               case 6:
-                                       // if start field value in session is greater than condstring
-                                       if (intval($startFieldSession) > intval($conf[$key]['condstring'])) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "is less than"
-                               case 7:
-                                       // if start field value in session is greater than condstring
-                                       if (intval($startFieldSession) < intval($conf[$key]['condstring'])) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "contains value from field"
-                               case 8:
-                                       // get comparisonfield value from session
-                                       $comparisonFieldSession = $this->session['field_' . $conf[$key]['equalField']];
-                                       if (stristr($comparisonFieldSession, $startFieldSession)) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               // "contains not value from field"
-                               case 9:
-                                       // get comparisonfield value from session
-                                       $comparisonFieldSession = $this->session['field_' . $conf[$key]['equalField']];
-                                       if (!stristr($comparisonFieldSession, $startFieldSession)) {
-                                               $act = 1;
-                                               $tmpConf = $conf[$key];
-                                       }
-                                       break;
-
-                               default:
-                       }
-
-                       // $do = 1;
-                       $do = $this->setDo(($act ? TRUE : FALSE), $do, $conf[$key]['conjunction']);
-               }
-
-               // add new field if needed
-               $content = $this->doAction($do, $content, $tmpConf);
-               // return commaseparated list
-               return rtrim($content, ',');
-       }
-
-       /**
-        * Set a value to 0 or 1 depending on previous value and on conjunction (AND/OR)
-        *
-        * @param boolean $newStatus: New status
-        * @param boolean $oldStatus: Old status
-        * @param string $conjunction: AND or OR
-        * @return boolean
-        */
-       protected function setDo($newStatus, $oldStatus = FALSE, $conjunction = 'OR') {
-               if ($conjunction == 'OR') {
-                       if ($newStatus || $oldStatus) {
-                               return TRUE;
-                       } else {
-                               return FALSE;
-                       }
-               } elseif ($conjunction == 'AND') {
-                       if ($newStatus && $oldStatus) {
-                               return TRUE;
-                       } else {
-                               return FALSE;
-                       }
-               }
-               return FALSE;
-       }
-
-       /**
-        * This function return current field uid
-        *              if this field should be hidden (and removes value from session)
-        *
-        * @param boolean $do: If something should be done or not
-        * @param string $content: List with all fields which should be hidden
-        * @param array $conf: Configuration of current field
-        * @return string list
-        */
-       protected function doAction($do, $content, $conf) {
-               if (!$do) {
-                       return $content;
-               }
-
-               switch ($conf['actions']) {
-                       // hide
-                       case 0:
-                               // remove value from session of this field
-                               $this->div->saveValueToSession('', $this->piVars['formUid'], $conf['targetField']);
-                               // hide this field
-                               $content .= $this->div->getFieldsFromFieldset($conf['targetField'], $this->piVars['formUid']) . ',';
-                               break;
-
-                       // show
-                       case 1:
-                               // remove from hidelist (show this field)
-                               $content = GeneralUtility::rmFromList(
-                                       $this->div->getFieldsFromFieldset($conf['targetField'], $this->piVars['formUid']),
-                                       $content
-                               );
-                               break;
-
-                       // filter from selectbox
-                       case 2:
-                               $content .= 'filter:' . $conf['targetField'] . ':' . str_replace(',', ';', $conf['filterSelectField']);
-                               break;
-
-                       default:
-               }
-
-               return $content;
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->piVars = GeneralUtility::_GET($this->prefixId);
-               $this->div = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Div');
-               $this->session = $this->div->getAllSessionValuesFromForm($this->piVars['formUid']);
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\GetFieldlistEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/ReadSessionEid.php b/Classes/Utility/Eid/ReadSessionEid.php
deleted file mode 100644 (file)
index 62b370e..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class is for reading values from session
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage ReadSessionEid
- */
-class ReadSessionEid {
-
-       /**
-        * The extension key
-        *
-        * @var string
-        */
-       public $extKey = 'powermail_cond';
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * Read values from session - example: 18:braun;17:rot;12:xd;11:fc;
-        *
-        * @return string
-        */
-       public function main() {
-               $piVars = GeneralUtility::_GP($this->prefixId);
-               $array = $this->div->getAllSessionValuesFromForm($piVars['form']);
-
-               $content = '';
-               foreach ((array) $array as $key => $value) {
-                       $content .= str_replace('field_', '', $key) . ':' . $value . ';';
-               }
-               return $content;
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\ReadSessionEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/RequiredFieldEid.php b/Classes/Utility/Eid/RequiredFieldEid.php
deleted file mode 100644 (file)
index 36484e3..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Remove fields from session which should be mandatory again
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage RequiredFieldEid
- */
-class RequiredFieldEid {
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * save field in session to be stored for non-mandatory fields
-        *
-        * @return int Field Uid which was disabled
-        */
-       public function main() {
-               $piVars = GeneralUtility::_GP($this->prefixId);
-               $formUid = intval($piVars['formUid']);
-               $fieldUid = intval($piVars['fieldUid']);
-
-               // start
-               if ($formUid === 0 || $fieldUid === 0) {
-                       return 0;
-               }
-
-               // removee single value from session
-               $this->div->removeValueFromSession($formUid, $fieldUid, 'deRequiredFields');
-               return $fieldUid;
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\RequiredFieldEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/RequiredFieldsEid.php b/Classes/Utility/Eid/RequiredFieldsEid.php
deleted file mode 100644 (file)
index 118f7b2..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Remove all fields from session which should be mandatory again
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage RequiredFieldEid
- */
-class RequiredFieldsEid {
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * save field in session to be stored for non-mandatory fields
-        *
-        * @return string
-        */
-       public function main() {
-               $piVars = GeneralUtility::_GP($this->prefixId);
-               $formUid = intval($piVars['formUid']);
-               if ($formUid === 0) {
-                       return 'no FormUid given';
-               }
-
-               // removee single value from session
-               $this->div->cleanfullSession($formUid, 'deRequiredFields');
-               return 'ok';
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\RequiredFieldsEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Eid/SaveInSessionEid.php b/Classes/Utility/Eid/SaveInSessionEid.php
deleted file mode 100644 (file)
index bd607ca..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Eid;
-
-use \TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2014 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class is for storing values to session on every fieldchange (via AJAX)
- *
- * @author Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- * @package TYPO3
- * @subpackage SaveInSessionEid
- */
-class SaveInSessionEid {
-
-       /**
-        * The extension key
-        *
-        * @var string
-        */
-       public $extKey = 'powermail_cond';
-
-       /**
-        * Prefix Id
-        *
-        * @var string
-        */
-       public $prefixId = 'tx_powermailcond_pi1';
-
-       /**
-        * @var \In2code\PowermailCond\Utility\Div
-        */
-       protected $div;
-
-       /**
-        * Read values from session - example: 18:braun;17:rot;12:xd;11:fc;
-        *
-        * @return bool
-        */
-       public function main() {
-               $GLOBALS['TSFE']->sesData = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $piVars = GeneralUtility::_GP($this->prefixId);
-
-               $uid = intval($piVars['uid']);
-               $form = intval($piVars['form']);
-               $value = htmlspecialchars($piVars['value']);
-
-               // start
-               if ($uid === 0 || $form === 0) {
-                       return FALSE;
-               }
-               // save single value in session
-               $this->div->saveValueToSession($value, $form, $uid);
-
-               return FALSE;
-       }
-
-       /**
-        * Initialize eID
-        */
-       public function __construct($TYPO3_CONF_VARS) {
-               $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
-               $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
-                       '\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
-                       $TYPO3_CONF_VARS,
-                       32,
-                       0,
-                       TRUE
-               );
-               $GLOBALS['TSFE']->connectToDB();
-               $GLOBALS['TSFE']->fe_user = $userObj;
-               $GLOBALS['TSFE']->id = GeneralUtility::_GET('id');
-               $GLOBALS['TSFE']->determineId();
-               $GLOBALS['TSFE']->initTemplate();
-               $GLOBALS['TSFE']->getConfigArray();
-
-               $this->div = GeneralUtility::makeInstance('\In2code\PowermailCond\Utility\Div');
-       }
-}
-
-$eid = GeneralUtility::makeInstance('In2code\PowermailCond\Utility\Eid\SaveInSessionEid', $GLOBALS['TYPO3_CONF_VARS']);
-echo $eid->main();
\ No newline at end of file
diff --git a/Classes/Utility/Tca/FieldlistingBackend.php b/Classes/Utility/Tca/FieldlistingBackend.php
deleted file mode 100644 (file)
index 7c20990..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-namespace In2code\PowermailCond\Utility\Tca;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2012 Alex Kellner <alexander.kellner@in2code.de>, in2code.de
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * List powermail fields in Backend for powermail_cond rules
- *
- * @package powermail_cond
- * @license http://www.gnu.org/licenses/lgpl.html
- *                     GNU Lesser General Public License, version 3 or later
- */
-class FieldlistingBackend {
-
-       /**
-        * show all fields in the backend
-        *
-        * @param       array   $params: Params
-        * @param       object  $pObj: Parent Object
-        * @return      void
-        */
-       public function getFieldname(&$params, $pObj) {
-               // settings
-               $formUid = intval($params['row']['form']);
-               if (!empty($params['row']['conditions'])) {
-                       $formUid = $this->getFormUidFromCondition($params['row']['conditions']);
-               }
-
-               // query
-               $select = 'tx_powermail_domain_model_fields.uid, tx_powermail_domain_model_fields.title,
-                       tx_powermail_domain_model_fields.marker';
-               $from = '
-                       tx_powermail_domain_model_fields
-                       left join tx_powermail_domain_model_pages on tx_powermail_domain_model_fields.pages = tx_powermail_domain_model_pages.uid
-                       left join tx_powermail_domain_model_forms on tx_powermail_domain_model_pages.forms = tx_powermail_domain_model_forms.uid
-               ';
-               $where = 'tx_powermail_domain_model_fields.hidden = 0 AND tx_powermail_domain_model_fields.deleted = 0';
-               // we want only some fields for starting fields
-               if (isset($params['config']['itemsProcFuncValue'])) {
-                       $where .= ' and tx_powermail_domain_model_fields.type in ("input", "textarea", "select", "radio", "check")';
-               }
-               if ($formUid > 0) {
-                       $where .= ' AND tx_powermail_domain_model_forms.uid = ' . $formUid;
-               }
-               $groupBy = '';
-               $orderBy = 'tx_powermail_domain_model_fields.sorting';
-               $limit = 10000;
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
-               if ($res) {
-                       // Title for optgroup
-                       $params['items'][] = array('powermail Fields', '--div--');
-
-                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
-                               $params['items'][] = array(
-                                       $pObj->sL($row['title']) . ', {' . $row['marker'] . '}, uid' . $row['uid'],
-                                       $row['uid']
-                               );
-                       }
-               }
-
-               // add fieldsets to selection
-               if (isset($params['config']['itemsProcFunc_addFieldsets'])) {
-                       // add some fieldsets
-                       $params['items'] = array_merge((array) $params['items'], $this->getFieldsets($formUid));
-               }
-       }
-
-       /**
-        * give me all fieldsets in an array
-        *
-        * @param int $formUid                  Form Uid
-        * @return      array   $arr: all fieldsets with its name and the fieldset uid
-        */
-       protected function getFieldsets($formUid) {
-               $arr = array();
-               $select = 'uid, title';
-               $from = 'tx_powermail_domain_model_pages';
-               $where = 'forms = ' . intval($formUid) . ' AND hidden = 0 AND deleted = 0';
-               $groupBy = '';
-               $orderBy = 'sorting';
-               $limit = '';
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
-               if ($res) {
-                       $arr[] = array('powermail Fieldsets', '--div--');
-                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
-                               $arr[] = array($row['title'] . ' (' . $row['uid'] . ')', 'fieldset:' . $row['uid']);
-                       }
-               }
-               return $arr;
-       }
-
-       /**
-        * Get Form Uid from Rule
-        *
-        * @param int $conditionUid
-        * @return int formUid
-        */
-       protected function getFormUidFromCondition($conditionUid) {
-               $select = 'form';
-               $from = 'tx_powermailcond_domain_model_condition';
-               $where = 'uid = ' . intval($conditionUid) . ' AND hidden = 0 AND deleted = 0';
-               $groupBy = '';
-               $orderBy = '';
-               $limit = 1;
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
-               if ($res) {
-                       $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
-                       return $row['form'];
-               }
-               return 0;
-       }
-
-       /**
-        * List values of a powermail selectorbox
-        *
-        * @param       array   $params: Params
-        * @param       object  $pObj: Parent Object
-        * @return      void
-        */
-       public function valuesFromPowermailSelectbox(&$params, $pObj) {
-               // Get targetField UID
-               $gParams = GeneralUtility::_GET('edit');
-               $gParams2 = $gParams['tx_powermailcond_domain_model_condition'];
-               $thisConditionsUid = 0;
-               foreach ((array) $gParams2 as $uid => $actions) {
-                       unset($actions);
-                       $thisConditionsUid = $uid;
-               }
-               $key = 'tx_powermailcond_domain_model_condition:' . $thisConditionsUid;
-               $targetField = $pObj->cachedTSconfig[$key]['_THIS_ROW']['targetField'];
-
-               // Read values from powermail
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                       $select = 'settings',
-                       $from = 'tx_powermail_domain_model_fields',
-                       $where = 'uid = ' . intval($targetField),
-                       $groupBy = '',
-                       $orderBy = '',
-                       $limit = '1'
-               );
-               if ($res) {
-                       $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
-               }
-               $options = GeneralUtility::trimExplode("\n", $row['settings'], 1);
-
-               // write params
-               foreach ((array) $options as $option) {
-                       $params['items'][] = array(
-                               htmlspecialchars($option),
-                               htmlspecialchars($option)
-                       );
-               }
-       }
-}
\ No newline at end of file
diff --git a/Configuration/TCA/Condition.php b/Configuration/TCA/Condition.php
deleted file mode 100644 (file)
index c093875..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-<?php
-if (!defined ('TYPO3_MODE')) {
-       die ('Access denied.');
-}
-
-$TCA['tx_powermailcond_domain_model_condition'] = array (
-       'ctrl' => $TCA['tx_powermailcond_domain_model_condition']['ctrl'],
-       'interface' => array (
-               'showRecordFieldList' =>
-                       'sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,
-                       endtime,title,targetField,actions,filterSelectField,rules,conjunction,form'
-       ),
-       'types' => array (
-               '1' => array('showitem' => '--palette--;x;1, form, targetField, --palette--;x;2, rules, conjunction')
-       ),
-       'palettes' => array (
-               '1' => array('showitem' => 'title, hidden'),
-               '2' => array('showitem' => 'actions, filterSelectField'),
-               'canNotCollapse' => '1'
-       ),
-       'columns' => array (
-               'sys_language_uid' => array (
-                       'exclude' => 1,
-                       'label'  => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
-                       'config' => array (
-                               'type'                => 'select',
-                               'foreign_table'       => 'sys_language',
-                               'foreign_table_where' => 'ORDER BY sys_language.title',
-                               'items' => array(
-                                       array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
-                                       array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
-                               )
-                       )
-               ),
-               'l18n_parent' => array (
-                       'displayCond' => 'FIELD:sys_language_uid:>:0',
-                       'exclude'     => 1,
-                       'label'       => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
-                       'config'      => array (
-                               'type'  => 'select',
-                               'items' => array (
-                                       array('', 0),
-                               ),
-                               'foreign_table'       => 'tx_powermailcond_conditions',
-                               'foreign_table_where' =>
-                                       'AND tx_powermailcond_conditions.pid=###CURRENT_PID### AND tx_powermailcond_conditions.sys_language_uid IN (-1,0)',
-                       )
-               ),
-               'l18n_diffsource' => array (
-                       'config' => array (
-                               'type' => 'passthrough'
-                       )
-               ),
-               'hidden' => array (
-                       'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
-                       'config'  => array (
-                               'type'    => 'check',
-                               'default' => '0'
-                       )
-               ),
-               'starttime' => array (
-                       'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
-                       'config'  => array (
-                               'type'     => 'input',
-                               'size'     => '8',
-                               'max'      => '20',
-                               //'eval'     => 'date',
-                               'default'  => '0',
-                               'checkbox' => '0'
-                       )
-               ),
-               'endtime' => array (
-                       'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
-                       'config'  => array (
-                               'type'     => 'input',
-                               'size'     => '8',
-                               'max'      => '20',
-                               //'eval'     => 'date',
-                               'checkbox' => '0',
-                               'default'  => '0',
-                               'range'    => array (
-                                       'upper' => mktime(0, 0, 0, 12, 31, 2020),
-                                       'lower' => mktime(0, 0, 0, date('m') - 1, date('d'), date('Y'))
-                               )
-                       )
-               ),
-               'title' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.title',
-                       'config' => Array (
-                               'type' => 'input',
-                               'size' => '30',
-                       )
-               ),
-               'form' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.form',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                                       Array('LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.form.pleaseChoose', '')
-                               ),
-                               'maxitems' => '1',
-                               'size' => '1',
-                               'minitems' => 1,
-                               'requestUpdate' => 1,
-                               'foreign_table' => 'tx_powermail_domain_model_forms',
-                               'foreign_table_where' => '
-                                       AND tx_powermail_domain_model_forms.deleted = 0
-                                       AND tx_powermail_domain_model_forms.hidden = 0
-                                       AND tx_powermail_domain_model_forms.sys_language_uid = 0
-                                       order by tx_powermail_domain_model_forms.title
-                               '
-                       )
-               ),
-               'targetField' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.targetField',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                                       Array('LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.targetField.I.0', '0'),
-                               ),
-                               'itemsProcFunc' => '\In2code\PowermailCond\Utility\Tca\FieldlistingBackend->getFieldname',
-                               'itemsProcFunc_addFieldsets' => 1,
-                               'size' => 1,
-                               'maxitems' => 1,
-                               'eval' => 'required'
-                       ),
-                       'displayCond' => 'FIELD:form:>:0'
-               ),
-               'actions' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                                       // title main
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.main',
-                                               '--div--'
-                                       ),
-
-                                       // hide
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.0',
-                                               '0'
-                                       ),
-
-                                       // unhide
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.1',
-                                               '1'
-                                       ),
-
-                                       // title additional
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.additional',
-                                               '--div--'
-                                       ),
-
-                                       // filter selectbox
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.2',
-                                               '2'
-                                       ),
-                               ),
-                               'size' => 1,
-                               'maxitems' => 1,
-                       ),
-                       'displayCond' => 'FIELD:form:>:0'
-               ),
-               'filterSelectField' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.filterSelectField',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                               ),
-                               'itemsProcFunc' => '\In2code\PowermailCond\Utility\Tca\FieldlistingBackend->valuesFromPowermailSelectbox',
-                               'size' => 4,
-                               'maxitems' => 1000,
-                               'allowNonIdValues' => 1
-                       ),
-                       // show only if ops value is greater than 1
-                       'displayCond' => 'FIELD:actions:IN:2,FIELD:form:>:0'
-               ),
-               'rules' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.rules',
-                       'config' => Array (
-                               'type' => 'inline',
-                               'foreign_table' => 'tx_powermailcond_domain_model_rule',
-                               'foreign_table_where' =>
-                                       'AND tx_powermailcond_domain_model_rule.pid=###CURRENT_PID### ORDER BY tx_powermailcond_domain_model_rule.sorting',
-                               'foreign_field' => 'conditions',
-                               'maxitems' => 99,
-                               'appearance' => array(
-                                       'collapseAll' => 1,
-                                       'expandSingle' => 1,
-                                       'useSortable' => 1,
-                                       'newRecordLinkAddTitle' => 1,
-                                       'newRecordLinkPosition' => 'both',
-                               ),
-                       ),
-                       'displayCond' => 'FIELD:form:>:0'
-               ),
-               'conjunction' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.conjunction',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                                       // OR
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.conjunction.I.1',
-                                               'OR'
-                                       ),
-
-                                       // AND
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.conjunction.I.0',
-                                               'AND'
-                                       ),
-                               ),
-                               'size' => 1,
-                               'maxitems' => 1,
-                       ),
-                       'displayCond' => 'FIELD:form:>:0'
-               ),
-       ),
-);
\ No newline at end of file
diff --git a/Configuration/TCA/Rule.php b/Configuration/TCA/Rule.php
deleted file mode 100644 (file)
index 59d3a98..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-if (!defined ('TYPO3_MODE')) {
-       die ('Access denied.');
-}
-
-$TCA['tx_powermailcond_domain_model_rule'] = array (
-       'ctrl' => $TCA['tx_powermailcond_domain_model_rule']['ctrl'],
-       'interface' => array (
-               'showRecordFieldList' => 'hidden,startField,ops,condstring,equalField'
-       ),
-       'types' => array (
-               '0' => array('showitem' => '--palette--;;1,startField,--palette--;;2')
-       ),
-       'palettes' => array (
-               '1' => array('showitem' => 'title, hidden'),
-               '2' => array('showitem' => 'ops,condstring,equalField')
-       ),
-       'columns' => array (
-               'hidden' => array (
-                       'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
-                       'config'  => array (
-                               'type'    => 'check',
-                               'default' => '0'
-                       )
-               ),
-               'title' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.title',
-                       'config' => Array (
-                               'type' => 'input',
-                               'size' => '30',
-                       )
-               ),
-               'startField' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.startField',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                                       Array('LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.startField.I.0', '0'),
-                               ),
-                               'itemsProcFunc' => '\In2code\PowermailCond\Utility\Tca\FieldlistingBackend->getFieldname',
-                               // allow only this types of fields in selector
-                               'itemsProcFuncValue' => '"text","textarea","select","radio","check"',
-                               'size' => 1,
-                               'maxitems' => 1,
-                               'eval' => 'required'
-                       )
-               ),
-               'ops' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                                       // title operators
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.operators',
-                                               '--div--'
-                                       ),
-
-                                       // is set
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.0',
-                                               '0'
-                                       ),
-
-                                       // is not set
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.1',
-                                               '1'
-                                       ),
-
-                                       // title operatorsComparisonValue
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.operatorsComparisonValue',
-                                               '--div--'
-                                       ),
-
-                                       // contains
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.2',
-                                               '2'
-                                       ),
-
-                                       // contains not
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.3',
-                                               '3'
-                                       ),
-
-                                       // is
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.4',
-                                               '4'
-                                       ),
-
-                                       // is not
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.5',
-                                               '5'
-                                       ),
-
-                                       // is greater than
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.6',
-                                               '6'
-                                       ),
-
-                                       // is less than
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.7',
-                                               '7'
-                                       ),
-
-                                       // title operatorsComparisonField
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.operatorsComparisonField',
-                                               '--div--'
-                                       ),
-
-                                       // contains value from field
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.8',
-                                               '8'
-                                       ),
-
-                                       // contains not value from field
-                                       Array(
-                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.9',
-                                               '9'
-                                       ),
-                               ),
-                               'size' => 1,
-                               'maxitems' => 1
-                       )
-               ),
-               'condstring' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.condstring',
-                       'config' => Array (
-                               'type' => 'text',
-                               'cols' => '30',
-                               'rows' => '2',
-                       ),
-                       // show only if ops value is greater than 1
-                       'displayCond' => 'FIELD:ops:IN:2,3,4,5,6,7'
-               ),
-               'equalField' => Array (
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.equalField',
-                       'config' => Array (
-                               'type' => 'select',
-                               'items' => Array (
-                                       Array('LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.equalField.I.0', '0'),
-                               ),
-                               'itemsProcFunc' => 'tx_powermailcond_fields_be->fieldname',
-                               // allow only this types of fields in selector
-                               'itemsProcFuncValue' => '"text","textarea","select","radio"',
-                               'size' => 1,
-                               'maxitems' => 1
-                       ),
-                       'displayCond' => 'FIELD:ops:IN:8,9'
-               ),
-       ),
-);
\ No newline at end of file
diff --git a/Configuration/TCA/tx_powermailcond_domain_model_condition.php b/Configuration/TCA/tx_powermailcond_domain_model_condition.php
new file mode 100644 (file)
index 0000000..f633d98
--- /dev/null
@@ -0,0 +1,235 @@
+<?php
+return array(
+       'ctrl' => array(
+               'title' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions',
+               'label' => 'title',
+               'tstamp' => 'tstamp',
+               'crdate' => 'crdate',
+               'cruser_id' => 'cruser_id',
+               'languageField' => 'sys_language_uid',
+               'sortby' => 'sorting',
+               'delete' => 'deleted',
+               'enablecolumns' => array(
+                       'disabled' => 'hidden',
+                       'starttime' => 'starttime',
+                       'endtime' => 'endtime',
+               ),
+               'requestUpdate' => 'actions,form',
+               'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('powermail_cond') .
+                       'Resources/Public/Icons/icon_tx_powermailcond_conditions.gif'
+       ),
+       'interface' => array(
+               'showRecordFieldList' => 'sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,
+                       endtime,title,target_field,actions,filter_select_field,rules,conjunction,form',
+       ),
+       'types' => array(
+               '1' => array('showitem' => '--palette--;x;1, form, rules, conjunction, target_field, --palette--;x;2'),
+       ),
+       'palettes' => array(
+               '1' => array('showitem' => 'title, hidden'),
+               '2' => array('showitem' => 'actions, filter_select_field'),
+               'canNotCollapse' => '1'
+       ),
+       'columns' => array(
+               'sys_language_uid' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
+                       'config' => array(
+                               'type' => 'select',
+                               'foreign_table' => 'sys_language',
+                               'foreign_table_where' => 'ORDER BY sys_language.title',
+                               'items' => array(
+                                       array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
+                                       array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
+                               ),
+                       ),
+               ),
+               'l18n_parent' => array (
+                       'displayCond' => 'FIELD:sys_language_uid:>:0',
+                       'exclude'     => 1,
+                       'label'       => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
+                       'config'      => array (
+                               'type'  => 'select',
+                               'items' => array (
+                                       array('', 0),
+                               ),
+                               'foreign_table' => 'tx_powermailcond_conditions',
+                               'foreign_table_where' =>
+                                       'AND tx_powermailcond_conditions.pid=###CURRENT_PID### AND tx_powermailcond_conditions.sys_language_uid IN (-1,0)',
+                       )
+               ),
+               'l18n_diffsource' => array (
+                       'config' => array (
+                               'type' => 'passthrough'
+                       )
+               ),
+               'hidden' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config' => array(
+                               'type' => 'check',
+                       ),
+               ),
+               'starttime' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'mergeIfNotBlank',
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 13,
+                               'max' => 20,
+                               'eval' => 'datetime',
+                               'checkbox' => 0,
+                               'default' => 0,
+                               'range' => array(
+                                       'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
+                               ),
+                       ),
+               ),
+               'endtime' => array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'mergeIfNotBlank',
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => 13,
+                               'max' => 20,
+                               'eval' => 'datetime',
+                               'checkbox' => 0,
+                               'default' => 0,
+                               'range' => array(
+                                       'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
+                               ),
+                       ),
+               ),
+               'title' => Array (
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.title',
+                       'config' => Array (
+                               'type' => 'input',
+                               'size' => '30',
+                       )
+               ),
+               'form' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.form',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.form.pleaseChoose',
+                                               ''
+                                       )
+                               ),
+                               'maxitems' => 1,
+                               'size' => 1,
+                               'minitems' => 1,
+                               'requestUpdate' => 1,
+                               'foreign_table' => 'tx_powermail_domain_model_forms',
+                               'foreign_table_where' => '
+                                       AND tx_powermail_domain_model_forms.deleted = 0
+                                       AND tx_powermail_domain_model_forms.hidden = 0
+                                       AND tx_powermail_domain_model_forms.sys_language_uid = 0
+                                       order by tx_powermail_domain_model_forms.title
+                               '
+                       )
+               ),
+               'rules' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.rules',
+                       'config' => array(
+                               'type' => 'inline',
+                               'foreign_table' => 'tx_powermailcond_domain_model_rule',
+                               'foreign_table_where' =>
+                                       'AND tx_powermailcond_domain_model_rule.pid=###CURRENT_PID### ORDER BY tx_powermailcond_domain_model_rule.sorting',
+                               'foreign_field' => 'conditions',
+                               'maxitems' => 99,
+                               'appearance' => array(
+                                       'collapseAll' => 1,
+                                       'expandSingle' => 1,
+                                       'useSortable' => 1,
+                                       'newRecordLinkAddTitle' => 1,
+                                       'newRecordLinkPosition' => 'both',
+                               ),
+                       ),
+                       'displayCond' => 'FIELD:form:>:0'
+               ),
+               'conjunction' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.conjunction',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       // OR
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.conjunction.I.1',
+                                               'OR'
+                                       ),
+
+                                       // AND
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.conjunction.I.0',
+                                               'AND'
+                                       ),
+                               ),
+                               'size' => 1,
+                               'maxitems' => 1,
+                       ),
+                       'displayCond' => 'FIELD:form:>:0'
+               ),
+               'target_field' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.targetField',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.targetField.I.0',
+                                               '0'
+                                       ),
+                               ),
+                               'itemsProcFunc' => 'In2code\PowermailCond\UserFunc\GetPowermailFields->getFields',
+                               'itemsProcFunc_addFieldsets' => TRUE,
+                               'size' => 1,
+                               'maxitems' => 1,
+                               'eval' => 'required'
+                       ),
+                       'displayCond' => 'FIELD:form:>:0'
+               ),
+               'actions' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       // title main
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.main',
+                                               '--div--'
+                                       ),
+
+                                       // hide
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.0',
+                                               '0'
+                                       ),
+
+                                       // unhide
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.1',
+                                               '1'
+                                       ),
+
+                                       // title additional
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions.action.I.additional',
+                                               '--div--'
+                                       ),
+                               ),
+                               'size' => 1,
+                               'maxitems' => 1,
+                       ),
+                       'displayCond' => 'FIELD:form:>:0'
+               ),
+       ),
+);
\ No newline at end of file
diff --git a/Configuration/TCA/tx_powermailcond_domain_model_rule.php b/Configuration/TCA/tx_powermailcond_domain_model_rule.php
new file mode 100644 (file)
index 0000000..6656347
--- /dev/null
@@ -0,0 +1,180 @@
+<?php
+return array(
+       'ctrl' => array(
+               'title' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules',
+               'label' => 'title',
+               'tstamp' => 'tstamp',
+               'crdate' => 'crdate',
+               'cruser_id' => 'cruser_id',
+               'sortby' => 'sorting',
+               'delete' => 'deleted',
+               'enablecolumns' => array(
+                       'disabled' => 'hidden'
+               ),
+               'requestUpdate' => 'ops',
+               'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('powermail_cond') .
+                       'Resources/Public/Icons/icon_tx_powermailcond_rules.gif'
+       ),
+       'interface' => array(
+               'showRecordFieldList' => 'hidden,start_field,ops,cond_string,equal_field',
+       ),
+       'types' => array(
+               '0' => array('showitem' => '--palette--;;1,start_field,--palette--;;2')
+       ),
+       'palettes' => array(
+               '1' => array('showitem' => 'title,hidden'),
+               '2' => array('showitem' => 'ops,cond_string,equal_field')
+       ),
+       'columns' => array(
+               'hidden' => array(
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config'  => array(
+                               'type' => 'check',
+                               'default' => '0'
+                       )
+               ),
+               'title' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.title',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '30',
+                       )
+               ),
+               'start_field' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.startField',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array('LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.startField.I.0', '0'),
+                               ),
+                               'itemsProcFunc' => 'In2code\PowermailCond\UserFunc\GetPowermailFields->getFields',
+                               // allow only this types of fields in selector
+                               'itemsProcFuncValue' => 'input,textarea,select,radio,check',
+                               'size' => 1,
+                               'maxitems' => 1,
+                               'eval' => 'required'
+                       )
+               ),
+               'ops' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       // title operators
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.operators',
+                                               '--div--'
+                                       ),
+
+                                       // is set
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.0',
+                                               '0'
+                                       ),
+
+                                       // is not set
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.1',
+                                               '1'
+                                       ),
+
+                                       // title operatorsComparisonValue
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.operatorsComparisonValue',
+                                               '--div--'
+                                       ),
+
+                                       // contains
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.2',
+                                               '2'
+                                       ),
+
+                                       // contains not
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.3',
+                                               '3'
+                                       ),
+
+                                       // is
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.4',
+                                               '4'
+                                       ),
+
+                                       // is not
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.5',
+                                               '5'
+                                       ),
+
+                                       // is greater than
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.6',
+                                               '6'
+                                       ),
+
+                                       // is less than
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.7',
+                                               '7'
+                                       ),
+
+                                       // title operatorsComparisonField
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.operatorsComparisonField',
+                                               '--div--'
+                                       ),
+
+                                       // contains value from field
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.8',
+                                               '8'
+                                       ),
+
+                                       // contains not value from field
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.operator.I.9',
+                                               '9'
+                                       ),
+                               ),
+                               'size' => 1,
+                               'maxitems' => 1
+                       )
+               ),
+               'cond_string' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.condstring',
+                       'config' => array(
+                               'type' => 'text',
+                               'cols' => '30',
+                               'rows' => '2',
+                       ),
+                       // show only if ops value is greater than 1
+                       'displayCond' => 'FIELD:ops:IN:2,3,4,5,6,7'
+               ),
+               'equal_field' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.equalField',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array(
+                                               'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules.equalField.I.0',
+                                               '0'
+                                       ),
+                               ),
+                               'itemsProcFunc' => 'tx_powermailcond_fields_be->fieldname',
+                               // allow only this types of fields in selector
+                               'itemsProcFuncValue' => '"text","textarea","select","radio"',
+                               'size' => 1,
+                               'maxitems' => 1
+                       ),
+                       'displayCond' => 'FIELD:ops:IN:8,9'
+               ),
+       ),
+);
\ No newline at end of file
index dd73b23..605593e 100644 (file)
@@ -1,14 +1,34 @@
-page.headerData.313131 = TEXT
-page.headerData.313131.value (
-       <meta http-equiv="expires" content="0" />
-       <meta http-equiv="cache-control" content="no-cache" />
-       <meta http-equiv="pragma" content="no-cache" />
-)
-page.includeJSFooter.powermail_cond = EXT:powermail_cond/Resources/Public/Js/PowermailCond.js
-page.includeCSS.powermail_cond = EXT:powermail_cond/Resources/Public/Css/PowermailCond.css
+page.includeJSFooter.powermailCond = EXT:powermail_cond/Resources/Public/JavaScript/PowermailCondition.js
 
-config.tx_extbase {
-       objects {
-               In2code\Powermail\Domain\Validator\InputValidator.className = In2code\PowermailCond\Domain\Validator\InputValidator
+powermailCondition = PAGE
+powermailCondition {
+       typeNum = 3131
+       config {
+               disableAllHeaderCode = 1
+               xhtml_cleaning = 0
+               admPanel = 0
+               #additionalHeaders = Content-type: text/plain
+               no_cache = 1
+               debug = 0
+       }
+
+       10 = USER
+       10 {
+               userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
+               extensionName = PowermailCond
+               vendorName = In2code
+               controller = Condition
+               pluginName = Pi1
+               switchableControllerActions {
+                       Condition {
+                               1 = buildCondition
+                       }
+               }
+               view {
+               }
+               persistence {
+               }
+               settings {
+               }
        }
 }
\ No newline at end of file
diff --git a/Resources/Private/.htaccess b/Resources/Private/.htaccess
deleted file mode 100644 (file)
index dfc0272..0000000
+++ /dev/null
@@ -1 +0,0 @@
-deny  from all
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_condition.xml b/Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_condition.xml
deleted file mode 100644 (file)
index 4eccd71..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3locallang>
-       <meta type="array">
-               <description>Context Sensitive Help (CSH) for table tx_powermailcond_domain_model_condition</description>
-               <type>CSH</type>
-               <csh_table>tx_powermailcond_domain_model_condition</csh_table>
-       </meta>
-       <data type="array">
-               <languageKey index="default" type="array">
-                       <label index="title.description">Enter a title for this condition</label>
-               </languageKey>
-               <languageKey index="de" type="array">
-                       <label index="title.description">Geben Sie eine Bezeichnung für diese Bedingung ein</label>
-               </languageKey>
-       </data>
-</T3locallang>
\ No newline at end of file
diff --git a/Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_rule.xml b/Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_rule.xml
deleted file mode 100644 (file)
index 4c5ac45..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3locallang>
-       <meta type="array">
-               <description>Context Sensitive Help (CSH) for table tx_powermailcond_domain_model_rule</description>
-               <type>CSH</type>
-               <csh_table>tx_powermailcond_domain_model_rule</csh_table>
-       </meta>
-       <data type="array">
-               <languageKey index="default" type="array">
-                       <label index="title.description">Enter a title for this rule</label>
-               </languageKey>
-               <languageKey index="de" type="array">
-                       <label index="title.description">Geben Sie eine Bezeichnung für diese Regel ein</label>
-               </languageKey>
-       </data>
-</T3locallang>
\ No newline at end of file
index 32bdbb3..2f26d42 100644 (file)
                        <label index="tx_powermailcond_conditions.action.I.additional">Additional Actions</label>
                        <label index="tx_powermailcond_conditions.action.I.0">hide</label>
                        <label index="tx_powermailcond_conditions.action.I.1">unhide</label>
-                       <label index="tx_powermailcond_conditions.action.I.2">filter Selectbox (for fields only)</label>
-                       <label index="tx_powermailcond_conditions.filterSelectField">Filter to these values</label>
                        <label index="tx_powermailcond_conditions.rules">Rules</label>
-                       <label index="tx_powermailcond_conditions.conjunction">Conjunction of the rules</label>
+                       <label index="tx_powermailcond_conditions.conjunction">Conjunction of the rules (if more than only 1)</label>
                        <label index="tx_powermailcond_conditions.conjunction.I.0">AND</label>
                        <label index="tx_powermailcond_conditions.conjunction.I.1">OR</label>
                        <label index="tx_powermailcond_rules">Rules</label>
                        <label index="tx_powermailcond_conditions.action.I.additional">Zusätzliche Aktionen</label>
                        <label index="tx_powermailcond_conditions.action.I.0">verberge</label>
                        <label index="tx_powermailcond_conditions.action.I.1">zeige</label>
-                       <label index="tx_powermailcond_conditions.action.I.2">filter Auswahlbox (nur für Felder)</label>
-                       <label index="tx_powermailcond_conditions.filterSelectField">Auf diese Werte begrenzen</label>
                        <label index="tx_powermailcond_conditions.rules">Regeln</label>
-                       <label index="tx_powermailcond_conditions.conjunction">Logische Verknüpfung der Regeln</label>
+                       <label index="tx_powermailcond_conditions.conjunction">Logische Verknüpfung der Regeln (wenn mehr als 1 Regel)</label>
                        <label index="tx_powermailcond_conditions.conjunction.I.0">UND</label>
                        <label index="tx_powermailcond_conditions.conjunction.I.1">ODER</label>
                        <label index="tx_powermailcond_rules">Regeln</label>
diff --git a/Resources/Private/Templates/Condition/BuildCondition.html b/Resources/Private/Templates/Condition/BuildCondition.html
new file mode 100644 (file)
index 0000000..c12301a
--- /dev/null
@@ -0,0 +1 @@
+jepp, läuft
\ No newline at end of file
diff --git a/Resources/Public/Css/PowermailCond.css b/Resources/Public/Css/PowermailCond.css
deleted file mode 100644 (file)
index 6150057..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-form.powermail_form {
-       -moz-opacity: 0.1;
-       -webkit-opacity: 0.1;
-       opacity: 0.1;
-       filter: alpha(opacity=10);
-}
-.hide {
-       display: none;
-}
\ No newline at end of file
diff --git a/Resources/Public/JavaScript/PowermailCondition.js b/Resources/Public/JavaScript/PowermailCondition.js
new file mode 100644 (file)
index 0000000..f215987
--- /dev/null
@@ -0,0 +1,72 @@
+/**
+ * PowermailCondition functions
+ *
+ * @class PowermailCondition
+ * @param {jQuery} $formElement powermail form
+ * @constructor
+ */
+function PowermailCondition($formElement) {
+
+       /**
+        * @type {jQuery}
+        */
+       this.$formElement = $formElement;
+
+       /**
+        * This class
+        *
+        * @type {PowermailCondition}
+        */
+       var that = this;
+
+       /**
+        * @type {null}
+        */
+       var init = initialize();
+
+       /**
+        * Classnames of all default fields
+        *
+        * @type {array}
+        */
+       var defaultFieldClassNames = [
+               'powermail_input',
+               'powermail_textarea',
+               'powermail_select',
+               'powermail_radio',
+               'powermail_checkbox'
+       ];
+
+       this.sendFormValuesToPowermailCond = function() {
+               jQuery.ajax({
+                       type: 'POST',
+                       url: 'index.php',
+                       data: new FormData(that.$formElement.get(0)),
+                       contentType: false,
+                       processData: false,
+                       success: function(data) {
+                               console.log(data);
+                       }
+               });
+       };
+
+       /**
+        * Initialize
+        *
+        * @returns {null}
+        */
+       function initialize() {
+               that.$formElement.css('background-color', 'red');
+               //that.sendFormValuesToPowermailCond();
+       }
+
+       // make global
+       window.PowermailCondition = PowermailCondition;
+}
+
+jQuery(document).ready(function() {
+       $('form.powermail_form').each(function() {
+               var PowermailCondition = new window.PowermailCondition($(this));
+               PowermailCondition.sendFormValuesToPowermailCond();
+       });
+});
\ No newline at end of file
diff --git a/Resources/Public/Js/PowermailCond.js b/Resources/Public/Js/PowermailCond.js
deleted file mode 100644 (file)
index bfe123e..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-jQuery(document).ready(function() {
-       base = getBaseUrl();
-       validationFieldClasses = '.powermail_input, .powermail_textarea, .powermail_select, .powermail_radio, .powermail_checkbox';
-       clearFullSession();
-       if ($('form.powermail_form').length > 0) { // only if the powermail form is on the page (not for confirmation page)
-               checkConditions(0); // check if something should be changed
-       }
-
-       // read values from session
-       var url = base + '/index.php?eID=powermailcond_readSession&tx_powermailcond_pi1[form]=' + getFormUid();
-       $.ajax({
-               url: url, // send to this url
-               cache: false, // disable cache (for ie)
-               success: function(data) { // return values
-                       if (data) { // if there is a response
-                               var sets = data.split(';');
-                               for (var i=0; i < sets.length; i++) { // for each field which should be filled
-                                       var tmp_value = sets[i].split(':');
-                                       fieldValue(tmp_value[0], tmp_value[1]);
-                               }
-                       }
-                       $('form.powermail_form').fadeTo('fast', 1);
-               }
-       });
-
-       // save values via ajax to session
-       $(validationFieldClasses).bind('change', function() {
-               $this = $(this); // caching
-               var url = base + '/index.php';
-               var timestamp = Number(new Date()); // timestamp is needed for a internet explorer workarround (always change a parameter)
-               var value = $this.val(); // current value
-               if ($this.hasClass('powermail_checkbox') && !$this.is(':checked')) { // clean value if checkbox was dechecked
-                       value = '';
-               }
-               var uid = $this.closest('.powermail_fieldwrap').attr('id').substr(20); // current field uid (without "uid")
-               var name = $this.prop('name');
-               var params = 'eID=' + 'powermailcond_saveToSession' + '&tx_powermailcond_pi1[form]=' + getFormUid() + '&tx_powermailcond_pi1[uid]=' + uid + '&tx_powermailcond_pi1[value]=' + value + '&ts=' + timestamp;
-
-               $.ajax({
-                       type: 'GET', // type
-                       url: url, // send to this url
-                       data: params, // add params
-                       cache: false, // disable cache (for ie)
-                       success: function(data) { // return values
-                               if (data != '') { // if there is a response
-                                       $('form.powermail_form').append('Error in powermail_cond.js in change function:' + data);
-                               }
-                               checkConditions(uid); // check if something should be changed
-                       }
-               });
-       });
-});
-
-/**
- * Fill a field with a value
- *
- * @param {int} fieldUid - Field Uid
- * @param {int} fieldValue - Field Value
- */
-function fieldValue(fieldUid, fieldValue) {
-       var fieldWrap = $('#powermail_fieldwrap_' + fieldUid);
-
-       // set value for all default fields
-       fieldWrap
-               .find('input.powermail_field')
-               .not('[type="checkbox"], input[type="radio"]')
-               .val(fieldValue);
-
-       // check checkboxes and radiobuttons
-       fieldWrap.find('input[type="checkbox"], input[type="radio"]').each(function() {
-               if ($(this).prop('value') == fieldValue) {
-                       $(this).prop('checked', 'checked');
-               }
-       })
-}
-
-/**
- * Main function to check conditions and do something (if necessary)
- *
- * @param {integer} uid: Field uid (if available)
- * @return void
- */
-function checkConditions(uid) {
-       var url = base + '/index.php';
-       var params = '';
-       if (uid > 0) {
-               params += '&tx_powermailcond_pi1[uid]=' + uid;
-       }
-       $.ajax({
-               type: 'GET', // type
-               url: url, // send to this url
-               data: 'eID=' + 'powermailcond_getFieldStatus' + params + '&tx_powermailcond_pi1[formUid]=' + getFormUid(), // add params
-               cache: false, // disable cache (for ie)
-               success: function(data) {
-                       if (data != 'nochange') {
-                               $('.powermail_fieldwrap select option').removeClass('hide').removeProp('disabled');
-                               if (data != '') { // if there is a response
-                                       if (data.length < 1000) { // stop if wrong result (maybe complete t3 page)
-                                               doAction(data); // hide all given fields
-                                       }
-                               } else { // if there is no response
-                                       showAll(); // show all fields and fieldsets at the beginning
-                               }
-                       }
-               },
-               error: function() {
-                       $('form.powermail_form').append('Error in PowermailCond.js in checkCondtions function by opening the given url');
-               }
-       });
-}
-
-/**
- * Do some actions (hide and/or filter)
- *
- * @param {string} list commaseparated list with uids (1,2,3)
- * @return void
- */
-function doAction(list) {
-       showAll();
-
-       var uid = list.split(',');
-       if (uid.length < 1) {
-               return false; // stop process
-       }
-       for (var i=0; i < uid.length; i++) { // one loop for every affected field
-               if (uid[i].indexOf('fieldset:') != '-1') { // fieldset part
-                       hideFieldset(uid[i]);
-               } else if (uid[i].indexOf('filter:') != '-1') { // filter part
-                       filterSelection(uid[i]);
-               } else { // fields part
-                       hideField(uid[i]);
-               }
-       }
-}
-
-/**
- * Hide a field and clear its value
- *
- * @param {integer} uid uid of the element
- * @return void
- */
-function hideField(uid) {
-       $('.powermail_fieldwrap_' + uid).addClass('hide'); // hide current field
-       deRequiredField(uid, true);
-       if ($('.powermail_fieldwrap_' + uid + ' .powermail_field').val() != '') { // only if value is not yet empty
-               clearValue('.powermail_fieldwrap_' + uid + ' .powermail_field'); // clear value of current field
-               clearSession(uid); // clear value of current field
-       }
-}
-
-/**
- * Hide some fields, which are bundled in a fieldset and clear there value
- *
- * @param {string} string mix of uid and values (fieldset:5:12;13;14)
- * @return void
- */
-function hideFieldset(string) {
-       var params = string.split(':'); // filter / uid / values
-       var values = params[2].split(';'); // value1 / value2 / value3
-       $('.powermail_fieldset_' + params[1]).addClass('hide');
-       var fields = [];
-       for (var k=0; k < values.length; k++) {
-               clearValue('.powermail_fieldwrap_' + values[k] + ' .powermail_field');
-               deRequiredField(values[k], true);
-               fields.push(values[k]);
-       }
-
-       // save this field in session so it's no mandatory field any more
-       $.ajax({
-               url: '/index.php',
-               data: 'eID=' + 'powermailcond_deRequiredFields&tx_powermailcond_pi1[formUid]=' + getFormUid() + '&tx_powermailcond_pi1[fieldUids]=' + fields.join() + '&no_cache=1',
-               cache: false,
-               async: false
-       });
-}
-
-/**
- * Hide some fields and clear there value
- *
- * @param {string} string mix of uid and values (filter:123:Value1;Value2;Value3)
- * @return void
- */
-function filterSelection(string) {
-       var params = string.split(':'); // filter / uid / values
-       var values = params[2].split(';'); // value1 / value2 / value3
-       $('.powermail_fieldwrap_' + params[1] + ' .powermail_field > option').addClass('hide').prop('disabled', 'disabled'); // disable all options
-
-       for (var j=0; j < values.length; j++) { // one loop for every option in select field
-               $('.powermail_fieldwrap_' + params[1] + ' .powermail_field > option:contains(' + values[j] + ')').removeClass('hide').removeProp('disabled'); // show this option
-       }
-
-       var valueSelected = $('.powermail_fieldwrap_' + params[1] + ' .powermail_field > option:selected').val(); // give me the value of the selected option
-       if (params[2].indexOf(valueSelected) == '-1') { // if current selected value is one of the not allowed options
-               $('.powermail_fieldwrap_' + params[1] + ' .powermail_field').get(0).selectedIndex = 0; // remove selection (because the selected option is not allowed)
-       }
-}
-
-/**
- * Show all fields and fieldsets
- *
- * @return void
- */
-function showAll() {
-       reRequiredAll();
-       $('.powermail_fieldwrap, .powermail_fieldset').removeClass('hide');
-}
-
-/**
- * Remove required class in Field
- *
- * @param {int} uid of the element
- * @param {bool} disableAjaxRequest
- * @return void
- */
-function deRequiredField(uid, disableAjaxRequest) {
-       // save this field in session so it's no mandatory field any more
-       if (disableAjaxRequest !== undefined && disableAjaxRequest === true) {
-               $.ajax({
-                       url: '/index.php',
-                       data: 'eID=' + 'powermailcond_deRequiredField&tx_powermailcond_pi1[formUid]=' + getFormUid() + '&tx_powermailcond_pi1[fieldUid]=' + uid + '&no_cache=1',
-                       cache: false,
-                       async: false
-               });
-       }
-
-       // rewrite required attributes
-       var element = $('#powermail_fieldwrap_' + uid).find('input');
-       if (element.prop('required') || element.data('parsley-required')) {
-               element.removeProp('required'); // remove required attribute
-               element.removeProp('data-parsley-required'); // remove parsley-required attribute
-               element.data('powermailcond-required', 'required'); // add own data required attribute
-       }
-       if (isParsleyValidationActivated()) {
-               // reinit parsley seems only to work with required="required" and not with data-parslay attributes :(
-               var form = $('form.powermail_form_'+ getFormUid());
-               form.parsley().destroy(); // turn off parsley
-               form.parsley(); // turn on parsley again
-       }
-}
-
-/**
- * Re required Fields for JS-Validation
- *
- * @return void
- */
-function reRequiredAll() {
-       // Required Fields all
-       $.ajax({
-               url: '/index.php',
-               data: 'eID=' + 'powermailcond_requiredFields&tx_powermailcond_pi1[formUid]=' + getFormUid(),
-               cache: false,
-               async: false
-       });
-
-       $(validationFieldClasses).each(function() {
-               var $this = $(this);
-               $this.removeProp('powermailcond-required');
-               if ($this.data('powermailcond-required') === 'required') {
-                       if (isHtml5ValidationActivated()) {
-                               $this.prop('required', 'required');
-                       } else if (isParsleyValidationActivated()) {
-                               $this.prop('required', 'required');
-                       }
-               }
-       });
-}
-
-/**
- * Clear value of an inputfield, set selectedIndex to 0 for selection, don't clear value of submit buttons
- *
- * @param {string} selection selection for jQuery (e.g. "input.powermail")
- * @return void
- */
-function clearValue(selection) {
-       if ($(selection).prop('type') == 'radio' || $(selection).prop('type') == 'checkbox') {
-               $(selection).prop('checked', false);
-       } else {
-               $(selection).not(':submit').val('');
-       }
-}
-
-/**
- * Read BaseUrl
- *
- * @return {string} BaseUrl from Tag in DOM
- */
-function getBaseUrl() {
-       var base = $('base').prop('href');
-       if (!base || base == undefined) {
-               base = '';
-       }
-       return base;
-}
-
-/**
- * Clear session of a uid
- *
- * @param {integer} uid of the element
- * @return void
- */
-function clearSession(uid) {
-       var url = base + '/index.php';
-       var timestamp = Number(new Date()); // timestamp is needed for a internet explorer workarround (always change a parameter)
-       var params = 'eID=' + 'powermailcond_saveToSession' + '&tx_powermailcond_pi1[form]=' + getFormUid() + '&tx_powermailcond_pi1[uid]=' + uid + '&tx_powermailcond_pi1[value]=&ts=' + timestamp;
-
-       $.ajax({
-               type: 'GET', // type
-               url: url, // send to this url
-               data: params, // add params
-               cache: false, // disable cache (for ie)
-               async: false,
-               success: function(data) { // return values
-                       if (data != '') { // if there is a response
-                               $('form.powermail_form').append('Error in powermail_cond.js in clearSession function:' + data);
-                       }
-                       checkConditions(uid); // check if something should be changed
-               }
-       });
-}
-
-/**
- * Clear session values if form is submitted
- *
- * @return void
- */
-function clearFullSession() {
-       if ($('.powermail_create').length || $('.powermail_frontend').length) { // if submitted Pi1 OR any Pi2
-               var url = base + '/index.php?eID=powermailcond_clearSession';
-               $.ajax({
-                       url: url, // send to this url
-                       cache: false,
-                       async: false
-               });
-       }
-}
-
-/**
- * Read Form uid from DOM
- *
- * @return {int} Form uid
- */
-function getFormUid() {
-       var formField = $('input[name="tx_powermail_pi1[mail][form]"]');
-       if (formField.length === 0) {
-               return 0;
-       }
-       return formField.val();
-}
-
-/**
- * Check if Parsley is activated
- *
- * @return bool
- */
-function isParsleyValidationActivated() {
-       if ($('form.powermail_form_'+ getFormUid()).data('parsley-validate') === 'data-parsley-validate') {
-               return true;
-       }
-       return false;
-}
-
-/**
- * Check if HTML5 Validation is activated
- *
- * @return bool
- */
-function isHtml5ValidationActivated() {
-       if ($('form.powermail_form_'+ getFormUid()).data('validate') === 'html5') {
-               return true;
-       }
-       return false;
-}
\ No newline at end of file
diff --git a/doc/manual.sxw b/doc/manual.sxw
deleted file mode 100644 (file)
index a189d87..0000000
Binary files a/doc/manual.sxw and /dev/null differ
index f074459..8bd3170 100644 (file)
 
 $EM_CONF[$_EXTKEY] = array(
        'title' => 'Powermail Conditions',
-       'description' => 'Add conditions via AJAX to powermail 2.1 forms (for fields and pages).',
+       'description' => 'Add conditions (via AJAX) to powermail (2.9 or newer) forms for fields and pages',
        'category' => 'plugin',
        'shy' => 0,
-       'version' => '2.2.0',
+       'version' => '3.0.0',
        'dependencies' => 'powermail',
        'conflicts' => '',
        'priority' => '',
@@ -25,7 +25,7 @@ $EM_CONF[$_EXTKEY] = array(
        'uploadfolder' => 0,
        'createDirs' => '',
        'modify_tables' => '',
-       'clearcacheonload' => 0,
+       'clearcacheonload' => 1,
        'lockType' => '',
        'author' => 'Alex Kellner',
        'author_email' => 'alexander.kellner@in2code.de',
@@ -34,7 +34,7 @@ $EM_CONF[$_EXTKEY] = array(
        'CGLcompliance_note' => '',
        'constraints' => array(
                'depends' => array(
-                       'powermail' => '2.1.0-2.2.99',
+                       'powermail' => '2.9.0-2.99.99',
                        'extbase' => '6.2.0-7.99.99',
                        'fluid' => '6.2.0-7.99.99',
                        'typo3' => '6.2.0-7.99.99',
@@ -44,7 +44,5 @@ $EM_CONF[$_EXTKEY] = array(
                'suggests' => array(
                ),
        ),
-       '_md5_values_when_last_written' => 'a:21:{s:12:"ext_icon.gif";s:4:"014a";s:17:"ext_localconf.php";s:4:"82ca";s:14:"ext_tables.php";s:4:"7580";s:14:"ext_tables.sql";s:4:"1691";s:23:"Classes/Utility/Div.php";s:4:"bf92";s:35:"Classes/Utility/EidClearSession.php";s:4:"d4b5";s:35:"Classes/Utility/EidGetFieldlist.php";s:4:"c60a";s:34:"Classes/Utility/EidReadSession.php";s:4:"e2e5";s:36:"Classes/Utility/EidSaveInSession.php";s:4:"507b";s:39:"Classes/Utility/FieldlistingBackend.php";s:4:"98aa";s:31:"Configuration/TCA/Condition.php";s:4:"c5cf";s:26:"Configuration/TCA/Rule.php";s:4:"ce4b";s:34:"Configuration/TypoScript/setup.txt";s:4:"8313";s:84:"Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_condition.xml";s:4:"d97c";s:79:"Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_rule.xml";s:4:"bb3b";s:43:"Resources/Private/Language/locallang_db.xml";s:4:"2461";s:38:"Resources/Public/Css/PowermailCond.css";s:4:"c51b";s:59:"Resources/Public/Icons/icon_tx_powermailcond_conditions.gif";s:4:"bd1e";s:54:"Resources/Public/Icons/icon_tx_powermailcond_rules.gif";s:4:"a2f9";s:36:"Resources/Public/Js/PowermailCond.js";s:4:"d612";s:14:"doc/manual.sxw";s:4:"f97a";}',
-       'suggests' => array(
-       ),
+       '_md5_values_when_last_written' => '',
 );
\ No newline at end of file
index bd5bb49..15713f2 100644 (file)
@@ -3,48 +3,16 @@ if (!defined ('TYPO3_MODE')) {
        die ('Access denied.');
 }
 
-// Show Tables in Page View
-$TYPO3_CONF_VARS['EXTCONF']['cms']['db_layout']['addTables']['tx_powermailcond_domain_model_condition'][0] = array(
-       'fList' => 'title',
-       'icon' => TRUE,
-);
-
-
 /**
- * eID Scripts
+ * Include Plugins
  */
-// eID for telling jQuery which values are allowed and which not (via AJAX)
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_getFieldStatus'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/GetFieldlistEid.php';
-
-// eID for storing values in the session (via AJAX)
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_saveToSession'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/SaveInSessionEid.php';
-
-// eID for reading existing values from session (via AJAX)
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_readSession'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/ReadSessionEid.php';
-
-// eID to clean session to a form completely (via AJAX)
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_clearSession'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/ClearSessionEid.php';
-
-// eID to save a field in a separate session to set to be non-mandatory
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_deRequiredField'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/DeRequiredFieldEid.php';
-
-// eID to save some fields in a separate session to set to be non-mandatory
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_deRequiredFields'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/DeRequiredFieldsEid.php';
-
-// eID to remove a field from session to select a field to be mandatory again
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_requiredField'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/RequiredFieldEid.php';
-
-// eID to read all session values for debugging (only if logged in into Backend)
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_debugSession'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/DebugSessionEid.php';
-
-// eID to clean the deRequired Fields session
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_requiredFields'] =
-       'EXT:powermail_cond/Classes/Utility/Eid/RequiredFieldsEid.php';
\ No newline at end of file
+\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
+       'In2code.' . $_EXTKEY,
+       'Pi1',
+       array(
+               'Condition' => 'buildCondition'
+       ),
+       array(
+               'Condition' => 'buildCondition'
+       )
+);
\ No newline at end of file
index 9450523..66f735f 100644 (file)
@@ -3,71 +3,11 @@ if (!defined ('TYPO3_MODE')) {
        die ('Access denied.');
 }
 
-// Fieldlisting in Backend
-if (TYPO3_MODE == 'BE') {
-       require_once(
-               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('powermail_cond') . 'Classes/Utility/Tca/FieldlistingBackend.php'
-       );
-}
-
-// Add TypoScript Static Template
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript/', 'Main TypoScript');
-
-// Configuration for Conditions
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
-       'tx_powermailcond_domain_model_condition',
-       'EXT:powermail_cond/Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_condition.xml'
-);
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_powermailcond_domain_model_condition');
-$TCA['tx_powermailcond_domain_model_condition'] = array (
-       'ctrl' => array (
-               'title'     => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_conditions',
-               'label'     => 'title',
-               'tstamp'    => 'tstamp',
-               'crdate'    => 'crdate',
-               'cruser_id' => 'cruser_id',
-               'languageField'            => 'sys_language_uid',
-               'transOrigPointerField'    => 'l18n_parent',
-               'transOrigDiffSourceField' => 'l18n_diffsource',
-               'sortby' => 'sorting',
-               'delete' => 'deleted',
-               'enablecolumns' => array (
-                       'disabled' => 'hidden',
-                       'starttime' => 'starttime',
-                       'endtime' => 'endtime'
-               ),
-               'requestUpdate' => 'actions,form',
-               'dynamicConfigFile' =>
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Condition.php',
-               'iconfile' =>
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) .
-                       '/Resources/Public/Icons/icon_tx_powermailcond_conditions.gif'
-       ),
-);
-
-// Configuration for Rules
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
-       'tx_powermailcond_domain_model_rule',
-       'EXT:powermail_cond/Resources/Private/Language/locallang_csh_tx_powermailcond_domain_model_rule.xml'
-);
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_powermailcond_domain_model_rule');
-$TCA['tx_powermailcond_domain_model_rule'] = array (
-       'ctrl' => array (
-               'title'     => 'LLL:EXT:powermail_cond/Resources/Private/Language/locallang_db.xml:tx_powermailcond_rules',
-               'label'     => 'title',
-               'tstamp'    => 'tstamp',
-               'crdate'    => 'crdate',
-               'cruser_id' => 'cruser_id',
-               'sortby' => 'sorting',
-               'delete' => 'deleted',
-               'enablecolumns' => array (
-                       'disabled' => 'hidden'
-               ),
-               'requestUpdate' => 'ops',
-               'dynamicConfigFile' =>
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/Rule.php',
-               'iconfile' =>
-                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) .
-                       '/Resources/Public/Icons/icon_tx_powermailcond_rules.gif'
-       ),
+/**
+ * Add TypoScript Static Template
+ */
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
+       'powermail_cond',
+       'Configuration/TypoScript/',
+       'Main TypoScript'
 );
\ No newline at end of file
index f141e96..e60ad68 100644 (file)
@@ -19,9 +19,8 @@ CREATE TABLE tx_powermailcond_domain_model_condition (
        rules int(11) DEFAULT '0' NOT NULL,\r
 \r
        title tinytext NOT NULL,\r
-       targetField tinytext NOT NULL,\r
+       target_field tinytext NOT NULL,\r
        actions tinytext NOT NULL,\r
-       filterSelectField text NOT NULL,\r
        conjunction tinytext NOT NULL,\r
        form int(11) DEFAULT '0' NOT NULL,\r
        \r
@@ -46,10 +45,10 @@ CREATE TABLE tx_powermailcond_domain_model_rule (
        conditions int(11) DEFAULT '0' NOT NULL,\r
 \r
        title tinytext NOT NULL,\r
-       startField int(11) DEFAULT '0' NOT NULL,\r
+       start_field int(11) DEFAULT '0' NOT NULL,\r
        ops int(11) DEFAULT '0' NOT NULL,\r
-       condstring text NOT NULL,\r
-       equalField int(11) DEFAULT '0' NOT NULL,\r
+       cond_string text NOT NULL,\r
+       equal_field int(11) DEFAULT '0' NOT NULL,\r
        \r
        PRIMARY KEY (uid),\r
        KEY parent (pid)\r