## @file # Prepare Lemonldap::NG::Manager response for new configurations ## @class # Prepare Lemonldap::NG::Manager response for new configurations package Lemonldap::NG::Manager::_Response; our $VERSION = '0.1'; ## @cmethod Lemonldap::NG::Manager::_Response new() # Constructor # @return Lemonldap::NG::Manager::_Response object sub new { my $class = shift; return bless { errors => [], warnings => [] }, $class; } ## @method void print(array p) # Join all stings in @p into $self->{txt} sub print { my $self = shift; $self->{txt} .= $_ foreach(@_); } ## @method void message(string title,string txt) # Build HTML part to display. # @param $title title of the message # @param $txt text of the message sub message { my $self = shift; my ($title, $txt) = @_; $self->{txt} = "
$txt
" . $self->{txt}; } ## @method private void warning(array warnings) # Store warnings in $self->{warnings} # @param @warnings array of string sub warning { my $self = shift; push @{$self->{warnings}}, @_; } ## @method private void error(array errors) # Store warnings in $self->{errors} # @param @errors array of string sub error { my $self = shift; return scalar @{$self->{errors}} unless(@_); push @{$self->{errors}}, @_; } ## @method protected void setConfiguration(hashref configuration) # Store $configuration in $self->{configuration} # @param $configuration Lemonldap::NG configuration sub setConfiguration { my $self = shift; $self->{configuration} = shift; } ## @method void send() # Display upload response. sub send { my $self = shift; my $buf; $buf = "tree.setItemText('root','Configuration $self->{configuration}');" if($self->{configuration}); if ( $self->error ) { $self->{txt} .= "