<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/">
    <xi:include href="layout.html" />

    <head>
        <title>Poll details</title>
    </head>
    <body>
        <h1>Poll: ${poll.title}</h1>
        <div class="poll_summary">
            <ul>
                <li>Author: ${poll.author}</li>
                <li>Description: ${poll.description}</li>
                <li>Created: ${poll.get_creation_time_string()}</li>
                <li>Public URL: <a href="${poll.get_url()}" title="link of this poll">${poll.get_url()}</a></li>
            </ul>
        </div>
        <div class="poll_submit_form">
            <h2>Submit something</h2>
            <form action="${poll.get_submit_url()}" method="post">
                <ul>
                    <li><label for="submitter">Submitter:</label><input type="text" id="submitter" class="form-entry" name="submitter" />
                        <span py:if="'submitter' in errors" class="error">${errors.submitter}</span></li>
                    <li><label for="content">New content:</label><input type="text" id="content" class="form-entry"  name="content" />
                        <span py:if="'content' in errors" class="error">${errors.content}</span></li>
                </ul>
                <input type="submit" name="submit" value="Submit" />
            </form>
        </div>
        <!-- previous submissions -->

        <div  class="poll_submissions" py:if="poll.get_settings()['show_all_submissions']">
            <h2>Previous submissions</h2>
            <table py:if="poll.get_num_of_submissions() > 0">
                <tr><th>Submitter</th><th>Content</th><th>Timestamp</th></tr>
		<?python
			from itertools import cycle
			cls=cycle(('rowA','rowB')) ?>
		<tr py:for="one_submission in poll.get_submissions()" class="${cls.next()}">
                    <td>${one_submission.submitter} </td>
                    <td>${one_submission.get_markup_content()}</td>
                    <td>${one_submission.get_creation_time_string()}</td>
                </tr>
		
            </table>
            <span py:if="poll.get_submissions().count() == 0">No submissions posted</span>
        </div>

        <!-- statistics -->
        <div class="poll_statistics" py:if="poll.get_settings()['show_all_submissions']">
            <h2>Statistics</h2>
            <ul>
                <li>Number of submitters: ${poll.get_num_of_submitters()}</li>
                <li>Number of submissions: ${poll.get_num_of_submissions()}</li>
            </ul>
        </div>
    </body>
</html>