<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>
    </h:head>

    <h:body>
        <ui:composition template="/dataverse_template.xhtml">
            <ui:param name="pageTitle" value="#{empty DataversePage.dataverse.name ? 'New' : DataversePage.dataverse.name} Dataverse"/>
            <ui:param name="dataverse" value="#{DataversePage.dataverse}"/>
            <ui:param name="showBreadcrumbs" value="#{empty DataversePage.editMode}"/>
            <ui:define name="body">
                <f:metadata>
                    <f:viewParam name="id" value="#{DataversePage.dataverse.id}"/>
                    <f:viewParam name="ownerId" value="#{DataversePage.ownerId}"/>
                    <f:viewParam name="editMode" value="#{DataversePage.editMode}"/>
                    <f:viewAction action="#{DataversePage.init}"/>
                    <f:viewParam name="id" value="#{SearchIncludeFragment.dataverseId}"/>
                    <f:viewParam name="q" value="#{SearchIncludeFragment.query}"/>
                    <f:viewParam name="types" value="#{SearchIncludeFragment.selectedTypesString}"/>
                    <f:viewParam name="fq1" value="#{SearchIncludeFragment.fq1}"/>
                    <f:viewParam name="fq0" value="#{SearchIncludeFragment.fq0}"/>
                    <f:viewParam name="fq2" value="#{SearchIncludeFragment.fq2}"/>
                    <f:viewParam name="fq3" value="#{SearchIncludeFragment.fq3}"/>
                    <f:viewParam name="fq4" value="#{SearchIncludeFragment.fq4}"/>
                    <f:viewParam name="fq5" value="#{SearchIncludeFragment.fq5}"/>
                    <f:viewParam name="fq6" value="#{SearchIncludeFragment.fq6}"/>
                    <f:viewParam name="fq7" value="#{SearchIncludeFragment.fq7}"/>
                    <f:viewParam name="fq8" value="#{SearchIncludeFragment.fq8}"/>
                    <f:viewParam name="fq9" value="#{SearchIncludeFragment.fq9}"/>
                    <f:viewParam name="sort" value="#{SearchIncludeFragment.sortField}"/>
                    <f:viewParam name="order" value="#{SearchIncludeFragment.sortOrder}"/>
                    <f:viewParam name="page" value="#{SearchIncludeFragment.page}"/>
                    <f:viewParam name="debug" value="#{SearchIncludeFragment.debug}"/>
                    <f:viewAction action="#{SearchIncludeFragment.search()}" />
                </f:metadata>

                <h:form id="dataverseForm">
                    <p:focus context="dataverseForm"/>

                    <!-- Name Panel -->
                    <p:panel styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}">
                        <p:panelGrid styleClass="panelgridLayoutTable" columns="2">
                            <p:panelGrid columns="2" style="width:100%;">
                                <ui:fragment>
                                    <div class="col-sm-12 form-group" style="margin-bottom:0;">
                                        <div class="col-sm-6">
                                            <p:inputText id="name" styleClass="form-control" style="margin-right:.5em;" value="#{DataversePage.dataverse.name}"/>
                                        </div>
                                        <label class="control-label" style="padding-right:1em;" for="name">
                                            <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The project, department, university, or professor this Dataverse will contain data for.">
                                                Dataverse <span class="glyphicon glyphicon-asterisk text-danger" title="Required field"></span>
                                            </a>
                                        </label>
                                        <p:watermark for="name" value="Enter name..."/>
                                    </div>
                                </ui:fragment>
                                <p:message for="name"/>
                            </p:panelGrid>
                            <p:panelGrid columns="2" rendered="#{DataversePage.ownerId != null}">
                                <label class="control-label" style="padding-right:1em;" for="hostDataverse">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The Dataverse which contains this data.">
                                        Host Dataverse
                                    </a>
                                </label>
                                <h:outputText value="#{ DataversePage.dataverse.getOwner().name }" />
                                <h:inputHidden value="#{DataversePage.ownerId}" id="hostDataverse" />
                                <ui:remove><!-- removed for beta -->
                                    <p:selectOneMenu id="hostDataverse" value="#{DataversePage.ownerId}" filter="true" filterMatchMode="startsWith" effect="none">                                    
                                        <f:selectItems value="#{dataverseServiceBean.findAll()}" var="dv" itemLabel="#{dv.name}" itemValue="#{dv.id}"
                                                       itemDisabled="#{dv eq DataversePage.dataverse or dv.owners.contains(DataversePage.dataverse)}" />                                                                          
                                    </p:selectOneMenu>
                                </ui:remove>    
                            </p:panelGrid>
                        </p:panelGrid>
                    </p:panel>

                    <!-- Edit Info Panel -->
                    <p:panel styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}">
                        <div class="row form-horizontal">
                            <div class="col-xs-6 form-group">
                                <label class="col-sm-3 control-label" for="alias" style="white-space:nowrap;">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="Short name used for the URL of this Dataverse.">
                                        Alias <span class="glyphicon glyphicon-asterisk text-danger" title="Required field"></span>
                                    </a>
                                </label>
                                <div class="col-sm-9">
                                    <p:panelGrid columns="2">
                                        <p:inputText id="alias" styleClass="form-control" validator="#{DataversePage.validateAlias}" value="#{DataversePage.dataverse.alias}"/>
                                        <p:message for="alias"/>
                                    </p:panelGrid>
                                </div>
                                <label class="col-sm-3 control-label" for="contactEmail" style="white-space:nowrap;">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The e-mail address(es) of the contact(s) for the Dataverse.">
                                        E-mail <span class="glyphicon glyphicon-asterisk text-danger" title="Required field"></span>
                                    </a>
                                </label>
                                <div class="col-sm-9">
                                    <p:panelGrid columns="2">
                                        <p:inputText id="contactEmail" styleClass="form-control" value="#{DataversePage.dataverse.contactEmail}"/>
                                        <p:message for="contactEmail"/>
                                    </p:panelGrid>
                                </div>
                                <label class="col-sm-3 control-label" for="affiliation" style="white-space:nowrap;">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The organization with which this Dataverse is affiliated.">
                                        Affiliation
                                    </a>
                                </label>
                                <div class="col-sm-9">
                                    <p:panelGrid columns="2">
                                        <p:inputText id="affiliation" styleClass="form-control" value="#{DataversePage.dataverse.affiliation}"/>
                                        <p:message for="affiliation"/>
                                    </p:panelGrid>
                                </div>
                            </div>
                            <div class="col-xs-6 form-group">
                                <label class="col-sm-3 control-label" for="description">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="A summary describing the purpose, nature, or scope of this Dataverse.">
                                        Description
                                    </a>
                                </label>
                                <div class="col-sm-8">
                                    <p:inputTextarea id="description" styleClass="form-control" value="#{DataversePage.dataverse.description}"
                                                     rows="5" cols="50"
                                                     autoResize="false">
                                    </p:inputTextarea>
                                    <div><span id="chars"/> characters remaining</div>
                                </div>
                                <div class="col-sm-2 control-label">
                                    <p:message for="description"/>
                                </div>
                            </div>
                        </div>
                    </p:panel>

                    <p:panel styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}">
                        <div class="row form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="mdbSelect">Metadata Elements</label>
                                <div class="col-sm-9">
                                    <p style="display:block; margin-bottom:.5em;" class="text-primary"><span class="glyphicon glyphicon-info-sign"></span> Choose the sets of Metadata Elements for datasets in this Dataverse.</p>
                                    <ui:fragment rendered="#{DataversePage.dataverse.owner != null}">
                                        <p:selectBooleanCheckbox styleClass="metadata-blocks-default" value="#{DataversePage.inheritMetadataBlockFromParent}" itemLabel="Metadata Elements from Host Dataverse">
                                            <p:ajax update="@widgetVar(metadataBlocks)" listener="#{DataversePage.editMetadataBlocks}"/>
                                        </p:selectBooleanCheckbox>
                                    </ui:fragment>

                                    <p:selectManyCheckbox id="mdbSelect" styleClass="metadata-blocks-select" value="#{DataversePage.dataverse.metadataBlocks}" converter="metadataBlockConverter"
                                                          widgetVar="metadataBlocks" layout="pageDirection">
                                        <f:selectItems value="#{dataverseServiceBean.findAllMetadataBlocks()}" var="mdb"
                                                       itemLabel="#{mdb.displayName}#{mdb.required ? ' (Required)' : ' (Examples: '.concat(DataversePage.getMetadataBlockPreview(mdb,3)).concat(')')}" itemValue="#{mdb}"
                                                       itemDisabled="#{(DataversePage.dataverse.owner != null and DataversePage.inheritMetadataBlockFromParent)}"/>
                                    </p:selectManyCheckbox>
                                </div>
                            </div>
                        </div>
                    </p:panel>
                    
                    <p:panel styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}">
                        <div class="row form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="facetPickListCreate">Select Facets</label>
                                <div class="col-sm-9">
                                    <p style="display:block; margin-bottom:.5em;" class="text-primary"><span class="glyphicon glyphicon-info-sign"></span> Choose the search result facets to display for this Dataverse.</p>
                                    <ui:fragment rendered="#{DataversePage.dataverse.owner != null}">
                                        <p:selectBooleanCheckbox styleClass="facet-category-default" value="#{DataversePage.inheritFacetFromParent}" itemLabel="Facets from Host Dataverse">
                                            <p:ajax update="@form" listener="#{DataversePage.editFacets}"/>
                                        </p:selectBooleanCheckbox>
                                    </ui:fragment>

                                    <p:pickList id="facetPickListCreate" value="#{DataversePage.facets}" var="facet" converter="facetConverter"
                                                itemLabel="#{facet.displayName}" itemValue="#{facet}" rendered="#{DataversePage.dataverse.facetRoot or DataversePage.dataverse.owner == null }"/>
                                </div>
                            </div>
                        </div>
                    </p:panel>

                    <!-- Description Panel / View Mode -->
                    <ui:fragment rendered="#{empty DataversePage.editMode}">

                        <div id="actionButtonBlock" class="clearfix" style="margin-bottom:1em;">
                            <!-- Edit Button -->
                            <ui:fragment rendered="#{!dataverseSession.user.guest and empty DataversePage.editMode and
                                                     permissionServiceBean.on(DataversePage.dataverse).canIssueCommand('UpdateDataverseCommand')}">
                                <div class="pull-right" style="margin-left:1em;">
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                            <span class="glyphicon glyphicon-pencil"/> Edit Dataverse <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu pull-right text-left" role="menu">
                                            <li>
                                                <div style="padding:.5em 1em .25em 1em; overflow:hidden; width:400px;">
                                                    <div style="width:48px; float:left; margin:4px 12px 6px 0;">
                                                        <img src="/resources/images/icon_dataverse.png" style="width:48px;" border="0" alt="Dataverse"/>
                                                    </div>
                                                    <div style="float:left; width:300px;">
                                                        <div style="font-weight:bold;">#{DataversePage.dataverse.name} Dataverse <h:outputText value=" (#{DataversePage.dataverse.affiliation})" rendered="#{!empty DataversePage.dataverse.affiliation}"/></div>
                                                        <div style="color:#777;">#{DataversePage.dataverse.alias}</div>
                                                        <div style="color:#777;">#{DataversePage.dataverse.contactEmail}</div>
                                                    </div>
                                                </div>
                                            </li>
                                            <li class="divider" role="presentation"></li>
                                            <li>
                                                <p:commandLink id="editInfo" actionListener="#{DataversePage.edit('INFO')}" update="@form" oncomplete="javascript:post_edit_dv_general_info();characterCounter();initPopover();">
                                                    <h:outputText value="General Information" />
                                                </p:commandLink>
                                            </li>
                                            <li>
                                                <h:link id="manageRoles" styleClass="ui-commandlink ui-widget" outcome="manage-roles">
                                                    <h:outputText value="Roles + Permissions" />
                                                    <f:param name="dataverseId" value="#{DataversePage.dataverse.id}" />
                                                    <f:param name="objectType" value="USERS" />
                                                </h:link>
                                            </li>
                                            <ui:fragment rendered="#{DataversePage.isEmptyDataverse() and !(DataversePage.dataverse.owner == null) 
                                                                    and permissionServiceBean.on(DataversePage.dataverse).canIssueCommand('DeleteDataverseCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deleteDataset" onclick="deleteConfirmation.show()">                                                          
                                                                <h:outputText value="Delete Dataverse" />
                                                            </p:commandLink>
                                                        </li>
                                           </ui:fragment>
                                        </ul>
                                    </div>
                                </div>
                            </ui:fragment>
                            <!-- Release Button -->
                            <ui:fragment rendered="#{!dataverseSession.user.guest and empty DataversePage.editMode and
                                                     permissionServiceBean.on(DataversePage.dataverse).canIssueCommand('PublishDataverseCommand')}">
                                <div style="float:right; margin-left:1em;">
                                    <ui:fragment rendered="#{!DataversePage.dataverse.released and (empty DataversePage.dataverse.owner or DataversePage.dataverse.owner.released)}">
                                        <button type="button" class="btn btn-default" onclick="confirmation.show()">
                                            <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataverse
                                        </button>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{!DataversePage.dataverse.released and (!empty DataversePage.dataverse.owner and !DataversePage.dataverse.owner.released)}">
                                        <button type="button" class="btn btn-default" onclick="mayNotRelease.show()">
                                            <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataverse
                                        </button>
                                    </ui:fragment>
                                </div>
                            </ui:fragment>
                            <ui:fragment rendered="#{empty DataversePage.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 Dataverse Contact
                                    </button>
                                </div>
                            </ui:fragment>
                            <p:confirmDialog message="Dataverse 4.0 Beta cannot email dataverse contacts. Look for this feature in Dataverse 4.0!" header="Email Dataverse Contact" widgetVar="contact_confirmation">                                           
                            </p:confirmDialog>                                                                
                        </div>
                        <ui:fragment rendered="#{empty DataversePage.editMode}">
                            <div style="margin-bottom:1em;">
                                <h:outputText value="#{DataversePage.dataverse.description}"/>
                            </div>
                        </ui:fragment>
                    </ui:fragment>

                    <p:confirmDialog message="Are you sure you want to publish your dataverse? Once you do so it must remain 'Published'." header="Publish Dataverse" widgetVar="confirmation">
                        <p:commandButton value="Continue" onclick="confirmation.hide()" action="#{DataversePage.releaseDataverse}">
                        </p:commandButton>
                        <p:commandButton value="Cancel" onclick="confirmation.hide()" type="button" />
                    </p:confirmDialog>
                    <p:confirmDialog message="This dataverse may not be published because its host dataverse has not been published." header="May not publish" widgetVar="mayNotRelease">
                    </p:confirmDialog>
                     <p:confirmDialog message="Are you sure you want to delete your dataverse? This action may not be 'Undone'." header="Delete Dataverse" widgetVar="deleteConfirmation">
                        <p:commandButton value="Continue" onclick="deleteConfirmation.hide()" action="#{DataversePage.deleteDataverse}">
                        </p:commandButton>
                        <p:commandButton value="Cancel" onclick="deleteConfirmation.hide()" type="button" />
                    </p:confirmDialog>
                    <!-- Dataverse Theme Panel -->
                    <ui:fragment rendered="#{DataversePage.editMode == 'THEME'}">
                        <p:panelGrid columns="3">
                            <h:outputLabel value="Logo"/>
                            <p:inputText id="logo" value="#{DataversePage.dataverse.logo}"/>
                            <p:message for="logo"/>

                            <h:outputLabel value="Logo Format"/>
                            <p:selectOneRadio id="logoFormat" value="#{DataversePage.dataverse.logoFormat}">
                                <f:selectItem itemLabel="SQUARE" itemValue="SQUARE"/>
                                <f:selectItem itemLabel="RECTANGLE" itemValue="RECTANGLE"/>
                            </p:selectOneRadio>
                            <p:message for="logoFormat"/>
                            
                            <h:outputLabel value="Logo Alignment"/>
                            <p:selectOneMenu id="logoAlignment" value="#{DataversePage.dataverse.logoAlignment}">
                                <f:selectItem id="left" itemLabel="LEFT" itemValue="LEFT" />
                                <f:selectItem id="center" itemLabel="CENTER" itemValue="CENTER" />
                                <f:selectItem id="right" itemLabel="RIGHT" itemValue="RIGHT" />
                            </p:selectOneMenu>
                            <p:message for="logoFormat"/>
                            
                            <h:outputLabel value="Logo Background Color"/>
                            <p:inputText id="logoBackgroundColor" value="#{DataversePage.dataverse.logoBackgroundColor}"/>
                            <p:message for="logoBackgroundColor"/>

                            <h:outputLabel value="Tagline"/>
                            <p:inputText id="tagline" value="#{DataversePage.dataverse.tagline}"/>
                            <p:message for="tagline"/>

                            <h:outputLabel value="Link URL"/>
                            <p:inputText id="linkUrl" value="#{DataversePage.dataverse.linkUrl}"/>
                            <p:message for="linkUrl"/>

                            <h:outputLabel value="Link Text"/>
                            <p:inputText id="linkText" value="#{DataversePage.dataverse.linkText}"/>
                            <p:message for="linkText"/>

                            <h:outputLabel value="Link Color"/>
                            <p:inputText id="linkColor" value="#{DataversePage.dataverse.linkColor}"/>
                            <p:message for="linkColor"/>

                            <h:outputLabel value="Text Color"/>
                            <p:inputText id="textColor" value="#{DataversePage.dataverse.textColor}"/>
                            <p:message for="textColor"/>

                            <h:outputLabel value="Background Color"/>
                            <p:inputText id="backgroundColor" value="#{DataversePage.dataverse.backgroundColor}"/>
                            <p:message for="backgroundColor"/>
                        </p:panelGrid>
                    </ui:fragment>

                    <!-- Save / Cancel Button Panel -->
                    <p:panel styleClass="panelLayoutButtonBlock" rendered="#{!empty DataversePage.editMode}">
                        <p:commandButton id="save" value="#{DataversePage.dataverse.id == null ? 'Create Dataverse' : 'Save Changes'}" action="#{DataversePage.save}" update="@all"/>
                        <p:commandButton id="cancel" value="Cancel" actionListener="#{DataversePage.cancel}" process="@this" update="@form" rendered="#{DataversePage.dataverse.id != null}" oncomplete="javascript:post_cancel_edit_dv()" />
                        <p:button value="Cancel" outcome="/dataverse.xhtml?id=#{DataversePage.ownerId}" rendered="#{DataversePage.dataverse.id == null and DataversePage.ownerId != null}"/>
                    </p:panel>
                </h:form>

                <!-- Content Panel -->
                <ui:fragment rendered="#{empty DataversePage.editMode}">
                    <ui:include src="search-include-fragment.xhtml">
                        <ui:param name="showAdvancedSearchLink" value="true"/>
                    </ui:include>
                </ui:fragment>
                
                <script type="text/javascript">
                    //<![CDATA[
                    $(document).ready(function() {
                        initPopover();
                        characterCounter();
                    });
                    
                    function initPopover() {
                        $('#content label.control-label[data-toggle="popover"]').popover();
                        $('body').on('click', function (e) {
                            $('label[data-toggle="popover"]').each(function () {
                                //the 'is' for buttons that trigger popups
                                //the 'has' for icons within a button that triggers a popup
                                if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
                                    $(this).popover('hide');
                                }
                            });
                        });
                    }
                    
                    function characterCounter() {
                        $.fn.extend({
                            updateCounter: function(limit, elem) {
                                $(this).on("keyup focus", function() {
                                    setCount(this, elem);
                                });
                                function setCount(src, elem) {
                                    if (typeof src === "undefined") {
                                        return;
                                    }
                                    var chars = src.value.length;
                                    elem.html(limit - chars);
                                }
                                setCount($(this)[0], elem);
                            }
                        });
                        
                        var elem = $("#chars");
                        $("textarea[id$='description']").updateCounter(1000, elem);
                    }
                    //]]>
                </script>

            </ui:define>
        </ui:composition>
    </h:body>
