logo





GradeBook released!
Oct, 2008
Solstice adds a grade book to its toolkit!

New Versions!
April, 2008
A new version of all our software is available!

CommonView Released
April, 2008
Check out our latest collaborative tool.

RESTful Web Services
Jan, 2008
Solstice provides support for RESTful development.

How to use MessageService

MessageService is a service for putting user notification at the top of a screen. It enables screens with many controllers to display pertinent messages without any trickle up chain. This service has a priority chain so only one 'type' of message will be displayed at a time, although multiple unique messages of the same type can be shown at the time.

Using MessageService within any View or Controller is very easy. The following code is an example of how to generate an error message.

Perl
my $message_service = $self->getMessageService(); $message_service->addErrorMessage('Bad form input.');

That's it. The message will show up on the top of the page.

One thing to note. The method getMessageService is provided only to those objects who subclass from Solstice::View and Solstice::Controller.

Message Type API

The following methods are availble:

  • addInfoMessage() - Information only.
  • addErrorMessage() - There has been an error the user needs to react to.
  • addSuccessMessage() - A user action has been successfully compelted.
  • addWarningMessage() - The user needs to know this info before continuing.
  • clearInfoMessages() - Clears out any information message placed into the service. A method exists for each of the message types (ie. clearErrorMessages())
  • clearAll() - Removes all messages from message service.

If you want to work directly with Solstice's LangService, you can do that as well.

  • addInfoKey()
  • addErrorKey()
  • addSuccessKey()
  • addWarningKey()

These allow you to specify a key that corresponds to a message in your language file. For more information on LangService, please visit this link

When showing messages, Solstice will only display one type, following this order of precedence: Error, Success, Warning, Info.