<#-- $This file is distributed under the terms of the license in LICENSE$ -->

<#-- Individual profile page template for foaf:Person individuals -->
<!--[if IE 7]>
<link rel="stylesheet" href="${urls.base}/css/individual/ie7-standard-view.css" />
<![endif]-->
<#include "individual-setup.ftl"> 
${scripts.add('<script async type="text/javascript" src="https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js"></script>')}
${scripts.add('<script async type="text/javascript" src="//cdn.plu.mx/widget-popup.js"></script>')}
<#import "individual-qrCodeGenerator.ftl" as qr>
<#import "lib-vivo-properties.ftl" as vp>
<#--Number of labels present-->
<#if !labelCount??>
    <#assign labelCount = 0 >
</#if>
<#--Number of available locales-->
<#if !localesCount??>
    <#assign localesCount = 1>
</#if>
<#--Number of distinct languages represented, with no language tag counting as a language, across labels-->
<#if !languageCount??>
    <#assign languageCount = 1>
</#if>
<#assign qrCodeIcon = "qr-code-icon.png">
<#assign visRequestingTemplate = "foaf-person-2column">
<#--add the VIVO-ORCID interface -->
<#include "individual-orcidInterface.ftl">
<section id="individual-intro" class="vcard person" role="region"><span itemscope itemtype="http://schema.org/Person">
    <section id="individual-info" ${infoClass!} role="region" style="width: 100%;">
        <#include "individual-adminPanel.ftl">
        <header>
            <#if relatedSubject??>
                <h2>${relatedSubject.relatingPredicateDomainPublic} ${i18n().for} ${relatedSubject.name}</h2>
                <p><a href="${relatedSubject.url}" title="${i18n().return_to(relatedSubject.name)}">&larr; ${i18n().return_to(relatedSubject.name)}</a></p>
            <#else>
                <h1 itemprop="name" class="vcard foaf-person fn" <#if !editable>style="float:left;border-right:1px solid #A6B1B0;"</#if>>
                    <#-- Label -->
                    <@p.label individual editable labelCount localesCount/>
                </h1>
                <#--  Display preferredTitle if it exists; otherwise mostSpecificTypes -->
                <#assign title = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Title")!>
                <#if title?has_content> <#-- true when the property is in the list, even if not populated (when editing) -->
                    <#if (title.statements?size < 1) >
                        <@p.addLinkWithLabel title editable />
                    <#elseif editable>
                        <h2>${title.name?capitalize!}</h2>
                        <@p.verboseDisplay title />
                    </#if>
                    <#list title.statements as statement>
                        <#if !editable >
                            <div id="titleContainer"><span itemprop="jobTitle" class="display-title-not-editable">${statement.preferredTitle}</span></div>
                        <#else>
                            <span itemprop="jobTitle" class="display-title-editable">${statement.preferredTitle}</span>
                            <@p.editingLinks "${title.localName}" "${title.name}" statement editable title.rangeUri />
                        </#if>
                    </#list>
                </#if>
                <#-- If preferredTitle is unpopulated, display mostSpecificTypes -->
                <#if ! (title.statements)?has_content>
                    <@p.mostSpecificTypesPerson individual editable/>
                </#if>
            </#if>
            <span id="iconControlsRightSide" class="<#if editable>iconControlsEditable<#else>iconControlsNotEditable</#if>" <#if !user.hasSiteAdminAccess>style="top:5px"</#if>>
                <#include "individual-iconControls.ftl">
            </span>
            <#if editable && profilePageTypesEnabled >
                <#include "individual-profilePageTypes.ftl">
            </#if>
        </header>
        <!-- Positions -->
        <#include "individual-positions.ftl">

        <!-- Overview -->
        <#if !editable>
            <p></p>
        </#if>
        <#include "individual-overview.ftl">

        <!-- Research Areas -->
        <#include "individual-researchAreas.ftl">

        <!-- Geographic Focus -->
        <#include "individual-geographicFocus.ftl">

        <#include "individual-openSocial.ftl">
    </section> <!-- end individual-info -->
</span></section> <!-- end individual-intro -->

<#assign nameForOtherGroup = "${i18n().other}">
<#if !editable>
    <#-- We don't want to see the first name and last name unless we might edit them. -->
    <#assign skipThis = propertyGroups.pullProperty("http://xmlns.com/foaf/0.1/firstName")!>
    <#assign skipThis = propertyGroups.pullProperty("http://xmlns.com/foaf/0.1/lastName")!>
