New feature: disclaimers
[ Feature description ]
Disclaimers objects are a way to to quickly add on workspaces generic
disclaimers messages, for example for legal, medical or financial
information.
[ Workspace configuration change ]
A new property 'disclaimers', array of strings is added
to workspace configuration objects.
[ New class: Disclaimer ]
Represents a disclaimer.
To use them:
$disclaimer = Disclaimer:get("legal");
It will read content/disclaimers/legal.txt (or localized
files, see below for TextFileMessage description), assign
the first line as title, the rest as content.
By convention, the first line of the disclaimer data
content is the title (except where there is only one
line; in this case, the code is the title.
[ New I18n class: TextFileMessage ]
Provides a way to store messages in text localized files.
Usage:
$message = new TextMessage('somefolder', 'quux');
This will read:
- whether somefolder/quux.txt
- whether somefolder/quux-fr.txt, somefolder/quux-en.txt, etc.
The class derives of Message, so the object created behaves as
described in commit 026cff193745aa7acc1e9960efb9596cc47eef3f.
So echo (string)$message will gives the localized output, in the
current user language or a fallback.
This is used for disclaimer text files, pending the implementation
of the system of JSON document collections and storage.
[ Other core libraries changes ]
Adding to core global functions get_filename ($file) to return
the filename without the extension.
[ Controllers changes ]
Workspace homepage will send to the view an array of the
disclaimers, if present.
[ View change ]
home_workspace.tpl will print at the bottom of the screen
the disclaimers.
[ L10n change ]
The following variables have been added to langauge files:
- Disclaimers
- NoSuchDisclaimer