Skip to content

Commit

Permalink
updates for new core releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Dec 16, 2017
1 parent 72b96c0 commit d04c910
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ class FormHandler {
new ArrayType().generate(it, fsa)
new ArrayFieldTransformer().generate(it, fsa)
}
if (hasColourFields && !targets('2.0-dev')) {
if (hasColourFields && !targets('2.0')) {
new ColourType().generate(it, fsa)
}
if (hasTelephoneFields && !targets('2.0-dev')) {
if (hasTelephoneFields && !targets('2.0')) {
new TelType().generate(it, fsa)
}
if (hasUploads) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class ServiceDefinitions {
- { name: form.type }
«ENDIF»
«ENDIF»
«IF hasColourFields && !targets('2.0-dev'
«IF hasColourFields && !targets('2.0'

«modPrefix».form.type.field.colour:
class: «nsBase»Field\ColourType
Expand Down Expand Up @@ -446,7 +446,7 @@ class ServiceDefinitions {
- { name: form.type }
«ENDIF»
«ENDIF»
«IF hasTelephoneFields && !targets('2.0-dev'
«IF hasTelephoneFields && !targets('2.0'

«modPrefix».form.type.field.tel:
class: «nsBase»Field\TelType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ class BlockListType {
'multiple' => $hasMultiSelection,
'module' => '«appName»',
'entity' => ucfirst($options['object_type']) . 'Entity',
'entityCategoryClass' => '«appNamespace»\Entity\\' . ucfirst($options['object_type']) . 'CategoryEntity'«IF targets('2.0-dev') || (!targets('2.0') && targets('1.5-dev'))»,
'showRegistryLabels' => true«ENDIF»
'entityCategoryClass' => '«appNamespace»\Entity\\' . ucfirst($options['object_type']) . 'CategoryEntity',
'showRegistryLabels' => true
]);
}
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ class EditEntityType {
'multiple' => «categorisableMultiSelection.displayBool»,
'module' => '«app.appName»',
'entity' => '«name.formatForCodeCapital»Entity',
'entityCategoryClass' => '«app.appNamespace»\Entityname.formatForCodeCapital»CategoryEntity'«IF app.targets('2.0-dev') || (!app.targets('2.0') && app.targets('1.5-dev'))»,
'showRegistryLabels' => true«ENDIF»
'entityCategoryClass' => '«app.appNamespace»\Entityname.formatForCodeCapital»CategoryEntity',
'showRegistryLabels' => true
]);
}
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ class FinderType {
'multiple' => «categorisableMultiSelection.displayBool»,
'module' => '«app.appName»',
'entity' => ucfirst($options['object_type']) . 'Entity',
'entityCategoryClass' => '«app.appNamespace»\Entity\\' . ucfirst($options['object_type']) . 'CategoryEntity'«IF app.targets('2.0-dev') || (!app.targets('2.0') && app.targets('1.5-dev'))»,
'showRegistryLabels' => true«ENDIF»
'entityCategoryClass' => '«app.appNamespace»\Entity\\' . ucfirst($options['object_type']) . 'CategoryEntity',
'showRegistryLabels' => true
]);
}
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ class QuickNavigationType {
'multiple' => «categorisableMultiSelection.displayBool»,
'module' => '«app.appName»',
'entity' => ucfirst($objectType) . 'Entity',
'entityCategoryClass' => '«app.appNamespace»\Entity\\' . ucfirst($objectType) . 'CategoryEntity'«IF app.targets('2.0-dev') || (!app.targets('2.0') && app.targets('1.5-dev'))»,
'showRegistryLabels' => true«ENDIF»
'entityCategoryClass' => '«app.appNamespace»\Entity\\' . ucfirst($objectType) . 'CategoryEntity',
'showRegistryLabels' => true
]);
}
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SharedFormTypeFields {
«IF !fields.filter(ListField).filter[!multiple].empty»
use «nsSymfonyFormType»ChoiceType;
«ENDIF»
«IF !fields.filter(StringField).filter[role == StringRole.COLOUR].empty && app.targets('2.0-dev'
«IF !fields.filter(StringField).filter[role == StringRole.COLOUR].empty && app.targets('2.0'
use «nsSymfonyFormType»ColorType;
«ENDIF»
«IF !fields.filter(StringField).filter[role == StringRole.COUNTRY].empty»
Expand Down Expand Up @@ -108,7 +108,7 @@ class SharedFormTypeFields {
«ENDIF»
use «nsSymfonyFormType»ResetType;
use «nsSymfonyFormType»SubmitType;
«IF !fields.filter(StringField).filter[role == StringRole.PHONE_NUMBER].empty && app.targets('2.0-dev'
«IF !fields.filter(StringField).filter[role == StringRole.PHONE_NUMBER].empty && app.targets('2.0'
use «nsSymfonyFormType»TelType;
«ENDIF»
«IF !fields.filter(TextField).empty || (null !== dataObject && dataObject instanceof Entity && (dataObject as Entity).workflow != EntityWorkflowType.NONE
Expand Down Expand Up @@ -169,7 +169,7 @@ class SharedFormTypeFields {
«IF !fields.filter(ArrayField).empty»
use «app.appNamespace»\Form\Type\Field\ArrayType;
«ENDIF»
«IF !fields.filter(StringField).filter[role == StringRole.COLOUR].empty && !app.targets('2.0-dev'
«IF !fields.filter(StringField).filter[role == StringRole.COLOUR].empty && !app.targets('2.0'
use «app.appNamespace»\Form\Type\Field\ColourType;
«ENDIF»
«IF null !== dataObject && dataObject instanceof Entity && (dataObject as Entity).geographical»
Expand All @@ -178,7 +178,7 @@ class SharedFormTypeFields {
«IF !fields.filter(ListField).filter[multiple].empty»
use «app.appNamespace»\Form\Type\Field\MultiListType;
«ENDIF»
«IF !fields.filter(StringField).filter[role == StringRole.PHONE_NUMBER].empty && !app.targets('2.0-dev'
«IF !fields.filter(StringField).filter[role == StringRole.PHONE_NUMBER].empty && !app.targets('2.0'
use «app.appNamespace»\Form\Type\Field\TelType;
«ENDIF»
«IF null !== dataObject && dataObject instanceof Entity && (dataObject as Entity).hasTranslatableFields»
Expand Down Expand Up @@ -453,7 +453,7 @@ class SharedFormTypeFields {
messages += '''$this->__f('Note: the image must have a height of at most %max% pixels.', ['%max%' => «maxHeight»])'''
}

if (application.targets('2.0-dev')) {
if (application.targets('2.0')) {
if (minPixels > 0 && maxPixels > 0) {
if (minPixels == maxPixels) {
messages += '''$this->__f('Note: the amount of pixels must be exactly equal to %amount% pixels.', ['%amount%' => «minPixels»])'''
Expand Down Expand Up @@ -587,7 +587,7 @@ class SharedFormTypeFields {
'scale' => «scale»
'''

def private dispatch formType(StringField it) '''«IF role == StringRole.COLOUR»«IF application.targets('2.0-dev')»Color«ELSE»Colour«ENDIF»«ELSEIF role == StringRole.COUNTRY»Country«ELSEIF role == StringRole.CURRENCY»Currency«ELSEIF role == StringRole.LANGUAGE»Language«ELSEIF role == StringRole.LOCALE»Locale«ELSEIF role == StringRole.PASSWORD»Password«ELSEIF role == StringRole.DATE_INTERVAL && application.targets('2.0')»DateInterval«ELSEIF role == StringRole.PHONE_NUMBER»Tel«ELSEIF role == StringRole.TIME_ZONE»Timezone«ELSE»Text«ENDIF»'''
def private dispatch formType(StringField it) '''«IF role == StringRole.COLOUR»«IF application.targets('2.0')»Color«ELSE»Colour«ENDIF»«ELSEIF role == StringRole.COUNTRY»Country«ELSEIF role == StringRole.CURRENCY»Currency«ELSEIF role == StringRole.LANGUAGE»Language«ELSEIF role == StringRole.LOCALE»Locale«ELSEIF role == StringRole.PASSWORD»Password«ELSEIF role == StringRole.DATE_INTERVAL && application.targets('2.0')»DateInterval«ELSEIF role == StringRole.PHONE_NUMBER»Tel«ELSEIF role == StringRole.TIME_ZONE»Timezone«ELSE»Text«ENDIF»'''
def private dispatch titleAttribute(StringField it) '''«IF role == StringRole.COLOUR || role == StringRole.COUNTRY || role == StringRole.CURRENCY || (role == StringRole.DATE_INTERVAL && application.targets('2.0')) || role == StringRole.LANGUAGE || role == StringRole.LOCALE || role == StringRole.TIME_ZONE»Choose the «name.formatForDisplay»«ELSE»Enter the «name.formatForDisplay»«ENDIF»«IF null !== entity» of the «entity.name.formatForDisplay»«ENDIF»'''
def private dispatch additionalAttributes(StringField it) '''
'maxlength' => «length»,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ColourType {
FileHelper fh = new FileHelper

def generate(Application it, IFileSystemAccess fsa) {
if (targets('2.0-dev')) {
if (targets('2.0')) {
return
}
generateClassPair(fsa, 'Form/Type/Field/ColourType.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TelType {
FileHelper fh = new FileHelper

def generate(Application it, IFileSystemAccess fsa) {
if (targets('2.0-dev')) {
if (targets('2.0')) {
return
}
generateClassPair(fsa, 'Form/Type/Field/TelType.php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ class ControllerHelper {
$url = 'javascript:void(0);';
$subscriberUrl = $assignment->getSubscriberUrl();
if (null !== $subscriberUrl && !empty($subscriberUrl)) {
«IF targets('2.0') || targets('2.0-dev')»
«IF targets('2.0'
$url = $this->router->generate($subscriberUrl['route'], $subscriberUrl['args']);
«ELSE»
if (!isset($subscriberUrl['route'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ class WorkflowEvents {
'workflow.transition' => ['onTransition', 5],
'workflow.enter' => ['onEnter', 5IF targets('2.0')»,«ENDIF»
«IF targets('2.0'
«IF targets('2.0-dev'
'workflow.completed' => ['onCompleted', 5]
«ENDIF»
'workflow.completed' => ['onCompleted', 5],
'workflow.announce' => ['onAnnounce', 5]
«ENDIF»
];
Expand Down Expand Up @@ -265,7 +263,7 @@ class WorkflowEvents {
}
«ENDIF»
}
«IF targets('2.0-dev'
«IF targets('2.0'
/**
* Listener for the `workflow.completed` event.
Expand All @@ -288,8 +286,6 @@ class WorkflowEvents {
return;
}
}
«ENDIF»
«IF targets('2.0'
/**
* Listener for the `workflow.announce` event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ValidationConstraints {
def dispatch fieldAnnotations(UrlField it) '''
«fieldAnnotationsString»
«' '»* @Assert\Length(min="«minLength»", max="«length»")
«' '»* @Assert\Url(checkDNS=«IF application.targets('2.0-dev') && checkDNS»'ANY'«ELSE»«checkDNS.displayBool»«ENDIF»«IF checkDNS», dnsMessage = "The host '{{ value }}' could not be resolved."«ENDIF»«/* , protocols={"http", "https"} */»)
«' '»* @Assert\Url(checkDNS=«IF application.targets('2.0') && checkDNS»'ANY'«ELSE»«checkDNS.displayBool»«ENDIF»«IF checkDNS», dnsMessage = "The host '{{ value }}' could not be resolved."«ENDIF»«/* , protocols={"http", "https"} */»)
'''
def dispatch fieldAnnotations(UploadField it) '''
«fieldAnnotationsString»
Expand Down Expand Up @@ -235,7 +235,7 @@ class ValidationConstraints {
if (maxHeight > 0) {
constraints += '''maxHeight = «maxHeight»'''
}
if (application.targets('2.0-dev')) {
if (application.targets('2.0')) {
if (minPixels > 0) {
constraints += '''minPixels = «minPixels»'''
}
Expand Down Expand Up @@ -292,7 +292,7 @@ class ValidationConstraints {
«' '»* @Assert\GreaterThan("now")
«ENDIF»
«IF endDate»
«IF mandatory && application.targets('2.0-dev')»
«IF mandatory && application.targets('2.0')»
«IF null !== entity && entity.hasStartDateField»
«' '»* @Assert\GreaterThan(propertyPath="«entity.getStartDateField.name.formatForCode»")
«ELSEIF null !== varContainer && varContainer.hasStartDateField»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class TechStructureFields {
}
else if (minHeight > 0) result += 'Die Höhe von Bildern darf nicht niedriger als ' + minHeight + ' Pixel sein.'
else if (maxHeight > 0) result += 'Die Höhe von Bildern darf nicht höher als ' + maxHeight + ' Pixel sein.'
if (application.targets('2.0-dev')) {
if (application.targets('2.0')) {
if (minPixels > 0 && maxPixels > 0) {
if (minPixels == maxPixels) result += 'Die Anzahl von Pixeln muß genau ' + minPixels + ' Pixel betragen.'
else result += 'Die Anzahl von Pixeln muß zwischen ' + minPixels + ' und ' + maxPixels + ' Pixeln liegen.'
Expand Down Expand Up @@ -367,7 +367,7 @@ class TechStructureFields {
}
else if (minHeight > 0) result += 'Image height must not be lower than ' + minHeight + ' pixels.'
else if (maxHeight > 0) result += 'Image height must not be greater than ' + maxHeight + ' pixels.'
if (application.targets('2.0-dev')) {
if (application.targets('2.0')) {
if (minPixels > 0 && maxPixels > 0) {
if (minPixels == maxPixels) result += 'The amount of pixels must be exactly equal to ' + minPixels + ' pixels.'
else result += 'The amount of pixels must be between ' + minPixels + ' and ' + maxPixels + ' pixels.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ class Layout {
{%- endif -%}
{%- endblock -%}
«ENDIF»
«IF hasColourFields && !targets('2.0-dev'
«IF hasColourFields && !targets('2.0'

{%- block «appName.formatForDB»_field_colour_widget -%}
{%- set type = type|default('color') -%}
{{ block('form_widget_simple') }}
{%- endblock -%}
«ENDIF»
«IF hasTelephoneFields && !targets('2.0-dev'
«IF hasTelephoneFields && !targets('2.0'

{%- block «appName.formatForDB»_field_tel_widget -%}
{%- set type = type|default('tel') -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ class Utils {
def targetSemVer(Application it, Boolean withPoint) {
switch targetCoreVersion {
case ZK2DEV:
if (!withPoint) '2.0' else '2.0.4'
if (!withPoint) '2.0' else '2.0.5'
case ZK20:
if (!withPoint) '2.0' else '2.0.3'
if (!withPoint) '2.0' else '2.0.4'
case ZK15:
if (!withPoint) '1.5' else '1.5.3'
case ZK15DEV:
if (!withPoint) '1.5' else '1.5.4'
case ZK15DEV:
if (!withPoint) '1.5' else '1.5.5'
default:
if (!withPoint) '1.5' else '2.0.3'
if (!withPoint) '1.5' else '2.0.4'
}
}

Expand Down

0 comments on commit d04c910

Please sign in to comment.