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

{% block js_import %}
{{block.super}}
	<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.contentsfilter filter='__FILTER__' %}";
var project_filter_url = "{% url ldt.ldt_utils.views.projectsfilter filter='__FILTER__' is_owner='false' status='2' %}";
var publish_project_url = "{% url ldt.ldt_utils.views.publish '__PROJECT_ID__' 'false' %}";
var unpublish_project_url = "{% url ldt.ldt_utils.views.unpublish '__PROJECT_ID__' 'false' %}";


function init_events(base_node) {

	init_events_all(base_node, "{% url ldt.ldt_utils.views.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 last" id="searchprojectsdiv">
		<div class="span-12 last titlediv" >
			<div class="span-8 projectscontentstitle" >{% trans "Search" %}</div>
		</div>
		<div class="span-12 last projectscontentsdiv" id="autre">
		<form method="post" id="my_form"
			action="{% url ldt.ldt_utils.views.searchIndex %}"
			accept-charset="utf-8">
		{% csrf_token %}
		<table>
			{{ form.as_table }}
		</table>
		<input type="submit" class="search_submit" /></form>
		</div>
	</div>		
	<div class="span-12 last" id="projectsdiv">
		<div class="span-12 last titlediv" >
			<div class="span-8 projectscontentstitle" >{% trans "Published projects" %}
			&nbsp;<a class='ldt_link_create' href="{% url ldt.ldt_utils.views.create_ldt_view %}" ><img src="{{LDT_MEDIA_PREFIX}}img/page_add.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/publishedprojectslist.html" %}
		</div>
	</div>
</div>
{% endblock %}
