{% extends "admin/change_list.html" %}
{% load adminmedia admin_list i18n cms_tags %}
{% block title %}List of pages{% endblock %}
{% block bodyclass %}change-list{% endblock %}

{% if not is_popup %}{% block breadcrumbs %}
    <div class="breadcrumbs">
    <a href="../../">{% trans "Home" %}</a> &rsaquo; 
    <a href="../">{{ app_label|capfirst|escape }}</a> &rsaquo; {{ opts.verbose_name_plural|capfirst|escape }}
    </div>
{% endblock %}{% endif %}

{% block coltype %}flex{% endblock %}
{% block extrahead %}{{ block.super }}

<link rel="stylesheet" type="text/css" href="{{ CMS_MEDIA_URL }}css/pages.css"/>
<link rel="stylesheet" type="text/css" href="{{ CMS_MEDIA_URL }}jstree/tree_component.css" />
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}jstree/_lib/_all.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}jstree/tree_component.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}javascript/change_list.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}jstree/_lib/jquery.cookie.js"></script>
{% if cl.is_filtered %}
<link rel="stylesheet" type="text/css" href="{{ CMS_MEDIA_URL }}jstree/themes/default/style.css" />
{% endif %}
{% endblock %}

{% block content %}
<script type="text/javascript">
	function showchangelistfilter(){
		$("#changelist-filter").toggle();
	}
	function moveSuccess(node){
		var msg = $('<span class="success">{% trans "Successfully moved" %}</span>');
		node.append(msg);
	    msg.fadeOut(3000);
	}
	function moveError(node){
		var msg = $('<span class="success">An error occured. Please reload the page</span>');
		node.append(msg);
	}
	
	$(document).ready(function() {
		{% if not cl.is_filtered %}
		initTree();
		{% endif %}
		
	});	
</script>

<div id="content-main"{% if cl.is_filtered %} class="activ-filter"{% endif %}>

{% block object-tools %}

<ul class="object-tools">
	{% if has_change_permission %}
		<li><a href="recover/" class="recoverlink">{% blocktrans with cl.opts.verbose_name_plural|escape as name %}Recover deleted {{name}}{% endblocktrans %}</a></li>
	{% endif %}
	{% if has_add_permission %}
	<li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}</a></li>
	{% endif %}
</ul>

{% endblock %}
<div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
{% block search %}

<div id="site-selector">
{% trans "Pages on:" %}
<select id="site-select">{% for site in cl.sites %}
	<option {% ifequal site.pk cl.current_site.pk %}selected {% endifequal %}value="{{ site.pk }}">{{ site.name }}</option>{% endfor %}
</select>
</div>
{% search_form cl %}
{% endblock %}
{% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}

{% block filters %}
{% if cl.has_filters %}


<a href="javascript:showchangelistfilter();" id="changelist-filter-button">Filter: {% if cl.is_filtered %}{% trans "on" %}{% else %}{% trans "off" %}{% endif %}</a>
<div id="changelist-filter" style="display:none;">
<h2>{% trans 'Filter' %}</h2>
{% for spec in cl.filter_specs %}
   {% clean_admin_list_filter cl spec %}
{% endfor %}
</div>
{% endif %}
{% endblock %}

{% include "admin/cms/page/change_list_tree.html" %}

</div>
</div>

{% endblock %}
