Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Sep 10, 2014
0 parents commit 2349fcf
Show file tree
Hide file tree
Showing 15 changed files with 413 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
msi.iws
.idea/
nbproject/
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
.svn
.sass-cache
24 changes: 24 additions & 0 deletions Classes/Controller/FormController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace In2code\Powermailextended\Controller;

/**
* Using a Slot to call a Powermail Signal
*
* Class FormControllerExtended
* @package In2code\Powermailextended\Controller
*/
class FormController {

/**
* @param \In2code\Powermail\Domain\Model\Mail $mail
* @param string $hash
* @param \In2code\Powermail\Controller\FormController $pObj
*/
public function manipulateMailObjectOnCreate($mail, $hash, $pObj) {
foreach ($mail->getAnswers() as $answer) {
if ($answer->getValue() === 'alex') {
$answer->setValue('alexander');
}
}
}
}
53 changes: 53 additions & 0 deletions Classes/Domain/Model/Field.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
namespace In2code\Powermailextended\Domain\Model;

/**
* Class Field
* @package In2code\Powermailextended\Domain\Model
*/
class Field extends \In2code\Powermail\Domain\Model\Field {

/**
* New property text
*
* @var string $txPowermailextendedPowermailText
*/
protected $txPowermailextendedPowermailText;

/**
* New property readonly
*
* @var string $txPowermailextendedPowermailReadonly
*/
protected $txPowermailextendedPowermailReadonly;

/**
* @param string $txPowermailextendedPowermailReadonly
* @return void
*/
public function setTxPowermailextendedPowermailReadonly($txPowermailextendedPowermailReadonly) {
$this->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;
}
}
31 changes: 31 additions & 0 deletions Classes/Domain/Model/Form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
namespace In2code\Powermailextended\Domain\Model;

/**
* Class Form
* @package In2code\Powermailextended\Domain\Model
*/
class Form extends \In2code\Powermail\Domain\Model\Form {

/**
* pages
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\In2code\Powermailextended\Domain\Model\Page>
*/
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;
}
}
31 changes: 31 additions & 0 deletions Classes/Domain/Model/Page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
namespace In2code\Powermailextended\Domain\Model;

/**
* Class Page
* @package In2code\Powermailextended\Domain\Model
*/
class Page extends \In2code\Powermail\Domain\Model\Page {

/**
* Powermail Fields
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\In2code\Powermailextended\Domain\Model\Field>
*/
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;
}
}
8 changes: 8 additions & 0 deletions Classes/Domain/Repository/FormRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
namespace In2code\Powermailextended\Domain\Repository;

/**
* Class FormRepository
* @package In2code\Powermailextended\Domain\Repository
*/
class FormRepository extends \In2code\Powermail\Domain\Repository\FormRepository {}
22 changes: 22 additions & 0 deletions Classes/Domain/Validator/ZipValidator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace In2code\Powermailextended\Domain\Validator;

/**
* ZipValidator
*/
class ZipValidator {

/**
* Check if given number is higher than in configuration
*
* @param string $value
* @param string $validationConfiguration
* @return bool
*/
public function validate100($value, $validationConfiguration) {
if (is_numeric($value) && $value >= $validationConfiguration) {
return TRUE;
}
return FALSE;
}
}
79 changes: 79 additions & 0 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
@@ -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
}
}
34 changes: 34 additions & 0 deletions Resources/Private/Partials/Form/Input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{namespace vh=In2code\Powermail\ViewHelpers}

<div id="powermail_fieldwrap_{field.uid}" class="powermail_fieldwrap powermail_fieldwrap_input powermail_fieldwrap_{field.uid} {field.css}">
<h2>
{field.txPowermailextendedPowermailText}
</h2>
<label for="powermail_field_{field.marker}" class="powermail_label" title="{field.description}">
<vh:string.RawAndRemoveXss>{field.title}</vh:string.RawAndRemoveXss><f:if condition="{field.mandatory}"><span class="mandatory">*</span></f:if>
</label>
<f:if condition="{field.txPowermailextendedPowermailReadonly}">
<f:then>
<f:form.textfield
type="{vh:Validation.FieldTypeFromValidation(field:field)}"
property="{field.marker}"
placeholder="{field.placeholder}"
readonly="readonly"
value="{vh:Misc.PrefillField(field:field, mail:mail)}"
class="powermail_field powermail_input {vh:Validation.ErrorClass(field:field, class:'powermail_field_error')}"
additionalAttributes="{vh:Validation.ValidationDataAttribute(field:field)}"
id="powermail_field_{field.marker}" />
</f:then>
<f:else>
<f:form.textfield
type="{vh:Validation.FieldTypeFromValidation(field:field)}"
property="{field.marker}"
placeholder="{field.placeholder}"
value="{vh:Misc.PrefillField(field:field, mail:mail)}"
class="powermail_field powermail_input {vh:Validation.ErrorClass(field:field, class:'powermail_field_error')}"
additionalAttributes="{vh:Validation.ValidationDataAttribute(field:field)}"
id="powermail_field_{field.marker}" />
</f:else>
</f:if>

</div>
3 changes: 3 additions & 0 deletions Resources/Private/Partials/Form/New.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<h2>This is a complete new Field</h2>
</div>
12 changes: 12 additions & 0 deletions Resources/Public/JavaScripts/ZipValidation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* <input type="text" data-parsley-custom100="1" data-parsley-error-message="Please try again" />
*/

window.ParsleyValidator
.addValidator('custom100', function (value, requirement) {
if (value >= 80000) {
return true;
}
return false;
}, 32)
.addMessage('en', 'custom100', 'Error');
44 changes: 44 additions & 0 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/***************************************************************
* Extension Manager/Repository config file for ext "powermail".
*
* Auto generated 04-07-2013 17:03
*
* Manual updates:
* Only the data in the array - everything else is removed by next
* writing. "version" and "dependencies" must not be touched!
***************************************************************/

$EM_CONF[$_EXTKEY] = array (
'title' => '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' => '',
);
10 changes: 10 additions & 0 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
// enable SignalSlot
//$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\SignalSlot\Dispatcher');
//$signalSlotDispatcher->connect(
// 'In2code\Powermail\Controller\FormController',
// 'createActionBeforeRenderView',
// 'In2code\Powermailextended\Controller\FormController',
// 'manipulateMailObjectOnCreate',
// FALSE
//);
Loading

0 comments on commit 2349fcf

Please sign in to comment.