{% extends "projects/base.html" %}
{% load i18n %}
{% load txcommontags %}
{% load txpagination %}
{% load permissions %}

{% block extra_head %}
<link media="screen" href="{{ STATIC_URL }}css/tablesorter.css" type="text/css" rel="stylesheet" />
<link media="screen" href="{{ STATIC_URL }}css/webtrans.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="{{ STATIC_URL }}js/tablesorted.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/table_pagination.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/web_editor.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.highlight-3.js"></script>

<!-- Google suggest -->
<script src="http://www.google.com/jsapi" type="text/javascript"></script>    
<script type="text/javascript">

{% if WEBTRANS_SUGGESTIONS %}
  google.load("language", "1");
  {% include 'webtrans/js/google-translate.js' %}
{% endif %}

{% if string %}
$(function(){
    $("#trans_web_edit tbody p").highlight('{{ string }}');
});
{% endif %}
</script>
{% endblock %}

{% block title %}
{% with pofile.object as component %}
{{ block.super }}
| {{ component.project.name }}
| {% blocktrans with component.name as component_name %}{{ component_name }}{% endblocktrans %}
| {% blocktrans with pofile.filename as filename %}Translate '{{ filename }}'{% endblocktrans %}
{% endwith %}
{% endblock %}

{% block breadcrumb %}
{% with pofile.object as component %}
{{ block.super }}
&raquo; <a href="{{ component.project.get_absolute_url }}">{{ component.project.name }}</a>
&raquo; <a href="{{ component.get_absolute_url }}">{{ component.name }}</a>
&raquo; {% blocktrans with pofile.filename as filename %}Translate '<code>{{ filename }}</code>'{% endblocktrans %}
{% endwith %}
{% endblock %}

{% block content_title %}
<h2 class="pagetitle">{% blocktrans with component.name as component_name and pofile.filename as filename %}Translate '<code>{{ filename }}</code>'{% endblocktrans %}</h2>
{% endblock %}

{% block content %}

{% get_permission "project_perm.submit_file" for request.user and pofile as "can_submit_file" %}

{% if pofile.total %}
  <form action='' method='post' class='webtrans'>
  <h3>{% trans "Current status for this page" %}</h3>

<div class="floatright" >
    <fieldset>
    <legend>{% trans "Settings" %}</legend>
    <table class="definition">
    <tr>
        <th>{% trans "Verbose editing:" %}</th>
        <td><input id="toggle_contexts" type="checkbox" {% if toggle_contexts %}checked="checked"{% endif %} name="toggle_contexts" /></td>
    </tr>
    </table>
    </fieldset>

   <input class="i16 find" type="text" value="{{ string }}" size="15" name="string"/>
   <input class="i16 filter" type="submit" value="{% trans "Filter" %}"/>
   <input class="i16 clear" type="submit" name="clear" value="{% trans "Clear" %}"/>
</div>
  <table class="definition stats_totals">
  <input id="filter_entries" type="hidden" name="filter_entries"/>
  <tr>
    <th class="translated">{% trans "Translated" %}</th>
      <td id="total_translated">{{ pofile.trans }}</td>
      <td id="total_translated_perc">{{ pofile.trans_perc }}%</td>
      <td><input id="only_translated" type="checkbox" {% if only_translated %}checked="checked"{% endif %} name="only_translated"/></td>
  </tr>
  <tr>
    <th class="fuzzy">{% trans "Fuzzy" %}</th>
      <td id="total_fuzzy">{{ pofile.fuzzy }}</td>
      <td id="total_fuzzy_perc">{{ pofile.fuzzy_perc }}%</td>
      <td><input id="only_fuzzy" type="checkbox" {% if only_fuzzy %}checked="checked"{% endif %} name="only_fuzzy"/></td>
  </tr>
  <tr>
    <th class="untranslated">{% trans "Untranslated" %}</th>
      <td id="total_untranslated">{{ pofile.untrans }}</td>
      <td id="total_untranslated_perc">{{ pofile.untrans_perc }}%</td>
      <td><input id="only_untranslated" type="checkbox" {% if only_untranslated %}checked="checked"{% endif %} name="only_untranslated"/></td>
  </tr>
  <tr class="last">
    <th>{% trans "Total" %}</th>
      <td id="total_sum">{{ pofile.total }}</td>
  </tr>
  </table>
{% endif %}

  {% if form_message %}
    <p class="message i16 bell">{{ form_message }}</p>
  {% endif %}

  {% txpaginate '' po_entries step ENTRIES_PER_PAGE 6 paginated_po_entries %}
  {% include 'pagination.html' %}

  <div class="generic_form" >
  <table id="trans_web_edit" class="trans_web_edit stats_comp tablesorter">
   <thead>
    <tr>
      <th>{% trans "#" %}</th>
      <th>{% trans "Source String" %}</th>
      <th>&nbsp;</th> 
      <th>{% trans "Translation" %}</th>
    {% if WEBTRANS_SUGGESTIONS %}      
      <th class="suggest_container"><abbr title="{% trans "Auto-translate" %}">{% trans "AT" %}</abbr></th>
    {% endif %}
      <th>{% trans "Fuzzy?" %}</th>
    </tr>
   </thead>
   <tbody>
    {% include "webtrans/transfile_form.html" %}
   </tbody>
  </table>
  </div>

  {% include 'pagination.html' %}

  <p class="submit">
  {% if perms.projects.submit_file or can_submit_file %}
  <input type="submit" class="i16 submit" name="submit_file" value="{% trans "Submit translations" %}" />
  {% endif %}
  <input type="submit" class="i16 send_file" name="submit_for_review" value="{% trans "Send for Review" %}">
  </p>

  </form>
{% endblock %}


