adding admin search fields, adding export functionality
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 21 Mar 2017 19:24:06 +0000 (15:24 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 21 Mar 2017 19:24:06 +0000 (15:24 -0400)
classes/data/dataObits.php
css/admin.css
models/admin/ajax/obitsExport.php [new file with mode: 0644]
models/admin/obits/list.php
setup/validActions.php
views/admin/ajax/obitsExport.html [new file with mode: 0644]
views/admin/ajax/obitsExportCsv.html [new file with mode: 0644]
views/admin/obits/list.html

index c47953f..f35aada 100644 (file)
@@ -280,8 +280,9 @@ class GlmDataObits extends GlmDataAbstract
         $savedFields = $this->fields;
 
         $this->fields = array(
-            'id' => $savedFields['id'],
-            'last_name' => $savedFields['last_name']
+            'id'        => $savedFields['id'],
+            'last_name' => $savedFields['last_name'],
+            'first_mid' => $savedFields['first_mid']
         );
 
         $r = $this->getList($where);
index 2352fe2..b7b0733 100644 (file)
@@ -22,3 +22,7 @@
     padding-left: 0px;
     padding-right: 10px;
 }
+.wp-admin .obit-search-select{
+    height: 24px;
+    margin-bottom: 5px;
+}
diff --git a/models/admin/ajax/obitsExport.php b/models/admin/ajax/obitsExport.php
new file mode 100644 (file)
index 0000000..1fcf422
--- /dev/null
@@ -0,0 +1,188 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Obits Export by AJAX
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+
+// Load Obits data abstract
+require_once GLM_MEMBERS_OBITS_PLUGIN_CLASS_PATH.'/data/dataObits.php';
+
+/**
+ *
+ * This class exports the currently selected members list
+ * to a printable HTML file, to a CSV file, or otherwise.
+ */
+class GlmMembersAdmin_ajax_obitsExport extends GlmDataObits
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /**
+     * Constructor
+     *
+     * This constructor sets up this model. At this time that only includes
+     * storing away the WordPress data object.
+     *
+     * @return object Class object
+     *
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        parent::__construct(false, false);
+
+    }
+
+    public function checkFlag($t) {return isset($_REQUEST[$t]) && $_REQUEST[$t] == 'on';}
+    /**
+     * Perform Model Action
+     *
+     * This modelAction takes an AJAX image upload and stores the image in the
+     * media/images directory of the plugin.
+     *
+     * This model action does not return, it simply does it's work then calls die();
+     *
+     * @param $actionData
+     *
+     * Echos JSON string as response and does not return
+     */
+    public function modelAction ($actionData = false)
+    {
+        $where          = '';
+        $haveObits    = false;
+        $list           = false;
+        $success        = false;
+        $numbDisplayed  = false;
+        $lastDisplayed  = false;
+        $paging         = true;
+        $prevStart      = false;
+        $nextStart      = false;
+        $start          = 1;
+        $limit          = '';        // Set to the number of listings per page
+        $namesList      = false;
+
+        // Check selected fields
+        $select = array(
+            'exportId'                  => $this->checkFlag('exportId'),
+            'exportLastName'            => $this->checkFlag('exportLastName'),
+            'exportFirstMiddle'         => $this->checkFlag('exportFirstMiddle'),
+            'exportBirthYear'           => $this->checkFlag('exportBirthYear'),
+            'exportDeathYear'           => $this->checkFlag('exportDeathYear'),
+            'exportBirthYearRange'      => $this->checkFlag('exportBirthYearRange'),
+            'exportDeathYearRange'      => $this->checkFlag('exportDeathYearRange'),
+            'exportSpouse'              => $this->checkFlag('exportSpouse'),
+            'exportMaiden'              => $this->checkFlag('exportMaiden'),
+            'exportObitArticle'         => $this->checkFlag('exportObitArticle'),
+            'exportArticleA'            => $this->checkFlag('exportArticleA'),
+            'exportArticleB'            => $this->checkFlag('exportArticleB'),
+            'exportMailingArticleC'     => $this->checkFlag('exportMailingArticleC'),
+            'exportMailingNewspaper'    => $this->checkFlag('exportMailingNewspaper'),
+            'exportNewspaperDate'       => $this->checkFlag('exportNewspaperDate'),
+            'exportFather'              => $this->checkFlag('exportFather'),
+            'exportMother'              => $this->checkFlag('exportMother'),
+            'exportMiscInfo'            => $this->checkFlag('exportMiscInfo')
+        );
+
+            // Check for a text search
+        if (trim($_REQUEST['text_search']) != '') {
+
+            $textSearch = addslashes(filter_input(INPUT_POST, 'text_search', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
+            $where = "last_name like '%$textSearch%'";
+        }
+        
+
+        // Get a current list of members without paging
+        $list = $this->getList($where,'last_name');
+//        $list = $list['list'];
+
+        //exit;
+
+        // If we have list entries - even if it's an empty list
+        $success     = true;
+        if ($list !== false) {
+
+            $success = true;
+
+            // If we have any entries
+            $obitCount = count($list);
+            if ($obitCount > 0) {
+                $haveObits = true;
+            }
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data');
+        }
+
+        // Compile template data
+        $templateData = array(
+            'select'         => $select,
+            'haveObits'      => $haveObits,
+            'numbDisplayed'  => $numbDisplayed,
+            'lastDisplayed'  => $lastDisplayed,
+            'paging'         => $paging,
+            'prevStart'      => $prevStart,
+            'nextStart'      => $nextStart,
+            'start'          => $start,
+            'limit'          => $limit,
+            'namesList'      => $namesList,
+            'obits'          => $list,
+            'total'          => $total_records
+        );
+
+        $view = 'admin/ajax/obitsExport.html';
+        if ($_REQUEST['type'] == 'csv') {
+            $view = 'admin/ajax/obitsExportCsv.html';
+            header("Content-Type: text/csv");
+            header("Content-Disposition: attachment; filename=obits.csv");
+        } else {
+            header("Content-Type: text/html");
+            header("Content-Disposition: attachment; filename=obits.html");
+        }
+
+        // Disable caching
+        header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1
+        header("Pragma: no-cache"); // HTTP 1.0
+        header("Expires: 0"); // Proxies
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => $view,
+            'data'             => $templateData
+        );
+
+    }
+
+}
index 7dc1374..75ebd9d 100644 (file)
@@ -222,46 +222,55 @@ class GlmMembersAdmin_obits_list extends GlmDataObits
             default:
 
                 $where = 'true';
