MojoMojo

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  New features:
  - add markdown="1" to block-level HTML elements to interpret Markdown (dandv)
  
  Translation:
  - Italian. MojoMojo ora parla italiano (enrico)
  
  Bug fixes:
  - Exports now export the entire subtree (dandv)
  - Sub pages do not show pages without view permission (linio)
  - Fixes for Pg Compability (depesz)
  - Users 'Active' field now shows users not validated yet as inactive (linio)
  - Login is now page-sensitive (marcus)
  - Changed RSS Formatter to use entry summary instead of body (marcus)
  - Fixed issue with incorrectly calculated cloud size (linio)

  Documentation:
  - improved and centralized installation docs into lib/MojoMojo/Installation.pod

  

0.999040 2009-09-04 19:53:00

MANIFEST  view on Meta::CPAN

root/base/gallery/cloud.tt
root/base/gallery/footer.tt
root/base/gallery/imginfo.tt
root/base/gallery/pager.tt
root/base/gallery/photo.tt
root/base/gallery/photo_info.tt
root/base/gallery/tags.tt
root/base/global.tt
root/base/header.tt
root/base/mail/reset_password.tt
root/base/mail/validate.tt
root/base/message.tt
root/base/mimetypes/default.tt
root/base/mimetypes/image.tt
root/base/navbar.tt
root/base/page/addtags.tt
root/base/page/atom.tt
root/base/page/attachments.tt
root/base/page/bottomnav.tt
root/base/page/delete.tt
root/base/page/deleted.tt

lib/MojoMojo/Controller/Image.pm  view on Meta::CPAN

    my $dir = $c->config->{'Formatter::Dir'}{whitelisting};

    my $io_file = IO::File->new("$dir/$filename")
        or $c->detach('file_not_found');
    $io_file->binmode;

    $c->res->output( $io_file );
    $c->res->header( 'content-type', $c->action );
    $c->res->header(
        "Content-Disposition" => "inline; filename=" . URI::Escape::uri_escape_utf8( $filename ) );
    $c->res->header( 'Cache-Control', 'max-age=86400, must-revalidate' );
}


=head1 AUTHOR

Daniel Brosseau <dab@catapulse.org>

=head1 LICENSE

This library is free software. You can redistribute it and/or modify

lib/MojoMojo/Controller/Jsrpc.pm  view on Meta::CPAN


=head2 set_permissions ( .jsrpc/set_permissions )

Sets page permissions.

=cut

sub set_permissions : Local {
    my ($self, $c) = @_;

    $c->forward('validate_perm_edit');

    my @path_elements = $c->_expand_path_elements($c->stash->{path});
    my $current_path = pop @path_elements;

    my ( $create, $read, $write, $delete, $attachment, $subpages) =
        map { $c->req->param($_) ? 'yes' : 'no' }
            qw/create read write delete attachment subpages/;

    my $role = $c->stash->{role};

lib/MojoMojo/Controller/Root.pm  view on Meta::CPAN

                        $c->uri_for(     
                                $c->stash->{path} . '.login' # send them to the login for this page
                        )
                );
        }
    }

    return 1 unless $c->stash->{user};
    return 1 if $c->stash->{user}->active != -1;
    return 1 if $c->req->action eq 'logout';
    $c->stash->{template} = 'user/validate.tt';
    return 0;
}

=head2 exit

A way to exit from MojoMojo.  Useful when testing leaks.

=cut

sub exit : Local {

lib/MojoMojo/Controller/User.pm  view on Meta::CPAN

      $c->model('DBIC::Person')
      ->search( [ { login => $login }, { email => $email } ] );

    return $person_rs->count;
}

=head2 do_register ( /.register )

New user registration processing.

B<templates:> C<user/password.tt>, C<user/validate.tt>

=cut

