From 2349fcfd0770537cea0214ac5297fc972d44534f Mon Sep 17 00:00:00 2001 From: Alex Kellner Date: Wed, 10 Sep 2014 13:13:40 +0200 Subject: [PATCH] Initial Commit --- .gitignore | 12 +++ Classes/Controller/FormController.php | 24 ++++++ Classes/Domain/Model/Field.php | 53 +++++++++++++ Classes/Domain/Model/Form.php | 31 ++++++++ Classes/Domain/Model/Page.php | 31 ++++++++ Classes/Domain/Repository/FormRepository.php | 8 ++ Classes/Domain/Validator/ZipValidator.php | 22 ++++++ Configuration/TypoScript/setup.txt | 79 +++++++++++++++++++ Resources/Private/Partials/Form/Input.html | 34 ++++++++ Resources/Private/Partials/Form/New.html | 3 + Resources/Public/JavaScripts/ZipValidation.js | 12 +++ ext_emconf.php | 44 +++++++++++ ext_localconf.php | 10 +++ ext_tables.php | 43 ++++++++++ ext_tables.sql | 7 ++ 15 files changed, 413 insertions(+) create mode 100644 .gitignore create mode 100755 Classes/Controller/FormController.php create mode 100644 Classes/Domain/Model/Field.php create mode 100644 Classes/Domain/Model/Form.php create mode 100644 Classes/Domain/Model/Page.php create mode 100644 Classes/Domain/Repository/FormRepository.php create mode 100755 Classes/Domain/Validator/ZipValidator.php create mode 100644 Configuration/TypoScript/setup.txt create mode 100644 Resources/Private/Partials/Form/Input.html create mode 100755 Resources/Private/Partials/Form/New.html create mode 100755 Resources/Public/JavaScripts/ZipValidation.js create mode 100755 ext_emconf.php create mode 100755 ext_localconf.php create mode 100644 ext_tables.php create mode 100644 ext_tables.sql diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d9911e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +msi.iws +.idea/ +nbproject/ +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +.svn +.sass-cache diff --git a/Classes/Controller/FormController.php b/Classes/Controller/FormController.php new file mode 100755 index 0000000..5a97d31 --- /dev/null +++ b/Classes/Controller/FormController.php @@ -0,0 +1,24 @@ +getAnswers() as $answer) { + if ($answer->getValue() === 'alex') { + $answer->setValue('alexander'); + } + } + } +} \ No newline at end of file diff --git a/Classes/Domain/Model/Field.php b/Classes/Domain/Model/Field.php new file mode 100644 index 0000000..8ede7a9 --- /dev/null +++ b/Classes/Domain/Model/Field.php @@ -0,0 +1,53 @@ +txPowermailextendedPowermailReadonly = $txPowermailextendedPowermailReadonly; + } + + /** + * @return string + */ + public function getTxPowermailextendedPowermailReadonly() { + return $this->txPowermailextendedPowermailReadonly; + } + + /** + * @param string $txPowermailextendedPowermailText + * @return void + */ + public function setTxPowermailextendedPowermailText($txPowermailextendedPowermailText) { + $this->txPowermailextendedPowermailText = $txPowermailextendedPowermailText; + } + + /** + * @return string + */ + public function getTxPowermailextendedPowermailText() { + return $this->txPowermailextendedPowermailText; + } +} \ No newline at end of file diff --git a/Classes/Domain/Model/Form.php b/Classes/Domain/Model/Form.php new file mode 100644 index 0000000..603cbe2 --- /dev/null +++ b/Classes/Domain/Model/Form.php @@ -0,0 +1,31 @@ + + */ + protected $pages; + + /** + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $pages + * @return void + */ + public function setPages($pages) { + $this->pages = $pages; + } + + /** + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage + */ + public function getPages() { + return $this->pages; + } +} \ No newline at end of file diff --git a/Classes/Domain/Model/Page.php b/Classes/Domain/Model/Page.php new file mode 100644 index 0000000..10fd8b2 --- /dev/null +++ b/Classes/Domain/Model/Page.php @@ -0,0 +1,31 @@ + + */ + protected $fields = NULL; + + /** + * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $fields + * @return void + */ + public function setFields($fields) { + $this->fields = $fields; + } + + /** + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage + */ + public function getFields() { + return $this->fields; + } +} \ No newline at end of file diff --git a/Classes/Domain/Repository/FormRepository.php b/Classes/Domain/Repository/FormRepository.php new file mode 100644 index 0000000..fc3838c --- /dev/null +++ b/Classes/Domain/Repository/FormRepository.php @@ -0,0 +1,8 @@ += $validationConfiguration) { + return TRUE; + } + return FALSE; + } +} \ No newline at end of file diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.txt new file mode 100644 index 0000000..bd4dba4 --- /dev/null +++ b/Configuration/TypoScript/setup.txt @@ -0,0 +1,79 @@ +# Add new Field +plugin.tx_powermail { + view { + templateRootPath > + templateRootPaths { + 10 = EXT:powermail/Resources/Private/Templates/ + } + partialRootPath > + partialRootPaths { + 10 = EXT:powermail/Resources/Private/Partials/ + 20 = EXT:powermailextended/Resources/Private/Partials/ + } + layoutRootPath > + layoutRootPaths { + 10 = EXT:powermail/Resources/Private/Layouts/ + } + } +} + + +# Add new Validation +plugin.tx_powermail { + settings.setup { + validation { + native = 1 + client = 1 + server = 1 + customValidation { + 100 = \In2code\Powermailextended\Domain\Validator\ZipValidator + } + } + } + _LOCAL_LANG.default.validationerror_validation.100 = Please add a ZIP with 8 begginning + _LOCAL_LANG.de.validationerror_validation.100 = Bitte eine bayerische PLZ eintragen +} + +page.includeJSFooter.powermailextended = EXT:powermailextended/Resources/Public/JavaScripts/ZipValidation.js + + +# Add new Field Properties +config.tx_extbase{ + persistence{ + classes{ + In2code\Powermail\Domain\Model\Form { + subclasses { + 0 = In2code\Powermailextended\Domain\Model\Form + } + } + In2code\Powermail\Domain\Model\Page { + subclasses { + 0 = In2code\Powermailextended\Domain\Model\Page + } + } + In2code\Powermail\Domain\Model\Field { + subclasses { + 0 = In2code\Powermailextended\Domain\Model\Field + } + } + In2code\Powermailextended\Domain\Model\Form { + mapping { + tableName = tx_powermail_domain_model_forms + } + } + In2code\Powermailextended\Domain\Model\Page { + mapping { + tableName = tx_powermail_domain_model_pages + } + } + In2code\Powermailextended\Domain\Model\Field { + mapping { + tableName = tx_powermail_domain_model_fields + } + } + } + } + objects { + In2code\Powermail\Domain\Repository\FormRepository.className = In2code\Powermailextended\Domain\Repository\FormRepository + } +} \ No newline at end of file diff --git a/Resources/Private/Partials/Form/Input.html b/Resources/Private/Partials/Form/Input.html new file mode 100644 index 0000000..285d035 --- /dev/null +++ b/Resources/Private/Partials/Form/Input.html @@ -0,0 +1,34 @@ +{namespace vh=In2code\Powermail\ViewHelpers} + +
+