-
+                $search_fields = array();
+                
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['last_name']) && trim($_REQUEST['last_name']) != '') {
                     $textSearch = trim($_REQUEST['last_name']);
                     $where .= " AND last_name LIKE '%$textSearch%'";
+                    $search_fields['last'] = $textSearch;
                 }
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['first_mid']) && trim($_REQUEST['first_mid']) != '') {
                     $textSearch = trim($_REQUEST['first_mid']);
                     $where .= " AND first_mid LIKE '%$textSearch%'";
+                    $search_fields['first'] = $textSearch;
                 }
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['spouse_partner']) && trim($_REQUEST['spouse_partner']) != '') {
                     $textSearch = trim($_REQUEST['spouse_partner']);
                     $where .= " AND spouse_partner LIKE '%$textSearch%'";
+                    $search_fields['spouse'] = $textSearch;
                 }
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['maiden_other']) && trim($_REQUEST['maiden_other']) != '') {
                     $textSearch = trim($_REQUEST['maiden_other']);
                     $where .= " AND maiden_other LIKE '%$textSearch%'";
+                    $search_fields['maiden'] = $textSearch;
                 }
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['b_year']) && trim($_REQUEST['b_year']) != '') {
                     $textSearch = trim($_REQUEST['b_year']);
                     $where .= " AND b_year LIKE '%$textSearch%'";
+                    $search_fields['birth'] = $textSearch;
                 }
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['d_year']) && trim($_REQUEST['d_year']) != '') {
                     $textSearch = trim($_REQUEST['d_year']);
                     $where .= " AND d_year LIKE '%$textSearch%'";
+                    $search_fields['death'] = $textSearch;
                 }
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['d_yr_range']) && trim($_REQUEST['d_yr_range']) != '') {
                     $textSearch = trim($_REQUEST['d_yr_range']);
                     $where .= " AND d_yr_range LIKE '%$textSearch%'";
+                    $search_fields['d_range'] = $textSearch;
                 }
                 // Check if we have a Text Search string
                 if (isset($_REQUEST['b_yr_range']) && trim($_REQUEST['b_yr_range']) != '') {
                     $textSearch = trim($_REQUEST['b_yr_range']);
                     $where .= " AND b_yr_range LIKE '%$textSearch%'";
+                    $search_fields['b_range'] = $textSearch;
                 }
 
                 // Get the total number of obits listed