sub do_register : Private {
    my ( $self, $c, $user ) = @_;
    $c->forward('/user/login');
    $c->pref('entropy') || $c->pref( 'entropy', rand );
    $c->stash(
        secret => md5_hex( $user->email . $c->pref('entropy') ),
        email  => {
            from     => $c->config->{system_mail},
            to       => $user->email,
            subject  => $c->loc( '~[x~] New User Validation', $c->pref('name') ),
            template => 'validate.tt',
        },
    );
    $c->model('DBIC::Page')->create_page($user->link,
        $c->loc("# Home node for x\n\nPut whatever you like here.",$user->name),
        $user);

    $c->forward( $c->view('Email') );
    if ( scalar( @{ $c->error } ) ) {
        $c->clear_errors;
        $c->stash->{error} = $c->loc('An error occourred. Sorry.');
    }
    $c->stash->{user}     = $user;
    $c->stash->{template} = 'user/validate.tt';
}

=head2 validate ( /.validate )

Validation of user email. Will accept a md5_hex mailed to the user
earlier. Non-validated users will only be able to log out.

=cut

sub validate : Global {
    my ( $self, $c, $user, $check ) = @_;
    $user = $c->model("DBIC::Person")->find( { login => $user } );
    if ( $user and $check eq md5_hex( $user->email . $c->pref('entropy') ) ) {
        $user->update({active=>1});
        if ( $c->stash->{user} ) {
            $c->res->redirect(
                $c->uri_for( '/', $c->stash->{user}->link, '.edit' ) );
        }
        else {
            $c->flash->{message} =
              $c->loc( 'Welcome, x your email is validated. Please log in.',
                $user->name );
            return $c->res->redirect( $c->uri_for('login') );
        }
        return;
    }
    $c->stash->{template} = 'user/validate.tt';
}

=head2 reconfirm

Send the confirmation mail again to another address.

=cut

