{% extends "base.html" %}
{% load i18n %}

{% block js_declaration %}
{{block.super}}
<script type="text/javascript">
$(document).ready(function(){
        	$('.ldt_link').nyroModal({
            	type: 'iframe',
            	forceType: 'iframe',
        		height:662, 
        		width:1022,
        		bgColor: 'rgb(239, 239, 239)',
        		padding: 5,
        		titleFromIframe: false
            	});
            $('.ldt_link_create').nyroModal({
                type: 'iframe',
                forceType: 'iframe',
                height:662, 
                width:1022,
                bgColor: 'rgb(239, 239, 239)',
                padding: 5,
                titleFromIframe: false,
                beforeHideContent: function(elts, settings, callback){
	                try {
		                var res = $('#ldtInitSwf',$('#nyroModalIframe').contents());
		                if(res.length > 0)
		                {              
		                	   res.get(0).forceSave();
		                }
	                }
	                catch(err)
	                {
		                // do nothing
	                }                   
	                callback();
	            }
                });
});
</script>

{% endblock %}

{% block css_import %}
{{block.super}}
    <link rel="stylesheet" href="{{BASE_URL}}static/css/workspace.css" type="text/css"/>
{% endblock %}

{% block content %}

<div class="span-24 last" id="contentsdiv">
<h1>{% trans "content list" %}</h1>
<table>
{% for content in contents %}
    <tr>
        <td>{{ content.title }}</td>
        <td><a href="{% url ldt.ldt_utils.views.index content.iri_id %}" class="ldt_link">{% trans "open ldt" %}</a></td>
        <td><a href="{% url ldt.ldt_utils.views.create_project content.iri_id %}" class="ldt_link_create">{% trans "create project" %}</a></td>
        <td><a href="{% url ldt.ldt_utils.views.project_json_externalid content.external_id %}" class="ldt_link">{% trans "link json by externalid" %}</a></td>
    </tr>
{% endfor %}
</table>
</div>

<div class="span-24 last" id="projectsdiv">
<h1>{% trans "project list" %}</h1>
<table>
{% for project in projects %}
    <tr>
        <td>{{ project.title }}</td>
        <td><a href="{% url ldt.ldt_utils.views.indexProject project.ldt_id %}" class="ldt_link">{% trans "open ldt" %}</a></td>
        <td><a href="{% url ldt.ldt_utils.views.copy_project project.ldt_id %}" class="ldt_link_create">{% trans "copy project" %}</a></td>
        <td><a href="{% url ldt.ldt_utils.views.project_json_id project.ldt_id %}" class="ldt_link">{% trans "link json by id" %}</a></td>
    </tr>
{% endfor %}
</table>
</div>

{% endblock %}
