<commit_before>{% extends "admin/change_list.html" %}
{% load i18n admin_modify adminmedia %}

{% block title %}{{ block.super }}{% endblock %}

{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="../../../jsi18n/"></script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>

<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.livequery.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.alerts.js"></script>

<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}helper.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}listener.js"></script>

<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.treeTable.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.json-1.3.js"></script>
<script type="text/javascript">

    {% include "admin/feincms/_messages.html" %}

    ancestors = [{% for item in object_list %}'{{ item.parent_id|default_if_none:"0" }}'{% if not forloop.last %}, {% endif %}{% endfor %}];

    tablestr = '';
    {% for item, title, item_properties in tree_editor.object_list %}
    tablestr += add_row({{ forloop.counter }}, {{ item.id }}, "{{ item.parent_id|default_if_none:"-1" }}", "{{ title|escapejs }}",
        [{% for property in item_properties %}"{{ property|escapejs }}"{% if not forloop.last %}, {% endif %}{% endfor %}]);{% endfor %}

    function add_row(node_id, item_id, parent_id, item_title, attrs) {
        var str = '<tr id="node-' + node_id + '" class="item-id-' + item_id + ' ';
        if (parseInt(parent_id) >= 0)
            str += 'child-of-node-'+ancestors.indexOf(parent_id);
        str += '">';
        str += '<td><div class="wrap nohover">';
        str += '<div class="insert-as-child"></div>';
        str += '<span class="title-col"><a href="'+item_id+'/"><strong>'+item_title+'</strong></a><img class="move-node" src="{{ FEINCMS_ADMIN_MEDIA }}img/icon_move.gif" /></span>';
        str += '<div class="insert-as-sibling"></div>';
        str += '</div></td>';
        for (key in attrs)
            str += attrs[key];
        str += '<td><img class="del-page" src="{{ FEINCMS_ADMIN_MEDIA }}img/icon_deletelink.gif"/></td></tr>';
        return str;
    }

    $(document).ready(function()  {
            // build table
            $("#sitetree tbody").append(tablestr);
            // register
            $("#sitetree").treeTable();
            // configure draggable
            $("#sitetree .title-col").draggable({
              helper:  function(){ return $(this).parent().clone(); } ,
              handle: ".move-node",
              opacity: .75,
              refreshPositions: true,
              revert: "invalid",
              revertDuration: 300,
              scroll: true
            });
            // configure droppable to insert as child
            $("#sitetree .insert-as-child").each(function() {
              $(this).droppable({
                accept: ".title-col",
                tolerance: "intersect",
                drop: function(e, ui) {
                    handle_drop_event($(ui.draggable).parents("tr"), $(this).parents("tr"), "child")
                },
                over: function(e, ui) {
                  $(this).parent().removeClass("nohover").addClass("hover-as-child");
                },
                out: function(e, ui) {
                  $(this).parent().removeClass("hover-as-child").addClass("nohover");
                }
              });
            });
            // configure droppable to insert as sibling
            $("#sitetree .insert-as-sibling").each(function() {
              $(this).droppable({
                accept: ".title-col",
                tolerance: "intersect",
                drop: function(e, ui) {
                    handle_drop_event($(ui.draggable).parents("tr"), $(this).parents("tr"), "sibling")
                },
                over: function(e, ui) {
                  var row = '<div style="background-color:#bcf; height:4px; width:100%; margin:-8px 0px 4px -5px; position:relative; z-index:10;"></div>'
                  $(row).insertBefore($(this).parent());
                },
                out: function(e, ui) {
                  $(this).parent().prev().remove();
                }
              });
            });

            $(".wrap").live('click',function() {
                if ($(this).find(".expander").length > 0)
                    $(this).parents("tr").toggleBranch();
            });

            $(".save_tree").click(function(){
                    save_page_tree();
            });

            $(".del-page").click(function(){
                handle_page_delete($(this).parents("tr"));
            });

    });

    function expandall(yesno) {
        if(yesno) {
            var elems = $('#sitetree tr.collapsed');

            if(elems.length)
                elems.expand().removeClass('collapsed').addClass('expanded');
        } else {
            var elems = $('#sitetree tr.expanded');

            for(var i=elems.length; i>=0; i--)
                $(elems[i]).collapse().removeClass('expanded').addClass('collapsed');
        }

        return false;
    }
</script>

<link rel="stylesheet" type="text/css" href="{{ FEINCMS_ADMIN_MEDIA }}css/layout.css" />
<link rel="stylesheet" type="text/css" href="{{ FEINCMS_ADMIN_MEDIA }}css/jquery.alerts.css" media="screen" />
<link href="{{ FEINCMS_ADMIN_MEDIA }}css/jquery.treeTable.css" rel="stylesheet" type="text/css" />

{% endblock %}

{% block content %}

<div id="content-main">
    {% block object-tools %}
    {% if has_add_permission %}
    <ul class="object-tools"><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></ul>
    {% endif %}
    {% endblock %}

    <input type="button" value="{% trans "Save tree" %}" class="save_tree" style="float:right;margin:0 1px 0 0" />

    <div id="sitetree-wrapper" style="clear:both">

    <div style="padding-bottom: 5px;">
        <a href="#" onclick="return expandall(1)">{% trans "Expand all" %}</a>
        <a href="#" onclick="return expandall(0)">{% trans "Collapse all" %}</a>
    </div>

    <table id="sitetree" border="1">
        <thead>
        <tr id="table_header">
        {% for header in result_headers %}
            <th{% if forloop.first %} style="min-width:400px"{% endif %}>{{ header.text|capfirst }}<commit_msg>This was an example for wasted space<commit_after>{% extends "admin/change_list.html" %}
{% load i18n admin_modify adminmedia %}