sub reconfirm : Local {
    my ( $self, $c ) = @_;

lib/MojoMojo/Formatter/TOC.pm  view on Meta::CPAN

=cut

sub assembleAnchorName {
    my ($aFile, $aGroupId, $aLevel, $aNode, $text, $children) = @_;

    if ($text !~ /^\s*$/) {
        # generate a SEO-friendly anchor right from the token content
        # The allowed character set is limited first by the URI specification for fragments, http://tools.ietf.org/html/rfc3986#section-2: characters
        # then by the limitations of the values of 'id' and 'name' attributes: http://www.w3.org/TR/REC-html40/types.html#type-name
        # Eventually, the only punctuation allowed in id values is [_.:-]
        # Unicode characters with code points > 0x7E (e.g. Chinese characters) are allowed (test "<h1 id="????">header</h1>" at http://validator.w3.org/#validate_by_input+with_options), except for smart quotes (!), see http://www.w3.org/Search/Mail/P...
        # However, that contradicts the HTML 4.01 spec: "Anchor names should be restricted to ASCII characters." - http://www.w3.org/TR/REC-html40/struct/links.html#h-12.2.1
        # ...and the [A-Za-z] class of letters mentioned at http://www.w3.org/TR/REC-html40/types.html#type-name
        # Finally, note that pod2html fails miserably to generate XHTML-compliant anchor links. See http://validator.w3.org/check?uri=http%3A%2F%2Fsearch.cpan.org%2Fdist%2FCatalyst-Runtime%2Flib%2FCatalyst%2FRequest.pm&charset=(detect+automatically)&...
        $text =~ s/\s/_/g;
        decode_entities($text);  # we need to replace [#&;] only when they are NOT part of an HTML entity. decode_entities saves us from crafting a nasty regexp
        $text = encode('utf-8', $text);  # convert to UTF-8 because we need to output the UTF-8 bytes
        $text =~ s/([^A-Za-z0-9_:.-])/sprintf('.%02X', ord($1))/eg;  # MediaWiki also uses the period, see http://en.wikipedia.org/wiki/Hierarchies#Ethics.2C_behavioral_psychology.2C_philosophies_of_identity
        $text = 'L'.$text if $text =~ /\A\W/; # "ID and NAME tokens must begin with a letter ([A-Za-z])" -- http://www.w3.org/TR/html4/types.html#type-name
    }
    $text = 'id' if $text eq '';

lib/MojoMojo/I18N/ca.po  view on Meta::CPAN

msgstr ""

#:
msgid "Deleted Text"
msgstr "Text Suprimit"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Descendents"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "No has trobat un correu electrònic?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr ""

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr ""

lib/MojoMojo/I18N/de.po  view on Meta::CPAN

msgstr ""

#:
msgid "Deleted Text"
msgstr "Durchgestrichen"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Nachfahren"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "Kein eMail erhalten?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr "Interne Suche deaktivieren (Google benutzen)"

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr ""

lib/MojoMojo/I18N/en.po  view on Meta::CPAN

msgstr ""

#: root/base/page/deleted.tt:1 root/base/page/deleted.tt:4
msgid "Deleted"
msgstr ""

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr ""

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr ""

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr ""

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr ""

lib/MojoMojo/I18N/es.po  view on Meta::CPAN

msgstr "Borrar página"

#: root/base/page/deleted.tt:1 root/base/page/deleted.tt:4
msgid "Deleted"
msgstr "Borrada"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Descendientes"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "¿No recibió un correo electrónico?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr "Desactivar el buscador interno (usar Google)"

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr "Descargar un zip de esta página y sus sub-páginas"

lib/MojoMojo/I18N/fr.po  view on Meta::CPAN

msgstr ""

#:
msgid "Deleted Text"
msgstr "Texte supprimé"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Descendants"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "Vous n'avez pas reçus de mail ?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr ""

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr ""

lib/MojoMojo/I18N/it.po  view on Meta::CPAN

msgstr ""

#: root/base/page/deleted.tt:1 root/base/page/deleted.tt:4
msgid "Deleted"
msgstr ""

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Discendenti"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "Non avete ricevuto una e-mail?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr "Disabilita la ricerca interna (utilizza Google)"

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr ""

lib/MojoMojo/I18N/ja.po  view on Meta::CPAN

msgstr ""

#:
msgid "Deleted Text"
msgstr "削除されたテキスト"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr ""

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "メールが受け取れなかった場合"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr ""

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr ""

lib/MojoMojo/I18N/ko.po  view on Meta::CPAN

msgstr "등록일"

#: root/base/toolbar.tt:23 root/base/toolbar.tt:45
msgid "Deleted Text"
msgstr "삭제된 텍스트"

#: root/base/page/info.tt:21
msgid "Descendants"
msgstr ""

#: root/base/user/validate.tt:19
msgid "Didn't receive an email?"
msgstr "메일을 받지 못했을 경우"

#: root/base/navbar.tt:56 root/base/navbar.tt:58
msgid "Download a zip with all the pages in this wiki"
msgstr "Wiki 내용을 ZIP형식으로 다운로드"

#: lib/MojoMojo/Controller/PageAdmin.pm:135
msgid "END OF CONFLICT"
msgstr ""

lib/MojoMojo/I18N/no.po  view on Meta::CPAN

msgstr "Slettet"

#:
msgid "Deleted Text"
msgstr "Slettet tekst"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Etterkommere"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "Mottok ikke en epost?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr "Skru av innebygget søk (bruk google site søk)"

#:
msgid "Disable search"
msgstr "Skru av søk"

lib/MojoMojo/I18N/pl.po  view on Meta::CPAN

msgstr "Usuń stronę"

#: root/base/page/deleted.tt:1 root/base/page/deleted.tt:4
msgid "Deleted"
msgstr "Usunięta"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Potomnych"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "Nie otrzymałeś wiadomości pocztowej?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr "Wyłącz wbudowane wyszukiwanie (użyj Google)"

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr "Pobierz archiwum ZIP tej strony wraz z podstronami"

lib/MojoMojo/I18N/ru.po  view on Meta::CPAN

msgstr ""

#:
msgid "Deleted Text"
msgstr "Удаленный текст"

#: root/base/page/info.tt:54
msgid "Descendants"
msgstr "Потомки"

#: root/base/user/validate.tt:11
msgid "Didn't receive an email?"
msgstr "Не получили почтовое сообщение?"

#: root/forms/admin/settings.yml:47
msgid "Disable internal search (use Google)"
msgstr "Запретить встроенный поиск (используйте Google)"

#: root/base/navbar.tt:14
msgid "Download a ZIP of this page and its subpages"
msgstr ""

root/base/mail/validate.tt  view on Meta::CPAN

[%loc('Hi. This is a mail to validate your email address, x. To confirm, please click the url below:', user.name)%]

[% c.uri_for('/.validate', user.login, secret) %]

root/base/user/validate.tt  view on Meta::CPAN


    <p>[% loc('Fill in the email address you want to use here') %]:</p>

    <form action="[% c.uri_for('user/reconfirm') %]" method="POST">
        <label for="email">[% loc('Email') %]:<label> 
        <input id="email" type="text" name="email"/>
        <input type="submit" name="OK" value="OK"/>
    </form>

    [% SET link = '<a href="' _ c.uri_for('logout') _ '">' _ loc('log out') _ '</a>' %]
    <p>[% loc('If you are unable to validate, please x', link) %].</p>
</div>
[% END # WRAPPER %]

root/static/js/jquery.form.js  view on Meta::CPAN

             a.push( { name: n, value: options.data[n] } );
        }
    }

    // give pre-submit callback an opportunity to abort the submit
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
        log('ajaxSubmit: submit aborted via beforeSubmit callback');
        return this;
    }    

    // fire vetoable 'validate' event
    this.trigger('form-submit-validate', [a, this, options, veto]);
    if (veto.veto) {
        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
        return this;
    }    

    var q = $.param(a);

    if (options.type.toUpperCase() == 'GET') {
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  // data is null for 'get'
    }
    else

