{% load analysis_tags %}

<section id="static_analysis">
    {% if not report.analysis.static.pdf or report.analysis.static.pdf|length == 1 and not report.analysis.static.pdf.0.modification and not report.analysis.static.pdf.0.urls and not report.analysis.static.pdf.0.javascript %}
        No PDF metadata could be extracted!
    {% endif %}

    {% with urls=report.analysis.static.pdf|pdf_urls %}
        {% if urls %}
            <div class="row">
                <div class="col-md-6">
                    <div class="panel panel-default list-panel">
                        <div class="panel-heading">
                            <h3 class="panel-title clearfix">
                                URLs
                                <span class="pull-right">
                                    <a href="#" class="button" id="submit-extracted-urls">submit urls</a>
                                </span>
                            </h3>
                        </div>
                        <div class="panel-body"></div>
                        <ul class="list-group">
                            {% for url, version in urls %}
                                <li class="list-group-item">{{ url }}</li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>
        {% endif %}
    {% endwith %}

    {% for p in report.analysis.static.pdf %}
	    {% if p.modification %}
            <div class="row">
                <div class="col-md-6">
                    <div class="panel panel-default list-panel">
                        <div class="panel-heading">
                            <h3 class="panel-title">Metadata</h3>
                        </div>
                        <ul class="list-group">
                            <li class="list-group-item">
                                <span class="item-label">Version:</span> {{ p.version }}
                            </li>
                            <li class="list-group-item">
                                <span class="item-label">Creator:</span> {{ p.creator }}
                            </li>
                            <li class="list-group-item">
                                <span class="item-label">Creation:</span> {{ p.creation }}
                            </li>
                            <li class="list-group-item">
                                <span class="item-label">Title:</span> {{ p.title }}
                            </li>
                            <li class="list-group-item">
                                <span class="item-label">Subject:</span> {{ p.subject }}
                            </li>
                            <li class="list-group-item">
                                <span class="item-label">Producer:</span> {{ p.producer }}
                            </li>
                            <li class="list-group-item">
                                <span class="item-label">Author:</span> {{ p.author }}
                            </li>
                            <li class="list-group-item">
                                <span class="item-label">Modification:</span> <span data-transform="date">{{ p.modification }}</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        {% endif %}
        {% if p.javascript %}
            {% for code in p.javascript %}
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default list-panel page-switcher">

                            <div class="panel-heading">
                                <h3 class="panel-title">
                                    Javascript
                                    <span class="pull-right page-switcher__nav">
                                        <a href="original-code" class="button active" id="original-code-{{ p.version }}">original</a>
                                        <a href="beautified-code" class="button" id="beautified-code-{{ p.version }}">beautified</a>
                                    </span>
                                </h3>
                            </div>

                            <div id="pdf_js" class="panel-collapse collapse in" style="text-align: left;">
                                <div class="panel-body">

                                    <div class="page-switcher__pages">
                                        <div id="original-code" class="active">
                                            <pre class="reset">
                                                <code class="javascript">{{ code.orig_code }}</code>
                                            </pre>
                                        </div>
                                        <div id="beautified-code">
                                            <pre class="reset">
                                                <code class="javascript">{{ code.beautified }}</code>
                                            </pre>
                                        </div>
                                    </div>

                                    <!-- <div class="col-md-5 split-left" style="padding-right:0;">
                                        <pre>
                                            <code class="javascript">{{ code.orig_code }}</code>
                                        </pre>
                                    </div>
                                    <div class="col-md-7 split-right" style="padding-left:0;border-left: 1px solid #d4d4d4;">
                                        <pre>
                                            <code class="javascript">{{ code.beautified }}</code>
                                        </pre>
                                    </div> -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            {% endfor %}
        {% endif %}
    {% endfor %}
</section>