{% block title %}{{ block.super }}{% endblock %}

{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="../../../jsi18n/"></script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>

<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.livequery.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.alerts.js"></script>

<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}helper.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}listener.js"></script>

<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.treeTable.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.json-1.3.js"></script>
<script type="text/javascript">

    {% include "admin/feincms/_messages.html" %}

    ancestors = [{% for item in object_list %}'{{ item.parent_id|default_if_none:"0" }}'{% if not forloop.last %}, {% endif %}{% endfor %}];

    tablestr = '';
    {% for item, title, item_properties in tree_editor.object_list %}
    tablestr += add_row({{ forloop.counter }}, {{ item.id }}, "{{ item.parent_id|default_if_none:"-1" }}", "{{ title|escapejs }}",
        [{% for property in item_properties %}"{{ property|escapejs }}"{% if not forloop.last %}, {% endif %}{% endfor %}]);{% endfor %}

    function add_row(node_id, item_id, parent_id, item_title, attrs) {
        var str = '<tr id="node-' + node_id + '" class="item-id-' + item_id + ' ';
        if (parseInt(parent_id) >= 0)
            str += 'child-of-node-'+ancestors.indexOf(parent_id);
        str += '">';
        str += '<td><div class="wrap nohover">';
        str += '<div class="insert-as-child"></div>';
        str += '<span class="title-col"><a href="'+item_id+'/"><strong>'+item_title+'</strong></a><img class="move-node" src="{{ FEINCMS_ADMIN_MEDIA }}img/icon_move.gif" /></span>';
        str += '<div class="insert-as-sibling"></div>';
        str += '</div></td>';
        for (key in attrs)
            str += attrs[key];
        str += '<td><img class="del-page" src="{{ FEINCMS_ADMIN_MEDIA }}img/icon_deletelink.gif"/></td></tr>';
        return str;
    }

    $(document).ready(function()  {
            // build table
            $("#sitetree tbody").append(tablestr);
            // register
            $("#sitetree").treeTable();
            // configure draggable
            $("#sitetree .title-col").draggable({
              helper:  function(){ return $(this).parent().clone(); } ,
              handle: ".move-node",
              opacity: .75,
              refreshPositions: true,
              revert: "invalid",
              revertDuration: 300,
              scroll: true
            });
            // configure droppable to insert as child
            $("#sitetree .insert-as-child").each(function() {
              $(this).droppable({
                accept: ".title-col",
                tolerance: "intersect",
                drop: function(e, ui) {
                    handle_drop_event($(ui.draggable).parents("tr"), $(this).parents("tr"), "child")
                },
                over: function(e, ui) {
                  $(this).parent().removeClass("nohover").addClass("hover-as-child");
                },
                out: function(e, ui) {
                  $(this).parent().removeClass("hover-as-child").addClass("nohover");
                }
              });
            });
            // configure droppable to insert as sibling
            $("#sitetree .insert-as-sibling").each(function() {
              $(this).droppable({
                accept: ".title-col",
                tolerance: "intersect",
                drop: function(e, ui) {
                    handle_drop_event($(ui.draggable).parents("tr"), $(this).parents("tr"), "sibling")
                },
                over: function(e, ui) {
                  var row = '<div style="background-color:#bcf; height:4px; width:100%; margin:-8px 0px 4px -5px; position:relative; z-index:10;"></div>'
                  $(row).insertBefore($(this).parent());
                },
                out: function(e, ui) {
                  $(this).parent().prev().remove();
                }
              });
            });

            $(".wrap").live('click',function() {
                if ($(this).find(".expander").length > 0)
                    $(this).parents("tr").toggleBranch();
            });

            $(".save_tree").click(function(){
                    save_page_tree();
            });

            $(".del-page").click(function(){
                handle_page_delete($(this).parents("tr"));
            });

    });

    function expandall(yesno) {
        if(yesno) {
            var elems = $('#sitetree tr.collapsed');

            if(elems.length)
                elems.expand().removeClass('collapsed').addClass('expanded');
        } else {
            var elems = $('#sitetree tr.expanded');

            for(var i=elems.length; i>=0; i--)
                $(elems[i]).collapse().removeClass('expanded').addClass('collapsed');
        }

        return false;
    }
</script>

<link rel="stylesheet" type="text/css" href="{{ FEINCMS_ADMIN_MEDIA }}css/layout.css" />
<link rel="stylesheet" type="text/css" href="{{ FEINCMS_ADMIN_MEDIA }}css/jquery.alerts.css" media="screen" />
<link href="{{ FEINCMS_ADMIN_MEDIA }}css/jquery.treeTable.css" rel="stylesheet" type="text/css" />

{% endblock %}

{% block content %}

<div id="content-main">
    {% block object-tools %}
    {% if has_add_permission %}
    <ul class="object-tools"><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></ul>
    {% endif %}
    {% endblock %}

    <input type="button" value="{% trans "Save tree" %}" class="save_tree" style="float:right;margin:0 1px 0 0" />

    <div style="padding-top: 10px;">
        <a href="#" onclick="return expandall(1)">{% trans "Expand all" %}</a>
        <a href="#" onclick="return expandall(0)">{% trans "Collapse all" %}</a>
    </div>

    <div id="sitetree-wrapper" style="clear:both">
    <table id="sitetree" border="1">
        <thead>
        <tr id="table_header">
        {% for header in result_headers %}
            <th{% if forloop.first %} style="min-width:400px"{% endif %}>{{ header.text|capfirst }}
{'fraction_non_alphanumeric': 0.1973901304934753, 'fraction_numerical': 0.006674666266686666, 'mean_word_length': 2.391403865717192, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 137, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6881290', 'n_tokens_mistral': 4265, 'n_tokens_neox': 4038, 'n_words': 740}