</#if>
<#--
<#assign issue = propertyGroups.pullProperty("https://litvinovg.pro/text_structures#issue")!>
  <#if issue.statements?has_content && issue.type == "data">
    <div class="issue" style="list-style:none;">
      <div class="label">Выпуск</div>
        <@p.dataPropertyList issue editable />
      </div>
</#if>

<#assign year = propertyGroups.pullProperty("https://litvinovg.pro/text_structures#year")!>
  <#if year.statements?has_content && year.type == "data">
    <div class="year" style="list-style:none;">
      <div class="label">Год</div>
        <@p.dataPropertyList year editable />
      </div>
</#if>
-->
<#if rubrics?? && rubrics?has_content>
   <div class="label">Относится к рубрикам:</div>
     <#list rubrics as rubric>
       <li role="listitem" style="list-style:none;">
        <a href="${urls.base}/individual?uri=${rubric.rubricID?url}"">${rubric.rubricName}</a>
       </li>
     </#list>
   <br/>
</#if>


<div class="articleParts" style="display:block;">
<#list paths as order>
  <div class = "articleExcerpt">
   <#-- ${order.path} -->
    <#list excerpts as excerptProperties>

      <#if order.elenphExcerpt?has_content &&  excerptProperties.elenphExcerpt == order.elenphExcerpt>
       <#if excerptProperties.property == "https://litvinovg.pro/text_structures#htmlExcerpt">
         <#assign excerptText = excerptProperties.value >
       </#if>
       <#if excerptProperties.property == "http://www.w3.org/2000/01/rdf-schema#label">
         <#assign excerptTextName = excerptProperties.value >
       </#if>
      </#if>
    </#list>
    <#if excerptText?? && excerptTextName?? && excerptTextName?has_content && excerptText?has_content>  
      <button type="button" style="border:none;padding: 18px;width: 100%; text-align:left;" class="collapsible">${excerptTextName}</button>
		  <div class="htmlExcerpt" style="list-style:none; display:none;">
			  ${excerptText}
      </div>         
    </#if> 
  </div> <#-- articleExcerpt -->

</#list>
</div>
<#-- <@dump var="works" /> -->
<#if works??>
  <#assign no_works = true>
  <#list works as work>
    <#if no_works>
      <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Работы</button>
      <div class="works" style="display:none;">
      <#assign no_works = false>
    </#if>
    <div class="work" style="list-style:none;">
      <p> ${work.works} </p>
    </div>
   	
  </#list>
  <#if !no_works>
    </div> <#-- works class-->
  </#if>
</#if>

<#if bibliography??>
  <#assign no_bibliography = true>
  <#list bibliography as one_bibliography>
    <#if no_bibliography>
      <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%; text-align: left;">Литература</button>
      <div class="bibliography" style="display:none;">
      <#assign no_bibliography = false>
    </#if>
    <div class="bibliography_entry" style="list-style:none;">
      <p> ${one_bibliography.bibliography} </p>
    </div>


  </#list>
  <#if !no_bibliography>
    </div> <#-- bibliography class-->
  </#if>
</#if>

<#if authors??>
  <#assign no_authors = true>
  <#list authors as author>
    <#if no_authors>
      <div class="authors" style="display:block;float:right; margin:15px;">
      <#assign no_authors = false>
    <#else>
      ", "
    </#if>
    ${author.author}
  </#list>
  </div> <#-- authors class-->
</#if>

<script>
var coll = document.getElementsByClassName("collapsible");
var i;

for (i = 0; i < coll.length; i++) {
  coll[i].addEventListener("click", function() {
    this.classList.toggle("active");
    var content = this.nextElementSibling;
    if (content.style.display === "block") {
      content.style.display = "none";
    } else {
      content.style.display = "block";
    }
  });
}
</script>
 <#-- <@dumpAll /> -->

 <#assign selectedTemplate = "individual--foaf-person-2column.ftl" > 

<#if profilePageTypesEnabled >
    <#assign profilePageType = profileType >

    <#-- targetedView takes precedence over the profilePageType. -->

    <#if targetedView?has_content>
        <#if targetedView != "standardView">
            <#assign selectedTemplate = "individual--foaf-person-quickview.ftl" >
        </#if>
    <#elseif profilePageType == "quickView" >
        <#assign selectedTemplate = "individual--foaf-person-quickview.ftl" >
    </#if>
