{% extends "webgateway/base/base_main.html" %}

{% comment %}
<!--
  Copyright (C) 2012 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 %}


{% block title %}Split View Figure{% endblock %}


{% block link %}
{% endblock %}

{% block script %}
<style type="text/css">

body {
    font-family: arial;
}
form dir {
    padding:0px;
    margin:0px;
}
.toggle_channel {
    padding:4px; margin:2px; padding-left:6px; border-radius: 6px;
}
</style>

<!-- this page is designed to work without jQuery, but use jQuery when this page is loaded E.g. into webclient -->
<script>
    $(document).ready(function() {

        $("#split_view_fig_form").ajaxForm({
            success: function(data) {
                $("#split_view_fig_content").html(data);
            }
        });
    });

function hideHeader() {
    if (document.getElementById) {
        document.getElementById("header").style.display = 'none';
    }
    return false;
}
</script>
{% endblock %}


{% block body %}
<div>
    
    <div style="margin-left:auto; margin-right:auto; margin-top:5px">
    <form id="split_view_fig_form" method='get' action="{% url 'webtest_split_view_fig_include' %}">
        <div style="display:none">
            <label>Image IDs</label>
            <input type="text" name="imageIds" {% if imageIds %} value="{{ imageIds }}" {% endif %} /> 
            <a href="{% url 'webtest_split_view_figure' %}">Clear</a>
        </div>
		
		
    {% if imageIds %}
        <div style="margin-left:auto; margin-right:auto; width:500px">
            <div style="float:left; padding-right:20px">
                <input type="radio" name="proj" value="normal" {% ifequal proj 'normal' %} checked="true" {% endifequal %} />
                    Single Z-section <br />
                <input type="radio" name="proj" value="intmax" {% ifequal proj 'intmax' %} checked="true" {% endifequal %} /> 
                    Maximum Intensity Projection<br />
                <input type="radio" name="proj" value="intmean" {% ifequal proj 'intmean' %} checked="true" {% endifequal %} /> 
                    Mean Intensity Projection
            </div>

            <div>
                Image size:
                <input type="text" name="width" size="9" {% if size.width %} value="{{ size.width }}" {% endif %} /> <br />
                <input type="text" name="height" {% if size.height %} value="{{ size.height }}" {% endif %} style="display:none"/>

            
                Split Channels Grey
                <input type="checkbox" name="split_grey" {% if split_grey %} checked="true" {% endif %} /> <br />
                Merged Channel Names
                <input type="checkbox" name="merged_names" {% if merged_names %} checked="true" {% endif %} />
            </div>
        </div>
        <div style="clear: both"></div>
		
		
        <div>
            <table cellspacing='3' style="margin-left:auto; margin-right:auto">
            <tr>
            {% for c in channels %}
                <td>
                    <div class="toggle_channel" style="background:#{{c.colour}}">
                        <input style="font-size:10px; border:solid white 1px; opacity:0.8" type="text" size='10' name="cName{{c.index}}" {% if c.name %} value="{{ c.name }}" {% endif %} />
                        <input type="checkbox" name="cActive{{c.index}}" {% if c.active %} checked="true" {% endif %} />
                    </div>
                    <div style="display:none">
                        <input type="text" size='3' name="cStart{{c.index}}" {% if c.start %} value="{{ c.start }}" {% endif %} />
                        -
                        <input type="text" size='3' name="cEnd{{c.index}}" {% if c.end %} value="{{ c.end }}" {% endif %} />
                        <input type="checkbox" name="cRenderAll{{c.index}}" {% if c.render_all %} checked="true" {% endif %} />
                        
                    </div>
                </td>
            {% endfor %}
                <td valign="top">
                    <table style="padding-left:10px">
                        <tr><td width="15"> </td>
                            {% for c in channels %}
                                <td>
                                    <div class="toggle_channel" style="background:#{{c.colour}}">
                                        <input type="checkbox" name="cMerged{{c.index}}" {% if c.merged %} checked="true" {% endif %} />
                                    </div>
                                </td> 
                            {% endfor %}
                        </tr>
                    </table>
                </td>
                <td valign="bottom">
                    <input type="submit" value='update' />
                </td>
            </tr>
            </table>
        </div>
    
    {% else %}

    Please start by entering Image IDs as a list. E.g: 3745, 3292, 3498
    
    {% endif %}
    </form>
    </div>

    
    <div style="clear: both; padding:10px; border-top: solid #ddd 1px"></div>
    
</div>
    
<div id="split_view_fig_content">

{% include "webtest/webclient_plugins/split_view_fig_include.html" %}

</div>

{% endblock %}