{% extends "ldt/ldt_base.html" %}
{% load i18n %}

{% block js_import %}
{{block.super}}
    <script type="text/javascript" src="{% url ldt.jsi18n packages='ldt' %}" ></script>
    <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/projectscontents.js" ></script>
{% endblock %}


{% block js_declaration %}
{{block.super}}
<script type="text/javascript">

var content_filter_url = "{% url ldt.ldt_utils.views.content.contents_filter filter='__FILTER__' %}";
var project_filter_url = "{% url ldt.ldt_utils.views.project.projects_filter filter='__FILTER__' is_owner='true' status='0' %}";
var publish_project_url = "{% url ldt.ldt_utils.views.project.publish '__PROJECT_ID__' %}";
var unpublish_project_url = "{% url ldt.ldt_utils.views.project.unpublish '__PROJECT_ID__' %}";


function init_events(base_node) {

	init_events_all(base_node, "{% url ldt.ldt_utils.views.workspace.popup_embed %}", content_filter_url, project_filter_url, publish_project_url, unpublish_project_url);
	
}
	
var global_csrf_token = "{{ csrf_token }}";

$(document).ready(function(){
	
	input_list_init = [
		{'input_selector':"#searchcontentsinput", 'container_selector':"#contentslistcontainer", 'url':content_filter_url},
		{'input_selector':"#searchprojectsinput", 'container_selector':"#projectslistcontainer", 'url':project_filter_url}
	];
	
	searchFieldInit(input_list_init);
	
	init_events(document);

});
</script>

{% endblock %}

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

{% block content %}
<div class="span-24 last" id="allcontentsdiv">
	<div class="span-12" id="contentsdiv">
	    <div class="span-12 last titlediv" >
			<div class="span-8 projectscontentstitle">{% trans "content list" %}
			<a class='content_link_create' href="{% url ldt.ldt_utils.views.content.write_content %}" ><img class='icon_title' src="{{LDT_MEDIA_PREFIX}}img/film_add.png" alt="{% trans 'Create content' %}" title="{% trans 'Create content' %}" /></a></div>
			<div class="span-4 last searchfielddiv" >
			    <div class="searchfield rounded"><input id="searchcontentsinput" class="searchfieldinput searchfieldinputbase" value="{% trans 'search' %}" type="text" /><img id="contentsajaxloader" class="searchajaxloader" src="{{LDT_MEDIA_PREFIX}}/img/ajax-loader-16x16.gif" alt="loader"/><img id="contentsclear" class="searchclear" src="{{LDT_MEDIA_PREFIX}}img/clear-left.png"/></div>
			</div>
		</div>
		<div class="span-12 last projectscontentsdiv" id="contentslistcontainer">
		{% include "ldt/ldt_utils/partial/contentslist.html" %}
		</div>
	</div>
	<div class="span-12 last" id="projectsdiv">
		<div class="span-12 last titlediv" >
			<div class="span-8 projectscontentstitle" >{% trans "My projects" %}
			<a class='ldt_link_create_project' href="{% url ldt.ldt_utils.views.project.create_ldt_view %}" ><img class='icon_title' src="{{LDT_MEDIA_PREFIX}}img/page_add_large.png" alt="{% trans 'Create project' %}" title="{% trans 'Create project' %}" /></a></div>
			<div class="span-4 last searchfielddiv" >
			    <div class="searchfield rounded"><input id="searchprojectsinput" class="searchfieldinput searchfieldinputbase" value="{% trans 'search' %}" type="text" /><img id="projectsajaxloader" class="searchajaxloader" src="{{LDT_MEDIA_PREFIX}}/img/ajax-loader-16x16.gif" alt="loader"/><img id="projecsclear" class="searchclear" src="{{LDT_MEDIA_PREFIX}}img/clear-left.png"/></div>
			</div>
		</div>
		<div class="span-12 last projectscontentsdiv" id="projectslistcontainer">
		{% include "ldt/ldt_utils/partial/projectslist.html" %}
		</div>
	</div>
</div>
{% endblock %}
