Maplat

 view release on metacpan or  search on metacpan

lib/Maplat/Web/DocsSpreadSheet.pm  view on Meta::CPAN


sub ajaxget {
    my ($self, $cgi) = @_;
    my $webpath = $cgi->path_info();

    my $dbh = $self->{server}->{modules}->{$self->{db}};
    my $sesh = $self->{server}->{modules}->{$self->{session}};

    # We only need webdata to get to the username 8-)
    my %webdata = (
        $self->{server}->get_defaultwebdata(),
        );
    
    my $fileid;
    if($webpath !~ /\/([0-9]+)$/) {
        return (status  =>  404); # ups no fileid
    } else {
        $fileid = $1;
    }

    my $data;
    my $getsth = $dbh->prepare_cached("SELECT content
                                      FROM documents
                                      WHERE id = ?")
            or croak($dbh->errstr);
    if(!$getsth->execute($fileid)) {
        $dbh->rollback;
        return (status  =>  404);
    } else {
        ($data) = $getsth->fetchrow_array;
        $getsth->finish;
        $dbh->rollback;
    }

#    open(my $fh, "<", "/home/cavac/src/maplat/Maplat::Web/Static/jquery.sheet-0.53/charts.html") or croak($!);
#    $data =  join("", <$fh>);
#    close $fh;

    return (status  =>  200,
            type    => "text/html",
            data    => $data);
}

1;
__END__

=head1 NAME

Maplat::Web::DocsSpreadSheet - edit spreadsheets complete with graphs

=head1 SYNOPSIS

This module provides a full SpreadSheet, complete with graphs and charts. The module uses
the fantastic jquery.sheet() module for all visualization and editing.

Of course, full text search is available through DocsSearch.

=head1 DESCRIPTION

With the fantastic jquery plugin jQuery.sheet(), this module provides a full-fledged Spreadsheet,
complete with formulas, charts and graphs. Most of the actions are done through AJAX.

Full-text search is provided by DocsSearch.

=head1 Configuration

        <module>
                <modname>docsspreadsheet</modname>
                <pm>DocsSpreadSheet</pm>
                <options>
                        <list>
                                <pagetitle>SpreadSheet</pagetitle>
                                <webpath>/devtest/spread/list</webpath>
                        </list>
                        <ajaxget>/dev/word/get</ajaxget>
                        <ajaxpost>/dev/word/post</ajaxpost>
                        <db>maindb</db>
                        <memcache>memcache</memcache>
                        <session>sessionsettings</session>
                </options>
        </module>

=head2 edit

Webform for a single Spreadsheet.

=head2 list

"File" browser for all Spreadsheets.

=head2 ajaxget

Internal function.

=head2 ajaxpost

Internal function.

=head1 Dependencies

This module depends on the following modules beeing configured (the 'as "somename"'
means the key name in this modules configuration):

Maplat::Web::Memcache as "memcache"
Maplat::Web::PostgresDB as "db"
Maplat::Web::SessionSettings as "session"

=head1 SEE ALSO

Maplat::Web
Maplat::Web::SessionSettings
Maplat::Web::PostgresDB
Maplat::Web::Memcache
Maplat::Web::DocsSearch
Maplat::Web::DocsWordProcessor

For more information about jQuery.sheet(), visit http://jqueryplugins.weebly.com/jquerysheet.html

=head1 AUTHOR

Rene Schickbauer, E<lt>rene.schickbauer@gmail.comE<gt>



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