{% extends "ldt/ldt_raw_base.html" %}
{% load i18n %}
{% load logintag %}
{% load navigation %}

{% block js_import %}
    {{ block.super }}
    <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.nyroModal.min.js"></script>
    <!--[if IE 6]>
    <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.nyroModal-ie6.min.js"></script>
    <![endif]-->
    <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.qtip.min.js"></script>
    <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.validate.js" ></script>
{% endblock %}

{% block js_declaration %}
    <script type="text/javascript">    
    
    jQuery(function($, undefined) {
    $.nmFilters({iriIframe:{
        is: function(nm) {
            var target = nm.opener.attr('target') || '',
                rel = nm.opener.attr('rel') || '',
                opener = nm.opener.get(0);
            return !nm._hasFilter('image') && (target.toLowerCase() == '_iri'
                || rel.toLowerCase().indexOf('external') > -1
                || (opener.hostname && opener.hostname.replace(/:\d*$/,'') != window.location.hostname.replace(/:\d*$/,'')));
        },
        init: function(nm) {
            nm.loadFilter = 'iframe';
        },
        load: function(nm) {
            nm.store.iframe = $('<iframe src="javascript:\'\';"></iframe>');
            nm._setCont(nm.store.iframe);
        },
        afterShowCont: function(nm) {
            nm.store.iframe.attr('src', nm.opener.attr('href'));
        },
        close: function(nm) {
            // Since we hacked the iriIframe jquery close filter from the file projectscontents.js,
            // this close function seems not useful anymore.
            if (nm.store.iframe) {
                var res =  $('#ldtInitSwf',nm.store.iframe.contents());
                if(res.length > 0) {
                    if(res.get(0).isModified()=="true") {
                        res.get(0).askSave();
                    }
                    else{
                        nm.store.iframe.remove();
                        nm.store.iframe = undefined;
                        delete(nm.store.iframe);
                    }
                }
                else{
                    nm.store.iframe.remove();
                    nm.store.iframe = undefined;
                    delete(nm.store.iframe);
                }
            }
        }
    }});
    });
    
    $(document).ready(function() {
    	
    	$("#version").css('visibility','hidden');
    	
    	$("#versionwrapper").hover(
    	    function(event) {
    		    $("#version",event.target).css('visibility','visible');
    		},
    	    function(event) {
    		   $("#version",event.target).css('visibility','hidden');
    		}
    	);
    	
    });
    
    </script>
{% endblock %}
        
{% block css_import %}
    {{ block.super }}
    <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/tabs.css" type="text/css" media="screen, projection" />
    <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/nyroModal.css" type="text/css"/>
    <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/js/login_ajax/login_ajax.css" type="text/css"/>
{% endblock %}
    
{% block body %}
    {{ block.super }}
    <div class="container">
    <div id="header" class="span-24 last">      
        {% block header %}
        <div id="header_left" class="span-24 last">
                   <a href="{% url ldt.ldt_utils.views.workspace %}">{% block base_title %}{% trans "header_title" %}{% endblock %}</a>
        </div>
        {% endblock %}
    </div>
    <div id="content" class="span-24 last">
    
        <div id="toolbar" class="span-24 last">
        {% block toolbar %}
            <div class="block span-24 last">
                <div id="tabsdiv" class="block span-20">
                {% if user.is_authenticated %}
                {% url ldt.ldt_utils.views.workspace as workspace_url %}
                {% url ldt.ldt_utils.views.list_ldt as space_url %}
                {% url ldt.ldt_utils.views.list_content as content_url %}
                {% url ldt.user.views.profile  as profile_url %}
                    <ul class="tabs">
                        <li class='{% active request "active" workspace_url %}'><a href="{{ workspace_url }}" >{% trans "home" %}</a></li>
                        <!--li class='{% active request "active" content_url %}'><a href="{{ content_url }}">{% trans "contents" %}</a></li>
                        <li class='{% active request "active" space_url %}'><a href="{{ space_url }}">{% trans "indexation projects" %}</a></li>
                        <li class='{% active request "active" "" %}'><a href="#">{% trans "accounts" %}</a></li>
                        <li class='{% active request "active" profile_url %}'><a href="{{ profile_url }}" >{% trans "Profiles" %}</a> </li-->
                    </ul>
                {% endif %}
                </div>
                <div id="loginstate" class="block span-4 last">
                {% if user.is_authenticated %}
                {{user.username}}&nbsp;|&nbsp;<a href="{% url ldt.user.views.logout_view %}" >{% trans "Log out" %}</a>
                {% endif %}
                </div>
            </div>
            {% if LANGUAGES.1 %}
              <div id="language_chooser">            
                <form action="{{BASE_URL}}enmi/i18n/setlang/" method="post">
                <input name="next" type="hidden" value="" />
                <label >{% trans "Langue" %}&nbsp;: </label>
                <select name="language"  onchange="submit()">
                {% for lang in LANGUAGES %}
                <option value="{{ lang.0 }}"{% ifequal lang.0 LANGUAGE_CODE %} selected="selected"{% endifequal %}>{% trans lang.1 %}</option>
                {% endfor %}    
                </select>        
                </form>            
              </div>  
            {% endif %}
        {% endblock %}
        </div>
        <div id="inner_content" class="span-24 last">
        {% block content %}{% endblock %}
        </div>      
    </div>
    <div id="footer" class="span-24 last">
        {% block footer %}
        <div class="footer_img">
        <a href="http://www.iri.centrepompidou.fr"><img src="{{LDT_MEDIA_PREFIX}}/img/logo_IRI_footer.png" alt="Logo IRI" /></a>
        </div>
        <div style="float: right; text-align: right;" class="small" id="copyright_version">
            <div>©2011 <a style="text-decoration: none; color: #4F5155;" href="http://www.iri.centrepompidou.fr">IRI</a></div>
            <div id="versionwrapper"><span class="version" id="version">{{VERSION}}</span></div>
        </div>
        {% endblock %}
    </div>
    </div>
{% endblock %}
