<commit_before><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"      
      xmlns:p="http://primefaces.org/ui">  

    <h:head>  
        <style type="text/css">
            .column75{width: 75%;height:auto}
            .column25{width: 25%;height:auto}
            .column60{width: 60%;height:auto}
            .column40{width: 40%;height:auto}            
        </style>
    </h:head>

    <h:body> 
        <f:metadata>
            <f:viewParam name="id" value="#{DatasetPage.dataset.id}"/>
            <f:viewParam name="ownerId" value="#{DatasetPage.ownerId}"/>
            <f:viewAction action="#{DatasetPage.init}" />
        </f:metadata>  

        <!-- Header Panel -->
        <p:panel  style="background-color: lightskyblue; height:70px;">
            <ui:repeat value="#{DatasetPage.dataset.owner.owners}" var="owner">                   
                <h:outputLink value="/dataverse.xhtml?id=#{owner.id}">
                    <h:outputText value="#{owner.name}" />             
                </h:outputLink> 
                <h:outputText value=" > "/>
            </ui:repeat>
            <br/>
            <h:outputLink value="/dataverse.xhtml?id=#{DatasetPage.dataset.owner.id}">
                <h:outputText value="#{DatasetPage.dataset.owner.name} Dataverse" /> 
            </h:outputLink>
        </p:panel>

        <h:form id="datasetForm"> 
            <!-- Message Panel -->
            <p:panel  rendered="#{!empty DatasetPage.editMode}">
                <h:outputText value="Edit your dataset's information:" rendered="#{DatasetPage.editMode == 'INFO'}"/>
                <h:outputText value="Edit your dataset's files:" rendered="#{DatasetPage.editMode == 'FILE'}"/>
                <h:outputText value="Upload your dataset:" rendered="#{DatasetPage.editMode == 'CREATE'}"/>
            </p:panel>              

            <!-- Title Panel -->
            <p:panel rendered="#{empty DatasetPage.editMode or DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                <h:outputText value="#{DatasetPage.dataset.title}" rendered="#{empty DatasetPage.editMode}"/>
                <p:panelGrid columns="2"  columnClasses="column60,column40"  rendered="#{DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                    <p:panelGrid columns="3">
                        <p:outputLabel value="Title" for="title" />
                        <ui:fragment>
                            <p:inputText id="title" value="#{DatasetPage.dataset.title}" />
                            <p:watermark for="title" value="Enter title..."/>
                        </ui:fragment>
                        <p:message for="title" />
                    </p:panelGrid>
                    <p:panelGrid columns="2">
                        <h:outputText value="Host Dataverse"/>
                        <p:selectOneMenu value="#{DatasetPage.ownerId}" filter="true" filterMatchMode="startsWith" effect="none">    
                            <f:selectItems value="#{dataverseServiceBean.findAll()}" var="dv" itemLabel="#{dv.name}" itemValue="#{dv.id}"/>   
                        </p:selectOneMenu>  
                    </p:panelGrid>             
                </p:panelGrid>
            </p:panel>

            <!-- Citation / Buttons Panel -->
            <p:panel>
                <p:panelGrid columns="2"  columnClasses="column75,column25">
                    <p:panel rendered="#{empty DatasetPage.editMode}">
                        <p:panel style="background-color: lightgrey;">
                            <h:outputText style="background-color: lightgrey;" value="#{DatasetPage.dataset.citation}" />
                        </p:panel>
                        <p:panel>
                            <p:panelGrid columns="2">
                                <p:commandButton value="Copy Citation" disabled="true"/>
                                <h:outputLink  onclick="PF('whyCite').show();" value="javascript:void(0)">
                                    <h:outputText value="Why cite?" style="color: green" />
                                </h:outputLink>
                                <p:dialog header="Why cite?" widgetVar="whyCite" modal="true" height="100">  
                                    <h:outputText value="Info on why to use a data citation." />  
                                </p:dialog>                                  
                            </p:panelGrid>                               
                        </p:panel>
                    </p:panel>
                    <p:panelGrid columns="2" rendered="#{DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                        <h:outputText value="Data Citation"/>
                        <p:panelGrid columns="3">
                            <p:outputLabel value="Author" for="author" />
                            <p:inputText id="author" value="#{DatasetPage.dataset.author}" />
                            <p:message for="author" />

                            <p:outputLabel value="Date" for="date" />
                            <p:inputText id="date" value="#{DatasetPage.dataset.citationDate}" />
                            <p:message for="date" />

                            <p:outputLabel value="Distributor" for="distributor" />
                            <p:inputText id="distributor" value="#{DatasetPage.dataset.distributor}" />
                            <p:message for="distributor" />
                        </p:panelGrid> 
                    </p:panelGrid>                            
                    <p:panel>
                        <p:menuButton value="Edit Data Set" iconPos="right" rendered="#{empty DatasetPage.editMode}"> 
                            <p:menuitem value="Edit Info" actionListener="#{DatasetPage.editInfo}" update="@all"/>
                            <p:menuitem value="Edit Files" onclick="content.select(0)" actionListener="#{DatasetPage.editFile}" update="@all"/>
                            <p:menuitem value="Edit Metadata" onclick="content. select(0)" actionListener="#{DatasetPage.editMetadata}" update="@all"/>
                            <p:menuitem value="Edit Permissions" disabled="true"/>  
                        </p:menuButton>
                        <ui:fragment rendered="#{!empty DatasetPage.editMode}">
                            <p:commandButton value="Save" actionListener="#{DatasetPage.save}" update="@all" />
                            <p:commandButton value="Cancel" actionListener="#{DatasetPage.cancel}" process="@this" update="@all"  rendered="#{DatasetPage.editMode != 'CREATE'}" />
                            <p:button value="Cancel" outcome="/dataverse.xhtml?id=#{DatasetPage.ownerId}"  rendered="#{DatasetPage.editMode == 'CREATE'}" />
                        </ui:fragment>
                    </p:panel>
                </p:panelGrid>
            </p:panel>

            <!-- Description Panel -->            
            <p:panel rendered="#{empty DatasetPage.editMode or DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                <h:outputText value="#{DatasetPage.dataset.description}" rendered="#{empty DatasetPage.editMode}" />
                <p:panelGrid columns="3" rendered="#{DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                    <p:outputLabel value="Description" for="description"/>
                    <p:inputTextarea  id="description" value="#{DatasetPage.dataset.description}"
                                      rows="5" cols="30" counter="counter" maxlength="1000"       
                                      counterTemplate="{0} characters remaining." autoResize="false"/>
                    <h:outputText id="counter" /> 
                </p:panelGrid>
            </p:panel>

            <!-- Content Panel -->
            <p:panel id="content" rendered="#{DatasetPage.editMode != 'INFO'}">
                <p:tabView widgetVar="content">  
                    <p:tab title="Data Files" rendered="#{(empty DatasetPage.editMode or DatasetPage.editMode == 'FILE' or DatasetPage.editMode == 'CREATE')}" >
                        <p:fileUpload  dragDropSupport="true"  auto="true" multiple="true" rendered="#{DatasetPage.editMode == 'FILE' or DatasetPage.editMode == 'CREATE'}"
                                       fileUploadListener="#{DatasetPage.handleFileUpload}" update="filesTable"/>
                        <p:dataTable id="filesTable" value="#{DatasetPage.dataset.files}" var="file">
                            <p:column>
                                <h:outputText value="#{file.name}" />     
                            </p:column>
                            <p:column>
                                <h:outputText value="#{file.contentType}" />    
                            </p:column>                     
                        </p:dataTable>                
                    </p:tab>                       
                    <p:tab title="Metadata" rendered="#{(empty DatasetPage.editMode or DatasetPage.editMode == 'METADATA')}">
                        <p:panelGrid columns="3">
                            <p:outputLabel value="Keyword" for="keyword" /><commit_msg>added selectedTabIndex to set tab<commit_after><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"      
      xmlns:p="http://primefaces.org/ui">  

    <h:head>  
        <style type="text/css">
            .column75{width: 75%;height:auto}
            .column25{width: 25%;height:auto}
            .column60{width: 60%;height:auto}
            .column40{width: 40%;height:auto}            
        </style>
    </h:head>

    <h:body> 
        <f:metadata>
            <f:viewParam name="id" value="#{DatasetPage.dataset.id}"/>
            <f:viewParam name="ownerId" value="#{DatasetPage.ownerId}"/>
            <f:viewAction action="#{DatasetPage.init}" />
        </f:metadata>  

        <!-- Header Panel -->
        <p:panel  style="background-color: lightskyblue; height:70px;">
            <ui:repeat value="#{DatasetPage.dataset.owner.owners}" var="owner">                   
                <h:outputLink value="/dataverse.xhtml?id=#{owner.id}">
                    <h:outputText value="#{owner.name}" />             
                </h:outputLink> 
                <h:outputText value=" > "/>
            </ui:repeat>
            <br/>
            <h:outputLink value="/dataverse.xhtml?id=#{DatasetPage.dataset.owner.id}">
                <h:outputText value="#{DatasetPage.dataset.owner.name} Dataverse" /> 
            </h:outputLink>
        </p:panel>

        <h:form id="datasetForm"> 
            <!-- Message Panel -->
            <p:panel  rendered="#{!empty DatasetPage.editMode}">
                <h:outputText value="Upload your dataset:" rendered="#{DatasetPage.editMode == 'CREATE'}"/>
                <h:outputText value="Edit your dataset's information:" rendered="#{DatasetPage.editMode == 'INFO'}"/>
                <h:outputText value="Edit your dataset's files:" rendered="#{DatasetPage.editMode == 'FILE'}"/>
                <h:outputText value="Edit your dataset's metadata" rendered="#{DatasetPage.editMode == 'METADATA'}"/>
            </p:panel>              

            <!-- Title Panel -->
            <p:panel rendered="#{empty DatasetPage.editMode or DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                <h:outputText value="#{DatasetPage.dataset.title}" rendered="#{empty DatasetPage.editMode}"/>
                <p:panelGrid columns="2"  columnClasses="column60,column40"  rendered="#{DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                    <p:panelGrid columns="3">
                        <p:outputLabel value="Title" for="title" />
                        <ui:fragment>
                            <p:inputText id="title" value="#{DatasetPage.dataset.title}" />
                            <p:watermark for="title" value="Enter title..."/>
                        </ui:fragment>
                        <p:message for="title" />
                    </p:panelGrid>
                    <p:panelGrid columns="2">
                        <h:outputText value="Host Dataverse"/>
                        <p:selectOneMenu value="#{DatasetPage.ownerId}" filter="true" filterMatchMode="startsWith" effect="none">    
                            <f:selectItems value="#{dataverseServiceBean.findAll()}" var="dv" itemLabel="#{dv.name}" itemValue="#{dv.id}"/>   
                        </p:selectOneMenu>  
                    </p:panelGrid>             
                </p:panelGrid>
            </p:panel>

            <!-- Citation / Buttons Panel -->
            <p:panel>
                <p:panelGrid columns="2"  columnClasses="column75,column25">
                    <p:panel rendered="#{empty DatasetPage.editMode}">
                        <p:panel style="background-color: lightgrey;">
                            <h:outputText style="background-color: lightgrey;" value="#{DatasetPage.dataset.citation}" />
                        </p:panel>
                        <p:panel>
                            <p:panelGrid columns="2">
                                <p:commandButton value="Copy Citation" disabled="true"/>
                                <h:outputLink  onclick="PF('whyCite').show();" value="javascript:void(0)">
                                    <h:outputText value="Why cite?" style="color: green" />
                                </h:outputLink>
                                <p:dialog header="Why cite?" widgetVar="whyCite" modal="true" height="100">  
                                    <h:outputText value="Info on why to use a data citation." />  
                                </p:dialog>                                  
                            </p:panelGrid>                               
                        </p:panel>
                    </p:panel>
                    <p:panelGrid columns="2" rendered="#{DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                        <h:outputText value="Data Citation"/>
                        <p:panelGrid columns="3">
                            <p:outputLabel value="Author" for="author" />
                            <p:inputText id="author" value="#{DatasetPage.dataset.author}" />
                            <p:message for="author" />

                            <p:outputLabel value="Date" for="date" />
                            <p:inputText id="date" value="#{DatasetPage.dataset.citationDate}" />
                            <p:message for="date" />

                            <p:outputLabel value="Distributor" for="distributor" />
                            <p:inputText id="distributor" value="#{DatasetPage.dataset.distributor}" />
                            <p:message for="distributor" />
                        </p:panelGrid> 
                    </p:panelGrid>                            
                    <p:panel>
                        <p:menuButton value="Edit Data Set" iconPos="right" rendered="#{empty DatasetPage.editMode}"> 
                            <p:menuitem value="Edit Info" actionListener="#{DatasetPage.editInfo}" update="@all"/>
                            <p:menuitem value="Edit Files" actionListener="#{DatasetPage.editFile}" update="@all">
                                <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
                            </p:menuitem>
                            <p:menuitem value="Edit Metadata" actionListener="#{DatasetPage.editMetadata}" update="@all">
                                <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
                            </p:menuitem>
                            <p:menuitem value="Edit Permissions" disabled="true"/>  
                        </p:menuButton>
                        <ui:fragment rendered="#{!empty DatasetPage.editMode}">
                            <p:commandButton value="Save" actionListener="#{DatasetPage.save}" update="@all" rendered="#{DatasetPage.editMode != 'METADATA'}"/>
                            <p:commandButton value="Save" actionListener="#{DatasetPage.save}" update="@all" rendered="#{DatasetPage.editMode == 'METADATA'}">
                                <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="1"/>
                            </p:commandButton>
                            <p:commandButton value="Cancel" actionListener="#{DatasetPage.cancel}" process="@this" update="@all"  rendered="#{DatasetPage.editMode != 'CREATE' and DatasetPage.editMode != 'METADATA'}"/>
                            <p:commandButton value="Cancel" actionListener="#{DatasetPage.cancel}" process="@this" update="@all"  rendered="#{DatasetPage.editMode != 'CREATE' and DatasetPage.editMode == 'METADATA'}">
                                <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}"  value="1"/>
                            </p:commandButton>                            
                            <p:button value="Cancel" outcome="/dataverse.xhtml?id=#{DatasetPage.ownerId}"  rendered="#{DatasetPage.editMode == 'CREATE'}" />
                        </ui:fragment>
                    </p:panel>
                </p:panelGrid>
            </p:panel>
            <!-- Description Panel -->            
            <p:panel rendered="#{empty DatasetPage.editMode or DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                <h:outputText value="#{DatasetPage.dataset.description}" rendered="#{empty DatasetPage.editMode}" />
                <p:panelGrid columns="3" rendered="#{DatasetPage.editMode == 'INFO' or DatasetPage.editMode == 'CREATE'}">
                    <p:outputLabel value="Description" for="description"/>
                    <p:inputTextarea  id="description" value="#{DatasetPage.dataset.description}"
                                      rows="5" cols="30" counter="counter" maxlength="1000"       
                                      counterTemplate="{0} characters remaining." autoResize="false"/>
                    <h:outputText id="counter" /> 
                </p:panelGrid>
            </p:panel>

            <!-- Content Panel -->
            <p:panel id="content" rendered="#{DatasetPage.editMode != 'INFO'}">
                <p:tabView widgetVar="content" activeIndex="#{DatasetPage.selectedTabIndex}">  
                    <p:tab title="Data Files" rendered="#{(empty DatasetPage.editMode or DatasetPage.editMode == 'FILE' or DatasetPage.editMode == 'CREATE')}" >
                        <p:fileUpload  dragDropSupport="true"  auto="true" multiple="true" rendered="#{DatasetPage.editMode == 'FILE' or DatasetPage.editMode == 'CREATE'}"
                                       fileUploadListener="#{DatasetPage.handleFileUpload}" update="filesTable"/>
                        <p:dataTable id="filesTable" value="#{DatasetPage.dataset.files}" var="file">
                            <p:column>
                                <h:outputText value="#{file.name}" />     
                            </p:column>
                            <p:column>
                                <h:outputText value="#{file.contentType}" />    
                            </p:column>                     
                        </p:dataTable>                
                    </p:tab>                       
                    <p:tab title="Metadata" rendered="#{(empty DatasetPage.editMode or DatasetPage.editMode == 'METADATA')}">
                        <p:panelGrid columns="3">
                            <p:outputLabel value="Keyword" for="keyword" />
{'fraction_non_alphanumeric': 0.1466148557764161, 'fraction_numerical': 0.005479998007273452, 'mean_word_length': 1.5735897435897437, 'pattern_counts': {'":': 0, '<': 266, '<?xml version=': 0, '>': 268, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4096546', 'n_tokens_mistral': 5259, 'n_tokens_neox': 5055, 'n_words': 816}