NAME

Rubric::WebApp - the web interface to Rubric

VERSION

version 0.156

SYNOPSIS

use strict;
use warnings;
use Rubric::WebApp;
Rubric::WebApp->new->run();

It's a CGI::Application!

DESCRIPTION

Rubric::WebApp provides a CGI-based interface to Rubric data. It's built on top of CGI::Application, which does most of the boring work. This module's code sets up the dispatch tables and implements the responses to various queries.

REQUESTS DISPATCH

Requests are mostly path-based, though some involve form submission. The basic dispatch table looks something like this:

setup

This method, called by CGI::Application's initialization process, sets up the dispatch table for requests, as described above.

entries

This passes off responsibility to the class named in the entries_query_class configuration option. This option defaults to Rubric::WebApp::Entries.

entry

This displays the single requested entry.

get_entry

This method gets the next part of the path, assumes it to be a Rubric::Entry id, and puts the corresponding entry in the "entry" parameter.

link

This runmode displays entries that point to a given link, identified either by URI or MD5 sum.

get_link

This method look for a uri or, failing that, url query parameter. If found, it finds a Rubric::Link for that URI and puts it in the "link" parameter.

tag_cloud

calendar

login

If the user is logged in, this request is immediately redirected to the root of the Rubric site. Otherwise, a login form is provided.

logout

This run mode unsets the "current_user" parameter in the session and the WebApp object, then redirects the user to the root of the Rubric site.

reset_password

This run mode allows a user to request that his password be reset and emailled to him.

setup_reset_code

This routine gets a reset code for the user and emails it to him.

preferences

This method displays account information for the current user. Some account settings may be changed.

update_user(\%prefs)

This method will update the current user object with the changes in %prefs, which is passed by the preferences method.

validate_prefs(\%prefs)

Given a set of preference updates from a form submission, this method validates them and returns a description of the validation results. This method will probably be redesigned (possibly with Data::FormValidator) in the future. Don't count on its interface.

newuser

If the proper form information is present, this runmode creates a new user account. If not, it presents a form.

If a user is already logged in, the user is redirected to the root of the Rubric.

validate_newuser_form(\%newuser)

Given a set of user data from a form submission, this method validates them and returns a description of the validation results. This method will probably be redesigned (possibly with Data::FormValidator) in the future. Don't count on its interface.

create_newuser(\%newuser)

This method creates a new user account from the given description. It sends the user a validation email (if needed) and displays an account creation page.

send_reset_email_to($user)

This method sends an email to the given user with a URI to reset his password.

send_verification_email_to($user)

This method sends a verification email to the given user.

verify

This runmode attempts to verify a user account. It expects a request to be in the form: /verify/username/verification_code

get_reset_code

This gets the next part of the path and puts it in the reset_code parameter.

get_verification_code

This gets the next part of the path and puts it in the verification_code parameter.

get_user

This gets the next part of the path and puts it in the user parameter.

display_entries

This method searches (with Rubric::Entry) for entries matching the requested user and tags. It pages the result (with page_entries) and renders the resulting page with render_entries.

page_entries($iterator)

Given a Class::DBI::Iterator, this method sets up parameters describing the current page. Most importantly, it retrieves an Iterator for the slice of entries representing the current page. The following parameters are set:

entries - a Class::DBI::Iterator for the current page's entries
count - the number of entries in the entire set
pages - the number of pages the set spans

render_entries

This method renders a template to display the set of entries set up by page_entries.

edit

If the user isn't logged in, it redirects to demand a login. If he is, it displays a post form, completed with the given entry's data.

post

This method wants to be simplified.

If the user isn't logged in, it redirects to demand a login. If he is, it checks whether it can create a new entry. If so, it tries to. If not, it displays a form for doing so. If the user already has an entry for the given URI, the existing entry is passed to the form renderer.

If a new entry is created, the user is redirected to his entry listing.

post_form

This method renders a form for the user to create a new entry.

delete

This method wants to be simplified. It's largely copied from post.

If the user isn't logged in, it redirects to demand a login. If he is, it checks whether the user has an entry for the given URI. If so, it's deleted.

Either way, the user is redirected to his entry listing.

doc

This runmode returns a mostly-static document from the template path.

get_doc

This gets the next part of the path and puts it in the doc_page parameter.

style

This runmode sends the named stylesheet from the CSS path.

AUTHOR

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2004 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Module Install Instructions

To install Rubric::WebApp, simply copy and paste either of the commands in to your terminal