{{py:

from mapproxy.compat import PY2

if PY2:
    from urllib import quote, quote_plus
else:
    from urllib.parse import quote, quote_plus
from mapproxy.version import version

def strip(s):
    return s.split('/')[1]

def replace(s):
    return s.replace(':','')

menu_title=None
jscript_openlayers=None
}}
{{def jscript_functions}}
<script type="text/javascript">
    /**
    * Getting the closest parent with the given tag name.
    */
    function NeighborFormSubmit(obj)
    {
        var obj_parent = obj.parentNode;
        if (!obj_parent) return false;
        if (obj_parent.tagName.toLowerCase() != 'tr') return NeighborFormSubmit(obj_parent);
        var forms = obj_parent.getElementsByTagName('form');
        if (!forms) return false;
        forms[0].submit()
    }
</script>
{{enddef}}
            <h2>About</h2>
            <p>MapProxy Version {{version}}</p>
            {{ extra_services_html_beginning }}
            <h2>WMS</h2>
            {{if 'wms' in services}}
            <div class="capabilities">
                <span>Capabilities document</span>
                <span><a href="../service?REQUEST=GetCapabilities">(download as xml)</a></span>
                <span><a href="../demo/?wms_capabilities">(view as html, internal)</a></span>
                <span><a href="../demo/?wms_capabilities&type=external">(view as html, external)</a></span>
            </div>
            {{if 'wms_111' in services }}
                <table class="code">
                    <tr>
                      <th>Layer</th>
                      <th>Coordinate-System</th>
                      <th>Image-Format</th>
                    </tr>
                    {{for layer in layers.values()}}
                    <tr>
                        <td rowspan="{{len(formats)}}">{{layer.name}}</td>
                        {{for loop, format in looper(formats)}}
                        <td class="value epsg-codes">
                                <form action="" method="GET">
                                <select name="srs" onchange="this.form.submit()">
                                    {{for srs_name, srs_code in layer_srs(layer)}}
                                    <option value="{{srs_code}}">{{srs_name}}</option>
                                    {{endfor}}
                                </select>
                                <input type="hidden" name="format" value="{{format}}">
                                <input type="hidden" name="wms_layer" value="{{layer.name}}">
                                </form>
                        </td>
                        <td class="value">
                            <a href="#" onclick="NeighborFormSubmit(this)">{{format | strip}}</a>
                        </td>
                    </tr>
                        {{endfor}}
                    {{endfor}}
                </table>
                <p>Coordinate systems marked with * are supported without reprojection.</p>
                {{else}}
                <div class="capabilities">
                    <span>The demo service only supports WMS 1.1.1. Enable 1.1.1 to see a list of your configured layers.</span>
                </div>
                {{endif}}
            {{else}}
            <div class="capabilities">
                <span>This service is not available with the current configuration.</span>
            </div>
            {{endif}}
            <h2>WMS-C</h2>
            {{if 'wms' in services}}
            <div class="capabilities">
                <span>Capabilities document</span>
                <span><a href="../service?REQUEST=GetCapabilities&tiled=true">(download as xml)</a></span>
                <span><a href="../demo/?wmsc_capabilities">(view as html, internal)</a></span>
                <span><a href="../demo/?wmsc_capabilities&type=external">(view as html, external)</a></span>
            </div>
            {{else}}
            <div class="capabilities">
                <span>This service is not available with the current configuration.</span>
            </div>
            {{endif}}
            <h2>WMTS</h2>
            {{if 'wmts' in services}}
                {{if 'wmts_kvp' in services}}
                <div class="capabilities">
                    <span>KVP capabilities document</span>
                    <span><a href="../service?REQUEST=GetCapabilities&SERVICE=WMTS">(download as xml)</a></span>
                    <span><a href="../demo/?wmts_capabilities_kvp">(view as html, internal)</a></span>
                    <span><a href="../demo/?wmts_capabilities_kvp&type=external">(view as html, external)</a></span>
                </div>
                {{endif}}
                {{if 'wmts_restful' in services}}
                <div class="capabilities">
                    <span>RESTFul capabilities document</span>
                    <span><a href="../wmts/1.0.0/WMTSCapabilities.xml">(download as xml)</a></span>
                    <span><a href="../demo/?wmts_capabilities">(view as html, internal)</a></span>
                    <span><a href="../demo/?wmts_capabilities&type=external">(view as html, external)</a></span>
                </div>
                {{endif}}
            <table class="code">
                <tr>
                    <th>Layer</th>
                    <th>Coordinate-System</th>
                    <th>Image-Format</th>
                </tr>
            {{for wmts_layer_name, wmts_layers in wmts_layers.items()}}
            <tr><td rowspan="{{len(wmts_layers)}}">{{wmts_layer_name}}</td>
                {{for loop, layer in looper(wmts_layers)}}
                    {{if not loop.first}}
                        <tr>
                    {{endif}}
                    {{if layer.grid.supports_access_with_origin('nw')}}
                    <td class="value"><a href="../demo/?wmts_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.grid.srs.srs_code}}</a></td>
                    <td class="value"><a href="../demo/?wmts_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.format}}</a>
                    {{else}}
                    <td class="value" colspan="2">
                        {{layer.grid.name}} not compatible with WMTS
                    </td>
                    {{endif}}
                    </tr>
                {{endfor}}
            {{endfor}}
            </table>
            {{else}}
            <div class="capabilities">
                <span>This service is not available with the current configuration.</span>
            </div>
            {{endif}}
            <h2>TMS</h2>
            {{if 'tms' in services}}
            <div class="capabilities">
                <span>Capabilities document</span>
                <span><a href="../tms/1.0.0/">(download as xml)</a></span>
                <span><a href="../demo/?tms_capabilities">(view as html, internal)</a></span>
                <span><a href="../demo/?tms_capabilities&type=external">(view as html, external)</a></span>
            </div>
            <table class="code">
                <tr>
                    <th>Layer</th>
                    <th>Coordinate-System</th>
                    <th>Image-Format</th>
                    <th>Layer Capabilities</th>
                </tr>
            {{for tms_layer_name, tms_layers in tms_layers.items()}}
            <tr><td rowspan="{{len(tms_layers)}}">{{tms_layer_name}}</td>
                {{for loop, layer in looper(tms_layers)}}
                    {{if not loop.first}}
                        <tr>
                    {{endif}}
                    {{if layer.grid.supports_access_with_origin('sw')}}
                    <td class="value"><a href="../demo/?tms_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.grid.srs.srs_code}}</a></td>
                    <td class="value"><a href="../demo/?tms_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.format}}</a></td>
                    <td class="value"><a href="../demo/?tms_capabilities&layer={{layer.name}}&srs={{layer.md['name_path'][1]}}">click here</a></td>
                    {{else}}
                    <td class="value" colspan="3">
                        {{layer.grid.name}} not compatible with TMS
                    </td>
                    {{endif}}
                    </tr>
                {{endfor}}
            {{endfor}}
            </table>
            {{else}}
            <div class="capabilities">
                <span>This service is not available with the current configuration.</span>
            </div>
            {{endif}}
            {{ extra_services_html_end }}
