=head1 NAME
-CatalystX::HelpText -
+CatalystX::HelpText -
=head1 DESCRIPTION
=head1 AUTHOR
-=head1 COPYRIGHT & LICENSE
+Cinxgler Mariaca Minda,C<cinxgler at ci-info.com>
-Copyright 2009 the above author(s).
+=head1 COPYRIGHT
+
+Copyright state51.
+
+=head1 LICENSE
This sofware is free software, and is licensed under the same terms as perl itself.
--- /dev/null
+package CatalystX::HelpText::File;
+use MooseX::Types::Moose qw/Str/;
+use Moose::Autobox;
+use Carp qw/confess/;
+use namespace::autoclean;
+
+has help_files_path => (
+ is => 'ro',
+ isa => Str,
+ default => '/support/help/',
+);
+
+has help_files_ext => (
+ is => 'ro',
+ isa => Str,
+ default => '.html',
+);
+
+sub get_help_text_for {
+ my ($self, $c, $help_key) = @_;
+ confess ('No $c provided') unless $c;
+ confess ('No $help_key provided') unless $help_key;
+
+ my $file_path = $c->path_to('root', $self->help_files_path.$help_key.$self->help_files_ext);
+ my $string = '';
+ my $source = $self->source_help_url.$help_key;
+ if ( -e $file_path ) {
+ local $/=undef;
+ open FILE, $file_path or confess "Couldn't open file: $!";
+ $string = <FILE>;
+ close FILE;
+ }
+
+ return $string;
+}
+
+1;
--- /dev/null
+package CatalystX::HelpText::Role::HelpText;
+use Moose::Role;
+use Try::Tiny;
+
+sub help_text {
+ my ($self, $c, $key) = @_;
+ try {
+ return $c->model('Help')->get_help_text_for($c, $key);
+ }
+ catch {
+ $c->log->warn("Error retrieving help_text: ".$_);
+ return '';
+ };
+}
+
+1;
\ No newline at end of file