App-Navegante

 view release on metacpan or  search on metacpan

lib/App/Navegante/CGI.pm  view on Meta::CPAN


# check if feedback function exists
if ($nav->{'feedback'}) {
    $h .= "a({href=>_monadicend(),target=>'_blank'}, img({src=>'http://nrc.homelinux.org/navegante/imagens/nav_logo.gif',border=>'0'})),";
}
else {
    $h .= "img({src=>'http://nrc.homelinux.org/navegante/imagens/nav_logo.gif',border=>'0'}),";
}

$h .=<<'END_TOOLBAR';
    "</td>",
    "<td>",a({href=>'http://natura.di.uminho.pt/navegante/'}, img({src=>'http://nrc.homelinux.org/navegante/imagens/nav_title.gif',border=>'0'})),"</td>",
    "<td>", $Navegante->{g}() , "</td>",
END_TOOLBAR

if ( $nav->{'iform'} or $nav->{'iframe'} ) {
        $h .= "\"<td align='right'><iframe frameborder='0' scrolling='no' height='65' width='95' src='?action=iframe&x=\$U'></iframe></td>\",";
}

if ($nav->{'quit'}) {
    $h .= "\"<td align='right' style='vertical-align: top;'><a href='?action=quit'><img width='15' height='15' border='0' src='http://nrc.homelinux.org/navegante/imagens/nav_quit.gif'</a>\",";
}

$h .=<<'END_TOOLBAR';
    "</td></tr></table>",
    div( {style=>"background-image: url(http://nrc.homelinux.org/navegante/imagens/nav_line.gif); background-repeat: repeat-x; width: 100%; height: 2px;"})
)
END_TOOLBAR
    return $h;
}

=head2 createIframe

This function creates the code needed to render the application's
frame in the banner. This function is used in the constructor.

TODO

* use info defined in the DSL to render the form

=cut

sub createIframe {
    my $iform = shift;
    my $h =<<'END_IFORM';
<div style='margin-left: 0px;'>
<form> <center>
<input type='hidden' name='action' value='iframe'>
<input type='hidden' name='x' value=$U>
END_IFORM

    my @list = split /\s*,\s*/, $iform;
    @list = reverse @list;
    my %hash = ();
    foreach (@list) { 
        $_ =~ m/\s*(.*?)\s*=>\s*(.*)/;
        $hash{$1} = $2;
    }
    foreach (keys %hash) {
      if ($hash{$_} eq 'submit') {
          $h .= "<input style='font-size: 65%;' type='$hash{$_}' value='".eval($_)."'><br />";
          next;
      }
      $h .= "<input style='font-size: 65%;' type='$hash{$_}' size='10' name='$_'><br />";
    }

$h.=<<'END_IFORM';
</center></form>
</div>
END_IFORM
    return $h;
}

=head1 AUTHOR

J.Joao Almeira, C<< <jj@di.uminho.pt> >>

Alberto Simões, C<< <albie@alfarrabio.di.uminho.pt> >>

Nuno Carvalho, C<< <smash@cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-navegante-appcgi at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Navegante-AppCGI>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc App::Navegante::CGI


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Navegante-AppCGI>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Navegante-AppCGI>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Navegante-AppCGI>

=item * Search CPAN

L<http://search.cpan.org/dist/Navegante-AppCGI>

=back


=head1 ACKNOWLEDGEMENTS


=head1 COPYRIGHT & LICENSE

Copyright 2007-2012 Project Natura.



( run in 1.238 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )