<commit_before><%
    /*
     * Copyright (c) 2014-2015 LabKey Corporation
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
%>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="org.labkey.api.data.Container" %>
<%@ page import="org.labkey.api.data.ContainerFilter" %>
<%@ page import="org.labkey.api.data.ContainerFilterable" %>
<%@ page import="org.labkey.api.data.ContainerManager" %>
<%@ page import="org.labkey.api.data.DbSchema" %>
<%@ page import="org.labkey.api.data.SqlSelector" %>
<%@ page import="org.labkey.api.data.TableInfo" %>
<%@ page import="org.labkey.api.data.TableSelector" %>
<%@ page import="org.labkey.api.query.DefaultSchema" %>
<%@ page import="org.labkey.api.query.QuerySchema" %>
<%@ page import="org.labkey.api.util.HeartBeat" %>
<%@ page import="org.labkey.api.view.ActionURL" %>
<%@ page import="org.labkey.api.view.HttpView" %>
<%@ page import="org.labkey.api.view.ViewContext" %>
<%@ page import="org.labkey.api.view.WebPartView" %>
<%@ page import="org.labkey.api.view.template.ClientDependency" %>
<%@ page import="org.labkey.immport.ImmPortController" %>
<%@ page import="org.labkey.immport.data.StudyBean" %>
<%@ page import="org.labkey.immport.view.DataFinderWebPart" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Collections" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.LinkedHashSet" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.TreeMap" %>
<%@ page extends="org.labkey.api.jsp.JspBase"%>
<%!
    public LinkedHashSet<ClientDependency> getClientDependencies()
    {
        LinkedHashSet<ClientDependency> resources = new LinkedHashSet<>();
        resources.add(ClientDependency.fromPath("Ext4"));
        resources.add(ClientDependency.fromPath("clientapi/ext4"));
        resources.add(ClientDependency.fromPath("query/olap.js"));
        resources.add(ClientDependency.fromPath("angular"));
        resources.add(ClientDependency.fromPath("immport/dataFinder.js"));

        resources.add(ClientDependency.fromPath("immport/ParticipantGroup.js"));
        return resources;
    }
%>
<%
    DataFinderWebPart me = (DataFinderWebPart)HttpView.currentView();
    ViewContext context = HttpView.currentContext();
    ArrayList<StudyBean> studies = new SqlSelector(DbSchema.get("immport"),"SELECT study.*, P.title as program_title, pi.pi_names\n" +
            "FROM immport.study " +
            "LEFT OUTER JOIN immport.workspace W ON study.workspace_id = W.workspace_id\n" +
            "LEFT OUTER JOIN immport.contract_grant C ON W.contract_id = C.contract_grant_id\n" +
            "LEFT OUTER JOIN immport.program P on C.program_id = P.program_id\n" +
            "LEFT OUTER JOIN\n" +
            "\t(\n" +
            "\tSELECT study_accession, array_to_string(array_agg(first_name || ' ' || last_name),', ') as pi_names\n" +
            "\tFROM immport.study_personnel\n" +
            "\tWHERE role_in_study ilike '%principal%'\n" +
            "\tGROUP BY study_accession) pi ON study.study_accession = pi.study_accession\n").getArrayList(StudyBean.class);

    String hipcImg = request.getContextPath() + "/immport/hipc.png";
    Collections.sort(studies, (o1, o2) -> {
        String a = o1.getStudy_accession();
        String b = o2.getStudy_accession();
        return Integer.parseInt(a.substring(3)) - Integer.parseInt(b.substring(3));
    });

    Map<String,StudyBean> mapOfStudies = new TreeMap<>();
    for (StudyBean sb : studies)
        mapOfStudies.put(sb.getStudy_accession(), sb);
%>

<style>
    DIV.outer {
        min-height:100px;
        min-width:400px;
    }

    .inner
    {
        background-color:#ffffff;
        height:100%;
        width:100%;
    }

    TR.filterMember IMG.delete
    {
        visibility:hidden;
    }
    TR.filterMember:hover IMG.delete
    {
        visibility:visible;
        cursor:pointer;
    }

    TABLE.data-finder
    {
        height: 450px;
        width:100%;
        padding:3pt;
    }

    /* study-card */
    .studycard-highlight
    {
        color:black;
        font-variant:small-caps;
    }
    DIV.study-card
    {
        background-color:#F8F8F8;
        border:1pt solid #AAAAAA;
        padding: 5pt;
        margin: 5pt;
        float:left;
        position:relative;
        width:160pt;
        height:140pt;
        overflow-y:hidden;
    }

    DIV.study-detail
    {
        background-color:#EEEEEE;
        padding: 10pt;
        width:100%;
        height:100%;
    }
    DIV.hipc
    {
        background-image:url('<%=text(hipcImg)%>');
        background-repeat:no-repeat;
        background-position:center;
    }
    DIV.loaded
    {
        background-color:rgba(81, 158, 218, 0.2);
    }
    SPAN.loaded
    {
        background-color:rgba(81, 158, 218, 0.2);
    }
    SPAN.hipc-label
    {
        border-radius: 10px;
        border: solid 1px #AAAAAA;
        background: #FFFFFF;
        padding: 6px;
    }

    TD.study-panel
    {
        valign: top;
    }

    TD.study-panel > DIV
    {
        height:100%;
        overflow-y:scroll;
    }

    SPAN.study-search
    {
        position: relative;
    }

    /* search area */
    DIV.search-box
    {
        float:left;
        padding:10pt;
    }
    INPUT.search-box
    {
        width:240pt;
    }

    TD.selection-panel
    {
        vertical-align: text-top;
        width:220pt;
        height:100%;
    }

    TD.selection-panel > DIV
    {
        height:100%;
        overflow-y:auto;
    }

    TD.help-links
    {
        vertical-align: text-top;
        text-align: right;
    }

    DIV.summary LI.member
    {
        clear:both;
        padding:2pt;
        margin:1px 0px 1px 0px;
        border:1px solid #ffffff;
        height:14pt;
        position:relative;
        width:100%;
    }

    /* facets */

    .clear-filter
    {
        float:right;
    }
    .facet-filter
    {
        float:left;
    }

    DIV.facet
    {
        max-width:200pt;
        border:solid 2pt rgb(220, 220, 220);
    }
    .active
    {
        cursor:pointer;
    }
    DIV.facet-header
    {
        padding:4pt;
        background-color: rgb(240, 240, 240);
    }
    DIV.facet-header .facet-caption
    {
        font-weight:400;
    }
    DIV.facet UL
    {
        list-style-type:none;
        padding-left:0;
        padding-right:5pt;
        margin:0;
    }
    DIV.facet LI.member
    {
        clear:both;
        cursor:pointer;
        padding:2pt;
        margin:1px 0px 1px 0px;
        border:1px solid #ffffff;
        height:14pt;
        position:relative;
        width:100%;
    }
    DIV.facet.collapsed LI.member
    {
        display:none;
    }
    DIV.facet.collapsed .fa-plus-square
    {
        float:left;
        display:inline;
    }
    DIV.facet.collapsed .fa-minus-square
    {
        float:left;
        display:none;
    }
    DIV.expanded  .fa-plus-square
    {
        float:left;
        display:none;
    }
    DIV.expanded  .fa-minus-square
    {
        float:left;
        display:inline;
    }
    DIV.facet.collapsed LI.member.selectedMember
    {
        display:block;
    }
    DIV.facet LI.member:hover SPAN.bar
    {
        background-color:rgba(81, 158, 218, 0.2);
    }
    /*DIV.facet LI.selectedMember*/
    /*{*/
        /*color: #126495*/
    /*}*/
    DIV.facet LI.emptyMember
    {
        color:#888888;
    }
    LI.member .member-indicator
    {
        position:relative;
        display:inline-block;
        width:16px;
        z-index:2;
    }
    .member-indicator.selected:after
    {
        content:"\002713"
    }
    .member-indicator.selected:hover:after
    {
        content:"x";
    }
    .member-indicator.not-selected:after
    {
        content:"\0025FB"
    }
    .member-indicator.not-selected:hover:after
    {
        content:"\002713"
    }
    .member-indicator.not-selected.none-selected:after
    {
        content:"\002713"; color:lightgray;
    }
    LI.member .member-name
    {
        display:inline-block;
        position:relative;
        max-width:150pt;
        overflow-x: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        z-index:2;
    }
    LI.member .member-count
    {
        position:relative;
        float:right;
        z-index:2;
    }

    LI.member SPAN.bar-selected
    {
        background-color:rgba(81, 158, 218, 0.2);
    }

    LI.member .bar
    {
        height:14pt;
        background-color:#DEDEDE;
        position:absolute; right:0;
        z-index:0;
    }

    /* filter type popup */
    DIV.filterPopup
    {
        z-index:100; background-color:white; opacity: 1; border:solid 2px black; position:absolute;
    }
    DIV.filterPopup UL
    {
        padding:2pt; margin:0;
    }
    DIV.filterPopup LI
    {
        padding:2pt; margin:2pt; cursor:pointer;
    }
    DIV.filterPopup LI
    {
        padding:2pt; margin:2pt; cursor:pointer;
        border: 1px solid #ffffff;
    }

    /* menus */
    .nav
    {
        margin: 0;
        padding-left: 0;;
        list-style: none;
    }

    ul.nav
    {
        display:block;
    }

    .navbar-nav > li
    {
        float: left;
    }

    .navbar-nav
    {
        float: left;
        margin: 0;
    }

    .navbar-nav > li > .dropdown-menu
    {
        margin-top : 0;
    }

    .dropdown:hover > .dropdown-menu
    {
        display: block;
    }

    .open > .dropdown-menu
    {
        display: block;
    }

    .dropdown-menu > li > a
    {
        color: black;
    }

    .dropdown-menu > li > a.inactive
    {
        color: #C0C0C0;
        cursor: default;
    }

    .dropdown-menu {
        position: absolute;
        display: none;
        min-width: 80px;
        padding-left: 8px;
        padding-right: 8px;
        margin: 2px 0 0;
        list-style: none;
        background-color: white;
        border-color:#b4b4b4;
        border-width: 1px;
        border-style: solid;
        box-shadow: rgb(136, 136, 136) 0px 0px 6px;
        z-index: 100;
    }

    #manageMenu > a {
        color:black;
        padding-right: 5px;
    }

    .menu-item-link {
        padding: 0;
    }
</style>


<div id="dataFinderOuterDIV" class="outer">
<div id="dataFinderAppDIV" class="x-hidden inner" ng-app="dataFinderApp" ng-controller="dataFinder">

    <table border=0 class="data-finder">
        <tr>
            <td>
                <div ng-controller="SubjectGroupController">
                    <div>{{currentGroup.id != null ? "Saved group: ": ""}}{{currentGroup.label}}</div>
                    <div id="toolbar"></div>
                    <div class="navbar navbar-default ">
                        <ul class="nav navbar-nav">
                            <li id="manageMenu" class="dropdown active">
                                <a href="#"><i class="fa fa-cog"></i> </a>
                                <ul class="dropdown-menu" ng-if="groupList.length > 0">
                                    <li class="x4-menu-item-text"><a class="menu-item-link x4-menu-item-link" href="<%=new ActionURL("study", "manageParticipantCategories", getContainer()).toHString()%>">Manage Groups</a></li>
                                </ul>
                            </li>
                            <li id="loadMenu" class="dropdown" ng-class="{active : groupList.length > 0 && !isGuest}">
                                <a class="labkey-text-link no-arrow" href="#">Load <i class="fa fa-caret-down"></i></a>
                                <ul class="dropdown-menu" ng-if="groupList.length > 0">
                                    <li class="x4-menu-item-text" ng-repeat="group in groupList">
                                        <a class="menu-item-link x4-menu-item-link" ng-click="applySubjectGroupFilter(group)">{{group.label}}</a>
                                    </li>
                                </ul>
                            </li>
                            <li id="saveMenu" class="dropdown active">
                                <a class="labkey-text-link no-arrow" href="#">Save <i class="fa fa-caret-down"></i> </a>
                                <ul class="dropdown-menu" ng-if="!isGuest">
                                    <li class="x4-menu-item-text" ng-repeat="opt in saveOptions">
                                        <a class="menu-item-link x4-menu-item-link" ng-class="{'inactive' : !opt.isActive}" ng-click="saveSubjectGroup(opt.id)">{{opt.label}}</a>
                                    </li>
                                </ul>
                                <ul class="dropdown-menu" ng-if="isGuest">
                                    <li class="x4-menu-item-text">
                                        <span class="menu-item-link x4-menu-item-link">You must be logged in to save a group.</span>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                        <span class="clear-filter active" ng-show="hasFilters()" ng-click="clearAllFilters(true);">[clear all]</span>
                    </div>

                </div>

            </td>
            <td class="help-links">
            <%=textLink("quick help", "#", "start_tutorial()", "showTutorial")%>
            <%=textLink("Export Study Datasets", ImmPortController.ExportStudyDatasetsAction.class)%><br><commit_msg>Change background image when hovering over menu item.<commit_after><%
    /*
     * Copyright (c) 2014-2015 LabKey Corporation
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
%>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="org.labkey.api.data.Container" %>
<%@ page import="org.labkey.api.data.ContainerFilter" %>
<%@ page import="org.labkey.api.data.ContainerFilterable" %>
<%@ page import="org.labkey.api.data.ContainerManager" %>
<%@ page import="org.labkey.api.data.DbSchema" %>
<%@ page import="org.labkey.api.data.SqlSelector" %>
<%@ page import="org.labkey.api.data.TableInfo" %>
<%@ page import="org.labkey.api.data.TableSelector" %>
<%@ page import="org.labkey.api.query.DefaultSchema" %>
<%@ page import="org.labkey.api.query.QuerySchema" %>
<%@ page import="org.labkey.api.util.HeartBeat" %>
<%@ page import="org.labkey.api.view.ActionURL" %>
<%@ page import="org.labkey.api.view.HttpView" %>
<%@ page import="org.labkey.api.view.ViewContext" %>
<%@ page import="org.labkey.api.view.WebPartView" %>
<%@ page import="org.labkey.api.view.template.ClientDependency" %>
<%@ page import="org.labkey.immport.ImmPortController" %>
<%@ page import="org.labkey.immport.data.StudyBean" %>
<%@ page import="org.labkey.immport.view.DataFinderWebPart" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Collections" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.LinkedHashSet" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.TreeMap" %>
<%@ page extends="org.labkey.api.jsp.JspBase"%>
<%!
    public LinkedHashSet<ClientDependency> getClientDependencies()
    {
        LinkedHashSet<ClientDependency> resources = new LinkedHashSet<>();
        resources.add(ClientDependency.fromPath("Ext4"));
        resources.add(ClientDependency.fromPath("clientapi/ext4"));
        resources.add(ClientDependency.fromPath("query/olap.js"));
        resources.add(ClientDependency.fromPath("angular"));
        resources.add(ClientDependency.fromPath("immport/dataFinder.js"));

        resources.add(ClientDependency.fromPath("immport/ParticipantGroup.js"));
        return resources;
    }
%>
<%
    DataFinderWebPart me = (DataFinderWebPart)HttpView.currentView();
    ViewContext context = HttpView.currentContext();
    ArrayList<StudyBean> studies = new SqlSelector(DbSchema.get("immport"),"SELECT study.*, P.title as program_title, pi.pi_names\n" +
            "FROM immport.study " +
            "LEFT OUTER JOIN immport.workspace W ON study.workspace_id = W.workspace_id\n" +
            "LEFT OUTER JOIN immport.contract_grant C ON W.contract_id = C.contract_grant_id\n" +
            "LEFT OUTER JOIN immport.program P on C.program_id = P.program_id\n" +
            "LEFT OUTER JOIN\n" +
            "\t(\n" +
            "\tSELECT study_accession, array_to_string(array_agg(first_name || ' ' || last_name),', ') as pi_names\n" +
            "\tFROM immport.study_personnel\n" +
            "\tWHERE role_in_study ilike '%principal%'\n" +
            "\tGROUP BY study_accession) pi ON study.study_accession = pi.study_accession\n").getArrayList(StudyBean.class);

    String hipcImg = request.getContextPath() + "/immport/hipc.png";
    Collections.sort(studies, (o1, o2) -> {
        String a = o1.getStudy_accession();
        String b = o2.getStudy_accession();
        return Integer.parseInt(a.substring(3)) - Integer.parseInt(b.substring(3));
    });

    Map<String,StudyBean> mapOfStudies = new TreeMap<>();
    for (StudyBean sb : studies)
        mapOfStudies.put(sb.getStudy_accession(), sb);
%>

<style>
    DIV.outer {
        min-height:100px;
        min-width:400px;
    }

    .inner
    {
        background-color:#ffffff;
        height:100%;
        width:100%;
    }

    TR.filterMember IMG.delete
    {
        visibility:hidden;
    }
    TR.filterMember:hover IMG.delete
    {
        visibility:visible;
        cursor:pointer;
    }

    TABLE.data-finder
    {
        height: 450px;
        width:100%;
        padding:3pt;
    }

    /* study-card */
    .studycard-highlight
    {
        color:black;
        font-variant:small-caps;
    }
    DIV.study-card
    {
        background-color:#F8F8F8;
        border:1pt solid #AAAAAA;
        padding: 5pt;
        margin: 5pt;
        float:left;
        position:relative;
        width:160pt;
        height:140pt;
        overflow-y:hidden;
    }

    DIV.study-detail
    {
        background-color:#EEEEEE;
        padding: 10pt;
        width:100%;
        height:100%;
    }
    DIV.hipc
    {
        background-image:url('<%=text(hipcImg)%>');
        background-repeat:no-repeat;
        background-position:center;
    }
    DIV.loaded
    {
        background-color:rgba(81, 158, 218, 0.2);
    }
    SPAN.loaded
    {
        background-color:rgba(81, 158, 218, 0.2);
    }
    SPAN.hipc-label
    {
        border-radius: 10px;
        border: solid 1px #AAAAAA;
        background: #FFFFFF;
        padding: 6px;
    }

    TD.study-panel
    {
        valign: top;
    }

    TD.study-panel > DIV
    {
        height:100%;
        overflow-y:scroll;
    }

    SPAN.study-search
    {
        position: relative;
    }

    /* search area */
    DIV.search-box
    {
        float:left;
        padding:10pt;
    }
    INPUT.search-box
    {
        width:240pt;
    }

    TD.selection-panel
    {
        vertical-align: text-top;
        width:220pt;
        height:100%;
    }

    TD.selection-panel > DIV
    {
        height:100%;
        overflow-y:auto;
    }

    TD.help-links
    {
        vertical-align: text-top;
        text-align: right;
    }

    DIV.summary LI.member
    {
        clear:both;
        padding:2pt;
        margin:1px 0px 1px 0px;
        border:1px solid #ffffff;
        height:14pt;
        position:relative;
        width:100%;
    }

    /* facets */

    .clear-filter
    {
        float:right;
    }
    .facet-filter
    {
        float:left;
    }

    DIV.facet
    {
        max-width:200pt;
        border:solid 2pt rgb(220, 220, 220);
    }
    .active
    {
        cursor:pointer;
    }
    DIV.facet-header
    {
        padding:4pt;
        background-color: rgb(240, 240, 240);
    }
    DIV.facet-header .facet-caption
    {
        font-weight:400;
    }
    DIV.facet UL
    {
        list-style-type:none;
        padding-left:0;
        padding-right:5pt;
        margin:0;
    }
    DIV.facet LI.member
    {
        clear:both;
        cursor:pointer;
        padding:2pt;
        margin:1px 0px 1px 0px;
        border:1px solid #ffffff;
        height:14pt;
        position:relative;
        width:100%;
    }
    DIV.facet.collapsed LI.member
    {
        display:none;
    }
    DIV.facet.collapsed .fa-plus-square
    {
        float:left;
        display:inline;
    }
    DIV.facet.collapsed .fa-minus-square
    {
        float:left;
        display:none;
    }
    DIV.expanded  .fa-plus-square
    {
        float:left;
        display:none;
    }
    DIV.expanded  .fa-minus-square
    {
        float:left;
        display:inline;
    }
    DIV.facet.collapsed LI.member.selectedMember
    {
        display:block;
    }
    DIV.facet LI.member:hover SPAN.bar
    {
        background-color:rgba(81, 158, 218, 0.2);
    }
    /*DIV.facet LI.selectedMember*/
    /*{*/
        /*color: #126495*/
    /*}*/
    DIV.facet LI.emptyMember
    {
        color:#888888;
    }
    LI.member .member-indicator
    {
        position:relative;
        display:inline-block;
        width:16px;
        z-index:2;
    }
    .member-indicator.selected:after
    {
        content:"\002713"
    }
    .member-indicator.selected:hover:after
    {
        content:"x";
    }
    .member-indicator.not-selected:after
    {
        content:"\0025FB"
    }
    .member-indicator.not-selected:hover:after
    {
        content:"\002713"
    }
    .member-indicator.not-selected.none-selected:after
    {
        content:"\002713"; color:lightgray;
    }
    LI.member .member-name
    {
        display:inline-block;
        position:relative;
        max-width:150pt;
        overflow-x: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        z-index:2;
    }
    LI.member .member-count
    {
        position:relative;
        float:right;
        z-index:2;
    }

    LI.member SPAN.bar-selected
    {
        background-color:rgba(81, 158, 218, 0.2);
    }

    LI.member .bar
    {
        height:14pt;
        background-color:#DEDEDE;
        position:absolute; right:0;
        z-index:0;
    }

    /* filter type popup */
    DIV.filterPopup
    {
        z-index:100; background-color:white; opacity: 1; border:solid 2px black; position:absolute;
    }
    DIV.filterPopup UL
    {
        padding:2pt; margin:0;
    }
    DIV.filterPopup LI
    {
        padding:2pt; margin:2pt; cursor:pointer;
    }
    DIV.filterPopup LI
    {
        padding:2pt; margin:2pt; cursor:pointer;
        border: 1px solid #ffffff;
    }

    /* menus */
    .nav
    {
        margin: 0;
        padding-left: 0;;
        list-style: none;
    }

    ul.nav
    {
        display:block;
    }

    .navbar-nav > li
    {
        float: left;
    }

    .navbar-nav
    {
        float: left;
        margin: 0;
    }

    .navbar-nav > li > .dropdown-menu
    {
        margin-top : 0;
    }

    .dropdown:hover > .dropdown-menu
    {
        display: block;
    }

    .open > .dropdown-menu
    {
        display: block;
    }

    .dropdown-menu > li {
        margin-right : 0px;
    }

    .dropdown-menu > li > a
    {
        color: black;
    }

    .dropdown-menu > li > a.inactive
    {
        color: #C0C0C0;
        cursor: default;
    }

    .dropdown-menu > li.inactive:hover
    {
        color: #C0C0C0;
        cursor: default;
        background-color: white;
        border-style: none;
        background-image: none;
    }

    .dropdown-menu > li:hover
    {
        background-image: none;
        background-color: #eaeaea;
        background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f2f2f2), color-stop(100%, #e0e0e0));
        background-image: -webkit-linear-gradient(top, #f2f2f2, #e0e0e0);
        background-image: -moz-linear-gradient(top, #f2f2f2, #e0e0e0);
        background-image: -o-linear-gradient(top, #f2f2f2, #e0e0e0);
        background-image: linear-gradient(top, #f2f2f2, #e0e0e0);
        border-color: #b4b4b4;
        border-width: 1px;
        border-style: solid;
        padding: 0;
    }

    .dropdown-menu {
        position: absolute;
        display: none;
        min-width: 80px;
        margin: 2px 0 0;
        list-style: none;
        background-color: white;
        border-color:#b4b4b4;
        border-width: 1px;
        border-style: solid;
        box-shadow: rgb(136, 136, 136) 0px 0px 6px;
        z-index: 100;
        -webkit-padding-start: 0px
    }

    #manageMenu > a {
        color:black;
        padding-right: 5px;
    }

    .menu-item-link {
        padding: 0 0 0 8px;
    }
</style>


<div id="dataFinderOuterDIV" class="outer">
<div id="dataFinderAppDIV" class="x-hidden inner" ng-app="dataFinderApp" ng-controller="dataFinder">

    <table border=0 class="data-finder">
        <tr>
            <td>
                <div ng-controller="SubjectGroupController">
                    <div>{{currentGroup.id != null ? "Saved group: ": ""}}{{currentGroup.label}}</div>
                    <div id="toolbar"></div>
                    <div class="navbar navbar-default ">
                        <ul class="nav navbar-nav">
                            <li id="manageMenu" class="dropdown active">
                                <a href="#"><i class="fa fa-cog"></i> </a>
                                <ul class="dropdown-menu" ng-if="groupList.length > 0">
                                    <li class="x4-menu-item-text"><a class="menu-item-link x4-menu-item-link" href="<%=new ActionURL("study", "manageParticipantCategories", getContainer()).toHString()%>">Manage Groups</a></li>
                                </ul>
                            </li>
                            <li id="loadMenu" class="dropdown" ng-class="{active : groupList.length > 0 && !isGuest}">
                                <a class="labkey-text-link no-arrow" href="#">Load <i class="fa fa-caret-down"></i></a>
                                <ul class="dropdown-menu" ng-if="groupList.length > 0">
                                    <li class="x4-menu-item-text" ng-repeat="group in groupList">
                                        <a class="menu-item-link x4-menu-item-link" ng-click="applySubjectGroupFilter(group)">{{group.label}}</a>
                                    </li>
                                </ul>
                            </li>
                            <li id="saveMenu" class="dropdown active">
                                <a class="labkey-text-link no-arrow" href="#">Save <i class="fa fa-caret-down"></i> </a>
                                <ul class="dropdown-menu" ng-if="!isGuest">
                                    <li class="x4-menu-item-text" ng-repeat="opt in saveOptions" ng-class="{'inactive' : !opt.isActive}">
                                        <a class="menu-item-link x4-menu-item-link" ng-class="{'inactive' : !opt.isActive}" ng-click="saveSubjectGroup(opt.id)">{{opt.label}}</a>
                                    </li>
                                </ul>
                                <ul class="dropdown-menu" ng-if="isGuest">
                                    <li class="x4-menu-item-text">
                                        <span class="menu-item-link x4-menu-item-link">You must be logged in to save a group.</span>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                        <span class="clear-filter active" ng-show="hasFilters()" ng-click="clearAllFilters(true);">[clear all]</span>
                    </div>

                </div>

            </td>
            <td class="help-links">
            <%=textLink("quick help", "#", "start_tutorial()", "showTutorial")%>
            <%=textLink("Export Study Datasets", ImmPortController.ExportStudyDatasetsAction.class)%><br>
{'fraction_non_alphanumeric': 0.13849505498305553, 'fraction_numerical': 0.02099038661041566, 'mean_word_length': 1.7989740611691831, 'pattern_counts': {'":': 2, '<': 213, '<?xml version=': 0, '>': 248, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4886170', 'n_tokens_mistral': 9864, 'n_tokens_neox': 9053, 'n_words': 1569}