<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"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

    <h:head>
    </h:head>

    <h:body>
        <ui:composition template="/dataverse_template.xhtml">
            <ui:param name="pageTitle" value="#{DatasetPage.editMode == 'CREATE' ? 'Add New Dataset' : DatasetPage.workingVersion.title} - #{DatasetPage.dataset.owner.name} Dataverse"/>
            <ui:param name="dataverse" value="#{DatasetPage.dataset.owner}"/>
            <ui:param name="dataset" value="#{DatasetPage.dataset}"/>
            <ui:param name="version" value="#{DatasetPage.workingVersion}"/>
            <ui:param name="showBreadcrumbs" value="#{empty DatasetPage.editMode}"/>
            <ui:param name="showMessagePanel" value="#{true}"/>
            <ui:define name="body">
                <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="#{DatasetPage.dropBoxKey}"/>
                <script type="text/javascript">

                    function openDialog() {
                        details.show();
                    }
                    function openCompareTwo() {
                        compareTwo.show();
                    }
                    function testCheckBoxes() {
                        var count = versionsTable.getSelectedRowsCount();
                        if (count !== 2) {
                            compareTwo.show();
                        } else {
                            $('button[id$="compareVersions"]').trigger('click');
                        }
                    }

                    function updateTemplate() {
                        $('button[id$="updateTemplate"]').trigger('click');
                    }

                    function checkFilesSelected() {
                        var count = filesTable.getSelectedRowsCount();
                        if (count > 0) {
                            deleteFileConfirmation.show();
                        } else {
                            $('button[id$="datasetSave"]').trigger('click');
                        }
                    }

                    function updateHiddenReason(textArea) {
                        $('input[id$="hiddenReasonInput"]').val(textArea.value);
                    }

                    function testDeaccessionVersionSelection(testVersion) {
                        var deaccessionText = $('input[id$="hiddenReasonInput"]').val();
                        var urlEntry = $('input[id$="forwardURLForDeaccession"]').val();
                        ;
                        var valid = true;
                        if (testVersion === true) {
                            var count = versionDeaccessionTable.getSelectedRowsCount();
                        }

                        if (validateURL(urlEntry) === false) {
                            valid = false;
                            enterForwardUrl.show();
                        }
                        if (valid === true) {
                            if ($("select[id$='reasonOptions'] option:selected").val() === '7') {
                                if (deaccessionText === '') {
                                    valid = false;
                                    enterOtherReason.show();
                                }
                            }
                        }
                        if (deaccessionText.length >= 1001) {
                            valid = false;
                            reasonTooManyCharacters.show();
                        }
                        if (valid === true) {
                            if ($("select[id$='reasonOptions'] option:selected").val() === '0') {
                                valid = false;
                                selectDeaccessionReason.show();
                            }
                        }
                        if (valid === true) {
                            if (testVersion === false) {
                                deaccessionAllConfirmation.show();
                            } else {
                                if (count === 0) {
                                    selectDeaccessionVersion.show();
                                } else {
                                    deaccessionConfirmation.show();
                                }
                            }
                        }
                    }

                    function validateURL(textval) {
                        if (textval === '') {
                            return true;
                        }
                        var urlregex = new RegExp("^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*$");
                        return urlregex.test(textval);
                    }

                    function openDropboxChooser() {
                        options = {
                            // Required. Called when a user selects an item in the Chooser.
                            success: function(files) {
                                // Pass the JSON-ized output of the Chooser to the backing bean,
                                // via a hidden input field:
                                $('input[id$="dropBoxSelectionInput"]').val(JSON.stringify(files));
                                //alert(JSON.stringify(files));
                                // Trigger the upload processing method in the backing
                                // bean, via an invisible commandButton:
                                $('button[id$="dropBoxButton"]').trigger('click');

                            },
                            linkType: "direct",
                            multiselect: true,
                        };
                        Dropbox.choose(options);
                    }
                </script>

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

                <h:form id="datasetForm">
                    <!-- Header / Button Panel -->
                    <ui:fragment>
                        <!-- View mode -->
                        <ui:fragment rendered="#{empty DatasetPage.editMode}">
                            <div id="topDatasetBlock">
                                <div id="actionButtonBlock" class="clearfix" style="margin-bottom:.55em;">
                                    <ui:fragment rendered="#{dataverseSession.user.authenticated and empty DatasetPage.editMode
                                                             and ((DatasetPage.workingVersion == DatasetPage.dataset.latestVersion and (DatasetPage.workingVersion.draft or DatasetPage.workingVersion.released))
                                                             or (DatasetPage.workingVersion != DatasetPage.dataset.latestVersion and DatasetPage.dataset.latestVersion.deaccessioned and  DatasetPage.workingVersion == DatasetPage.dataset.releasedVersion))
                                                             and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('UpdateDatasetCommand')
                                                             and !DatasetPage.locked}">
                                        <div style="float:right; margin-left:1em;">
                                            <div class="btn-group">
                                                <button type="button" id="editDataSet" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                    <span class="glyphicon glyphicon-pencil" style="margin-right:.3em;"/> Edit Dataset <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu pull-right" role="menu" style="text-align:left;">
                                                    <li>
                                                        <p:commandLink id="editFiles" actionListener="#{DatasetPage.edit('FILE')}" update="@form" oncomplete="javascript:post_edit_files()">
                                                            <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
                                                            <h:outputText value="Files (Upload + Edit)" />
                                                        </p:commandLink>
                                                    </li>
                                                    <li>
                                                        <p:commandLink id="editMetadata" actionListener="#{DatasetPage.edit('METADATA')}" update="@form" oncomplete="javascript:post_edit_metadata()">
                                                            <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
                                                            <h:outputText value="Metadata" />
                                                        </p:commandLink>
                                                    </li>
                                                    <ui:fragment rendered="#{!DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('DeleteDatasetCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deleteDataset" onclick="deleteConfirmation.show()">
                                                                <h:outputText value="Delete Dataset" />
                                                            </p:commandLink>
                                                        </li>
                                                    </ui:fragment>
                                                    <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('DeleteDatasetCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deleteVersion" onclick="deleteVersionConfirmation.show()">
                                                                <h:outputText value="Delete Draft Version" />
                                                            </p:commandLink>
                                                        </li>
                                                    </ui:fragment>
                                                    <ui:fragment rendered="#{DatasetPage.dataset.released and !empty(DatasetPage.releasedVersionTabList) and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('DeleteDatasetCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deaccessionDatasetLink" onclick="deaccessionBlock.show()">
                                                                <h:outputText value="Deaccession Dataset" />
                                                            </p:commandLink>
                                                        </li>
                                                    </ui:fragment>
                                                    <!--<li><a href="#" class="ui-commandlink ui-widget" style="pointer-events: none; color: grey;">Permissions</a></li>-->
                                                </ul>
                                            </div>
                                        </div>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{dataverseSession.user.authenticated and empty DatasetPage.editMode
                                                             and DatasetPage.workingVersion == DatasetPage.dataset.latestVersion
                                                             and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('PublishDatasetCommand')}">
                                        <div style="float:right; margin-left:1em;">
                                            <ui:fragment rendered="#{!DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and DatasetPage.dataset.owner.released and !DatasetPage.locked}">
                                                <button type="button" class="btn btn-default" onclick="confirmation.show()">
                                                    <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataset
                                                </button>
                                            </ui:fragment>
                                            <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and DatasetPage.dataset.owner.released and !DatasetPage.locked}">
                                                <button type="button" class="btn btn-default" onclick="releaseDraft.show()">
                                                    <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataset
                                                </button>
                                            </ui:fragment>
                                            <ui:fragment rendered="#{DatasetPage.dataset.latestVersion.versionState=='DRAFT' and !DatasetPage.dataset.owner.released and !DatasetPage.locked}">
                                                <button type="button" class="btn btn-default" onclick="mayNotRelease.show()">
                                                    <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataset
                                                </button>
                                            </ui:fragment>
                                        </div>
                                        <p:confirmDialog message="Are you sure you want to publish your dataset? Once you do so it must remain 'Published'." header="Publish Dataset" widgetVar="confirmation">
                                            <p:commandButton value="Continue" onclick="confirmation.hide()" action="#{DatasetPage.releaseDataset}">
                                            </p:commandButton>
                                            <p:commandButton value="Cancel" onclick="confirmation.hide()" type="button" />
                                        </p:confirmDialog>
                                        <p:confirmDialog message="Are you sure you want to republish your dataset?" header="Publish Dataset" widgetVar="releaseDraft">
                                            <ui:fragment rendered="#{DatasetPage.dataset.latestVersion.minorUpdate}">
                                                Select version number:
                                                <p:selectOneRadio id="options" value="#{DatasetPage.releaseRadio}">
                                                    <f:selectItem itemLabel="Major Release (#{DatasetPage.datasetNextMajorVersion})" itemValue="1" />
                                                    <f:selectItem itemLabel="Minor Release (#{DatasetPage.datasetNextMinorVersion})" itemValue="2" />
                                                </p:selectOneRadio>
                                            </ui:fragment>
                                            <ui:fragment rendered="#{!DatasetPage.dataset.latestVersion.minorUpdate}">
                                                Due to the nature of changes to the current draft this will be a major release (#{DatasetPage.datasetNextMajorVersion})
                                            </ui:fragment>
                                            <p:commandButton value="Continue" onclick="releaseDraft.hide()" action="#{DatasetPage.releaseDraft}">
                                            </p:commandButton>
                                            <p:commandButton value="Cancel" onclick="releaseDraft.hide()" type="button" />
                                        </p:confirmDialog>
                                        <p:confirmDialog message="This dataset may not be published because its host dataverse has not been published." header="May not publish" widgetVar="mayNotRelease">
                                        </p:confirmDialog>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{DatasetPage.dataset.latestVersion.draft and DatasetPage.workingVersion != DatasetPage.dataset.latestVersion
                                                             and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('UpdateDatasetCommand')}">
                                        <div style="float:right; margin-left:1em;">
                                            <h:outputLink styleClass="btn btn-warning" value="/dataset.xhtml?id=#{DatasetPage.dataset.id}&#38;versionId=#{DatasetPage.dataset.latestVersion.id}">
                                                <h:outputText value="View Unpublished Version"/>
                                            </h:outputLink>
                                        </div>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.workingVersion != DatasetPage.dataset.releasedVersion
                                                             and !empty(DatasetPage.releasedVersionTabList)}">
                                        <div style="float:right; margin-left:1em;">
                                            <h:outputLink styleClass="btn btn-primary" value="/dataset.xhtml?id=#{DatasetPage.dataset.id}&#38;versionId=#{DatasetPage.dataset.releasedVersion.id}">
                                                <h:outputText value="View Published Version"/>
                                            </h:outputLink>
                                        </div>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{empty DatasetPage.editMode}">
                                        <div style="float:right;">
                                            <button type="button" class="btn btn-default" onclick="contact_confirmation.show()">
                                                <span class="glyphicon glyphicon-envelope" style="margin-right:.3em;"/> Email Dataset Contact
                                            </button>
                                        </div>
                                    </ui:fragment>
                                    <p:confirmDialog message="Dataverse 4.0 Beta cannot email dataset contacts. Look for this feature in Dataverse 4.0!" header="Email Dataset Contact" widgetVar="contact_confirmation">
                                    </p:confirmDialog>
                                </div>
                                <div id="datasetVersionBlock">
                                    <ui:fragment rendered="#{!empty DatasetPage.datasetVersionUI.title.value}">
                                        <span id="title">#{DatasetPage.datasetVersionUI.title.value}</span>
                                        <h:outputText value="Draft" styleClass="label label-warning" rendered="#{DatasetPage.workingVersion.draft}"/>
                                        <h:outputText value="Unpublished" styleClass="label label-danger" rendered="#{!DatasetPage.dataset.released}"/>
                                        <h:outputText value="Deaccessioned" styleClass="label label-info" rendered="#{DatasetPage.workingVersion.deaccessioned}"/>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{!empty DatasetPage.displayCitation}">
                                        <div class="row" style="margin-bottom:.5em; padding-left:15px;">
                                            <div id="citation" class="bg-info col-md-9">
                                                <span>#{DatasetPage.displayCitation}</span>
                                                <ui:fragment rendered="#{!DatasetPage.dataset.released}">
                                                    <span class="glyphicon glyphicon-question-sign text-primary" style="cursor:pointer; cursor:hand;" data-toggle="tooltip" data-trigger="hover" data-placement="top" data-original-title="DRAFT VERSION will be replaced in the citation with V1 once the dataset has been published."></span>
                                                </ui:fragment>
                                                <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.workingVersion.draft}">
                                                    <span class="glyphicon glyphicon-question-sign text-primary" style="cursor:pointer; cursor:hand;" data-toggle="tooltip" data-trigger="hover" data-placement="top" data-original-title="DRAFT VERSION will be replaced in the citation with the selected version once the dataset has been published."></span>
                                                </ui:fragment>
                                                <ui:fragment rendered="#{DatasetPage.workingVersion.deaccessioned}">
                                                    <span class="glyphicon glyphicon-question-sign text-primary" style="cursor:pointer; cursor:hand;" data-toggle="tooltip" data-trigger="hover" data-placement="top" data-original-title="DEACCESSIONED VERSION has been added to the citation for this version since it is no longer available."></span>
                                                </ui:fragment>
                                            </div>
                                            <div class="row col-md-3" style="padding-right:0;">
                                                <span id="whycitelink" class="bg-warning small pull-left"><a href="/guides/Data_Citation/index.html" target="_blank">Why Cite?</a></span>
                                                <div class="dropdown pull-right">
                                                    <button type="button" id="downloadCitation" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                        <span class="glyphicon glyphicon-download-alt" style="margin-right:.3em;"/> Download Citation <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu pull-right" role="menu" style="text-align:left;">
                                                        <li>
                                                            <h:commandLink id="endNoteLink" action="#{DatasetPage.downloadXMLFile()}" >

                                                                <h:outputText value="End Note XML" />
                                                            </h:commandLink>
                                                        </li>
                                                        <li>
                                                            <h:commandLink id="risLink" actionListener="#{DatasetPage.downloadRISFile()}">

                                                                <h:outputText value="RIS Format" />
                                                            </h:commandLink>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                    </ui:fragment>

                                    <ui:fragment rendered="#{DatasetPage.workingVersion.deaccessioned}">
                                        <div class="bg-danger" style="padding:4px;margin-bottom:.5em;">
                                            <p><strong>Deaccession Reason:</strong> #{DatasetPage.workingVersion.versionNote}</p>
                                            <ui:fragment rendered="#{!empty DatasetPage.workingVersion.archiveNote}">
                                                <p>The dataset can now be accessed at: <a href="#{DatasetPage.workingVersion.archiveNote}" target="_blank">#{DatasetPage.workingVersion.archiveNote}</a></p>
                                            </ui:fragment>
                                        </div>
                                    </ui:fragment><commit_msg>Fix EndNote label<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"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

    <h:head>
    </h:head>

    <h:body>
        <ui:composition template="/dataverse_template.xhtml">
            <ui:param name="pageTitle" value="#{DatasetPage.editMode == 'CREATE' ? 'Add New Dataset' : DatasetPage.workingVersion.title} - #{DatasetPage.dataset.owner.name} Dataverse"/>
            <ui:param name="dataverse" value="#{DatasetPage.dataset.owner}"/>
            <ui:param name="dataset" value="#{DatasetPage.dataset}"/>
            <ui:param name="version" value="#{DatasetPage.workingVersion}"/>
            <ui:param name="showBreadcrumbs" value="#{empty DatasetPage.editMode}"/>
            <ui:param name="showMessagePanel" value="#{true}"/>
            <ui:define name="body">
                <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="#{DatasetPage.dropBoxKey}"/>
                <script type="text/javascript">

                    function openDialog() {
                        details.show();
                    }
                    function openCompareTwo() {
                        compareTwo.show();
                    }
                    function testCheckBoxes() {
                        var count = versionsTable.getSelectedRowsCount();
                        if (count !== 2) {
                            compareTwo.show();
                        } else {
                            $('button[id$="compareVersions"]').trigger('click');
                        }
                    }

                    function updateTemplate() {
                        $('button[id$="updateTemplate"]').trigger('click');
                    }

                    function checkFilesSelected() {
                        var count = filesTable.getSelectedRowsCount();
                        if (count > 0) {
                            deleteFileConfirmation.show();
                        } else {
                            $('button[id$="datasetSave"]').trigger('click');
                        }
                    }

                    function updateHiddenReason(textArea) {
                        $('input[id$="hiddenReasonInput"]').val(textArea.value);
                    }

                    function testDeaccessionVersionSelection(testVersion) {
                        var deaccessionText = $('input[id$="hiddenReasonInput"]').val();
                        var urlEntry = $('input[id$="forwardURLForDeaccession"]').val();
                        ;
                        var valid = true;
                        if (testVersion === true) {
                            var count = versionDeaccessionTable.getSelectedRowsCount();
                        }

                        if (validateURL(urlEntry) === false) {
                            valid = false;
                            enterForwardUrl.show();
                        }
                        if (valid === true) {
                            if ($("select[id$='reasonOptions'] option:selected").val() === '7') {
                                if (deaccessionText === '') {
                                    valid = false;
                                    enterOtherReason.show();
                                }
                            }
                        }
                        if (deaccessionText.length >= 1001) {
                            valid = false;
                            reasonTooManyCharacters.show();
                        }
                        if (valid === true) {
                            if ($("select[id$='reasonOptions'] option:selected").val() === '0') {
                                valid = false;
                                selectDeaccessionReason.show();
                            }
                        }
                        if (valid === true) {
                            if (testVersion === false) {
                                deaccessionAllConfirmation.show();
                            } else {
                                if (count === 0) {
                                    selectDeaccessionVersion.show();
                                } else {
                                    deaccessionConfirmation.show();
                                }
                            }
                        }
                    }

                    function validateURL(textval) {
                        if (textval === '') {
                            return true;
                        }
                        var urlregex = new RegExp("^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*$");
                        return urlregex.test(textval);
                    }

                    function openDropboxChooser() {
                        options = {
                            // Required. Called when a user selects an item in the Chooser.
                            success: function(files) {
                                // Pass the JSON-ized output of the Chooser to the backing bean,
                                // via a hidden input field:
                                $('input[id$="dropBoxSelectionInput"]').val(JSON.stringify(files));
                                //alert(JSON.stringify(files));
                                // Trigger the upload processing method in the backing
                                // bean, via an invisible commandButton:
                                $('button[id$="dropBoxButton"]').trigger('click');

                            },
                            linkType: "direct",
                            multiselect: true,
                        };
                        Dropbox.choose(options);
                    }
                </script>

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

                <h:form id="datasetForm">
                    <!-- Header / Button Panel -->
                    <ui:fragment>
                        <!-- View mode -->
                        <ui:fragment rendered="#{empty DatasetPage.editMode}">
                            <div id="topDatasetBlock">
                                <div id="actionButtonBlock" class="clearfix" style="margin-bottom:.55em;">
                                    <ui:fragment rendered="#{dataverseSession.user.authenticated and empty DatasetPage.editMode
                                                             and ((DatasetPage.workingVersion == DatasetPage.dataset.latestVersion and (DatasetPage.workingVersion.draft or DatasetPage.workingVersion.released))
                                                             or (DatasetPage.workingVersion != DatasetPage.dataset.latestVersion and DatasetPage.dataset.latestVersion.deaccessioned and  DatasetPage.workingVersion == DatasetPage.dataset.releasedVersion))
                                                             and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('UpdateDatasetCommand')
                                                             and !DatasetPage.locked}">
                                        <div style="float:right; margin-left:1em;">
                                            <div class="btn-group">
                                                <button type="button" id="editDataSet" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                    <span class="glyphicon glyphicon-pencil" style="margin-right:.3em;"/> Edit Dataset <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu pull-right" role="menu" style="text-align:left;">
                                                    <li>
                                                        <p:commandLink id="editFiles" actionListener="#{DatasetPage.edit('FILE')}" update="@form" oncomplete="javascript:post_edit_files()">
                                                            <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
                                                            <h:outputText value="Files (Upload + Edit)" />
                                                        </p:commandLink>
                                                    </li>
                                                    <li>
                                                        <p:commandLink id="editMetadata" actionListener="#{DatasetPage.edit('METADATA')}" update="@form" oncomplete="javascript:post_edit_metadata()">
                                                            <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
                                                            <h:outputText value="Metadata" />
                                                        </p:commandLink>
                                                    </li>
                                                    <ui:fragment rendered="#{!DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('DeleteDatasetCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deleteDataset" onclick="deleteConfirmation.show()">
                                                                <h:outputText value="Delete Dataset" />
                                                            </p:commandLink>
                                                        </li>
                                                    </ui:fragment>
                                                    <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('DeleteDatasetCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deleteVersion" onclick="deleteVersionConfirmation.show()">
                                                                <h:outputText value="Delete Draft Version" />
                                                            </p:commandLink>
                                                        </li>
                                                    </ui:fragment>
                                                    <ui:fragment rendered="#{DatasetPage.dataset.released and !empty(DatasetPage.releasedVersionTabList) and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('DeleteDatasetCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deaccessionDatasetLink" onclick="deaccessionBlock.show()">
                                                                <h:outputText value="Deaccession Dataset" />
                                                            </p:commandLink>
                                                        </li>
                                                    </ui:fragment>
                                                    <!--<li><a href="#" class="ui-commandlink ui-widget" style="pointer-events: none; color: grey;">Permissions</a></li>-->
                                                </ul>
                                            </div>
                                        </div>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{dataverseSession.user.authenticated and empty DatasetPage.editMode
                                                             and DatasetPage.workingVersion == DatasetPage.dataset.latestVersion
                                                             and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('PublishDatasetCommand')}">
                                        <div style="float:right; margin-left:1em;">
                                            <ui:fragment rendered="#{!DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and DatasetPage.dataset.owner.released and !DatasetPage.locked}">
                                                <button type="button" class="btn btn-default" onclick="confirmation.show()">
                                                    <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataset
                                                </button>
                                            </ui:fragment>
                                            <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and DatasetPage.dataset.owner.released and !DatasetPage.locked}">
                                                <button type="button" class="btn btn-default" onclick="releaseDraft.show()">
                                                    <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataset
                                                </button>
                                            </ui:fragment>
                                            <ui:fragment rendered="#{DatasetPage.dataset.latestVersion.versionState=='DRAFT' and !DatasetPage.dataset.owner.released and !DatasetPage.locked}">
                                                <button type="button" class="btn btn-default" onclick="mayNotRelease.show()">
                                                    <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataset
                                                </button>
                                            </ui:fragment>
                                        </div>
                                        <p:confirmDialog message="Are you sure you want to publish your dataset? Once you do so it must remain 'Published'." header="Publish Dataset" widgetVar="confirmation">
                                            <p:commandButton value="Continue" onclick="confirmation.hide()" action="#{DatasetPage.releaseDataset}">
                                            </p:commandButton>
                                            <p:commandButton value="Cancel" onclick="confirmation.hide()" type="button" />
                                        </p:confirmDialog>
                                        <p:confirmDialog message="Are you sure you want to republish your dataset?" header="Publish Dataset" widgetVar="releaseDraft">
                                            <ui:fragment rendered="#{DatasetPage.dataset.latestVersion.minorUpdate}">
                                                Select version number:
                                                <p:selectOneRadio id="options" value="#{DatasetPage.releaseRadio}">
                                                    <f:selectItem itemLabel="Major Release (#{DatasetPage.datasetNextMajorVersion})" itemValue="1" />
                                                    <f:selectItem itemLabel="Minor Release (#{DatasetPage.datasetNextMinorVersion})" itemValue="2" />
                                                </p:selectOneRadio>
                                            </ui:fragment>
                                            <ui:fragment rendered="#{!DatasetPage.dataset.latestVersion.minorUpdate}">
                                                Due to the nature of changes to the current draft this will be a major release (#{DatasetPage.datasetNextMajorVersion})
                                            </ui:fragment>
                                            <p:commandButton value="Continue" onclick="releaseDraft.hide()" action="#{DatasetPage.releaseDraft}">
                                            </p:commandButton>
                                            <p:commandButton value="Cancel" onclick="releaseDraft.hide()" type="button" />
                                        </p:confirmDialog>
                                        <p:confirmDialog message="This dataset may not be published because its host dataverse has not been published." header="May not publish" widgetVar="mayNotRelease">
                                        </p:confirmDialog>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{DatasetPage.dataset.latestVersion.draft and DatasetPage.workingVersion != DatasetPage.dataset.latestVersion
                                                             and permissionServiceBean.on(DatasetPage.dataset).canIssueCommand('UpdateDatasetCommand')}">
                                        <div style="float:right; margin-left:1em;">
                                            <h:outputLink styleClass="btn btn-warning" value="/dataset.xhtml?id=#{DatasetPage.dataset.id}&#38;versionId=#{DatasetPage.dataset.latestVersion.id}">
                                                <h:outputText value="View Unpublished Version"/>
                                            </h:outputLink>
                                        </div>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.workingVersion != DatasetPage.dataset.releasedVersion
                                                             and !empty(DatasetPage.releasedVersionTabList)}">
                                        <div style="float:right; margin-left:1em;">
                                            <h:outputLink styleClass="btn btn-primary" value="/dataset.xhtml?id=#{DatasetPage.dataset.id}&#38;versionId=#{DatasetPage.dataset.releasedVersion.id}">
                                                <h:outputText value="View Published Version"/>
                                            </h:outputLink>
                                        </div>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{empty DatasetPage.editMode}">
                                        <div style="float:right;">
                                            <button type="button" class="btn btn-default" onclick="contact_confirmation.show()">
                                                <span class="glyphicon glyphicon-envelope" style="margin-right:.3em;"/> Email Dataset Contact
                                            </button>
                                        </div>
                                    </ui:fragment>
                                    <p:confirmDialog message="Dataverse 4.0 Beta cannot email dataset contacts. Look for this feature in Dataverse 4.0!" header="Email Dataset Contact" widgetVar="contact_confirmation">
                                    </p:confirmDialog>
                                </div>
                                <div id="datasetVersionBlock">
                                    <ui:fragment rendered="#{!empty DatasetPage.datasetVersionUI.title.value}">
                                        <span id="title">#{DatasetPage.datasetVersionUI.title.value}</span>
                                        <h:outputText value="Draft" styleClass="label label-warning" rendered="#{DatasetPage.workingVersion.draft}"/>
                                        <h:outputText value="Unpublished" styleClass="label label-danger" rendered="#{!DatasetPage.dataset.released}"/>
                                        <h:outputText value="Deaccessioned" styleClass="label label-info" rendered="#{DatasetPage.workingVersion.deaccessioned}"/>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{!empty DatasetPage.displayCitation}">
                                        <div class="row" style="margin-bottom:.5em; padding-left:15px;">
                                            <div id="citation" class="bg-info col-md-9">
                                                <span>#{DatasetPage.displayCitation}</span>
                                                <ui:fragment rendered="#{!DatasetPage.dataset.released}">
                                                    <span class="glyphicon glyphicon-question-sign text-primary" style="cursor:pointer; cursor:hand;" data-toggle="tooltip" data-trigger="hover" data-placement="top" data-original-title="DRAFT VERSION will be replaced in the citation with V1 once the dataset has been published."></span>
                                                </ui:fragment>
                                                <ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.workingVersion.draft}">
                                                    <span class="glyphicon glyphicon-question-sign text-primary" style="cursor:pointer; cursor:hand;" data-toggle="tooltip" data-trigger="hover" data-placement="top" data-original-title="DRAFT VERSION will be replaced in the citation with the selected version once the dataset has been published."></span>
                                                </ui:fragment>
                                                <ui:fragment rendered="#{DatasetPage.workingVersion.deaccessioned}">
                                                    <span class="glyphicon glyphicon-question-sign text-primary" style="cursor:pointer; cursor:hand;" data-toggle="tooltip" data-trigger="hover" data-placement="top" data-original-title="DEACCESSIONED VERSION has been added to the citation for this version since it is no longer available."></span>
                                                </ui:fragment>
                                            </div>
                                            <div class="row col-md-3" style="padding-right:0;">
                                                <span id="whycitelink" class="bg-warning small pull-left"><a href="/guides/Data_Citation/index.html" target="_blank">Why Cite?</a></span>
                                                <div class="dropdown pull-right">
                                                    <button type="button" id="downloadCitation" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                        <span class="glyphicon glyphicon-download-alt" style="margin-right:.3em;"/> Download Citation <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu pull-right" role="menu" style="text-align:left;">
                                                        <li>
                                                            <h:commandLink id="endNoteLink" action="#{DatasetPage.downloadXMLFile()}" >

                                                                <h:outputText value="EndNote XML" />
                                                            </h:commandLink>
                                                        </li>
                                                        <li>
                                                            <h:commandLink id="risLink" actionListener="#{DatasetPage.downloadRISFile()}">

                                                                <h:outputText value="RIS Format" />
                                                            </h:commandLink>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                    </ui:fragment>

                                    <ui:fragment rendered="#{DatasetPage.workingVersion.deaccessioned}">
                                        <div class="bg-danger" style="padding:4px;margin-bottom:.5em;">
                                            <p><strong>Deaccession Reason:</strong> #{DatasetPage.workingVersion.versionNote}</p>
                                            <ui:fragment rendered="#{!empty DatasetPage.workingVersion.archiveNote}">
                                                <p>The dataset can now be accessed at: <a href="#{DatasetPage.workingVersion.archiveNote}" target="_blank">#{DatasetPage.workingVersion.archiveNote}</a></p>
                                            </ui:fragment>
                                        </div>
                                    </ui:fragment>
{'fraction_non_alphanumeric': 0.10902595032750043, 'fraction_numerical': 0.005954553312460383, 'mean_word_length': 1.033513006796344, 'pattern_counts': {'":': 0, '<': 435, '<?xml version=': 0, '>': 439, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 642, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4528135', 'n_tokens_mistral': 10419, 'n_tokens_neox': 10038, 'n_words': 1744}