<commit_before><?xml version="1.0" encoding="UTF-8"?>

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/
-->

<xwikidoc version="1.1">
  <web>PhenoTips</web>
  <name>ExportPreferences</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <creationDate>1401822206000</creationDate>
  <parent>PhenoTips.Export</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <date>1401822206000</date>
  <contentUpdateDate>1401822206000</contentUpdateDate>
  <version>1.1</version>
  <title/>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.1</syntaxId>
  <hidden>true</hidden>
  <content>{{include reference="PhenoTips.DatabaseFilters" /}}

{{velocity output="false"}}
#macro (__export__displayOrganizedFieldList)
#set ($remoteEnabledFields = $request.getParameterValues('enabledFields'))## fields enabled on the remote server
#set($ignored = {
    'fields' : ['negative_phenotype', 'negative_prenatal_phenotype'],
    'types'  : ['PhenoTips.PedigreeClass', 'PhenoTips.MeasurementsClass', 'PhenoTips.GeneVariantClass']
})
#set($customExporters = {
    'PhenoTips.GeneClass' : {'name' : 'genes', 'label': "$services.localization.render('phenotips.exportPreferences.field.genes')"},
    'PhenoTips.InvestigationClass' : {'name' : 'genes', 'label': "$services.localization.render('phenotips.exportPreferences.field.genes')"},
    'PhenoTips.AllergiesDataClass' : {'name': 'allergies', 'label' : "$services.localization.render('PhenoTips.AllergiesDataClass_allergies')"}
})
#set ($targetFieldName = "columns")
#set($valueList = ['external_id', 'gender', 'phenotype', 'negative_phenotype', 'clinical_diagnosis', 'omim_id'])
{{html clean="false" wiki="false"}}
## Extensions making up the main content, the actual information about the patient
#set ($recordConfiguration = $services.recordConfiguration.getActiveConfiguration())
#foreach ($section in $recordConfiguration.enabledSections)
 #set ($sectionContent = '')
 #foreach ($element in $section.enabledElements)
   #set ($eClasses = $element.extension.getParameters().pt_class.split(','))
   #if ($eClasses)
     #foreach ($eClass in $eClasses)
       #set ($eCMeta = $customExporters.get($eClass))
       #if (!$ignored.types.contains($eClass) &amp;&amp;
            "$!{eCMeta}" != '' &amp;&amp;
            (!($remoteEnabledFields.size() &gt; 0) || $remoteEnabledFields.contains("${eCMeta.name}")) &amp;&amp;
            $xwiki.getDocument($eClass).getxWikiClass().properties.size() &gt; 0
            )
         #set ($itemContent = "&lt;li class='checkbox_tree_container'&gt;&lt;label for=""${targetFieldName}_${eCMeta.name}""&gt;&lt;input type=""checkbox"" name=""${targetFieldName}"" id=""${targetFieldName}_${eCMeta.name}"" value=""$eCMeta.name""#if ($valueList.contains($eCMeta.name)) checked=""checked""#end/&gt;${eCMeta.label}&lt;/label&gt;&lt;/li&gt;")
         #set ($sectionContent = $sectionContent.concat($itemContent))
       #end
     #end
   #else
     #set ($eClass = $xwiki.getDocument('PhenoTips.PatientClass').getxWikiClass())
     #set ($eFields = $element.extension.getParameters().fields.split(','))
     #if ($eFields)
       #foreach ($eField in $eFields)
          #set ($f = $eClass.get($eField))
          #if ("$!f" != '' &amp;&amp;
               !$ignored.fields.contains($eField) &amp;&amp;
               (!($remoteEnabledFields.size() &gt; 0) || $remoteEnabledFields.contains($eField))
            )
            #set ($itemContent = "&lt;li class='checkbox_tree_container'&gt;&lt;label for=""${targetFieldName}_${f.name}""&gt;&lt;input type=""checkbox"" name=""${targetFieldName}"" id=""${targetFieldName}_${f.name}"" value=""$f.name""#if ($valueList.contains($f.name)) checked=""checked""#end/&gt;${f.translatedPrettyName}&lt;/label&gt;&lt;/li&gt;")
            #set ($sectionContent = $sectionContent.concat($itemContent))
          #end
       #end
     #end
   #end
 #end
 #if ($sectionContent != '')

 &lt;div class="checkbox_tree_container"&gt;
 &lt;h5&gt;&lt;label for=""&gt;&lt;input type="checkbox" name="" id="" value="" /&gt;&lt;span class="section-name-header field-no-user-select"&gt;$section.name&lt;/span&gt;&lt;/label&gt;&lt;/h5&gt;
 &lt;ul class="field-list#if ($foreach.index &gt; 0) v-collapsed#end"&gt;
 $sectionContent
 &lt;/ul&gt;
 &lt;/div&gt;
 #end
