{% extends "admin/base_site.html" %}{% load cwr_filters %}
{% block title %}{{ title }}{% endblock %}
{% block extrastyle %}
    {{ block.super }}
    <style>
      .cwr {overflow: auto; font-family: monospace;}
      .cwr pre {padding: 1px 0; margin: 0; color: #666}

      .cwr div.HDR span.record_type,
      .cwr div.TRL span.record_type {color: #609; margin: 0 1em 0 0}
      .cwr div.GRH span.record_type,
      .cwr div.GRT span.record_type {color: #606; margin: 0 1em 0 0}
      .cwr div.ACK span.record_type,
      .cwr div.WRK span.record_type,
      .cwr div.ISR span.record_type,
      .cwr div.NWR span.record_type,
      .cwr div.REV span.record_type {color: #060; margin: 0 .7em 0 .3em}
      .cwr div.SPU span.record_type,
      .cwr div.OPU span.record_type {color: #B00; margin: 0 .4em 0 .6em}
      .cwr div.WRI span.record_type,
      .cwr div.SWR span.record_type,
      .cwr div.OWR span.record_type {color: #00A; margin: 0 .4em 0 .6em}
      .cwr div.SPT span.record_type,
      .cwr div.OPT span.record_type {color: #B00; margin: 0 .1em 0 .9em}
      .cwr div.SWT span.record_type,
      .cwr div.PWR span.record_type,
      .cwr div.OWT span.record_type {color: #00A; margin: 0 .1em 0 .9em}
      .cwr div.PER span.record_type {color: #069; margin: 0 .4em 0 .6em}
      .cwr div.OWK span.record_type {color: #060; margin: 0 .4em 0 .6em}
      .cwr div.MSG span.record_type {color: #000; margin: 0 .4em 0 .6em}
      .cwr div span.record_type {color: #666; margin: 0 .4em 0 .6em}
      .cwr div span.counters {color: #999;}
      .cwr div span.prshare {color: #069;}
      .cwr div span.mrshare {color: #609;}
      .cwr div span.srshare {color: #906;}
      span.title {color: #609}
      .cwr div.WRI span.ipnumber,
      .cwr div.SWR span.ipnumber,
      .cwr div.SWT span.ipnumber,
      .cwr div.OWR span.ipnumber,
      .cwr div.OWT span.ipnumber,
      .cwr div.PWR span.ipnumber:last-of-type,
      .cwr div span.writer {color: #00A;}
      .cwr div.ACK span.type,
      .cwr div.SPU span.ipnumber,
      .cwr div.SPT span.ipnumber,
      .cwr div.OPU span.ipnumber,
      .cwr div.OPT span.ipnumber,
      .cwr div.PWR span.ipnumber,
      .cwr div span.publisher {color: #060;}
      .cwr div span.chain,
      .cwr div span.message,
      .cwr div span.status {color: #B00;}
      .cwr div span.artist {color: #069;}
      .cwr div span.capacity {color: #B00;}
      .cwr div.ACK,
      .cwr div.ISR,
      .cwr div.WRK,
      .cwr div.NWR,
      .cwr div.REV,
      .cwr div.GRT {margin-top:0.5em}
      .ACK + div.ISR,
      .ACK + div.WRK,
      .ACK + div.NWR,
      .ACK + div.REV {margin-top:0.1em}
      .MSG + div.ISR,
      .MSG + div.WRK,
      .MSG + div.NWR,
      .MSG + div.REV {margin-top:0}
      .cwr div.ACK.CO,
      .cwr div.ACK.DU,
      .cwr div.ACK.RJ,
      .cwr div.ACK.NP,
      .cwr div.ACK.RC,
      .cwr div.ACK.NA,
      .cwr div.ACK.WA {background-color: #fcc}
      .cwr div.MSG {background-color: #fcc}
    </style>

{% endblock %}
{% block content %}
<div class="module">
    <div class="readonly cwr">
        {% for line in lines %}{% with line|slice:'0:3' as rt %}
            {% if version == '30'  %}
                {% if rt == 'HDR' or rt == 'TRL' or rt == 'GRH' or rt == 'GRT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span>{{ line|slice:'3:' }}</pre></div>
                {% elif rt == 'WRK' or rt == 'ISR' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="title" title="Work title">{{ line|slice:'19:79' }}</span>{{ line|slice:'79:' }}</pre></div>
                {% elif rt == 'SPU' or rt == 'OPU' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="chain" title="Publisher sequence">{{ line|slice:'19:21' }}</span><span class="ipnumber" title="Publisher IP number">{{ line|slice:'21:30' }}</span><span class="publisher" title="Publisher">{{ line|slice:'30:75' }}</span>{{ line|slice:'75:76' }}<span class="capacity" title="Capacity: Original publisher">{{ line|slice:'76:78' }}</span>{{ line|slice:'78:' }}</pre></div>
                {% elif rt == 'SWR' or rt == 'OWR' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="ipnumber" title="Writer IP number">{{ line|slice:'19:28' }}</span><span class="writer" title="Writer">{{ line|slice:'28:103' }}</span>{{ line|slice:'103:104' }}<span class="capacity" title="Capacity: {{ line|slice:'104:106'|capacity }}">{{ line|slice:'104:106' }}</span>{{ line|slice:'106:' }}</pre></div>
                {% elif rt == 'WRI' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="ipnumber" title="Writer IP number">{{ line|slice:'19:28' }}</span>{{ line|slice:'28:39' }}<span class="writer" title="Writer">{{ line|slice:'39:114' }}</span><span class="capacity" title="Capacity: {{ line|slice:'114:116'|capacity }}">{{ line|slice:'114:116' }}</span>{{ line|slice:'116:' }}</pre></div>
                {% elif rt == 'SPT' or rt == 'OPT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:22' }}</span><span class="ipnumber" title="Publisher IP number">{{ line|slice:'22:31' }}</span><span class="prshare" title="Performance share: {{ line|slice:'31:36'|perc  }}">{{ line|slice:'31:36' }}</span><span class="mrshare" title="Mechanical share: {{ line|slice:'36:41'|perc }}">{{ line|slice:'36:41' }}</span><span class="srshare" title="Sync share: {{ line|slice:'41:46'|perc }}">{{ line|slice:'41:46' }}</span>{{ line|slice:'46:51' }}<span class="prshare" title="Perf. affiliation: {{ line|slice:'51:55'|soc_name  }}">{{ line|slice:'51:55' }}</span><span class="mrshare" title="Mech. affiliation: {{ line|slice:'55:59'|soc_name  }}">{{ line|slice:'55:59' }}</span><span class="srshare" title="Sync affiliation: {{ line|slice:'59:63'|soc_name  }}">{{ line|slice:'59:63' }}</span>{{ line|slice:'63:' }}</pre></div>
                {% elif rt == 'SWT' or rt == 'OWT'%}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:22' }}</span><span class="ipnumber" title="Writer IP number">{{ line|slice:'22:31' }}</span><span class="prshare" title="Performance share: {{ line|slice:'31:36'|perc  }}">{{ line|slice:'31:36' }}</span><span class="mrshare" title="Mechanical share: {{ line|slice:'36:41'|perc }}">{{ line|slice:'36:41' }}</span><span class="srshare" title="Sync share: {{ line|slice:'41:46'|perc }}">{{ line|slice:'41:46' }}</span>{{ line|slice:'46:51' }}<span class="prshare" title="Perf. affiliation: {{ line|slice:'51:55'|soc_name  }}">{{ line|slice:'51:55' }}</span><span class="mrshare" title="Mech. affiliation: {{ line|slice:'55:59'|soc_name  }}">{{ line|slice:'55:59' }}</span><span class="srshare" title="Sync affiliation: {{ line|slice:'59:63'|soc_name  }}">{{ line|slice:'59:63' }}</span>{{ line|slice:'63:' }}</pre></div>
                {% elif rt == 'PWR' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="chain" title="Publisher sequence">{{ line|slice:'19:21' }}</span><span class="ipnumber" title="Publisher IP number">{{ line|slice:'21:30' }}</span><span class="ipnumber" title="Writer IP number">{{ line|slice:'30:39' }}</span>{{ line|slice:'39:71' }}<span class="chain" title="Agreement Type: {{ line|slice:'71:73'|agreement_type }}">{{ line|slice:'71:73' }}</span>{{ line|slice:'73:' }}</pre></div>
                {% elif rt == 'ALT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="title" title="Alternative title">{{ line|slice:'19:79' }}</span>{{ line|slice:'79:' }}</pre></div>
                {% elif rt == 'OWK' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="title" title="Original work title">{{ line|slice:'19:79' }}</span>{{ line|slice:'79:' }}</pre></div>
                {% elif rt == 'PER' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="artist" title="Performing artist">{{ line|slice:'19:79' }}</span>{{ line|slice:'79:' }}</pre></div>
                {% elif rt == 'REC' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span>{{ line|slice:'19:45' }}<span class="title" title="Recording title">{{ line|slice:'45:105' }}</span><span class="title" title="Version title">{{ line|slice:'105:165' }}</span><span class="artist" title="Recording artist">{{ line|slice:'165:225' }}</span>{{ line|slice:'225:' }}</pre></div>
                {% else %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span>{{ line|slice:'19:' }}</pre></div>
                {% endif %}
            {% elif version == '21' %}
                {% if rt == 'HDR' or rt == 'TRL' or rt == 'GRH' or rt == 'GRT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span>{{ line|slice:'3:' }}</pre></div>
                {% elif rt == 'ACK' %}
                    {% with line|slice:'157:159' as status_code %}
                        <div class="{{ rt }} {{ status_code }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span>{{ line|slice:'19:46' }}<span class="type" title="Original transaction type">{{ line|slice:'46:49' }}</span><span class="title" title="Work title">{{ line|slice:'49:109' }}</span>{{ line|slice:'109:157' }}<span class="status" title="Transaction Status: {{ status_code|status }}">{{ line|slice:'157:159' }}</span>{{ line|slice:'159:' }}</pre></div>
                    {% endwith %}
                {% elif rt == 'MSG' %}
                    <div class="{{ rt }} {{ status_code }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span>{{ line|slice:'19:35' }}<span class="message" title="Message Text">{{ line|slice:'35:' }}</span></pre></div>
                {% elif rt == 'NWR' or rt == 'REV' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="title" title="Work title">{{ line|slice:'19:79' }}</span>{{ line|slice:'79:' }}</pre></div>
                {% elif rt == 'SPU' or rt == 'OPU' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:21' }}</span><span class="ipnumber" title="Publisher IP number">{{ line|slice:'21:30' }}</span><span class="publisher" title="Publisher">{{ line|slice:'30:75' }}</span>{{ line|slice:'75:' }}</pre></div>
                {% elif rt == 'SWR' or rt == 'OWR' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="ipnumber" title="Writer IP number">{{ line|slice:'19:28' }}</span><span class="writer" title="Writer">{{ line|slice:'28:103' }}</span>{{ line|slice:'103:' }}</pre></div>
                {% elif rt == 'SPT' or rt == 'OPT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="ipnumber" title="Publisher IP number">{{ line|slice:'19:29' }}</span>{{ line|slice:'29:34' }}<span class="prshare" title="Performance share: {{ line|slice:'34:39'|perc  }}">{{ line|slice:'34:39' }}</span><span class="mrshare" title="Mechanical share: {{ line|slice:'39:44'|perc  }}">{{ line|slice:'39:44' }}</span><span class="srshare" title="Sync share: {{ line|slice:'44:49'|perc  }}">{{ line|slice:'44:49' }}</span>{{ line|slice:'49:55' }}<span class="counters">{{ line|slice:'55:' }}</span></pre></div>
                {% elif rt == 'SWT' or rt == 'OWT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="ipnumber" title="Writer IP number">{{ line|slice:'19:28' }}</span><span class="prshare" title="Performance share: {{ line|slice:'28:33'|perc  }}">{{ line|slice:'28:33' }}</span><span class="mrshare" title="Mechanical share: {{ line|slice:'33:38'|perc  }}">{{ line|slice:'33:38' }}</span><span class="srshare" title="Sync share: {{ line|slice:'38:43'|perc  }}">{{ line|slice:'38:43' }}</span>{{ line|slice:'43:49' }}<span class="counters">{{ line|slice:'49:' }}</span></pre></div>
                {% elif rt == 'PWR'%}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="ipnumber" title="Publisher IP number">{{ line|slice:'19:28' }}</span><span class="publisher" title="Publisher">{{ line|slice:'28:73' }}</span>{{ line|slice:'73:101' }}<span class="ipnumber" title="Writer IP number">{{ line|slice:'101:110' }}</span>{{ line|slice:'110:' }}</pre></div>
                {% elif rt == 'ALT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="title" title="Alternative title">{{ line|slice:'19:79' }}</span>{{ line|slice:'79:' }}</pre></div>
                {% elif rt == 'PER' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span><span class="artist" title="Performing artist">{{ line|slice:'19:79' }}</span>{{ line|slice:'79:' }}</pre></div>
                {% else %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span>{{ line|slice:'19:' }}</pre></div>
                {% endif %}
            {% else %}
                {% if rt == 'HDR' or rt == 'TRL' or rt == 'GRH' or rt == 'GRT' %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span>{{ line|slice:'3:' }}</pre></div>
                {% else %}
                    <div class="{{ rt }}"><pre><span class="record_type">{{ rt }}</span><span class="counters">{{ line|slice:'3:19' }}</span>{{ line|slice:'19:' }}</pre></div>
                {% endif %}
            {% endif %}
        {% endwith %}{% endfor %}
    </div>
</div>
{% endblock %}