+ {field.txPowermailextendedPowermailText} +

+ + + + + + + + + + +
\ No newline at end of file diff --git a/Resources/Private/Partials/Form/New.html b/Resources/Private/Partials/Form/New.html new file mode 100755 index 0000000..2118918 --- /dev/null +++ b/Resources/Private/Partials/Form/New.html @@ -0,0 +1,3 @@ +
+

This is a complete new Field

+
diff --git a/Resources/Public/JavaScripts/ZipValidation.js b/Resources/Public/JavaScripts/ZipValidation.js new file mode 100755 index 0000000..adda276 --- /dev/null +++ b/Resources/Public/JavaScripts/ZipValidation.js @@ -0,0 +1,12 @@ +/** + * + */ + +window.ParsleyValidator + .addValidator('custom100', function (value, requirement) { + if (value >= 80000) { + return true; + } + return false; + }, 32) + .addMessage('en', 'custom100', 'Error'); \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php new file mode 100755 index 0000000..fc4e80a --- /dev/null +++ b/ext_emconf.php @@ -0,0 +1,44 @@ + 'powermailextended', + 'description' => 'Sample Extension to extend powermail 2.1: Add new validators, Add new Fieldtypes or Add new Field Properties', + 'category' => 'plugin', + 'shy' => 0, + 'version' => '2.1.0', + 'dependencies' => '', + 'conflicts' => '', + 'priority' => '', + 'loadOrder' => '', + 'module' => '', + 'state' => 'beta', + 'uploadfolder' => 0, + 'createDirs' => 'uploads/tx_powermail', + 'modify_tables' => '', + 'clearcacheonload' => 0, + 'lockType' => '', + 'author' => 'Powermail dev team', + 'author_email' => 'alexander.kellner@in2code.de', + 'author_company' => 'in2code.de', + 'CGLcompliance' => '', + 'CGLcompliance_note' => '', + 'constraints' => array( + 'depends' => array( + 'typo3' => '6.2.0-6.2.99', + 'powermail' => '2.1.0-2.1.99', + ), + 'conflicts' => array(), + 'suggests' => array(), + ), + '_md5_values_when_last_written' => '', +); \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php new file mode 100755 index 0000000..a549ba7 --- /dev/null +++ b/ext_localconf.php @@ -0,0 +1,10 @@ +connect( +// 'In2code\Powermail\Controller\FormController', +// 'createActionBeforeRenderView', +// 'In2code\Powermailextended\Controller\FormController', +// 'manipulateMailObjectOnCreate', +// FALSE +//); \ No newline at end of file diff --git a/ext_tables.php b/ext_tables.php new file mode 100644 index 0000000..494acf4 --- /dev/null +++ b/ext_tables.php @@ -0,0 +1,43 @@ + array( + 'exclude' => 1, + 'label' => 'Text before field', + 'config' => array ( + 'type' => 'text', + 'cols' => '32', + 'rows' => '2' + ) + ), + 'tx_powermailextended_powermail_readonly' => array( + 'exclude' => 1, + 'label' => 'Readonly', + 'config' => array ( + 'type' => 'check' + ) + ), +); +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( + 'tx_powermail_domain_model_fields', + $tempColumns, + 1 +); +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'tx_powermail_domain_model_fields', + '--div--;Powermailextended, tx_powermailextended_powermail_text, tx_powermailextended_powermail_readonly', + '', + 'after:own_marker_select' +); \ No newline at end of file diff --git a/ext_tables.sql b/ext_tables.sql new file mode 100644 index 0000000..82df6f9 --- /dev/null +++ b/ext_tables.sql @@ -0,0 +1,7 @@ +# +# Table structure for table 'tx_powermail_domain_model_fields' +# +CREATE TABLE tx_powermail_domain_model_fields ( + tx_powermailextended_powermail_text varchar(255) DEFAULT '' NOT NULL, + tx_powermailextended_powermail_readonly tinyint(4) unsigned DEFAULT '0' NOT NULL +); \ No newline at end of file