<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
    <title>ConE generation report</title>
    <style type="text/css">
        body {
            font-family: Nokia Standard Multiscript, Tahoma, Verdana, Arial;
            font-size: 0.8em;
            color: #0055B7;
        }

        .red{
            color: Red;
        }
        
        h1 {
            padding: 30px 0 0 0;
            margin: 0;
            text-align: left;
        }

        #date {
            text-align: center;
        }

        hr {
            height: 1px;
            background-color: cccccc;
            color: #cccccc;
        }

        h2 h3 {
            padding: 10px 0 10px 0;
            margin: 0;
        }

        table.report {
            width: 100%;
            border: 1px solid #e0dfe3;
            border-collapse: collapse;
            color: #333333;
        }

        table.report th {
            text-align: left;
            padding: 5px;
            background-color: #f9fafd;
            color: #595a5f;
            border-bottom: 1px #999999 solid;
        }

        table.report th.featureName {
            background-color: #f2f2f3;
            font: #595a5f Tahoma, Verdana, Arial bold;
            font-size: 1.1em;
            border-top: 3px #9d9da1;
            border-top-style: double;
            border-bottom: 3px #9d9da1;
            border-bottom-style: double;
        }

        table.report th.header {
            background-color: #f9fafd;
            font: #595a5f Tahoma, Verdana, Arial bold;
            font-size: 0.8em;
            border-top: 1px #9d9da1;
            border-bottom: 1px #9d9da1;
        }

        table.report td {
            word-wrap: break-word;
            border: 1px #EBEBEB;
            padding: 5px;
            border-style: solid; 
            vertical-align: top;
            font: Tahoma, Verdana, Arial;
            _font-size: 0.8em;
        }

        table.summary {
            border: 1px solid #e0dfe3;
            border-collapse: collapse;
            color: #333333;
        }

        table.summary th {
            text-align: left;
            padding: 5px;
            background-color: #f9fafd;
            color: #595a5f;
            border-bottom: 1px #999999 solid;
        }

        table.summary th.featureName {
            background-color: #f2f2f3;
            font: #595a5f Tahoma, Verdana, Arial bold;
            font-size: 1.1em;
            border-top: 3px #9d9da1;
            border-top-style: double;
            border-bottom: 3px #9d9da1;
            border-bottom-style: double;
        }

        table.summary td {
            word-wrap: break-word;
            border: 1px #EBEBEB;
            padding: 5px;
            border-style: solid; 
            vertical-align: top;
            font: Tahoma, Verdana, Arial;
            _font-size: 0.8em;
        }
        div.popup  {
            background-color: #f9fafd;
            font: #595a5f Tahoma, Verdana, Arial bold;
            font-size: 0.8em;
            border-top: 1px #9d9da1;
            border-bottom: 1px #9d9da1;
        }
        div.floater  {
            text-align: left; 
            width: 50%; 
            float: left;
        }
        div.floater-right  {
            text-align: right; 
            width: 50%; 
            float: right;
        }
        table.log {
            word-wrap: break-word;
            border: 1px #EBEBEB;
            padding: 5px;
            border-style: solid; 
            vertical-align: top;
            font: #595a5f Tahoma, Verdana, Arial;
            font-size: 0.8em;
        }
        .currentValue {
            background-color: #e8f2fe;
        }
    </style>
    <script language="javascript" type="text/javascript">
    //<![CDATA[
    {% include 'tablefilter.js' without context %}
    //]]>
    </script>
    
    <script language="javascript" type="text/javascript">
    //<![CDATA[
    {% include 'popup.js' without context %}
    //]]>
    </script>

