<!DOCTYPE html>
<html lang="en">
    <head>
        <title>{{ theme.getThemeConfig("theme_title") }}</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="token" content="{{ csrfToken }}"/>
        <link rel="shortcut icon" href="{{ theme.uri("img/favicon.ico") }}" />

        <link href="{{ theme.uri("libraries/bootstrap/css/bootstrap.min.css") }}?{{ version }}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("libraries/font-awesome/css/font-awesome.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/select2/css/select2.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/select2/css/select2-bootstrap.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/jquery-timepicker/jquery.timepicker.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/bootstrap-slider-master/bootstrap-slider.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/bootstrap-ekko-lightbox/ekko-lightbox.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/bootstrap-switch/bootstrap-switch.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/bootstrap-tagsinput-master/bootstrap-tagsinput.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/calendar/css/calendar.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/morrisjs/morris.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/datatables/dataTables.bootstrap.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/datatables/buttons.dataTables.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/jquery/jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.min.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/jquery-file-upload/css/jquery.fileupload.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/jquery-file-upload/css/jquery.fileupload-ui.css") }}?{{ version }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/toastr/toastr.min.css") }}" rel="stylesheet">
        <link href="{{ theme.uri("libraries/bootstrap-tour/bootstrap-tour.min.css") }}" rel="stylesheet">
        <link href="{{ theme.uri("css/dashboard.css") }}?{{ version }}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/timeline.css") }}?{{ version }}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/xibo.css") }}?{{ version }}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/calendar.css") }}?{{ version }}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/override.css") }}?{{ version }}" rel="stylesheet" media="screen">
        <link href="{{ urlFor("library.font.css") }}" rel="stylesheet">
        <!-- Copyright 2006-2018 Spring Signage Ltd. Part of the Xibo Open Source Digital Signage Solution. Released under the AGPLv3 or later. -->
        <!-- Please be sure you read this before removing the Source/About links from your theme: http://bit.ly/agplv3 -->
        {% block headContent %}{% endblock %}
    </head>
    <body>
        {% block content %}{% endblock %}

        <script src="{{ theme.uri("libraries/jquery/jquery-1.11.1.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery/jquery.validate.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery/additional-methods.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap/js/bootstrap.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap/js/bootbox.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap-switch/bootstrap-switch.min.js") }}?{{ version }}"></script>

        {# Datatables #}
        <script src="{{ theme.uri("libraries/datatables/jquery.dataTables.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/datatables/dataTables.bootstrap.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/datatables/dataTables.buttons.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/datatables/buttons.colVis.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/datatables/buttons.print.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/datatables/buttons.html5.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/datatables/buttons.flash.min.js") }}?{{ version }}"></script>

        <script src="{{ theme.uri("libraries/jquery/jquery-ui/jquery-ui-1.10.2.custom.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js") }}?{{ version }}"></script>

        <script src="{{ theme.uri("libraries/select2/js/select2.full.js") }}?{{ version }}"></script>

        <script src="{{ theme.uri("libraries/bootstrap-ekko-lightbox/ekko-lightbox.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/underscore/underscore-min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jstimezonedetect/jstz.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/ckeditor/ckeditor.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap/js/bootstrap-ckeditor-fix.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/tmpl.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-load-image/load-image.all.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.iframe-transport.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload-process.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload-resize.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload-validate.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload-ui.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload-image.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload-video.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-file-upload/js/jquery.fileupload-audio.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-message-queuing/jquery.ba-jqmq.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-throttle-debounce/jquery.ba-throttle-debounce.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/toastr/toastr.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap-tour/bootstrap-tour.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/date-time-format.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/momentjs/moment.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/momentjs/moment-timezone.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/morrisjs/raphael.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/morrisjs/morris.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/chartjs/Chart.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/colors/colors.min.js") }}?{{ version }}"></script>

        <script src="{{ theme.uri("js/xibo-cms.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("js/xibo-forms.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("js/xibo-preview-timeline.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("js/xibo-calendar.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("js/xibo-datasets.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/handlebars/handlebars-v3.0.0.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-serialize-object/jquery.serialize-object.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap-tagsinput-master/bootstrap-tagsinput.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/jquery-timepicker/jquery.timepicker.min.js") }}?{{ version }}"></script>
        <script src="{{ theme.uri("libraries/bootstrap-slider-master/bootstrap-slider.min.js") }}?{{ version }}"></script>

        {# Dates #}
        {% if settings.CALENDAR_TYPE == "Jalali" %}
            <script src="{{ theme.uri("libraries/bootstrap-datetimepicker/js/jalali-date.js") }}?{{ version }}"></script>
            <script src="{{ theme.uri("libraries/bootstrap-datetimepicker/js/bootstrap-datetimepicker-jalali.min.js") }}?{{ version }}"></script>
            <script src="{{ theme.uri("libraries/calendar/js/calendar-jalali.js") }}?{{ version }}"></script>
            <script src="{{ theme.uri("libraries/momentjs/moment-jalali.js") }}?{{ version }}"></script>
            <script type="text/javascript">
                moment.loadPersian();
            </script>
        {% else %}
            <script src="{{ theme.uri("libraries/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js") }}?{{ version }}"></script>
            <script src="{{ theme.uri("libraries/calendar/js/calendar.js") }}?{{ version }}"></script>
        {% endif %}

        {# Handle the inclusion of i18n #}
        {% set calendarTranslation %}libraries/calendar/js/language/{{ translate.jsShortLocale }}.js{% endset %}
        {% if theme.fileExists(calendarTranslation) %}
            <script src="{{ theme.uri(calendarTranslation) }}"></script>
        {% endif %}

        {% set datePickerTranslation %}libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.{{ translate.jsShortLocale }}.js{% endset %}
        {% if theme.fileExists(datePickerTranslation) %}
            <script src="{{ theme.uri(datePickerTranslation) }}"></script>
        {% endif %}

        {% set selectPickerTranslation %}libraries/select2/js/i18n/{{ translate.jsShortLocale }}.js{% endset %}
        {% if theme.fileExists(selectPickerTranslation) %}
            <script src="{{ theme.uri(selectPickerTranslation) }}"></script>
        {% endif %}

        <script type="text/javascript">
            // Default theme for select2
            $.fn.select2.defaults.set( "theme", "bootstrap" );

            var translations = {{ translations|raw }};
            // Translations we want always available
            {% autoescape "js" %}
            translations.withselected = "{{ "With Selected"|trans }}";
            translations.selectAll = "{{ "Select All"|trans }}";
            translations.multiselect = "{{ "Multiple Items Selected"|trans }}";
            translations.multiselectNoItemsMessage = "{{ "Sorry, no items have been selected."|trans }}";
            translations.multiselectMessage = "{{ "Caution, you have selected %1 items. Clicking save will run the %2 transaction on all these items."|trans }}";
            translations.save = "{{ "Save"|trans }}";
            translations.cancel = "{{ "Cancel"|trans }}";
            translations.close = "{{ "Close"|trans }}";
            translations.success = "{{ "Success"|trans }}";
            translations.failure = "{{ "Failure"|trans }}";
            translations.enterText = "{{ "Enter text..."|trans }}";
            translations.noDataMessage = "{{ "No Data returned from the source"|trans }}";
            translations.statusPending = "{{ "Status Pending"|trans }}";
            translations.duplicate = "{{ "Duplicate"|trans }}";
            translations.spacesWarning = "{{ "Warning - starts with or ends with a space, or contains double spaces"|trans }}";
            {% endautoescape %}

            var language = "{{ translate.jsLocale }}";
            var timezone = "{{ settings.defaultTimezone }}";
            var dateFormat = "{{ settings.DATE_FORMAT }}";
            var jsDateFormat = "{{ settings.DATE_FORMAT_JS }}";
            var timeFormat = "{{ settings.TIME_FORMAT }}";
            var jsTimeFormat = "{{ settings.TIME_FORMAT_JS }}";
            var systemDateFormat = "{{ settings.systemDateFormat }}";
            var systemTimeFormat = "{{ settings.systemTimeFormat }}";
            var bootstrapDateFormat = "{{ settings.DATE_FORMAT_BOOTSTRAP }}";
            var bootstrapDateFormatDateOnly = "{{ settings.DATE_FORMAT_BOOTSTRAP_DATEONLY }}";
            var calendarType = "{{ settings.CALENDAR_TYPE }}";
            var clockUrl = "{{ urlFor("clock") }}";
            var calendarLanguage = "{{ translate.jsShortLocale }}";
            var pingUrl = "{{ urlFor("ping") }}";
            {% autoescape "js" %}
            var dataTablesLanguage = {
                "decimal":        "",
                "emptyTable":     "{{ "No data available in table"|trans }}",
                "info":           "{{ "Showing _START_ to _END_ of _TOTAL_ entries"|trans }}",
                "infoEmpty":      "{{ "Showing 0 to 0 of 0 entries"|trans }}",
                "infoFiltered":   "{{ "(filtered from _MAX_ total entries)"|trans }}",
                "infoPostFix":    "",
                "thousands":      ",",
                "lengthMenu":     "{{ "Show _MENU_ entries"|trans }}",
                "loadingRecords": "{{ "Loading..."|trans }}",
                "processing":     "{{ "Processing..."|trans }}",
                "search":         "{{ "Search:"|trans }}",
                "zeroRecords":    "{{ "No matching records found"|trans }}",
                "paginate": {
                    "first":      "{{ "First"|trans }}",
                    "last":       "{{ "Last"|trans }}",
                    "next":       "{{ "Next"|trans }}",
                    "previous":   "{{ "Previous"|trans }}"
                },
                "aria": {
                    "sortAscending":  "{{ ": activate to sort column ascending"|trans }}",
                    "sortDescending": "{{ ": activate to sort column descending"|trans }}"
                }
            };
            {% endautoescape %}

            moment.locale("{{ translate.jsLocale }}");

            $(function() {
                var csrf_token = $('meta[name="token"]').attr('content');
                $.ajaxSetup({
                    headers: {
                        'X-XSRF-TOKEN': csrf_token
                    }
                });
            });

            toastr.options.positionClass = "toast-bottom-center";

            // CKEditor default config
            var CKEDITOR_DEFAULT_CONFIG = {
                contentsCss: [ CKEDITOR.getUrl('contents.css'), "{{ urlFor("library.font.css") }}" ],
                font_names: '{{ ckeditorConfig }}' + CKEDITOR.config.font_names,
                imageDownloadUrl: "{{ urlFor("library.download") }}?preview=1"
            }

        </script>

        {% block javaScriptTemplates %}{% endblock %}
        {% block javaScript %}{% endblock %}

        {% include "user-welcome.twig" %}
    </body>
</html>
