In legacy mode, many standard functions are supported. This article covers features often used on websites.
With CMS Fiona, the validity period of objects can be limited. The validFrom
attribute lets you release an object at a later point in time, and the validUntil
attribute allows you to limit the release period.
These two standard attributes are mapped to the valid_from
and valid_until
attributes of the Date type. To have them available in all formats, it is recommendable to define these attributes in the Obj
class. In legacy
mode, this needs to be done using an in_place
block:
class Obj < RailsConnector::BasicObj
in_place do
attribute :valid_from, :date
attribute :valid_until, :date
end
end
The values of these attributes can be edited as usual. Since the validity period concept does not exist in Scrivito, not yet or no longer released objects are handled differently: they are simply not delivered via the published
workspace if they are not temporally valid. Requesting such an object causes a Not found message to be displayed.
There is another way to suppress the release of an object, the suppressExport
attribute. Its value can be '0'
or '1'
; if it's '1'
, the object is considered expired.
This attribute should be defined like this:
class Obj < RailsConnector::BasicObj
in_place do
attribute :suppress_export, :enum, values: ['0', '1']
end
end
Even though not yet or no longer released content is not visible to the Scrivito SDK, it can still be obtained by means of the Fiona Connector. Since this behavior is error-prone, the validity of the objects fetched using the Fiona Connector should always be checked with exportable?
.
For better performance, the completion checks that were implemented as TCL callbacks are not executed along with each page request, but only as pages are released.
If required, this behavior can be changed. On this occasion, the completion checks could also be implemented in Ruby instead of TCL. The API for this is the standard Rails API for Validation:
class Obj < RailsConnector::BasicObj
validate :tcl_completion_check_passed, on: :release
def tcl_completion_check_passed
self.__send__(:crul_obj).reasons_for_incomplete_state.each do |tcl_error_message|
errors.add(:base, tcl_error_message)
end
rescue Reactor::Cm::XmlRequestError
end
end
The code above also causes the error messages produced by completion checks to be displayed in the user interface.
The Channels available in CMS Fiona can be used in Fiona 7, too. However, there are a couple of points you should be aware of.
The read page remains as it is, i.e. the RailsConnector::News
class of the Fiona Connector or RailsConnector::Channel
of the Reactor gem is used for fetching. Channels still include released objects only.
To be able to set channels via the user interface, please add the channels
attribute to Obj
:
class Obj < RailsConnector::BasicObj
in_place do
attribute :channels, :multienum, values: RailsConnector::Channel.all.map(&:channel_name)
end
end
After changing the list of available channels, the application needs to be restarted because the selectable channels
are retrieved only once as the application is launched.