#end
&lt;input type="hidden" name="${targetFieldName}" value="" /&gt;{{/html}}
#end
{{/velocity}}

{{velocity output=false}}
## if $simple is true the meta fields and the code fields are not rendered
#macro(__export__displayFieldList $xclassName $targetFieldName $customValues $ignored $valueList $simple)
  {{html clean="false"}}
    #set($valueListisEmpty = ($valueList.size() == 0))
    #set($xclass = $xwiki.getDocument($xclassName).getxWikiClass())
    &lt;ul class="field-list"&gt;
      #foreach($customVal in $customValues.keySet())
        &lt;li&gt;
          &lt;label for="${targetFieldName}_${customVal}"&gt;
            &lt;input type="checkbox" name="${targetFieldName}" id="${targetFieldName}_${customVal}" value="$customVal"#if ($valueList.contains($customVal) || $valueListisEmpty) checked="checked"#end/&gt;
            ${customValues.get($customVal)}
          &lt;/label&gt;
        &lt;/li&gt;
      #end
      #foreach ($field in $xclass.properties)
        #if (!$ignored.fields.contains(${field.name}) &amp;&amp; !$ignored.types.contains(${field.type}))
        &lt;li&gt;
          &lt;label for="${targetFieldName}_${field.name}"&gt;
          &lt;input type="checkbox" name="${targetFieldName}" id="${targetFieldName}_${field.name}" value="${field.name}" #if($valueList.contains(${field.name}) || $valueListisEmpty) checked="checked" #end /&gt;
          ${field.translatedPrettyName}
        &lt;/li&gt;
        #if ($metaFields.contains(${field.name}) &amp;&amp; !${simple})
        &lt;li&gt;
          &lt;label for="${targetFieldName}_${field.name}_meta"&gt;
          &lt;input type="checkbox" name="${targetFieldName}" id="${targetFieldName}_${field.name}_meta" value="${field.name}_meta" #if($valueList.contains("${field.name}_meta") || $valueListisEmpty) checked="checked" #end /&gt;
          $services.localization.render('phenotips.exportPreferences.phenotype.qualifiers')
        &lt;/li&gt;
        #end
        #end<commit_msg>PT-3240 Removes redundant export checkboxes Fixed regression introduced accidentally in 983356235<commit_after><?xml version="1.0" encoding="UTF-8"?>

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/
-->

<xwikidoc version="1.1">
  <web>PhenoTips</web>
  <name>ExportPreferences</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <creationDate>1401822206000</creationDate>
  <parent>PhenoTips.Export</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <date>1401822206000</date>
  <contentUpdateDate>1401822206000</contentUpdateDate>
  <version>1.1</version>
  <title/>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.1</syntaxId>
  <hidden>true</hidden>
  <content>{{include reference="PhenoTips.DatabaseFilters" /}}

