<metal:block metal:use-macro="here/standard_template_macro">
    <metal:block fill-slot="meta">
        <meta tal:define="description here/description;
                          content python:here.html2text(description);"
              tal:condition="content"
              tal:attributes="content content" name="description" />
        <meta tal:condition="here/keywords"
              tal:attributes="content here/keywords" name="keywords" />
        <meta tal:attributes="content here/contributor" name="author" />
        <meta tal:attributes="content here/gl_get_selected_language"
              name="dc.language" />
        <meta tal:attributes="content string:${here/title} | ${here/site_title}"
              name="title" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </metal:block>

    <metal:block metal:fill-slot="header-title">
        <title tal:content="string:${here/title} | ${here/site_title}" />
    </metal:block>

    <metal:block fill-slot="head">
        <link rel="alternate" type="application/rdf+xml" title="RDF"
              tal:attributes="href here/absolute_url" />
    </metal:block>

    <metal:block tal:define="is_ratable here/is_ratable;
                              site_object_index python:(here.getFormsTool()
                                                .getForm('site_object_index'))"
                 fill-slot="body">
        <h1>
          <metal:block use-macro="site_object_index/macros/icon"/>
          <span tal:replace="here/title_or_id" />
        <tal:block condition="is_ratable"
                        replace="structure here/user_rating_view|nothing"/>
            <span class="available_langs" tal:condition="python:here.item_has_title(here, here.title)">
              <span i18n:translate="">Item only translated in </span>
              <span tal:repeat="lang here/gl_get_languages_map">
                <a tal:content="python:' %s' % lang['title']" tal:condition="python:not lang['selected'] and here.getLocalProperty('title', lang['id'])" tal:attributes="href python:'gl_changeLanguage?old_lang=%s' % (lang['id'])" />
              </span>
            </span>
        </h1>


        <metal:block use-macro="site_object_index/macros/action_buttons"/>

        <!-- Map widget -->
        <tal:block condition="python:here.prop_details('geo_location')['show']"
            content="structure python:here.portal_map.render_object_map(here.geo_location)"/>

        <table border="0" cellspacing="2" cellpadding="2" tal:define="portal_map here/getGeoMapTool;">
        <tal:block content="structure python: here.prop_display_tr('releasedate')" />
        <metal:block use-macro="site_object_index/macros/contributor_tr" />
        <tal:block content="structure python: here.prop_display_tr('coverage')" />

        <tal:block condition="here/is_geo_enabled">
            <tr tal:define="title python:portal_map.getSymbolTitle(here.geo_type);
              picture python:portal_map.getSymbolPicture(here.geo_type)"
              tal:condition="python: title != '' and here.geo_location">
            <th i18n:translate="Type (translate as a noun)">Type</th>
            <td>
              <img tal:condition="picture" tal:attributes="src string:${portal_map/absolute_url}/getSymbolPicture?id=${here/geo_type}; alt title; title title" />
              <span tal:replace="title" />
            </td>
            </tr>
        </tal:block>

        <tal:block content="structure python: here.prop_display_tr('keywords')" />
        </table>

        <div tal:define="description python:here.prop_value_or_none('description')"
          tal:condition="description" tal:content="structure description" />

        <tal:block define="ready here/mediaReady;
                           broken here/mediaBroken">
          <div tal:condition="python:ready and not broken" tal:define="
            site python:here.getSite();
            site_url site/absolute_url;
            mediapath string:${here/absolute_url}/${here/getSingleMediaId};
            flowplayer_js string:$site_url/flowplayer.js;
            flowplayer_css string:$site_url/flowplayer.css;
            flowconfig_js string:$site_url/flowplayer.config.js;
            has_subtitle here/subtitle|nothing;
            has_subtitle python:not not has_subtitle;
            subtitle string:${here/absolute_url}/flowplayer.srt;
            subtitle python:has_subtitle and subtitle or '';
            has_startup_image here/startup_image;
            startup_image string:${here/absolute_url}/get_startup_image;
            startup_image python:has_startup_image and startup_image or '';
            is_audio here/is_audio;
            aspect_ratio here/get_aspect_ratio;">
            <!-- Player -->
            <div>
              <script type="text/javascript" tal:attributes="src flowplayer_js"></script>
              <link rel="stylesheet" tal:attributes="href
                  flowplayer_css">
              <script type="text/javascript" tal:attributes="src
  flowconfig_js"></script>
              <tal:block condition="python:not is_audio or has_startup_image"
                  tal:define="height python:500/aspect_ratio">
                  <div class="is-splash" id="player"
                    tal:attributes="style string:width:500px;; height:${height}px;;
                                                 background-color:#777;;">
                  </div>
                  <script type="text/javascript" tal:content='string:
                    jQuery(document).ready(function(){
                      flowplayer_config("player", "$mediapath",
                      "$subtitle", "$startup_image");
                    });
                  '></script>
              </tal:block>
              <tal:block condition="python:is_audio and not has_startup_image">
                  <div id="audio" style="width:500px; height:60px;">
                  </div>
                  <script type="text/javascript" tal:content='string:
                    jQuery(document).ready(function(){
                      flowplayer_config("audio", "$mediapath",
                      "$subtitle", "$startup_image");
                    });
                  '></script>
              </tal:block>
            </div>

            <!-- Embed -->
            <!-- The value of videoEmbed should remain on multiple lines otherwhise IE8 will not display it properly in editor tool -->
            <include package="plone.i18n" />
            <input tal:condition="python:not is_audio or has_startup_image"
              id="videoEmbed" name="videoEmbed" type="text" style="width: 500px;"
              readonly="true" onclick="javascript:this.select();"
              tal:define="height python:280/aspect_ratio"
              tal:attributes='value string:<!-- Embed video - copy & paste -->
                <script type="text/javascript" src="$flowplayer_js"></script>
                <link rel="stylesheet" href="$flowplayer_css"></script>
                <script type="text/javascript" src="$flowconfig_js"></script>
                <div id="miniplayer" style="width:280px;;height:${height}px"></div>
                <script
                type="text/javascript">jQuery(document).ready(function(){flowplayer_config(
                "miniplayer", "$mediapath", "$subtitle", "$startup_image")})</script>'/>
            <input tal:condition="python:is_audio and not has_startup_image"
              id="videoEmbed" name="videoEmbed" type="text" style="width: 500px;"
              readonly="true" onclick="javascript:this.select();"
              tal:attributes='value string:<!-- Embed video - copy & paste -->
                <script type="text/javascript" src="$flowplayer_js"></script>
                <link rel="stylesheet" href="$flowplayer_css"></script>
                <script type="text/javascript" src="$flowconfig_js"></script>
                <div id="miniplayer" style="width:280px;;height:210px"></div>
                <script
                type="text/javascript">jQuery(document).ready(function(){flowplayer_config(
                "miniplayer", "$mediapath", "$subtitle", "$startup_image", "", "false")})</script>'/>
            <!-- Download -->
            <div>
              <a tal:attributes="href mediapath">
                <span i18n:translate="">Download</span>
                <span tal:content="python:'(' + here.utShowSize(here.getSize()) + ')'" />
              </a><span i18n:translate="">as</span>
              <a rel="external" href="http://en.wikipedia.org/wiki/MP4">MP4 video</a>
            </div>
          </div>

          <div tal:condition="python: not ready or broken">
            <div tal:condition="broken" class="flvPlayerBroken">
              <img src="misc_/NaayaContent/NyMediaFileBroken.gif" /><br />
              <label i18n:translate="">
              An error occurred when trying to process uploaded video file:
              <tal:block content="broken" i18n:name="broken" />
              This may be because the file you uploaded is not a valid video file,
              or the system does not recognize this encoding.
              </label>
            </div>
            <div tal:condition="not:broken" class="flvPlayerNotReady">
              <img src="misc_/NaayaContent/NyMediaFileLoading.gif" /><br />
              <label i18n:translate="" >
                Video file is being processed. Please try again later.
              </label>
            </div>
          </div>
        </tal:block>

        <tal:block content="structure here/set_content_rating" />

        <tal:block content="structure here/comments_box" />
    </metal:block>
</metal:block>
