Predefined Checking Functions

The following checking functions are included in Infopark CMS Fiona. You can use them as templates for your own functions.

Source: shareScriptDir/cm/serverCmds/completionCheck.tcl

Checking Image Sizes with ::check::imageSize

The ::check::imageSize function determines the current image size and delegates the checking to the specified functions sizeCheckNameN in the namespace ::check::images.

These functions are called with width, height, and all parameters from sizeCheckArgsN.


::check::imageSize contentId sizeCheckName1 sizeCheckArgs1 ...


::check::imageSize $contentId sizes {100x40 100x80}

This corresponds to the following call:

::check::images::sizes [content withId $contentId get width] [content withId $contentId get height] {100x40 100x80}

This call compares the sizes specified with the permitted values specified in the list. If the image size is not included in the list, a corresponding message is returned.

Configuration options

You can adapt the messages returned by the checking routines to your own requirements. For this, two methods are available:

  1. The message is specified statically as the last parameter:

    completionCheck {
      ::check::imageSize sizes {{100x80} "The image dimensions are not correct"}}
  2. The message is localized by means of the localization key:

    namespace eval ::check::images {
      localizer add de $illegalImageSize "Only the following image sizes are allowed: %sizes%"

Extension options

Further image checking functions can be defined analogously to the definition of sizes in the ::check::images namespace. They are then also available via the ::check::imagesSizes helper function.

Analogously to the ::check::imageSizes helper function, ::check::links can be used to check the links in the link list field specified.

This is done by calling the subfunctions for checking the link list, ::check::links::linklistCheckNameN. These functions expect the following arguments to be passed to them:

  • The name of the link list field
  • The link IDs of the link list field
  • The flat list of the other arguments specified


::check::links contentId linklistCheckName1 linklistCheckArgs1 ...


completionCheck {
  ::check::links teaserLinks min 2 max 4 targetObjClasses Teaser} {::check::links relatedLinks max 5}

This will call, in the specified order, the following checking functions for the teaserLinks field: ::check::links::min (with the additional argument 2), ::check::links::max (with the additional argument 4), and ::check::links::targetObjClasses (with the additional argument Teaser). Afterwards, the checking function is called for the relatedLinks link list field. All the messages returned by the checking functions (as lists) are collected in a list and then returned to the CM as the completion check function terminates.

The targetObjClasses checking function, for example, is actually called in the following way: ::check::links::targetObjClasses "teaserLinks" {2009 2010} "Teaser" where 2009 and 2010 are the IDs of the links contained in the link list.

Configuration and enhancement options

Infopark CMS Fiona 6.7 and later supports link list size restrictions and link destination restrictions (with respect to the file format) which can be specified directly in the field definition. You can do without calling min, max, count, and targetObjClasses if the same restrictions apply to all the formats containing the link list concerned.

The list of link checking routines can be extended analogously to ::check::imageSize. Please observe the parameter list and the return value. The functions need to be defined in the ::check::links namespace in the safe interpreter.