@@ -274,7 +283,13 @@ class GlmMembersAdmin_obits_list extends GlmDataObits
 
                 // Get full list of names matching this where clause for search box
                 $namesList = $this->getIdName($where);
-
+                $uniqueNames = array();
+                foreach($namesList as $name){
+                    if( !in_array($name['last_name'], $uniqueNames ) ){
+                        $uniqueNames[] = $name['last_name'];
+                    }
+                }
+   
                 // Check if we're doing paging
                 if (isset($_REQUEST['pageSelect'])) {
 
@@ -291,7 +306,7 @@ class GlmMembersAdmin_obits_list extends GlmDataObits
                         $start = $newStart;
                     }
                 }
-
+                
                 // Get the list of obits and determine number of obits in list
                 $obitsResult = $this->getList($where, 'last_name', true, 'id', $start, $limit);
 
@@ -342,10 +357,11 @@ class GlmMembersAdmin_obits_list extends GlmDataObits
             'nextStart'       => $nextStart,
             'start'           => $start = 1,
             'limit'           => $limit,
-            'namesList'       => $namesList,
+            'namesList'       => $uniqueNames,
             'obitDeleted'     => $obitDeleted,
             'obitDeleteError' => $obitDeleteError,
-            'birthDeathRange' => $birth_death_range 
+            'birthDeathRange' => $birth_death_range,
+            'search_fields'   => $search_fields
 
         );
 
