[%# shownote_template7.tpl 2016-10-02 -%]
[%# HTML snippet for insertion into the database -%]
[%# This one uses the new format for the mailing list data, and partitions -%]
[%# comments into past and current. It requires make_shownotes > V0.0.21   -%]
[%- USE date -%]
[%- prefix = "http://hackerpublicradio.org"
    correspondents = "$prefix/correspondents.php"
    mailthreads = "$prefix/pipermail/hpr_hackerpublicradio.org/$review_year-$review_month/thread.html" -%]
[%- DEFAULT skip_comments = 0 -%]
[%# For the '-mailnotes' option without a file we generate our own inclusion. -%]
[%# We pretend 'default_mail' is a filename in the calling script. Messy.     -%]
[% BLOCK default_mail -%]
<a href="[% mailthreads %]" target="_blank">[% mailthreads %]</a>
[% END -%]

<h2>New hosts</h2>
<p>
[% IF hosts.size > 0 -%]
Welcome to our new host[%- hosts.size > 1 ? 's' : '' -%]: <br />
[%- count = 0 %]
[%- FOREACH row IN hosts %]
    [%- count = count + 1 %]
    [%- hostname = (row.host.search(',') ? row.host.replace('^(.*)$','"$1"') : row.host) %]
    <a href="[% correspondents %]?hostid=[% row.hostid %]" target="_blank">[% hostname %]</a>
    [%- count < hosts.size ? ', ' : '.' %]
[%- END %]
[% ELSE -%]
There were no new hosts this month.
[% END -%]
</p>

<h2>Last Month's Shows</h2>
[%# The 'summary' attribute is deprecated in HTML5 but is included here to      -%]
[%# prevent errors being reported in the note checker                           -%]
<table id="t01" summary="Last month's shows">
    <tr>
    <th>Id</th>
    <th>Day</th>
    <th>Date</th>
    <th>Title</th>
    <th>Host</th>
    </tr>
    [%- FOREACH row IN shows %]
    <tr valign="top">
    <td><strong><a href="http://hackerpublicradio.org/eps.php?id=[% row.eps_id %]" target="_blank">[% row.eps_id %]</a></strong></td>
    <td>[% date.format(row.date,'%a') %]</td>
    <td>[% date.format(row.date,'%Y-%m-%d') %]</td>
    <td><a href="http://hackerpublicradio.org/eps.php?id=[% row.eps_id %]" target="_blank">[% row.title %]</a></td>
    <td><a href="[% correspondents %]?hostid=[% row.ho_hostid %]" target="_blank">[% row.ho_host FILTER html_entity %]</a></td>
    </tr>
    [%- END %]
</table>

[%- IF includefile.defined -%]
<h2>Mailing List discussions</h2>
<p>
Policy decisions surrounding HPR are taken by the community as a whole. This
discussion takes place on the <a href="http://hackerpublicradio.org/maillist"
target="_blank">Mail List</a> which is open to all HPR listeners and
contributors. The discussions are open and available in the archives run
externally by <a href="http://news.gmane.org/gmane.network.syndication.podcast.hacker-public-radio" target="_blank">Gmane</a>
(see below) and on the HPR server under <a href="http://hackerpublicradio.org/pipermail/hpr_hackerpublicradio.org/">Mailman</a>.
</p>
<p><em>Note: since the summer of 2016 Gmane has changed location and is currently
being reestablished. At the moment the HPR archive is not available there.</em></p>
<p>The threaded discussions this month can be found here:</p>
[% INCLUDE $includefile -%]
[%- END %]

[%# Skip comments if told to by the caller -%]
[%- IF skip_comments == 0 -%]
<h2>Comments this month</h2>

[% IF comment_count > 0 -%]
<p>These are comments which have been made during the past month, either to shows
released during the month or to past shows.<br/>
There [%- comment_count == 1 ? "is $comment_count comment" : "are $comment_count comments" -%] in total.</p>
[% IF past_count > 0 -%]
<p>There [% past_count == 1 ? "is $past_count comment" : "are $past_count comments" %] on
[% past.size %] previous [% past.size == 1 ? "show" : "shows" %]:</p>
<ul>
[%- FOREACH ep IN past.keys.sort -%]
[%- arr = past.$ep -%]
<li><strong><a href="[% arr.0.identifier_url %]#comments" target="_blank">hpr[% arr.0.episode %]</a></strong>
([% arr.0.date %]) "<em>[% arr.0.title %]</em>"
by <a href="[% correspondents %]?hostid=[% arr.0.hostid %]" target="_blank">[% arr.0.host %]</a>.</li>
<li style="list-style: none; display: inline">
<ul>
[%- FOREACH row IN arr -%]
<li><a href="[% row.identifier_url %]#[% row.index %]" target="_blank">Comment [% row.index %]</a>:
[% row.comment_author_name FILTER html_entity -%] on [% date.format(row.comment_timestamp,'%Y-%m-%d') -%]:
[%- IF row.comment_title.length > 0 %]
"[% row.comment_title FILTER html_entity %]"
[%- ELSE -%]
"[no title]"
[%- END -%]
</li>
[%- END -%]
</ul><br/>
</li>
[%- END -%]
</ul>
[%- END %]
[%# ---------------------------------------------------------------------------------------- -%]
[% cc = (comment_count - past_count) -%]
[% IF cc > 0 -%]
<p>There [% cc == 1 ? "is $cc comment" : "are $cc comments" %] on [% current.size %] of this month's shows:</p>
<ul>
[%- FOREACH ep IN current.keys.sort -%]
[%- arr = current.$ep -%]
<li><strong><a href="[% arr.0.identifier_url %]#comments" target="_blank">hpr[% arr.0.episode %]</a></strong>
([% arr.0.date %]) "<em>[% arr.0.title %]</em>"
by <a href="[% correspondents %]?hostid=[% arr.0.hostid %]" target="_blank">[% arr.0.host %]</a>.</li>
<li style="list-style: none; display: inline">
<ul>
[%- FOREACH row IN arr -%]
<li><a href="[% row.identifier_url %]#[% row.index %]" target="_blank">Comment [% row.index %]</a>:
[% row.comment_author_name FILTER html_entity -%] on [% date.format(row.comment_timestamp,'%Y-%m-%d') -%]:
[%- IF row.comment_title.length > 0 %]
"[% row.comment_title FILTER html_entity %]"
[%- ELSE -%]
"[no title]"
[%- END -%]
</li>
[%- END -%]
</ul><br/>
</li>
[%- END -%]
</ul>
[%- END %]
[%- ELSE %]
There were no comments this month.
[%- END %]
[%- END %]
[%#
  # vim: syntax=tt2:ts=8:sw=4:ai:et:tw=78:fo=tcrqn21
-%]

