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

<!-- LOADING -->
{% load admin_static i18n fb_tags fb_versions %}

<!-- JAVASCRIPTS -->
{% block extrahead %}
    {{ block.super }}
    <script type="text/javascript" src="{% static "admin/js/jquery.min.js" %}"></script>
    <script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
    {% ifequal query.pop '1' %} <!-- FileBrowseField -->
    <script language="javascript" type="text/javascript" src="{% static "filebrowser/js/FB_FileBrowseField.js" %}"></script>
    {% endifequal %}
    {% ifequal query.pop '2' %} <!-- TinyMCE -->
    <script language="javascript" type="text/javascript" src="{% static "tiny_mce/tiny_mce_popup.js" %}"></script>
    <script language="javascript" type="text/javascript" src="{% static "filebrowser/js/FB_TinyMCE.js" %}"></script>
    {% if query.mce_rdomain %}<script language="javascript">document.domain = "{{ query.mce_rdomain }}"</script>{% endif %}
    {% endifequal %}
{% endblock %}

<!-- CONTENT -->
{% block content %}
    {% if fileobject.filetype == "Image" %}
        {% version_object fileobject.path settings_var.ADMIN_THUMBNAIL as thumbnail_version %}
        {% version_object fileobject.path query.version as image_version %}
        {% ifequal query.pop '1' %} <!-- FileBrowseField -->
        <script type="text/javascript" charset="utf-8">
            (function($) {
                $(document).ready(function() {
                    FileSubmit('{{ image_version.path }}', '{{ image_version.url }}', '{{ thumbnail_version.url }}', '{{ image_version.filetype }}');
                });
            })(django.jQuery);
        </script>
        {% endifequal %}
        {% ifequal query.pop '2' %} <!-- TinyMCE -->
        <script type="text/javascript" charset="utf-8">
            (function($) {
                $(document).ready(function() {
                    FileBrowserDialogue.fileSubmit('{{ image_version.url|escapejs }}');
                });
            })(django.jQuery);
        </script>
        {% endifequal %}
    {% endif %}
{% endblock %}