index 8e3028d..7d50f36 100644 (file)
@@ -59,6 +59,9 @@
 
 $glmMembersObitsAddOnValidActions = array(
     'adminActions' => array(
+        'ajax' => array(
+            'obitsExport' => GLM_MEMBERS_OBITS_PLUGIN_SLUG,
+        ),
         'obits' => array(
             'index' => GLM_MEMBERS_OBITS_PLUGIN_SLUG,
             'list'  => GLM_MEMBERS_OBITS_PLUGIN_SLUG,
diff --git a/views/admin/ajax/obitsExport.html b/views/admin/ajax/obitsExport.html
new file mode 100644 (file)
index 0000000..c627c24
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<!--
+To change this license header, choose License Headers in Project Properties.
+To change this template file, choose Tools | Templates
+and open the template in the editor.
+-->
+<html>
+    <head>
+        <title>TODO supply a title</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    </head>
+    <body>
+        <div>TODO write content</div>
+    </body>
+</html>
diff --git a/views/admin/ajax/obitsExportCsv.html b/views/admin/ajax/obitsExportCsv.html
new file mode 100644 (file)
index 0000000..a1df7de
--- /dev/null
@@ -0,0 +1,43 @@
+{if $haveObits}
+
+{if $select.exportId}"ID",{/if}
+{if $select.exportLastName}"LAST_NAME",{/if}
+{if $select.exportFirstMiddle}"FIRST_MIDDLE",{/if}
+{if $select.exportBirthYear}"BIRTH_YEAR",{/if}
+{if $select.exportDeathYear}"DEATH_YEAR",{/if}
+{if $select.exportBirthYearRange}"BIRTH_YEAR_RANGE",{/if}
+{if $select.exportDeathYearRange}"DEATH_YEAR_RANGE",{/if}
+{if $select.exportArticleA}"ARTICLE_A",{/if}
+{if $select.exportArticleB}"ARTICLE_B",{/if}
+{if $select.exportMailingArticleC}"ARTICLE_C",{/if}
+{if $select.exportMailingNewspaper}"NEWSPAPER",{/if}
+{if $select.exportNewspaperDate}"NEWSPAPER_DATE",{/if}
+{if $select.exportSpouse}"SPOUSE",{/if}
+{if $select.exportMaiden}"MAIDEN_OTHER",{/if}
+{if $select.exportFather}"FATHER",{/if}
+{if $select.exportMother}"MOTHER",{/if}
+{if $select.exportMiscInfo}"MISC_INFO",{/if}
+{if $select.exportObitArticle}"OBIT_ARTICLE"{/if}
+
+{foreach $obits as $o}
+{if $select.exportId}"{$o.id}",{/if}
+{if $select.exportLastName}"{$o.last_name}",{/if}
+{if $select.exportFirstMiddle}"{$o.first_mid}",{/if}
+{if $select.exportBirthYear}"{$o.b_year}",{/if}
+{if $select.exportDeathYear}"{$o.d_year}",{/if}
+{if $select.exportBirthYearRange}"{$o.b_yr_range}",{/if}
+{if $select.exportDeathYearRange}"{$o.d_yr_range}",{/if}
+{if $select.exportArticleA}"{$o.article_a}",{/if}
+{if $select.exportArticleB}"{$o.article_b}",{/if}
+{if $select.exportArticleC}"{$o.article_c}",{/if}
+{if $select.exportNewspaper}"{$o.newspaper}",{/if}
+{if $select.exportNewspaperDate}"{$o.newspaper_date}",{/if}
+{if $select.exportSpouse}"{$o.spouse_partner}",{/if}
+{if $select.exportMaiden}"{$o.maiden_other}",{/if}
+{if $select.exportFather}"{$o.father_name}",{/if}
+{if $select.exportMother}"{$o.mother_name}",{/if}
+{if $select.exportMiscInfo}"{$o.misc_info}",{/if}
+{if $select.exportObitArticle}"{$o.obit_article}"{/if}
+
+{/foreach}
+{/if}
\ No newline at end of file
index b0d062e..668064d 100644 (file)
             <div class="glm-small-12 glm-medium-4 glm-large-3 glm-columns obit-admin-column less-padding"> 
                 <div class="glm-obit-admin-search"> 
                     <p class="glm-obit-search-label"><b>Last Name: </b></p>
-                    <input type="text" name="last_name" value="{$fromDate}"> 
+                    <input type="text" name="last_name" value="{$search_fields.last}"> 
                 </div>
                 <div class="glm-obit-admin-search"> 
                      <p class="glm-obit-search-label"><b>First Middle: </b></p>
-                    <input type="text" name="first_mid" value="{$toDate}">
+                    <input type="text" name="first_mid" value="{$search_fields.first}">
                 </div>
             </div>
             <div class="glm-small-12 glm-medium-4 glm-large-3 glm-columns obit-admin-column less-padding"> 
 
                 <div class="glm-obit-admin-search"> 
                      <p class="glm-obit-search-label"><b>Death Year: </b></p>
-                    <input type="text" name="d_year" value="{$fromDate}"> 
+                    <input type="text" name="d_year" value="{$search_fields.death}"> 
                 </div>
                 <div class="glm-obit-admin-search"> 
                      <p class="glm-obit-search-label"><b>Birth Year: </b></p>
-                    <input type="text" name="b_year" value="{$toDate}"> 
+                    <input type="text" name="b_year" value="{$search_fields.birth}"> 
                 </div>
             </div>
             <div class="glm-small-12 glm-medium-4 glm-large-3 glm-columns obit-admin-column less-padding"> 
                 <div class="glm-obit-admin-search"> 
                      <p class="glm-obit-search-label"><b>Death Year Range: </b> </p>
-                     <input type="text" name="b_yr_range" value="{$fromDate}"> 
+                     <select class="obit-search-select" id="d_yr_range" data-id="d_yr_range" name="d_yr_range">
+                    <option value="">Select a date range</option>
+                    {foreach from=$birthDeathRange.death item=r}
+                        <option value="{$r.start}" {if $search_fields.d_range == {$r.start}} selected="selected"{/if}>
+                            {$r.start} - {$r.end}
+                        </option>
+                    {/foreach}
+                </select>
                 </div>
                 <div class="glm-obit-admin-search"> 
-                    <p class="glm-obit-search-label"><b>Birth Year Range: </b></p>
-                    <input type="text" name="d_yr_range" value="{$toDate}"> 
+                      <p class="glm-obit-search-label"><b>Birth Year Range: </b> </p>
+                    <select class="obit-search-select" id="b_yr_range" data-id="b_yr_range" name="b_yr_range">
+                    <option value="">Select a date range</option>
+                    {foreach from=$birthDeathRange.birth item=r}
+                        <option value="{$r.start}" {if $search_fields.b_range == {$r.start}} selected="selected"{/if}>
+                            {$r.start} - {$r.end}
+                        </option>
+                    {/foreach}
+                </select>
                 </div>
             </div>
                  <div class="glm-small-12 glm-medium-4 glm-large-3 glm-columns obit-admin-column less-padding"> 
                 <div class="glm-obit-admin-search"> 
                      <p class="glm-obit-search-label"><b>Spouse: </b> </p>
-                     <input type="text" name="spouse_partner" value="{$fromDate}"> 
+                     <input type="text" name="spouse_partner" value="{$search_fields.spouse}"> 
                 </div>
                 <div class="glm-obit-admin-search"> 
                     <p class="glm-obit-search-label"><b>Maiden / Other: </b></p>
-                    <input type="text" name="maiden_other" value="{$toDate}"> 
+                    <input type="text" name="maiden_other" value="{$search_fields.maiden}"> 
                 </div>
             </div>
          </div>
@@ -67,7 +81,7 @@
         <input type="Submit" name="pageSelect" value="Previous {$limit} Obits" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
         <input type="Submit" name="pageSelect" value="Next {$limit} Obits" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
     {/if}
-
+      <div id="exportObitsButton" class="button button-secondary glm-right">Export Obits</div>
         <table class="wp-list-table striped glm-admin-table">
             <thead>
                 <tr>
     {/if}
 
     </form>
+<div id="exportObitsDialog" class="glm-dialog-box" title="Export Obits">
+        <form id="exportForm" action="{$ajaxUrl}" method="post" enctype="multipart/form-data">
+            <input type="hidden" name="action" value="glm_members_admin_ajax">
+            <input type="hidden" name="glm_action" value="obitsExport">
+            <table class="glm-admin-table">
+                <tr>
+                <tr><th>Last Name Search: </th><td><input  class="exportObitsSearch glm-form-text-input-medium" type="text" name="text_search" id="autoTest"><br>
+                        Enter any portion of a {$terms.term_member_cap} name and press enter or select any specific {$terms.term_member_cap} found.
+                    </td></tr>
+                <tr>
+                    <th>Fields to export</th>
+                    <td>
+                        <table padding="3">
+                            <tr>
+                                <td>
+                                    <input type="checkbox" name="exportId"> Obit ID<br>
+                                    <input type="checkbox" name="exportLastName" checked> Last Name<br>
+                                    <input type="checkbox" name="exportFirstMiddle" checked> First Middle<br>
+                                    <input type="checkbox" name="exportBirthYear" checked> Birth Year<br>
+                                    <input type="checkbox" name="exportDeathYear" checked> Death Year<br>
+                                    <input type="checkbox" name="exportBirthYearRange" checked> Birth Year Range<br>
+                                    <input type="checkbox" name="exportDeathYearRange" checked> Death Year Range<br>
+                                    <input type="checkbox" name="exportArticleA" checked> Article A<br>
+                                    <input type="checkbox" name="exportArticleB" checked> Article B<br>
+                                </td>
+                                <td>
+                                    <input type="checkbox" name="exportArticleC" checked> Article C<br>
+                                    <input type="checkbox" name="exportNewspaper" checked> Newspaper<br>
+                                    <input type="checkbox" name="exportNewspaperDate" checked> Newspaper Date<br>
+                                    <input type="checkbox" name="exportSpouse" checked> Spouse / Partner<br>
+                                    <input type="checkbox" name="exportMaiden" checked> Maiden / Other<br>
+                                    <input type="checkbox" name="exportFather" checked> Father<br>
+                                    <input type="checkbox" name="exportMother" checked> Mother<br>
+                                    <input type="checkbox" name="exportMiscInfo" checked> Misc Info<br>
+                                    <input type="checkbox" name="exportObitArticle" checked> Obit Article<br>
+                                </td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+                <tr>
+                    <th>Export to: </th>
+                    <td>
+                        <input type="radio" name="type" value="print" checked="checked"> Export for Print<br>
+                        <input type="radio" name="type" value="csv"> Export to Spreadsheet (CSV)
+                    </td>
+                </tr>
+            </table>
+            <a id="exportObitsCancel" class="button button-secondary glm-right">Cancel</a>
+            <input type="submit" value="Export" class="button button-primary">
+        </form>
+    </div>
 
     <script type="text/javascript">
         jQuery(document).ready(function($) {
-
+            
+        
+             $("#exportObitsDialog").dialog({
+                autoOpen: false,
+                minWidth: 600,
+                dialogClass: "glm-dialog-no-close"
+            });
+            
+            $('#exportObitsButton').click( function() {
+            
+                $("#exportObitsDialog").dialog("open");
+            });
+            $('#exportObitsCancel').click( function() {
+                $("#exportObitsDialog").dialog("close");
+            });
             // Add Obit Button Action
             $('#addObitButton').click( function() {
                 window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=list&option=add";
 
                 return false;
             });
-*/
+
             /*
              * Do autocomplete search for member
              * label: What will be searched
              */
 
              var availableTags = [
-    {foreach $namesList as $e}
-                { label: "{$e.last_name|replace:'"':"'"}", value: "{$e.last_name|replace:'"':"'"}", id: '{$e.id}' },
-    {/foreach}
-             ];
-
+                {foreach $namesList as $e}
+                    { label: "{$e|replace:'"':"'"}", value: "{$e|replace:'"':"'"}", id: '{$e.id}' },
+                {/foreach}
+                     ];
+                     
              $( "#glmObitsSearch" ).autocomplete({
                  source: availableTags,
                  html: true,
                      }
                  }
              });
+             // Autocomplete for export Text field
+             $( ".exportObitsSearch" ).autocomplete({
+
+                 source: availableTags,
+                 html: true,
+                 position: { my : "right top", at: "right bottom" },
+                 response: function(event, ui) {
+                     if (!ui.content.length) {
+                         var noResult = { value:"",label:"No results found" };
+                         ui.content.push(noResult);
+                     }
+                 }
+             });
+
+             // No submit on ENTER for pop-up export form
+             jQuery.each($("#exportForm").find('input'), function(){
+                 $(this).bind('keypress keydown keyup', function(e){
+                    if(e.keyCode == 13) {
+                        $( ".exportMembersSearch" ).autocomplete("close");
+                        return false;
+                    }
+                 });
+             });
+
+             // Restrict autocomplete list to a certain height with scrollbar
+             $('.ui-autocomplete').css('height','200px').css('overflow-y','scroll');
 
              // Expand multi-select on hover
              $('#filterCategories').multiselect();