Permalink
Browse files

merge revisions 2274, 2275, 2276, 2277, 2278: add a proceedings page.

git-svn-id: svn://svn.mongueurs.net/act/branches/stable@2279 67b57a05-4208-db11-a765-00306e02d86a
  • Loading branch information...
1 parent 51792a9 commit 62012fe69075d6c4e4ef6bea53818c589c8c9b3f @maddingue maddingue committed Jul 14, 2011
Showing with 147 additions and 0 deletions.
  1. +1 −0 lib/Act/Dispatcher.pm
  2. +87 −0 lib/Act/Handler/Talk/Proceedings.pm
  3. +59 −0 templates/talk/proceedings
@@ -26,6 +26,7 @@ my %public_handlers = (
login => 'Act::Handler::Login',
news => 'Act::Handler::News::List',
openid => 'Act::Handler::OpenID',
+ proceedings => 'Act::Handler::Talk::Proceedings',
register => 'Act::Handler::User::Register',
schedule => 'Act::Handler::Talk::Schedule',
search => 'Act::Handler::User::Search',
@@ -0,0 +1,87 @@
+package Act::Handler::Talk::Proceedings;
+use strict;
+use Act::Config;
+use Act::Template::HTML;
+use Act::Talk;
+use Act::User;
+
+
+#
+# handler()
+# -------
+sub handler {
+ # retrieve talks and speaker info
+ my $talks = Act::Talk->get_talks( conf_id => $Request{conference} );
+ for my $talk (@$talks) {
+ # make the User object for the speaker
+ $talk->{user} = Act::User->new( user_id => $talk->user_id );
+
+ # make a summary of the abstract (some people write long abstracts)
+ my $abstract = text_summary($talk->abstract, 400);
+ $talk->{chunked_abstract} = Act::Abstract::chunked($abstract);
+ }
+
+ # sort talks
+ $talks = [
+ sort {
+ $a->title cmp $b->title
+ }
+ grep {
+ $Config->talks_show_all
+ || $_->accepted
+ || ($Request{user} && ( $Request{user}->is_talks_admin
+ || $Request{user}->user_id == $_->user_id))
+ } @$talks
+ ];
+
+ # process the template
+ my $template = Act::Template::HTML->new;
+ $template->variables(
+ talks => $talks,
+ );
+
+ $template->process("talk/proceedings");
+}
+
+
+#
+# text_summary()
+# ------------
+sub text_summary {
+ my ($text, $limit) = @_;
+
+ # extract the first paragraph
+ my $para = substr($text, 0, index($text, "\n"));
+
+ # if it's still too long, extract as many phrases as possible,
+ # while keeping below $limit characters
+ if (length($para) > $limit) {
+ my @chunks = split /([.?!] +|[.?!]\z)/, $para;
+ my $str = "";
+
+ while (@chunks and (length($str) + length($chunks[0])) < $limit) {
+ $str .= shift @chunks;
+ $str .= shift @chunks;
+ }
+
+ $para = "$str [...]";
+ }
+
+ return $para
+}
+
+
+1;
+__END__
+
+=head1 NAME
+
+Act::Handler::Talk::Proceedings - show proceedings
+
+=head1 DESCRIPTION
+
+Show proceedings: all talks in a big list, with the useful details.
+
+See F<DEVDOC> for a complete discussion on handlers.
+
+=cut
@@ -0,0 +1,59 @@
+[% title = loc("Proceedings");
+ WRAPPER ui title = title %]
+[% INCLUDE js/mytalks.js %]
+
+[% IF global.request.user.is_talks_admin OR global.config.talks_show_schedule %]
+<div class="proceedings">
+ [% FOREACH t = talks %]
+ <dl class="talk">
+ <dd class="title">
+ [% IF global.request.user.has_registered %]
+ <input type="checkbox"
+ name="mt-[% t.talk_id %]"
+ value="[% t.talk_id %]"
+ [% IF global.request.user.is_my_talk(t.talk_id) %]
+ title="{{remove from personal schedule}}"
+ checked="checked"
+ [% ELSE %]
+ title="{{add to personal schedule}}"
+ [% END %]
+ />
+ [% END %]
+
+ [% talk_link(t) %]
+ </dd>
+
+ <dd class="speaker">
+ <a href="[% make_uri_info('user', t.user.user_id) %]"
+ class="name">[% user_info(t.user) %]</a>[% IF t.user.company %],
+ <span class="company">[% t.user.company %]</span>[% END %]
+ </dd>
+
+ <dd class="info">
+ [% global.config.talks_languages.${t.lang}
+ || global.config.default_language %],
+ [% IF t.lightning %]
+ {{lightning}}
+ [% ELSE %]
+ [% t.duration %] {{minutes}}
+ [% END %]
+ </dd>
+
+ [% IF t.url_talk %]
+ <dd class="link_slides">
+ {{Talk:}} <a href="[% t.url_talk %]">[% t.url_talk %]</a>
+ </dd>
+ [% END %]
+
+ <dd class="abstract">
+ <blockquote>
+ [% expand(t.chunked_abstract) | html_line_break %]
+ </blockquote>
+ </dd>
+
+ </dl>
+ [% END %]
+</div>
+[% END %]
+
+[% END %]

0 comments on commit 62012fe

Please sign in to comment.