{% extends "admin/change_list.html" %}
{% load admin_list i18n cms_admin cms_js_tags %}
{% block title %}{% trans "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 %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}cms/css/pages.css"/>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}cms/jstree/tree_component.css" />
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}cms/css/jquery.dialog.css" />

{{ block.super }}
<script type="text/javascript" src="{% admin_static_url %}js/jquery.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/csrf.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.livequery.js"></script>

<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.ui.core.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.bind.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.ui.checkbox.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.ui.effects.core.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.ui.effects.highlight.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.form.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/jstree/_lib/_all.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/jstree/tree_component.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.ui.dialog.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/jquery.functional.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/classy.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/plugins/cms.setup.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/plugins/cms.base.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/change_list.js"></script>


{% if cl.is_filtered %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}cms/jstree/themes/default/style.css" />
{% endif %}
{% endblock %}

{% block content %}
<script type="text/javascript">
//<![CDATA[	
(function namespacing($) {
	$(document).ready(function() {
		{% if not cl.is_filtered %}
			initTree();
		{% endif %}		
	});
	
	showchangelistfilter = function(){
		$("#changelist-filter").toggle();
	}
	moveSuccess = function(node){
		var msg = $({% javascript_string %}<span class="success">{% trans "Successfully moved" %}</span>{% end_javascript_string %});
		node.append(msg);
	    msg.fadeOut(3000);
	}
	moveError = function(node,message){
        if(message && message!="error") {
            var msg = $({% javascript_string %}<span class="success">{% end_javascript_string %}+message+{% javascript_string %}</span>{% end_javascript_string %});
        }
        else {
            var msg = $({% javascript_string %}<span class="success">{% trans "An error occured. Please reload the page" %}</span>{% end_javascript_string %});
        }
		node.append(msg);
	}
	// some settings used by javascript functions

	cmsSettings = {
		cmsPermission: {{ CMS_PERMISSION|js }},
		debug: {{ DEBUG|js }}
	};
})(window.CMS.$);
//]]>
</script>


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

{% block object-tools %}

	<ul class="object-tools">
		{% if has_recover_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>
	
	{% include "admin/cms/page/loading.html" %}

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


{% if cl.has_access_to_multiple_sites %}
	<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>
{% else %}
	<input type="hidden" id="site-select" value="{{ cl.sites.0.pk }}">
{% endif %}

{% 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">{% trans "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>

<div id="dialogs"></div>

{% endblock %}