</head>
<body>

    <h1>Generation summary:</h1>
    <table class="summary">
    <tr>
        <th class="featureName">Statistics</th>
        {% for report in rep_data -%}
        <th class="featureName">{{ report.label }}</th>
        {% endfor -%}
    </tr>
    <tr>
        <td>Refs in files</td>
        {% for report in rep_data -%}
        <td>{{ report.context.changed_refs|length }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td>Not generated Refs</td>
        {% for report in rep_data -%}
        <td>{{ report.context.get_refs_with_no_output()|length }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <th class="featureName" colspan="{{ rep_data|length + 1 }}">Details</th>
    </tr>
    <tr>
        <td>Report generated</td>
        {% for report in rep_data -%}
        <td>{{ report.generation_time }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td>Generation duration</td>
        {% for report in rep_data -%}
        <td>{{ report.duration }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td>Generation log</td>
        {% for report in rep_data -%}
        <td><a href="file:{{ report.context.log_file|pathname_to_url }}">cone log</a></td>
        {% endfor -%}
    </tr>
    <tr>
        <th class="featureName" colspan="{{ rep_data|length + 1 }}">Generation options</th>
    </tr>
    <tr>
        <td align="left">Layers</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.layers }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Added</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.added }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Dryrun</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.dryrun }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Verbose</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.verbose }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Overrides</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.overrides }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Project</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.project }}</td>
        {% endfor -%}
    </tr>
        <tr>
        <td align="left">Report</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.report }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Impls</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.impls }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Tags</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.context.tags }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Output</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.output }}</td>
        {% endfor -%}
    </tr>
    <tr>
        <td align="left">Configuration</td>
        {% for report in rep_data -%}
        <td align="left">{{ report.options.configuration }}</td>
        {% endfor -%}
    </tr>
    </table>
    
    <h1>Generation Outputs:</h1><br>
    <p>Predefined filters:<br>
        <FORM>
        <INPUT type="button" value="Refs with no implementation" onclick="tf_outputs.SetFilterValue(1,'None');tf_outputs.SetFilterValue(0, '');tf_outputs.SetFilterValue(2, '');tf_outputs.Filter();return false;" name="Refs with no implementation"">
        <br>
        <INPUT type="button" value="Refs with not output" onclick="tf_outputs.SetFilterValue(2, 'None');tf_outputs.SetFilterValue(0, '');tf_outputs.SetFilterValue(1, '');tf_outputs.Filter();return false;" name="Refs with not output">
        </FORM>
    </p>
    <table class="report" id="outputs">
    <tr>
        <th class="featureName">Settings</th>
        <th class="featureName">Impl. file</th>
        <th class="featureName">Outputs</th>
    </tr>

    {% macro popup_link(source, linkid, linkname) -%}
        {% if 'all' in report_options %}
            <a href="#" onclick="Showpopup({{source}}, '{{linkid}}');return false;">{{ linkname }}</a>
        {% else %}
           {{ linkname }}
        {% endif %}
    {%- endmacro %}

    {% macro get_report_colums(reports_list, report_elem) -%}        
    {%- endmacro %}

    <!-- process the output files -->    
    {% for out in merged_context.get_output() %}
    <tr>
        <td>
            {%- if out.implementation.get_refs() %}
                {%- for ref in out.implementation.get_refs() %}
                   {%- if ref in merged_context.changed_refs %}                  
                     {%- if ref in merged_context.temp_features %}
                       <i>{{ popup_link('this', ref+'.apidiv',ref) }}</i><br>
                     {%- else %}
                       <B>{{ popup_link('this', ref+'.apidiv', ref) }}</B><br>
                     {%- endif %}
                   {%- else %}
                     {{ ref }}<br>
                   {%- endif %}
                {%- endfor %}
            {%- endif %}
        </td>
        <td>
          {%- if out.type == 'ref' %}
            Rule: 
          {%- elif out.type == 'exception'  %}
            Exception: 
          {%- endif  %}
          {{ popup_link('this',out.implementation.ref|replace("/", ".") +':'+out.implementation.lineno|string+'.impldiv',out.implementation.ref+':'+out.implementation.lineno|string) }}
        </td>
        <td>
        {%- if out.name != None and out.type != 'exception' %}
        {{ popup_link('this',out.name|replace("/", ".")|replace("\\", ".")+'.output',out.name) }}
        {%- else %}
            <span class="red">None</span><br>
        {%- endif %}
        </td>
    </tr>
    {%- endfor %}
            
    <!-- process the refs with no output -->    
    {%- for ref in merged_context.get_refs_with_no_output(merged_context.get_changed_refs(operation='intersection',ignore_temps=True)) %}
    <tr>
        <td>
          <B>
            {{ popup_link('this',ref+'.apidiv',ref) }}
          </B><br>
        </td>
        <td>
          {%- if merged_context.impl_set.get_implementations_with_ref(ref) %}    
              {%- for impl in merged_context.impl_set.get_implementations_with_ref(ref) %}
                {{ popup_link('this',impl.ref|replace("/", ".")|replace("\\", ".")+'.impldiv',impl.ref) }}
              {%- endfor %}
          {%- else %}
            <span class="red">None</span><br>           
          {%- endif %}
        </td>
        <td>
            <span class="red">None</span><br> 
        </td>
    </tr>
    {%- endfor %}

    </table>
        
    <!-- Create extra data divs only when debug is on -->        
    {% if 'all' in report_options %}
        <!-- Create data divs for feature ref elements -->
        {%- for feat in merged_context.features.get_features(merged_context.changed_refs) %}
            <div id="{{ feat.fqr|replace("/", ".")  }}.apidiv" style="background-color:#f9fafd;border:1px solid black;display:none;padding:2px;width:50%;">
                <table class="report">
                <tr><td>
                    <div class="floater"><b>Ref:</b>{{ feat.fqr }}</div> 
                    <div class="floater-right"><a href="#" onclick="Popup.hide('{{ feat.fqr }}.apidiv');return false;">Close</a></div>
                </td></tr>
                <tr><td>
                    <div>
                        <b>Name: </b>{{ feat.name }}<br>
                        <b>Type: </b>{{ feat.type }}<br>
                        <b>ConfML: </b><a href="file:{{ rep_data[0].project_dir|pathname_to_url }}/{{ feat.get_proxied_obj().get_configuration_path()|pathname_to_url }}">{{ feat.get_proxied_obj().get_configuration_path() }}</a>
                    </div>
                </tr></td>
                </table>
                <b>Data: </b>
                <table class="report">
                {%- if feat.is_sequence_root() %}
                    <tr>
                      {%- for columnfea in feat.get_column_features() %}
                      <th class="th.header">{{ columnfea.ref }}</th>
                      {%- endfor %}
                    </tr>
                    {%- for row in feat.get_value() %}
                       <tr>
                        {%- for col in row %}
                            <td>{{ col|e|xml_charref_replace  }}</td>
                        {%- endfor %}
                       </tr>
                    {%- endfor %}
                {%- else %}
                    {%- for data in feat.get_datas() %}
                        {% if loop.first %}
                            <tr>
                                <th class="th.header">Layer</th>
                                <th class="th.header">Value</th>
                            </tr>
                        {% endif -%}    
                        {% if not data.template %}
                            <tr>
                                <td><a href="file:{{ rep_data[0].project_dir|pathname_to_url }}/{{ data.get_configuration_path()|pathname_to_url }}">{{ data.get_configuration_path() }}</a></td>
                                <td>{{ data.get_value()|e|xml_charref_replace  }}</td>
                            </tr>
                        {% endif -%}
                    {% endfor %}
                {% endif -%}
                </table>
            </div>
        {%- endfor %}
    
        <!-- Create data divs for generation output elements -->
        {% for output in merged_context.outputs.values() %}
            <div id="{{ output.name|replace("/", ".")|replace("\\", ".") }}.output" style="background-color:#f9fafd;border:1px solid black;display:none;padding:2px;width:50%;">
                <table class="report">
                <tr><td>
                    <div class="floater"><b>Ref:</b>{{ output.name }}</div> 
                    <div class="floater-right"><a href="#" onclick="Popup.hide('{{ output.name|replace("/", ".")|replace("\\", ".") }}.output');return false;">Close</a></div>
                </td></tr>
                <tr><td>
                    <div>
                        <b>Implml: </b>{{ output.implementation }}<br>
                        <b>Type: </b>{{ output.type }}<br>
                        {% if output.type == 'file' %}
                        <b>File: </b><a href="file:{{ output.abspath|pathname_to_url }}">{{ output.name }}</a><br>
                        {% elif output.type == 'ref' %}
                        <b>Target ref: </b>{{ output.name }} <a href="#" onclick="tf_outputs.SetFilterValue(0, '{{output.name}}');tf_outputs.SetFilterValue(1, '');tf_outputs.SetFilterValue(2, '');tf_outputs.Filter();return false;">filter</a><br>
                        {% elif output.type == 'exception' %}
                        <b>Exception: </b>{{ output.exception }}<br>
                        {% endif %}
                        <b>Related log entries: </b><br>
                        <table class="log">
                        {% for log in merged_context.grep_log(output.filename) -%}
                        <tr><td>{{ log[0] }}</td><td>{{ log[1] }}</td></tr>
                        {% endfor -%}
                        </table>
                    </div>
                </tr></td>
                </table>
            </div>
        {% endfor %}
    
        <!-- Create data divs for generation specific implementation elements -->
        {% for output in merged_context.outputs.values() %}
            <div id="{{ output.implementation.ref|replace("/", ".") }}:{{ output.implementation.lineno }}.impldiv" style="background-color:#f9fafd;border:1px solid black;display:none;padding:2px;width:50%;">
                <table class="report">
                <tr><td>
                    <div class="floater"><b>Ref:</b>{{ output.name }}</div> 
                    <div class="floater-right"><a href="#" onclick="Popup.hide('{{ output.implementation.ref|replace("/", ".") }}:{{ output.implementation.lineno }}.impldiv');return false;">Close</a></div>
                </td></tr>
                <tr><td>
                    <div>
                        <b>Implml: </b>{{ output.implementation }}<br>
                        <b>Type: </b>{{ output.implementation.__class__.__name__ }}<br>
                        <b>File: </b><a href="file:{{ [rep_data[0].project_dir,output.implementation.ref]|join('/')|pathname_to_url }}">{{ output.implementation.ref }}</a><br>
                        <b>Line: </b>{{output.implementation.lineno}}<br>
                        {% if output.type == 'exception' %}
                        <b>Exception: </b>{{ output.exception }}<br>
                        {% endif %}
                        <b>Related log entries: </b><br>
                        <table class="log">
                        {% for log in merged_context.grep_log(output.implementation.ref) -%}
                        <tr><td>{{ log[0] }}</td><td>{{ log[1] }}</td></tr>
                        {% endfor -%}
                        </table>
                    </div>
                </tr></td>
                </table>
            </div>
        {% endfor %}
        
        <!-- Create data divs for implementation elements -->
        {% for impl in merged_context.impl_dict.values() %}
            <div id="{{ impl.ref|replace("/", ".")|replace("\\", ".") }}.impldiv" style="background-color:#f9fafd;border:1px solid black;display:none;padding:2px;width:50%;">
                <table class="report">
                <tr><td>
                    <div class="floater"><b>Ref:</b>{{ impl.ref|replace("/", ".")|replace("\\", ".") }}}</div> 
                    <div class="floater-right"><a href="#" onclick="Popup.hide('{{ impl.ref|replace("/", ".")|replace("\\", ".") }}.impldiv');return false;">Close</a></div>
                </td></tr>
                <tr><td>
                    <div>
                        <b>Implml: </b><a href="file:{{ [rep_data[0].project_dir,impl.ref]|join('/')|pathname_to_url }}">{{ impl.ref }}</a><br>
                        <b>Type: </b>{{ impl.__class__.__name__ }}<br>
                        <b>Related log entries: </b><br>
                        <table class="log">
                        {% for log in merged_context.grep_log(impl.ref) -%}
                        <tr><td>{{ log[0] }}</td><td>{{ log[1] }}</td></tr>
                        {% endfor -%}
                        </table>
    
                    </div>
                </tr></td>
                </table>
            </div>
        {% endfor %}
    {% endif %} <!-- verbose 3 -->
        
    <script language="javascript" type="text/javascript">
        //<![CDATA[
             var output_Props =  {  
                     paging: false,
                     highlight_keywords: true,                      
                     rows_counter: true,  
                     rows_counter_text: "Rows:",  
                     btn_reset: true,  
                     loader: true,  
                     loader_text: "Filtering data..."  
                 }; 
            setFilterGrid("outputs", output_Props);
            
            function Showpopup(item_over, popup_ref)
            {
                Popup.show(popup_ref, item_over,'top left', {'offsetTop':20});
            } 
        //]]>
    </script>

    
</body>
</html>