The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojito - A Web Document System

SYNOPSIS

  use Mojito::Model::Config;
  my $mojito = Mojito->new(config => Mojito::Model::Config->new->config);
  my $page_id = '123456781234567812345678';
  my $rendered_page = $mojito->view_page({id => $page_id});

  # You might want to checkout one of the applications in app/
  # For example: 'plackup -Ilib app/mojito.pl' starts up a Web::Simple instance of Mojito

DESCRIPTION

Mojito is a web document system that enables individuals to easily author HTML5 compliant documents. It provides a source editor for various markup languages along with a near realtime view pane. It allows for the intermixing of different source formats.

Attributes

base_url

Base of the application used for creating internal links.

username

Authenticated (Digest Auth) user name (aka REMOTE_USER)

Methods

create_page

Create a new page and return the url to redirect to, namely the page in edit mode. We might change this to view mode if demand persuades.

preview_page

AJAX preview of a page (parse and render, save when button pressed)

update_page

Update a page given: content, id and base_url

edit_page_form

Present the form with a page ready to be edited.

view_page

Given a page id, we retrieve its page from the db and return the HTML form of the page to the browser.

view_page_public

Given a page id, we retrieve its page from the db and return the HTML form of the page to the browser. This method is much like the view_page() method is setup for public pages (ones that do not require authentication).

view_page_collected

Given a page id and a collection id we retrieve the collected page source from the db and return it as an HTML rendered page to the browser. This method is much like the view_page() method, but is setup for viewing pages in a collection with a collection navigation: next, previous, index (toc)

view_home_page

Create the view for the base of the application.

view_page_diff

View the diff of a page.

Search the documents for a single word.

collect

Collect documents. The id for each document submitted will be put into a list of document ids stored in the 'collection' collection. Yeah, that may seem strange at first, but the idea is we want to put allow for arbitrary sets of documents from the notes collection. We construct these sets by creating a list (array) of the corresponding document ids and inserting this "document" into the "collection" collection.

For example, the Beer collection document could look like:

    { 
        collection_name => 'Beer',
        documents       => [$some_doc_id, $another_doc_id, .. $last_doc_id]
        permissions     => { owner => 'rwx', group=> 'r', world => 'r' }
    }

where the doc ids are the usual mongodb auto-generated id.

Return the /collections URL to which we'll redirect.

sort_collection

Store a sorted list of pages. Return the /collections URL to which we'll redirect.

merge_collection

Given a collection id, we concatentate all its page into one.

delete_collection

Given a collection id: * Delete it from the mongo DB Return the URL to of the collections index

epub_collection

Create and .epub document from the given collection.

delete_page

Given a page id: * Delete it from the mongo DB * Remove it from the git repo Return the URL to recent (maybe home someday?)

publish_page

Publish a page - Currently this means POST to a MM instance.

feed_page

Get a feed in a particular format

bench

A path for benchmarking to get an basic idea of performance.

Current Limitations

    * single word search
    * revision history doesn't have a web interface yet

Authors

Mateu Hunter hunter@missoula.org

Copyright

Copyright 2011, Mateu Hunter

License

You may distribute this code under the same terms as Perl itself.