t/c/email.t  view on Meta::CPAN

        },
    },
    'Register submit'
);

# NOTE: This test will fail if the user already exists in t/var/mojomojo.db
# Run: prove --lib /lib t/01app.t to start with fresh database and then run this test.
is( () = $sender->deliveries, 1, 'registerration validation email sent' );
($mail) = ($sender->deliveries)[0];
like( $mail->{email}->get_header('to'), qr/^mojam/,        'right recipient' );
like( $mail->{email}->get_body,         qr/validate your email address/i, 'email contains validate email address' );

done_testing();

t/formatter_include.t  view on Meta::CPAN

        unless MojoMojo::Formatter::Include->module_loaded;
    plan tests => 2;
    $ENV{CATALYST_CONFIG} = 't/var/mojomojo.yml';
    use_ok('Catalyst::Test', 'MojoMojo');
}

my $fake_c = FakeCatalystObject->new;
my ($content);

#content_like('/.jsrpc/render?content=%7B%7Bhttp://localhost/help%7D%7D', qr'{{http://localhost/help}}',
#    'invalidate the old "syntax"');

# match against the start of the string, \A, to make sure no page cruft gets included besides the content
#content_like('/.jsrpc/render?content=%7B%7Binclude http://localhost/help%7D%7D', qr/\A<h1>Help/,
#             'include part of wiki, absolute URL');
#content_like('/.jsrpc/render?content=%7B%7Binclude /help%7D%7D', qr/\A<h1>Help/,
#    'include part of wiki, relative URL');

#content_like('/help.jsrpc/render?content=%7B%7Binclude http://localhost/%7D%7D', qr/\A<h1>Welcome\sto\sMojoMojo/,
#    'include the root page, absolute URL');
#content_like('/help.jsrpc/render?content=%7B%7Binclude /%7D%7D', qr/\A<h1>Welcome\sto\sMojoMojo/,

t/formatter_rss.t  view on Meta::CPAN

        unless MojoMojo::Formatter::RSS->module_loaded;
    plan tests => 4;
    $ENV{CATALYST_CONFIG} = 't/var/mojomojo.yml';
    use_ok('Catalyst::Test', 'MojoMojo');
}

my $fake_c = FakeCatalystObject->new;
my ($content);

content_like '/.jsrpc/render?content=%7B%7Bhttp://localhost/.rss%7D%7D', qr'\{\{http://localhost/.rss}}',
    'invalidate the old "syntax"';

SKIP: {
    skip "set TEST_LIVE to run tests that requires a live Internet connection", 2
        if not $ENV{TEST_LIVE};
        
    content_like '/.jsrpc/render?content=%7B%7Bfeed http://rss.cnn.com/rss/cnn_latest.rss%7D%7D', 
        qr'<div class="feed">[^\n]+cnn\.com/[^\n]+</div>\Z',
        'CNN feed - one entry only';

    content_like '/.jsrpc/render?content=%7B%7Bfeed http://rss.cnn.com/rss/cnn_latest.rss 3%7D%7D', 

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 2.509 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-0ab70e22118 )