{% extends "admin/change_form.html" %}

{% block extrahead %}{{ block.super }}
    <script type="text/javascript" src="{{ metas.medias_url }}js/jquery/jquery-1.6.4.min.js"></script>
    <script type="text/javascript" src="{{ metas.medias_url }}js/jquery/jquery.flash.js"></script>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="{{ metas.medias_url }}js/jquery/plugins/gmap3.min.js"></script>
    
    <style type="text/css">@import url('{{ metas.medias_url }}css/wiki.css');</style>
    
    <style type="text/css">@import url('{{ metas.kiwimedias_url }}js/bof_editor/wikibar/ui.css');</style>
    <script type="text/javascript" src="{{ metas.kiwimedias_url }}js/bof_editor/wikibar/api.js"></script>
    
    <style type="text/css">@import url('{{ metas.kiwimedias_url }}js/bof_editor/ui.css');</style>
    <script type="text/javascript" src="{{ metas.kiwimedias_url }}js/bof_editor/api.js"></script>
    <script type="text/javascript" src="{{ metas.kiwimedias_url }}js/admin.js"></script>
    
    <script language="JavaScript" type="text/javascript">
    //<![CDATA[
        $(document).ready(function(){
            MEDIAS_URL = "{{ metas.medias_url }}";
            $('#id_text').BOF_Editor({
                {% comment %}'url_preview': "{% if original %}{% url kiwi-syntax-wikipage-preview original.id %}{% else %}{% url kiwi-syntax-preview %}{% endif %}",{% endcomment %}
                'url_preview': "{% if original %}{% url kiwi-syntax-wikipage-preview original.uri %}{% else %}{% url kiwi-syntax-preview %}{% endif %}",
                'syntax_help': "{% url kiwi-syntax-help %}",
                'with_alert': true,
                'alert_position': "bottom",
                'csrf_token': "csrftoken",
                'with_wikibar': true{% if original %},
                'wikibar_options': {
                    'with_attachment': true,
                    'syntax_schema': {
                        'attachment': {
                            'label':"Insérer un lien vers le fichier séléctionné",
                            'access_key':"f",
                            'enclosure': ["[", "]", "Séléctionnez un fichier", jQuery.fn.Wikibar.putAttachMacro],
                            'control_activation': 'with_attachment',
                            'item_list': [{% for item in original.attached_files.all %}
                                ["{{ item.id }}", "{{ item }}"],{% endfor %}
                            ]
                        }
                    }
                }{% endif %}
            });
        });
    //]]>
    </script>
{% endblock %}
