{% comment %}
Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com> 

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions 
are met:

 * Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials provided
   with the distribution.

 * Neither the name of the Nokia Corporation and/or its
   subsidiary(-ies) nor the names of its contributors may be used
   to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% endcomment %}
{% load ietf_filters %}
<table class="ietf-ballot"><tr valign="top"><td class="left">

{% if doc_ballot_edit_button and user|in_group:"Area_Director,Secretariat" %}
{% if user|in_group:"Area_Director" %}
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_edit_position name=doc.draft_name %}">Edit position</a></span></span></div>
{% endif %}

{% if ballot.was_deferred %}
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_undefer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_undefer_ballot name=doc.draft_name %}">Undefer ballot</a></span></span></div>
<div style="margin-top:8px; margin-bottom:8px;">Ballot deferred by {{ ballot.deferred_by }} on {{ ballot.deferred_date }}.</div>
{% else %}
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_defer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_defer_ballot name=doc.draft_name %}">Defer ballot</a></span></span></div>
{% endif %}

{% endif %}

<p style="margin-top:1em;"><span class="square" style="background:#c00000;"></span><b>Discuss</b><br/>
{% with ballot.get_discuss as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}</p>

<p><span class="square" style="background:#80ff80;"></span><b>Yes</b><br/>
{% with ballot.get_yes as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}</p>

<p><span class="square" style="background:#80ff80;"></span><b>No Objection</b><br/>
{% with ballot.get_no_objection as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}</p>

<p><span class="square" style="background:#ffff00;"></span><b>Abstain</b><br/>
{% with ballot.get_abstain as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}</p>

<p><span class="square" style="background:#c0c0c0;"></span><b>Recuse</b><br/>
{% with ballot.get_recuse as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}</p>

<p><span class="square" style="background:white;"></span><b>No Record</b><br/>
{% with ballot.get_no_record as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}</p>

</td>
<td class="right">

<h2 style="margin-top:12px;">Discusses and other comments</h2>

{% if ballot.is_ballot_set %}<p>Other documents in this ballot set: {% for x in ballot.ballot_set_other%}{{x|urlize_ietf_docs}}{% if not forloop.last %}, {% endif %}{% endfor %}</p>{% endif %}

{% if doc.in_ietf_process and doc.ietf_process.has_active_iesg_ballot %}
<p>Summary: <i>{{ doc.ietf_process.iesg_ballot_needed }}</i></p>
{% endif %}

{% for pos in ballot.get_texts|dictsort:"is_old_ad" %}
<h2 class="ballot_ad"><a name="{{pos.ad_name|slugify}}">{% if pos.is_old_ad %}[{%endif%}{{pos.ad_name|escape}}{% if pos.is_old_ad %}]{%endif%}</a></h2>

{% ifequal pos.position "Discuss" %}
<p><b>Discuss ({{pos.discuss_date}})</b> <img src="/images/comment.png" width="14" height="12" alt=""/></p>
<pre>{{pos.discuss_text|fill:"80"|escape }}</pre>
{% endifequal %}

{% if pos.comment_text %}
<p><b>Comment ({{pos.comment_date}})</b> <img src="/images/comment.png" width="14" height="12" alt=""/></p>
<pre>{{pos.comment_text|fill:"80"|escape }}</pre>
{% endif %}
{% endfor %}
</td></tr></table>