</#if>
<#--  <#include "individual-property-group-tabs.ftl"> -->

<#if profilePageTypesEnabled && (targetedView?has_content || user.loggedIn) >
<span id="quickViewLink" >
    <a href="${urls.base}/display/${individual.localName}?destination=quickView" >
        <img id="quickViewIcon" src="${urls.images}/individual/quickViewIcon.png" alt="${i18n().quick_view_icon}"/>
    </a>
</span>
</#if>
<#if !editable>
<script>
    var title = $('div#titleContainer').width();
    var name = $('h1.vcard').width();
    var total = parseInt(title,10) + parseInt(name,10);
    if ( name < 280 && total > 600 ) {
        var diff = total - 600;
        $('div#titleContainer').width(title - diff);
    }
    else if ( name > 279 && name + title > 600 ) {
        $('div#titleContainer').width('620');
    }
</script>
</#if>
<script>
    var imagesPath = '${urls.images}';
</script>
<#assign rdfUrl = individual.rdfUrl>

<#if rdfUrl??>
    <script>
        var individualRdfUrl = '${rdfUrl}';
    </script>
</#if>
<script type="text/javascript">
var individualUri = '${individual.uri!}';
var individualPhoto = '${individual.thumbNail!}';
var exportQrCodeUrl = '${urls.base}/qrcode?uri=${individual.uri!}';
var baseUrl = '${urls.base}';
var profileTypeData = {
    processingUrl: '${urls.base}/edit/primitiveRdfEdit',
    individualUri: '${individual.uri!}',
    defaultProfileType: '${profileType!}'
};
var i18nStrings = {
    errorProcessingTypeChange: '${i18n().error_processing_type_change}',
    displayLess: '${i18n().display_less}',
    displayMoreEllipsis: '${i18n().display_more_ellipsis}',
    showMoreContent: '${i18n().show_more_content}',
    verboseTurnOff: '${i18n().verbose_turn_off}',
    standardviewTooltipOne: '${i18n().standardview_tooltip_one}',
    standardviewTooltipTwo: '${i18n().standardview_tooltip_two}',
    researchAreaTooltipOne: '${i18n().research_area_tooltip_one}',
    researchAreaTooltipTwo: '${i18n().research_area_tooltip_two}'
};
var i18nStringsUriRdf = {
    shareProfileUri: '${i18n().share_profile_uri}',
    viewRDFProfile: '${i18n().view_profile_in_rdf}',
    closeString: '${i18n().close}'
};
</script>

${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/individual/individual.css" />',
                  '<link rel="stylesheet" href="${urls.base}/css/individual/individual-vivo.css" />',
                  '<link rel="stylesheet" href="${urls.base}/css/individual/individual-2column-view.css" />',
                  '<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.12.1.css" />',
                  '<link rel="stylesheet" type="text/css" href="${urls.base}/css/jquery_plugins/qtip/jquery.qtip.min.css" />')}

${headScripts.add('<script type="text/javascript" src="${urls.base}/js/tiny_mce/tiny_mce.js"></script>',
                  '<script type="text/javascript" src="${urls.base}/js/jquery_plugins/qtip/jquery.qtip.min.js"></script>',
                  '<script type="text/javascript" src="${urls.base}/js/json2.js"></script>',
                  '<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.truncator.js"></script>')}

${scripts.add('<script async type="text/javascript" src="${urls.base}/js/individual/individualUriRdf.js"></script>',
              '<script async type="text/javascript" src="${urls.base}/js/individual/individualQtipBubble.js"></script>',
              '<script async type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.12.1.min.js"></script>',
              '<script async type="text/javascript" src="${urls.base}/js/individual/individualUtils.js?vers=1.5.1"></script>',
              '<script async type="text/javascript" src="${urls.base}/js/individual/moreLessController.js"></script>',
              '<script async type="text/javascript" src="${urls.base}/js/individual/individualProfilePageType.js"></script>',
              '<script async type="text/javascript" src="${urls.base}/js/imageUpload/imageUploadUtils.js"></script>',
              '<script async type="text/javascript" src="https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js"></script>',
              '<script async type="text/javascript" src="//cdn.plu.mx/widget-popup.js"></script>')}

<script type="text/javascript">
    i18n_confirmDelete = "${i18n().confirm_delete}";
</script>
