{% 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.kiwimedias_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_introduction').BOF_Editor({
                'url_preview': "{% if original %}{% url news-admin-entry-object-introduction-preview original.id %}{% else %}{% url news-admin-entry-introduction-preview %}{% endif %}",
                'syntax_help': "{% url news-syntax_help %}?configset_name=short",
                'with_alert': true,
                'alert_position': "bottom",
                'csrf_token': "csrftoken",
                'with_wikibar': true{% if original %}
                {% endif %}
            });
        });
        $(document).ready(function(){
            MEDIAS_URL = "{{ metas.medias_url }}";
            $('#id_content').BOF_Editor({
                'url_preview': "{% if original %}{% url news-admin-entry-object-content-preview original.id %}{% else %}{% url news-admin-entry-content-preview %}{% endif %}",
                'syntax_help': "{% url news-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 %}
