<html>
{% load i18n %}
{% load common_filters %}
{% load common_tags %}
{% load mapr_filters %}
{% comment %}
<!--
  Copyright (C) 2011-2016 University of Dundee & Open Microscopy Environment.
  All rights reserved.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
{% endcomment %}

    <style type="text/css">
        #mapAnnContainer, .mapAnnContainer {
            position: relative;
            overflow-y: auto;
            max-height: none;
        }
    </style>

    <script type="text/javascript">
        
        $(document).ready(function()
            {

                // This is called once the html for "General" tab of right panel has loaded...

                // Delegate to sub-views to handle content of each collapsible panel
                var selectedObjs = ["map-" + {{ manager.obj_id|json_dumps|safe }}];
                var annPaneData = {
                    'selected': selectedObjs,
                    // canAnnotate used by map annotations and ratings panes
                    'canAnnotate': {% if manager.canAnnotate %}true{% else %}false{% endif %},
                    'url': '{% url "mapannotations_api_annotations" menu %}',
                }

                var mapAnnsPane = new MapAnnsPane($("#mapAnnsPane"), annPaneData);

                var acquisition_load = false;
                var preview_load = false;
                var hierarchy_load = false;

                $(".tooltip").parent().children("span").hide(); // hide tool tip source
                $(".tooltip").tooltip_init();

                // show a link to the current object
                $("#show_link_btn").click(function(){
                    $("#link_info_popup").show();
                    var lnk = location.protocol + '//' + location.host + '{% url "webindex" %}?show={{ menu }}-' + encodeURIComponent({{ manager.obj_id|json_dumps|safe }});
                    var link_input = $("#link_info_popup input");
                    link_input.val(lnk);
                    link_input.get(0).focus();
                    link_input.get(0).select();
                });
                $("#link_info_popup img").click(function(){
                    $("#link_info_popup").hide();
                });

            });
            
    </script>
    <!-- This is used by AJAX loading the right panel, to check it matches current selection -->
    <div id='object-id' style="display:none">{{manager.obj_type}}-{{ manager.obj_id }}</div>

        <!-- ANNOTATIONS "General" -->
        <div id="general_tab" class="right_tab_inner" >
            
            <!-- Toolbar at the top -->
            {% include "webclient/annotations/includes/toolbar.html" %}
        
            <!-- MAP ANNOTATIONS -->
            <div id="mapAnnsPane">
            <h1 class="can-collapse closed" data-name="keyvaluepairs">
                {{ menu|menutolabel }} information
            </h1>
            <div class="annotations_section" >

                {% include "webclient/annotations/includes/mapannotations.html" %}

            </div>
            </div>

        </div>
</html>