{% load compress i18n wirecloudtags %}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xml:lang="{{ LANGUAGE_CODE }}"
      lang="{{ LANGUAGE_CODE }}">
<head>
    <title>{% block title %}{% trans "Wirecloud Platform" %}{% endblock %}</title>

    {% block meta %}
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="google" value="notranslate" />
    <link rel="shortcut icon" type="image/x-icon" href="{{ STATIC_URL }}images/favicon.ico" />
    {% endblock %}

    <!-- Theme css -->
    {% block css %}
    {% compress css %}
    {% platform_css "index" %}
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/window_menu.css"  />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/wirecloud_core.css"  />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/dragboard_core.css"  />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/catalogue_core.css" />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/catalogue/resource.css" />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/catalogue/resource_details.css" />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/dragboard.css" />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/catalogue.css" />

    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/default.css" />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/icons.css" />
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/font-awesome.css" />
    {% endcompress %}
    <!--[if IE]>
      <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/ie.css" />
    <![endif]-->
    {% endblock %}

    {% block js %}
    {% endblock %}
</head>

<body>

<!-- Menu layer -->
<div id="menu_layer" style="display:none"></div>

<!-- Loading indicator -->
<div id="loading-window">
  <div id="loading-background"></div>
  <div id="loading-message" class="window_menu">
    <div class="window_top">
      <div id="loading-task-title" class="window_title">{% trans "Loading Wirecloud Platform" %} 0%</div>
    </div>
    <div class="window_content">
      <div id="loading-indicator"></div>
      <div id="loading-subtask-title" class="msg">{% trans "Retrieving wirecloud code" %}: 0%</div>
    </div>
  </div>
</div>

{% include "wirecloud/views/header.html" %}
<script id="wirecloud_catalogue_search_interface" type="wirecloud/template"><![CDATA[{% include "wirecloud/catalogue/search_interface.html" %}]]></script>
<script id="wirecloud_wiring_template" type="wirecloud/template"><![CDATA[{% include "wirecloud/wiring.html" %}]]></script>
<script id="catalogue_resource_template" type="html/template"><![CDATA[{% include "wirecloud/catalogue/resource.html" %}]]></script>
<script id="catalogue_main_resource_details_template" type="html/template"><![CDATA[{% include "wirecloud/catalogue/main_resource_details.html" %}]]></script>
<script id="catalogue_resource_details_template" type="html/template"><![CDATA[{% include "wirecloud/catalogue/resource_details.html" %}]]></script>
<script id="fiware_catalogue_resource_details_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/resource_details.html" %}]]></script>
<script id="fiware_resource_parts" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/resource_parts.html" %}]]></script>
<script id="fiware_main_details_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/main_resource_details.html" %}]]></script>
<script id="legal_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/legal/legal_template.html" %}]]></script>
<script id="legal_clause_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/legal/legal_clause_template.html" %}]]></script>
<script id="service_level_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/sla/service_level_template.html" %}]]></script>
<script id="sla_expresion_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/sla/sla_expresion_template.html" %}]]></script>
<script id="sla_variable_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/sla/sla_variable_template.html" %}]]></script>
<script id="pricing_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/pricing/pricing_template.html" %}]]></script>
<script id="price_component_template" type="html/template"><![CDATA[{% include "wirecloud/fiware/marketplace/pricing/price_component_template.html" %}]]></script>
<script id="wirecloud_catalogue_publish_interface" type="wirecloud/template"><![CDATA[{% include "wirecloud/catalogue/developers.html" %}]]></script>
<script id="fiware_catalogue_publish_interface" type="wirecloud/template"><![CDATA[{% include "wirecloud/fiware/marketplace/publish_template.html" %}]]></script>
<script id="wirecloud_logs_template" type="wirecloud/template"><![CDATA[{% include "wirecloud/logs.html" %}]]></script>


<!-- JavaScript code -->

{% compress js %}
<script type="text/javascript" src="{{ STATIC_URL }}js/lib/json2.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/lib/strftime.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/lib/strftime-locales.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/lib/prototype/prototype-1.7.js"></script>
{% endcompress %}
<script type="text/javascript">
<![CDATA[
var URIs = {
  GET_POST_RESOURCES: 'catalogue/resources',
  GET_RESOURCES_SIMPLE_SEARCH: 'catalogue/search',
  GET_RESOURCES_GLOBAL_SEARCH: 'catalogue/globalsearch',
  DELETE_TAG: '/user/{{ user.username }}/catalogue/tag',
  POST_RESOURCE_TAGS: '/user/{{ user.username }}/catalogue/tag',
  POST_RESOURCE_VOTES: '/user/{{ user.username }}/catalogue/voting',
  PROXY: '/proxy',
  GET_SHARE_GROUPS: new Template('/workspace/#{workspace_id}/share/groups'),
  POST_CHECK_VERSIONS: '/user/{{ user.username }}/catalogue/versions',
  FILE_UPLOADER: '/uploader',
  BASIC_THEME: '/ezweb/themes/default',
  ACTIVE_THEME: '{{ STATIC_URL }}'
};

var ezweb_user_name = '{{ user.username }}';
var ezweb_user_screen_name = '{{ screen_name }}';
var ezweb_organizations = '{{ ezweb_organizations|safe }}';
var tag_categories = '{{ tag_categories|safe }}';
var _currentTheme = null;

var _SKINS = ["default"];
//default skin for workspaces. Users may change the skin of a workspace afterwards
var _DEFAULT_SKIN = 'default';

{% block policies %}
{% endblock %}
]]>
</script>


<script type="text/javascript" src="/jsi18n/?language={{ LANGUAGE_CODE }}"></script>
{% compress js %}
{% include "wirecloud/views/js_includes.js" %}
{% wirecloud_ajax_endpoints "index" %}
{% extra_javascripts "index" %}
{% endcompress %}

{% block extra_scripts %}{% endblock %}

<!-- Initialization code -->
<script type="text/javascript">
    var LANGUAGE_CODE = "{{LANGUAGE_CODE}}";
    var LANGUAGES = [];
    {% for lang in LANGUAGES %} LANGUAGES.push(["{{lang.0}}","{{lang.1}}"]);{% endfor %}

    function setLanguage(language) {
        var onSuccess = function() {
            window.location.reload();
        }

        var onError = function() {}

        var persistenceEngine = PersistenceEngineFactory.getInstance();
        var params = {language: language};
        persistenceEngine.send_post("/i18n/setlang/", params, this, onSuccess, onError);

        return false;
    }

    var opManager = OpManagerFactory.getInstance();
    opManager.loadEnviroment();
</script>
</body>
</html>
