Migration from 1.10 to 1.11

1. Introduction

The present article describes the changes, that have to be applied to your software upgrading to release 1.11. This is necessary because the new version contains API chnages.

2. Form taglib migration

The changes concerning the new form taglibs are surely the biggest part of the migration. Here, controller and templates must be adapted to the new structure.

2.1. Controller

Within the controller classes, the API change of the html_taglib_form taglib concerning the status query must be adapted. This can be done by replacing

PHP-Code
get('isSent')
and
PHP-Code
get('isValid')
with
PHP-Code
isSent()
and
PHP-Code
isValid()
respectively.

2.2. Templates

Adapting the templates includes extraction of the validator and filter definition into separate tags. For this reason, the developer must decide, which validator should be used instead of the old one. The subsequent list contains a suggestion:

  • Text -> TextLengthValidator
  • EMail -> EMailValidator
  • Telefon -> PhoneAndFaxValidator
  • Fax -> PhoneAndFaxValidator
  • Number -> NumberValidator
  • Folder -> FolderValidator
  • Birthday -> SimpleBirthdayValidator

After that, the validator definition must be extracted from the taglib statement. Instead of the old notation

APF-Template
<form:text name="sender-address" validate="true" validator="EMail" button="send" />

you now have to add

APF-Template
<form:text name="sender-name" /> <form:addvalidator class="EMailValidator" button="send" control="sender-name" />
to you templates.
In case the form control definition contains generic tags such as style or class these must be kept in the form control definition as before. The validator tags do not create own output.

The migration of the form filter is similar. Here, the integrated filter definitions must be put into seperate filter tags. In case a text field is secured by

APF-Template
<form:text name="sender-name" button="send" filter="stripTags" />

using the stripTags filter, the taglib definition now must look like this:

APF-Template
<form:text name="sender-name" /> <form:addfilter class="StripTagsFilter" button="send" control="sender-name" />

The following list contains a suggestions for the migration of the filter classes:

  • string2Lower -> String2LowerFilter
  • string2Upper -> String2UpperFilter
  • stripTags -> StripTagsFilter
  • noSpecialCharacters -> NoSpecialCharacterFilter
  • onlyNumbers -> OnlyNumbersFilter
  • onlyInteger -> OnlyIntegersFilter
  • onlyLetters -> OnlyLettersFilter
  • onlyHTMLEntities -> OnlyHTMLEntitiesFilter

Die to the fact, that the validator group (<form:genericval >) and the generic validator tag <form:genericval /> hav been removed from the release, validation messages displayed within a dedicated boy must be implemented in some different way.

To achieve this, the <form:error /> and <form:listener /> can be used. The latter one can be instructed to display the border of the box and several listener tags display the dedicated error messages. Instead of

APF-Template
<form:valgroup name="FormValGroup"> <div class="form-error"> <img src="/img/form-error.png" alt=""/>Fehler: <ul> <li><valgroup:validate type="text" field="AbsenderName" button="KontaktSenden" msginputreq="Contact.Sender.InputRequired" /></li> <li><valgroup:validate type="text" field="AbsenderAdresse" button="KontaktSenden" msginputreq="Contact.EMail.InputRequired" msginputwrg="Contact.EMail.InputWrong" validator="EMail" /></li> <li><valgroup:validate type="text" field="Betreff" button="KontaktSenden" msginputreq="Contact.Subject.InputRequired" /></li> <li><valgroup:validate type="text" field="Text" button="KontaktSenden" msginputreq="Contact.Text.InputRequired" /></li> </ul> </div> </form:valgroup>

you may use the following tag syntax:

APF-Template
<form:error id="toperror"> <div class="form-error"> <img src="/img/form-error.png" alt=""/>Fehler: <ul> </form:error> <form:listener control="AbsenderName" id="sender-error"> <li><listener:placeholder name="content" /></li> </form:listener> <form:listener control="AbsenderAdresse" id="addr-error"> <li><listener:placeholder name="content" /></li> </form:listener> <form:listener control="Betreff" id="subject-error"> <li><listener:placeholder name="content" /></li> </form:listener> <form:listener control="Text" id="text-error"> <li><listener:placeholder name="content" /></li> </form:listener> <form:error id="bottomerror"> </ul> </div> </form:error>

3. Renamings

Just like in release 1.10, some classes were renamed to conform to the APF coding conventions. To upgrade to the new version, search&replace them as stated below:

  • xmlParser -> XmlParser
  • linkHandler -> LinkHandler
  • frontcontrollerLinkHandler -> FrontcontrollerLinkHandler

4. Configuration changes

This release also contains configuration changes to the following components:

  • Contact module: The file /config/modules/kontakt4/EXAMPLE_kontakt4.ini was added the validator messages necessary for form validation and the style directives were removed.
  • Usermanagement: Introducing the PasswordHashProvider, two new directives have been added to configure the component. Please have a look at /config/modules/usermanagement/EXAMPLE_umgtconfig.ini for a detailed example.

Comments

Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.