</html>
<commit_msg>Limit Refresh to Facet section when select boolean for using host dv facets is updated<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>
    </h:head>

    <h:body>
        <ui:composition template="/dataverse_template.xhtml">
            <ui:param name="pageTitle" value="#{empty DataversePage.dataverse.name ? 'New' : DataversePage.dataverse.name} Dataverse"/>
            <ui:param name="dataverse" value="#{DataversePage.dataverse}"/>
            <ui:param name="showBreadcrumbs" value="#{empty DataversePage.editMode}"/>
            <ui:define name="body">
                <f:metadata>
                    <f:viewParam name="id" value="#{DataversePage.dataverse.id}"/>
                    <f:viewParam name="ownerId" value="#{DataversePage.ownerId}"/>
                    <f:viewParam name="editMode" value="#{DataversePage.editMode}"/>
                    <f:viewAction action="#{DataversePage.init}"/>
                    <f:viewParam name="id" value="#{SearchIncludeFragment.dataverseId}"/>
                    <f:viewParam name="q" value="#{SearchIncludeFragment.query}"/>
                    <f:viewParam name="types" value="#{SearchIncludeFragment.selectedTypesString}"/>
                    <f:viewParam name="fq1" value="#{SearchIncludeFragment.fq1}"/>
                    <f:viewParam name="fq0" value="#{SearchIncludeFragment.fq0}"/>
                    <f:viewParam name="fq2" value="#{SearchIncludeFragment.fq2}"/>
                    <f:viewParam name="fq3" value="#{SearchIncludeFragment.fq3}"/>
                    <f:viewParam name="fq4" value="#{SearchIncludeFragment.fq4}"/>
                    <f:viewParam name="fq5" value="#{SearchIncludeFragment.fq5}"/>
                    <f:viewParam name="fq6" value="#{SearchIncludeFragment.fq6}"/>
                    <f:viewParam name="fq7" value="#{SearchIncludeFragment.fq7}"/>
                    <f:viewParam name="fq8" value="#{SearchIncludeFragment.fq8}"/>
                    <f:viewParam name="fq9" value="#{SearchIncludeFragment.fq9}"/>
                    <f:viewParam name="sort" value="#{SearchIncludeFragment.sortField}"/>
                    <f:viewParam name="order" value="#{SearchIncludeFragment.sortOrder}"/>
                    <f:viewParam name="page" value="#{SearchIncludeFragment.page}"/>
                    <f:viewParam name="debug" value="#{SearchIncludeFragment.debug}"/>
                    <f:viewAction action="#{SearchIncludeFragment.search()}" />
                </f:metadata>

                <h:form id="dataverseForm">
                    <p:focus context="dataverseForm"/>

                    <!-- Name Panel -->
                    <p:panel styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}">
                        <p:panelGrid styleClass="panelgridLayoutTable" columns="2">
                            <p:panelGrid columns="2" style="width:100%;">
                                <ui:fragment>
                                    <div class="col-sm-12 form-group" style="margin-bottom:0;">
                                        <div class="col-sm-6">
                                            <p:inputText id="name" styleClass="form-control" style="margin-right:.5em;" value="#{DataversePage.dataverse.name}"/>
                                        </div>
                                        <label class="control-label" style="padding-right:1em;" for="name">
                                            <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The project, department, university, or professor this Dataverse will contain data for.">
                                                Dataverse <span class="glyphicon glyphicon-asterisk text-danger" title="Required field"></span>
                                            </a>
                                        </label>
                                        <p:watermark for="name" value="Enter name..."/>
                                    </div>
                                </ui:fragment>
                                <p:message for="name"/>
                            </p:panelGrid>
                            <p:panelGrid columns="2" rendered="#{DataversePage.ownerId != null}">
                                <label class="control-label" style="padding-right:1em;" for="hostDataverse">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The Dataverse which contains this data.">
                                        Host Dataverse
                                    </a>
                                </label>
                                <h:outputText value="#{ DataversePage.dataverse.getOwner().name }" />
                                <h:inputHidden value="#{DataversePage.ownerId}" id="hostDataverse" />
                                <ui:remove><!-- removed for beta -->
                                    <p:selectOneMenu id="hostDataverse" value="#{DataversePage.ownerId}" filter="true" filterMatchMode="startsWith" effect="none">                                    
                                        <f:selectItems value="#{dataverseServiceBean.findAll()}" var="dv" itemLabel="#{dv.name}" itemValue="#{dv.id}"
                                                       itemDisabled="#{dv eq DataversePage.dataverse or dv.owners.contains(DataversePage.dataverse)}" />                                                                          
                                    </p:selectOneMenu>
                                </ui:remove>    
                            </p:panelGrid>
                        </p:panelGrid>
                    </p:panel>

                    <!-- Edit Info Panel -->
                    <p:panel styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}">
                        <div class="row form-horizontal">
                            <div class="col-xs-6 form-group">
                                <label class="col-sm-3 control-label" for="alias" style="white-space:nowrap;">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="Short name used for the URL of this Dataverse.">
                                        Alias <span class="glyphicon glyphicon-asterisk text-danger" title="Required field"></span>
                                    </a>
                                </label>
                                <div class="col-sm-9">
                                    <p:panelGrid columns="2">
                                        <p:inputText id="alias" styleClass="form-control" validator="#{DataversePage.validateAlias}" value="#{DataversePage.dataverse.alias}"/>
                                        <p:message for="alias"/>
                                    </p:panelGrid>
                                </div>
                                <label class="col-sm-3 control-label" for="contactEmail" style="white-space:nowrap;">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The e-mail address(es) of the contact(s) for the Dataverse.">
                                        E-mail <span class="glyphicon glyphicon-asterisk text-danger" title="Required field"></span>
                                    </a>
                                </label>
                                <div class="col-sm-9">
                                    <p:panelGrid columns="2">
                                        <p:inputText id="contactEmail" styleClass="form-control" value="#{DataversePage.dataverse.contactEmail}"/>
                                        <p:message for="contactEmail"/>
                                    </p:panelGrid>
                                </div>
                                <label class="col-sm-3 control-label" for="affiliation" style="white-space:nowrap;">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="The organization with which this Dataverse is affiliated.">
                                        Affiliation
                                    </a>
                                </label>
                                <div class="col-sm-9">
                                    <p:panelGrid columns="2">
                                        <p:inputText id="affiliation" styleClass="form-control" value="#{DataversePage.dataverse.affiliation}"/>
                                        <p:message for="affiliation"/>
                                    </p:panelGrid>
                                </div>
                            </div>
                            <div class="col-xs-6 form-group">
                                <label class="col-sm-3 control-label" for="description">
                                    <a href="#" data-toggle="tooltip" data-placement="auto right" class="tooltiplabel right" data-original-title="A summary describing the purpose, nature, or scope of this Dataverse.">
                                        Description
                                    </a>
                                </label>
                                <div class="col-sm-8">
                                    <p:inputTextarea id="description" styleClass="form-control" value="#{DataversePage.dataverse.description}"
                                                     rows="5" cols="50"
                                                     autoResize="false">
                                    </p:inputTextarea>
                                    <div><span id="chars"/> characters remaining</div>
                                </div>
                                <div class="col-sm-2 control-label">
                                    <p:message for="description"/>
                                </div>
                            </div>
                        </div>
                    </p:panel>

                    <p:panel styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}">
                        <div class="row form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="mdbSelect">Metadata Elements</label>
                                <div class="col-sm-9">
                                    <p style="display:block; margin-bottom:.5em;" class="text-primary"><span class="glyphicon glyphicon-info-sign"></span> Choose the sets of Metadata Elements for datasets in this Dataverse.</p>
                                    <ui:fragment rendered="#{DataversePage.dataverse.owner != null}">
                                        <p:selectBooleanCheckbox styleClass="metadata-blocks-default" value="#{DataversePage.inheritMetadataBlockFromParent}" itemLabel="Metadata Elements from Host Dataverse">
                                            <p:ajax update="@widgetVar(metadataBlocks)" listener="#{DataversePage.editMetadataBlocks}"/>
                                        </p:selectBooleanCheckbox>
                                    </ui:fragment>

                                    <p:selectManyCheckbox id="mdbSelect" styleClass="metadata-blocks-select" value="#{DataversePage.dataverse.metadataBlocks}" converter="metadataBlockConverter"
                                                          widgetVar="metadataBlocks" layout="pageDirection">
                                        <f:selectItems value="#{dataverseServiceBean.findAllMetadataBlocks()}" var="mdb"
                                                       itemLabel="#{mdb.displayName}#{mdb.required ? ' (Required)' : ' (Examples: '.concat(DataversePage.getMetadataBlockPreview(mdb,3)).concat(')')}" itemValue="#{mdb}"
                                                       itemDisabled="#{(DataversePage.dataverse.owner != null and DataversePage.inheritMetadataBlockFromParent)}"/>
                                    </p:selectManyCheckbox>
                                </div>
                            </div>
                        </div>
                    </p:panel>
                    
                    <p:panel id="editFacets" styleClass="panelLayoutBlock" rendered="#{DataversePage.editMode == 'INFO'}" widgetVar="editFacets">
                        <div class="row form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="facetPickListCreate">Select Facets</label>
                                <div class="col-sm-9">
                                    <p style="display:block; margin-bottom:.5em;" class="text-primary"><span class="glyphicon glyphicon-info-sign"></span> Choose the search result facets to display for this Dataverse.</p>
                                    <ui:fragment rendered="#{DataversePage.dataverse.owner != null}">
                                        <p:selectBooleanCheckbox styleClass="facet-category-default" value="#{DataversePage.inheritFacetFromParent}" itemLabel="Facets from Host Dataverse">
                                            <p:ajax update="editFacets" listener="#{DataversePage.editFacets}"/>
                                        </p:selectBooleanCheckbox>
                                    </ui:fragment>

                                    <p:pickList id="facetPickListCreate" value="#{DataversePage.facets}" var="facet" converter="facetConverter"
                                                itemLabel="#{facet.displayName}" itemValue="#{facet}" rendered="#{DataversePage.dataverse.facetRoot or DataversePage.dataverse.owner == null }"/>
                                </div>
                            </div>
                        </div>
                    </p:panel>

                    <!-- Description Panel / View Mode -->
                    <ui:fragment rendered="#{empty DataversePage.editMode}">

                        <div id="actionButtonBlock" class="clearfix" style="margin-bottom:1em;">
                            <!-- Edit Button -->
                            <ui:fragment rendered="#{!dataverseSession.user.guest and empty DataversePage.editMode and
                                                     permissionServiceBean.on(DataversePage.dataverse).canIssueCommand('UpdateDataverseCommand')}">
                                <div class="pull-right" style="margin-left:1em;">
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                            <span class="glyphicon glyphicon-pencil"/> Edit Dataverse <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu pull-right text-left" role="menu">
                                            <li>
                                                <div style="padding:.5em 1em .25em 1em; overflow:hidden; width:400px;">
                                                    <div style="width:48px; float:left; margin:4px 12px 6px 0;">
                                                        <img src="/resources/images/icon_dataverse.png" style="width:48px;" border="0" alt="Dataverse"/>
                                                    </div>
                                                    <div style="float:left; width:300px;">
                                                        <div style="font-weight:bold;">#{DataversePage.dataverse.name} Dataverse <h:outputText value=" (#{DataversePage.dataverse.affiliation})" rendered="#{!empty DataversePage.dataverse.affiliation}"/></div>
                                                        <div style="color:#777;">#{DataversePage.dataverse.alias}</div>
                                                        <div style="color:#777;">#{DataversePage.dataverse.contactEmail}</div>
                                                    </div>
                                                </div>
                                            </li>
                                            <li class="divider" role="presentation"></li>
                                            <li>
                                                <p:commandLink id="editInfo" actionListener="#{DataversePage.edit('INFO')}" update="@form" oncomplete="javascript:post_edit_dv_general_info();characterCounter();initPopover();">
                                                    <h:outputText value="General Information" />
                                                </p:commandLink>
                                            </li>
                                            <li>
                                                <h:link id="manageRoles" styleClass="ui-commandlink ui-widget" outcome="manage-roles">
                                                    <h:outputText value="Roles + Permissions" />
                                                    <f:param name="dataverseId" value="#{DataversePage.dataverse.id}" />
                                                    <f:param name="objectType" value="USERS" />
                                                </h:link>
                                            </li>
                                            <ui:fragment rendered="#{DataversePage.isEmptyDataverse() and !(DataversePage.dataverse.owner == null) 
                                                                    and permissionServiceBean.on(DataversePage.dataverse).canIssueCommand('DeleteDataverseCommand')}">
                                                        <li class="divider"></li>
                                                        <li>
                                                            <p:commandLink id="deleteDataset" onclick="deleteConfirmation.show()">                                                          
                                                                <h:outputText value="Delete Dataverse" />
                                                            </p:commandLink>
                                                        </li>
                                           </ui:fragment>
                                        </ul>
                                    </div>
                                </div>
                            </ui:fragment>
                            <!-- Release Button -->
                            <ui:fragment rendered="#{!dataverseSession.user.guest and empty DataversePage.editMode and
                                                     permissionServiceBean.on(DataversePage.dataverse).canIssueCommand('PublishDataverseCommand')}">
                                <div style="float:right; margin-left:1em;">
                                    <ui:fragment rendered="#{!DataversePage.dataverse.released and (empty DataversePage.dataverse.owner or DataversePage.dataverse.owner.released)}">
                                        <button type="button" class="btn btn-default" onclick="confirmation.show()">
                                            <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataverse
                                        </button>
                                    </ui:fragment>
                                    <ui:fragment rendered="#{!DataversePage.dataverse.released and (!empty DataversePage.dataverse.owner and !DataversePage.dataverse.owner.released)}">
                                        <button type="button" class="btn btn-default" onclick="mayNotRelease.show()">
                                            <span class="glyphicon glyphicon-globe" style="margin-right:.3em;"/> Publish Dataverse
                                        </button>
                                    </ui:fragment>
                                </div>
                            </ui:fragment>
                            <ui:fragment rendered="#{empty DataversePage.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 Dataverse Contact
                                    </button>
                                </div>
                            </ui:fragment>
                            <p:confirmDialog message="Dataverse 4.0 Beta cannot email dataverse contacts. Look for this feature in Dataverse 4.0!" header="Email Dataverse Contact" widgetVar="contact_confirmation">                                           
                            </p:confirmDialog>                                                                
                        </div>
                        <ui:fragment rendered="#{empty DataversePage.editMode}">
                            <div style="margin-bottom:1em;">
                                <h:outputText value="#{DataversePage.dataverse.description}"/>
                            </div>
                        </ui:fragment>
                    </ui:fragment>

                    <p:confirmDialog message="Are you sure you want to publish your dataverse? Once you do so it must remain 'Published'." header="Publish Dataverse" widgetVar="confirmation">
                        <p:commandButton value="Continue" onclick="confirmation.hide()" action="#{DataversePage.releaseDataverse}">
                        </p:commandButton>
                        <p:commandButton value="Cancel" onclick="confirmation.hide()" type="button" />
                    </p:confirmDialog>
                    <p:confirmDialog message="This dataverse may not be published because its host dataverse has not been published." header="May not publish" widgetVar="mayNotRelease">
                    </p:confirmDialog>
                     <p:confirmDialog message="Are you sure you want to delete your dataverse? This action may not be 'Undone'." header="Delete Dataverse" widgetVar="deleteConfirmation">
                        <p:commandButton value="Continue" onclick="deleteConfirmation.hide()" action="#{DataversePage.deleteDataverse}">
                        </p:commandButton>
                        <p:commandButton value="Cancel" onclick="deleteConfirmation.hide()" type="button" />
                    </p:confirmDialog>
                    <!-- Dataverse Theme Panel -->
                    <ui:fragment rendered="#{DataversePage.editMode == 'THEME'}">
                        <p:panelGrid columns="3">
                            <h:outputLabel value="Logo"/>
                            <p:inputText id="logo" value="#{DataversePage.dataverse.logo}"/>
                            <p:message for="logo"/>

                            <h:outputLabel value="Logo Format"/>
                            <p:selectOneRadio id="logoFormat" value="#{DataversePage.dataverse.logoFormat}">
                                <f:selectItem itemLabel="SQUARE" itemValue="SQUARE"/>
                                <f:selectItem itemLabel="RECTANGLE" itemValue="RECTANGLE"/>
                            </p:selectOneRadio>
                            <p:message for="logoFormat"/>
                            
                            <h:outputLabel value="Logo Alignment"/>
                            <p:selectOneMenu id="logoAlignment" value="#{DataversePage.dataverse.logoAlignment}">
                                <f:selectItem id="left" itemLabel="LEFT" itemValue="LEFT" />
                                <f:selectItem id="center" itemLabel="CENTER" itemValue="CENTER" />
                                <f:selectItem id="right" itemLabel="RIGHT" itemValue="RIGHT" />
                            </p:selectOneMenu>
                            <p:message for="logoFormat"/>
                            
                            <h:outputLabel value="Logo Background Color"/>
                            <p:inputText id="logoBackgroundColor" value="#{DataversePage.dataverse.logoBackgroundColor}"/>
                            <p:message for="logoBackgroundColor"/>

                            <h:outputLabel value="Tagline"/>
                            <p:inputText id="tagline" value="#{DataversePage.dataverse.tagline}"/>
                            <p:message for="tagline"/>

                            <h:outputLabel value="Link URL"/>
                            <p:inputText id="linkUrl" value="#{DataversePage.dataverse.linkUrl}"/>
                            <p:message for="linkUrl"/>

                            <h:outputLabel value="Link Text"/>
                            <p:inputText id="linkText" value="#{DataversePage.dataverse.linkText}"/>
                            <p:message for="linkText"/>

                            <h:outputLabel value="Link Color"/>
                            <p:inputText id="linkColor" value="#{DataversePage.dataverse.linkColor}"/>
                            <p:message for="linkColor"/>

                            <h:outputLabel value="Text Color"/>
                            <p:inputText id="textColor" value="#{DataversePage.dataverse.textColor}"/>
                            <p:message for="textColor"/>

                            <h:outputLabel value="Background Color"/>
                            <p:inputText id="backgroundColor" value="#{DataversePage.dataverse.backgroundColor}"/>
                            <p:message for="backgroundColor"/>
                        </p:panelGrid>
                    </ui:fragment>

                    <!-- Save / Cancel Button Panel -->
                    <p:panel styleClass="panelLayoutButtonBlock" rendered="#{!empty DataversePage.editMode}">
                        <p:commandButton id="save" value="#{DataversePage.dataverse.id == null ? 'Create Dataverse' : 'Save Changes'}" action="#{DataversePage.save}" update="@all"/>
                        <p:commandButton id="cancel" value="Cancel" actionListener="#{DataversePage.cancel}" process="@this" update="@form" rendered="#{DataversePage.dataverse.id != null}" oncomplete="javascript:post_cancel_edit_dv()" />
                        <p:button value="Cancel" outcome="/dataverse.xhtml?id=#{DataversePage.ownerId}" rendered="#{DataversePage.dataverse.id == null and DataversePage.ownerId != null}"/>
                    </p:panel>
                </h:form>

                <!-- Content Panel -->
                <ui:fragment rendered="#{empty DataversePage.editMode}">
                    <ui:include src="search-include-fragment.xhtml">
                        <ui:param name="showAdvancedSearchLink" value="true"/>
                    </ui:include>
                </ui:fragment>
                
                <script type="text/javascript">
                    //<![CDATA[
                    $(document).ready(function() {
                        initPopover();
                        characterCounter();
                    });
                    
                    function initPopover() {
                        $('#content label.control-label[data-toggle="popover"]').popover();
                        $('body').on('click', function (e) {
                            $('label[data-toggle="popover"]').each(function () {
                                //the 'is' for buttons that trigger popups
                                //the 'has' for icons within a button that triggers a popup
                                if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
                                    $(this).popover('hide');
                                }
                            });
                        });
                    }
                    
                    function characterCounter() {
                        $.fn.extend({
                            updateCounter: function(limit, elem) {
                                $(this).on("keyup focus", function() {
                                    setCount(this, elem);
                                });
                                function setCount(src, elem) {
                                    if (typeof src === "undefined") {
                                        return;
                                    }
                                    var chars = src.value.length;
                                    elem.html(limit - chars);
                                }
                                setCount($(this)[0], elem);
                            }
                        });
                        
                        var elem = $("#chars");
                        $("textarea[id$='description']").updateCounter(1000, elem);
                    }
                    //]]>
                </script>

            </ui:define>
        </ui:composition>
    </h:body>
</html>

{'fraction_non_alphanumeric': 0.11754216130840169, 'fraction_numerical': 0.0036684159576094158, 'mean_word_length': 1.1752558276995826, 'pattern_counts': {'":': 0, '<': 667, '<?xml version=': 0, '>': 667, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 398, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4309683', 'n_tokens_mistral': 12984, 'n_tokens_neox': 12273, 'n_words': 2212}