{{velocity output="false"}}
#macro (__export__displayOrganizedFieldList)
#set ($remoteEnabledFields = $request.getParameterValues('enabledFields'))## fields enabled on the remote server
#set($ignored = {
    'fields' : ['negative_phenotype', 'negative_prenatal_phenotype'],
    'types'  : ['PhenoTips.PedigreeClass', 'PhenoTips.MeasurementsClass', 'PhenoTips.GeneVariantClass']
})
#set($customExporters = {
    'PhenoTips.GeneClass' : {'name' : 'genes', 'label': "$services.localization.render('phenotips.exportPreferences.field.genes')"},
    'PhenoTips.InvestigationClass' : {'name' : 'genes', 'label': "$services.localization.render('phenotips.exportPreferences.field.genes')"},
    'PhenoTips.AllergiesDataClass' : {'name': 'allergies', 'label' : "$services.localization.render('PhenoTips.AllergiesDataClass_allergies')"}
})
#set ($targetFieldName = "columns")
#set($valueList = ['external_id', 'gender', 'phenotype', 'negative_phenotype', 'clinical_diagnosis', 'omim_id'])
{{html clean="false" wiki="false"}}
## Extensions making up the main content, the actual information about the patient
#set ($recordConfiguration = $services.recordConfiguration.getActiveConfiguration())
#foreach ($section in $recordConfiguration.enabledSections)
 #set ($sectionContent = '')
 #foreach ($element in $section.enabledElements)
   #set ($eClasses = $element.extension.getParameters().pt_class.split(','))
   #if ($eClasses)
     #foreach ($eClass in $eClasses)
       #set ($eCMeta = $customExporters.get($eClass))
       #if (!$ignored.types.contains($eClass) &amp;&amp;
            "$!{eCMeta}" != '' &amp;&amp;
            (!($remoteEnabledFields.size() &gt; 0) || $remoteEnabledFields.contains("${eCMeta.name}")) &amp;&amp;
            $xwiki.getDocument($eClass).getxWikiClass().properties.size() &gt; 0
            )
         #set ($itemContent = "&lt;li class='checkbox_tree_container'&gt;&lt;label for=""${targetFieldName}_${eCMeta.name}""&gt;&lt;input type=""checkbox"" name=""${targetFieldName}"" id=""${targetFieldName}_${eCMeta.name}"" value=""$eCMeta.name""#if ($valueList.contains($eCMeta.name)) checked=""checked""#end/&gt;${eCMeta.label}&lt;/label&gt;&lt;/li&gt;")
         #set ($sectionContent = $sectionContent.concat($itemContent))
       #end
     #end
   #else
     #set ($eClass = $xwiki.getDocument('PhenoTips.PatientClass').getxWikiClass())
     #set ($eFields = $element.extension.getParameters().fields.split(','))
     #if ($eFields)
       #foreach ($eField in $eFields)
          #set ($f = $eClass.get($eField))
          #if ("$!f" != '' &amp;&amp;
               !$ignored.fields.contains($eField) &amp;&amp;
               (!($remoteEnabledFields.size() &gt; 0) || $remoteEnabledFields.contains($eField))
            )
            #set ($itemContent = "&lt;li class='checkbox_tree_container'&gt;&lt;label for=""${targetFieldName}_${f.name}""&gt;&lt;input type=""checkbox"" name=""${targetFieldName}"" id=""${targetFieldName}_${f.name}"" value=""$f.name""#if ($valueList.contains($f.name)) checked=""checked""#end/&gt;${f.translatedPrettyName}&lt;/label&gt;&lt;/li&gt;")
            #set ($sectionContent = $sectionContent.concat($itemContent))
          #end
       #end
     #end
   #end
 #end
 #if ($sectionContent != '')

 &lt;div class="checkbox_tree_container"&gt;
 &lt;h5&gt;&lt;label for=""&gt;&lt;input type="checkbox" name="" id="" value="" /&gt;&lt;span class="section-name-header field-no-user-select"&gt;$section.name&lt;/span&gt;&lt;/label&gt;&lt;/h5&gt;
 &lt;ul class="field-list#if ($foreach.index &gt; 0) v-collapsed#end"&gt;
 $sectionContent
 &lt;/ul&gt;
 &lt;/div&gt;
 #end
#end
&lt;input type="hidden" name="${targetFieldName}" value="" /&gt;{{/html}}
#end
{{/velocity}}

{{velocity output=false}}
## if $simple is true the meta fields and the code fields are not rendered
#macro(__export__displayFieldList $xclassName $targetFieldName $customValues $ignored $valueList $simple)
  {{html clean="false"}}
    #set($valueListisEmpty = ($valueList.size() == 0))
    #set($xclass = $xwiki.getDocument($xclassName).getxWikiClass())
    &lt;ul class="field-list"&gt;
      #foreach($customVal in $customValues.keySet())
        &lt;li&gt;
          &lt;label for="${targetFieldName}_${customVal}"&gt;
            &lt;input type="checkbox" name="${targetFieldName}" id="${targetFieldName}_${customVal}" value="$customVal"#if ($valueList.contains($customVal) || $valueListisEmpty) checked="checked"#end/&gt;
            ${customValues.get($customVal)}
          &lt;/label&gt;
        &lt;/li&gt;
      #end
      #foreach ($field in $xclass.properties)
        #if (($activeFields.size() == 0 || $activeFields.contains(${field.name})) &amp;&amp; !$ignored.fields.contains(${field.name}) &amp;&amp; !$ignored.types.contains(${field.type}))
        &lt;li&gt;
          &lt;label for="${targetFieldName}_${field.name}"&gt;
          &lt;input type="checkbox" name="${targetFieldName}" id="${targetFieldName}_${field.name}" value="${field.name}" #if($valueList.contains(${field.name}) || $valueListisEmpty) checked="checked" #end /&gt;
          ${field.translatedPrettyName}
        &lt;/li&gt;
        #if ($metaFields.contains(${field.name}) &amp;&amp; !${simple})
        &lt;li&gt;
          &lt;label for="${targetFieldName}_${field.name}_meta"&gt;
          &lt;input type="checkbox" name="${targetFieldName}" id="${targetFieldName}_${field.name}_meta" value="${field.name}_meta" #if($valueList.contains("${field.name}_meta") || $valueListisEmpty) checked="checked" #end /&gt;
          $services.localization.render('phenotips.exportPreferences.phenotype.qualifiers')
        &lt;/li&gt;
        #end
        #end
{'fraction_non_alphanumeric': 0.1822312316510555, 'fraction_numerical': 0.008947294841325318, 'mean_word_length': 4.861122490782466, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 2, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '376825', 'n_tokens_mistral': 4677, 'n_tokens_neox': 4532, 'n_words': 865}