| Solstice documentation | Contained in the Solstice distribution. |
Solstice::View::FormInput::EmailList - A view of an html <textarea> element containing email addresses
# See L<Solstice::View> for usage.
A view of a form input, showing email addresses
None by default.
Educational Technology Development Group, <catalyst@u.washington.edu>
$Revision: 107 $
UMail::View, perl.
Copyright 1998-2007 Office of Learning Technologies, University of Washington
Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.opensource.org/licenses/ecl1.php
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| Solstice documentation | Contained in the Solstice distribution. |
package Solstice::View::FormInput::EmailList; # $Id: EmailList.pm 107 2005-09-01 23:14:11Z mcrawfor $
use strict; use warnings; use 5.006_000; use base qw(Solstice::View::FormInput); use Solstice::List; use Solstice::StringLibrary qw(unrender); use constant TRUE => 1; use constant FALSE => 0; our $template = 'form_input/email_list.html';
sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->_setTemplatePath('templates'); return $self; }
sub setInvalidEmails { my $self = shift; $self->{'_invalid_emails'} = shift; }
sub getInvalidEmails { my $self = shift; return $self->{'_invalid_emails'}; }
sub generateParams { my $self = shift; my $email_list = $self->getModel(); my $name = $self->getName(); $self->setParam('name', $name); if (my $error = $self->getError()) { my $error_hash = $error->getFormMessages(); for my $key (keys %$error_hash){ if ($key =~ /^err_$name$/) { $self->setParam('error', $error_hash->{$key}); #TODO: maximum number of invalid emails displayed? for my $str (@{$self->getInvalidEmails()}) { $self->addParam('invalid', { address => unrender($str) }); } last; } } } my $iterator = $email_list->iterator(); while (my $email = $iterator->next()) { $self->addParam('addresses', { address => unrender($email) }); } return TRUE; } 1; __END__