Saving current state of feature branch to test on development server
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 15 Feb 2016 14:31:22 +0000 (09:31 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 15 Feb 2016 14:31:22 +0000 (09:31 -0500)
31 files changed:
classes/data/dataAccommodationTypes.php [deleted file]
classes/data/dataMemberInfo.php
classes/data/dataMembers.php
controllers/admin.php
css/admin.css
css/front.css
glm-member-db.php
lib/GlmDataAbstract/DataAbstract.php
models/admin/configure/accommodationTypes.php [deleted file]
models/admin/dashboardWidget/index.php
models/admin/management/index.php
models/admin/member/memberEdit.php [new file with mode: 0644]
models/admin/member/memberInfo.php
models/admin/members/index.php
models/admin/members/list.php
setup/databaseScripts/create_database_V1.0.43.sql [deleted file]
setup/databaseScripts/create_database_V1.1.0.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V1.1.0.sql [new file with mode: 0644]
setup/validActions.php
views/admin/configure/accommodationTypes.html [deleted file]
views/admin/configure/amenities.html
views/admin/configure/header.html
views/admin/dashboardWidget/index.html
views/admin/management/header.html
views/admin/member/header.html
views/admin/member/index.html
views/admin/member/memberEdit.html [new file with mode: 0644]
views/admin/member/memberInfo.html
views/admin/members/index.html
views/admin/members/list.html

diff --git a/classes/data/dataAccommodationTypes.php b/classes/data/dataAccommodationTypes.php
deleted file mode 100644 (file)
index 230fde5..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-
-/**
- * GLM Member-DB WordPress Plugin
- * Accommodation Types data class
- *
- * PHP version 5.3
- *
- * @category Data
- * @package  GLM Member-DB
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
- */
-
-/**
- * EventManagementDataAccommodationTypes class
- *
- * PHP version 5
- *
- * @category Data
- * @package EventManagement
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
- *          Exp $
- */
-class GlmDataAccommodationTypes extends GlmDataAbstract
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Field definitions
-     *
-     * @var $ini
-     * @access public
-     */
-    public $table;
-
-    /**
-     * Field definitions
-     *
-     * 'type' is type of field as defined by the application
-     * text Regular text field
-     * pointer Pointer to an entry in another table
-     * 'filters' is the filter name for a particular filter ID in PHP filter
-     * functions
-     * See PHP filter_id()
-     *
-     * 'use' is when to use the field
-     * l = List
-     * g = Get
-     * n = New
-     * i = Insert
-     * e = Edit
-     * u = Update
-     * d = Delete
-     * a = All
-     *
-     * @var $ini
-     * @access public
-     */
-    public $fields = false;
-
-    /**
-     * Constructor
-     *
-     * @param object $d
-     *            database connection
-     *
-     * @return void
-     * @access public
-     */
-    function __construct ($wpdb, $config)
-    {
-
-        // If this class is not being extended along with existing $wpdb and $config
-        if (!$this->wpdb) {
-
-            // Save WordPress Database object
-            $this->wpdb = $wpdb;
-
-            // Save plugin configuration object
-            $this->config = $config;
-
-        }
-
-        /*
-         * Table Name
-         */
-        $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'accommodation_types';
-
-        /*
-         * Table Data Fields
-         */
-        $this->fields = array(
-
-                'id' => array(
-                        'field' => 'id',
-                        'type' => 'integer',
-                        'view_only' => true,
-                        'use' => 'a'
-                ),
-
-                // Name
-                'name' => array(
-                        'field' => 'name',
-                        'type' => 'text',
-                        'required' => true,
-                        'unique' => true,
-                        'use' => 'a'
-                ),
-
-                // Description
-                'descr' => array(
-                        'field' => 'descr',
-                        'type' => 'text',
-                        'use' => 'a'
-                ),
-
-                // Short Description
-                'short_descr' => array(
-                        'field' => 'short_descr',
-                        'type' => 'text',
-                        'use' => 'a'
-                )
-
-
-        );
-
-        if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
-        }
-
-    }
-}
-
-?>
\ No newline at end of file
index d6e5169..63c1658 100644 (file)
@@ -178,20 +178,6 @@ class GlmDataMemberInfo extends GlmDataAbstract
                 'use' => 'a'
             ),
 
-            // Create Time
-            'create_time' => array (
-                'field' => 'create_time',
-                'type' => 'datetime',
-                'use' => 'lgie'
-            ),
-
-            // Last Modify Time
-            'modify_time' => array (
-                'field' => 'modify_time',
-                'type' => 'datetime',
-                'use' => 'a'
-            ),
-
             // Description
             'descr' => array(
                 'field' => 'descr',
@@ -206,132 +192,25 @@ class GlmDataMemberInfo extends GlmDataAbstract
                 'use' => 'a'
             ),
 
-            // Address Line 1
-            'addr1' => array (
-                'field' => 'addr1',
-                'type' => 'text',
-                'use' => 'a'
-            ),
-
-            // Address Line 2
-            'addr2' => array (
-                'field' => 'addr2',
-                'type' => 'text',
-                'use' => 'a'
-            ),
-
-            // City
-            'city' => array (
-                'field' => 'city',
-                'type' => 'pointer',
-                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities',
-                    'p_field' => 'name',
-                    'p_orderby' => 'name',
-                'use' => 'a'
-            ),
-
-            // State
-            'state' => array (
-                'field' => 'state',
-                'type' => 'list',
-                'list' => $this->config['states'],
-                'default' => 'MI',
-                'use' => 'a'
-            ),
-
-            // ZIP / Postal Code
-            'zip' => array (
-                'field' => 'zip',
-                'type' => 'text',
-                'use' => 'a'
-            ),
-
-            // Country
-            'country' => array (
-                'field' => 'country',
-                'type' => 'list',
-                'list' => $this->config['countries'],
-                'default' => 'US',
-                'use' => 'a'
-            ),
-
-            // Latitude
-            'lat' => array(
-                'field'    => 'lat',
-                'type'     => 'float',
-                'default'  => $this->config['settings']['maps_default_lat'],
-                'use'      => 'a'
-            ),
-
-            // Longitude
-            'lon' => array(
-                'field'    => 'lon',
-                'type'     => 'float',
-                'default'  => $this->config['settings']['maps_default_lon'],
-                'use'      => 'a'
-            ),
-
-            // Region
-            'region' => array (
-                'field' => 'region',
-                'type' => 'pointer',
-                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions',
-                    'p_field' => 'name',
-                    'p_orderby' => 'name',
-                    'p_blank' => true,
-                //  'force_list' => true,
-                'use' => 'a'
-            ),
-
-            // Phone
-            'phone' => array(
-                'field'    => 'phone',
-                'type'     => 'phone',
-                'use'      => 'a'
-            ),
-
-            // Toll Free
-            'toll_free' => array(
-                'field'    => 'toll_free',
-                'type'     => 'phone',
-                'use'      => 'a'
-            ),
-
-            // E-Mail Address
-            'email' => array(
-                'field'    => 'email',
-                'type'     => 'email',
-                'use'      => 'a'
-            ),
-
-            // URL
-            'url' => array(
-                'field'    => 'url',
-                'type'     => 'text',
-                'use'      => 'a'
-            ),
-
-            // Logo
-            'logo' => array(
-                    'field'    => 'logo',
-                    'type'     => 'image',
-                    'use'      => 'a'
-            ),
-
-            // Credit Cards Accepted - multi-pick
-            'cc_type' => array(
-                    'field'    => 'cc_type',
-                    'type'     => 'bitmap',
-                    'bitmap'    => $this->config['credit_card'],
-                    'default'  => 0, // no cards selected
-                    'use'      => 'a'
-            ),
-
             // Notes
             'notes' => array (
                     'field' => 'notes',
                     'type' => 'text',
                     'use' => 'a'
+            ),
+
+            // Create Time
+            'create_time' => array (
+                'field' => 'create_time',
+                'type' => 'datetime',
+                'use' => 'lgie'
+            ),
+
+            // Last Modify Time
+            'modify_time' => array (
+                'field' => 'modify_time',
+                'type' => 'datetime',
+                'use' => 'a'
             )
 
         );
@@ -364,23 +243,6 @@ class GlmDataMemberInfo extends GlmDataAbstract
             return $r;
         }
 
-        // Get Member Category data for this entry
-        $sql = "
-            SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr,
-                   COALESCE (
-                        (
-                        SELECT name
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories
-                         WHERE id = C.parent
-                        ), ''
-                   ) AS parent_name
-              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C,
-                   ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI
-             WHERE C.id = CMI.category
-               AND CMI.member_info = ".$r['id']."
-        ;";
-        $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
-
         // Get Amenity Data for this entry
         $sql = "
            SELECT A.*
index 3b779c2..4575770 100644 (file)
@@ -47,6 +47,13 @@ class GlmDataMembers extends GlmDataAbstract {
      * @access public
      */
     public $table;
+    /**
+     * Do Post Processing flag
+     *
+     * @var $doPostProcessing
+     * @access public
+     */
+    public $doPostProcessing = true;
 
     /**
      * Field definitions
@@ -133,7 +140,7 @@ class GlmDataMembers extends GlmDataAbstract {
                     'l_blank' => true,
                 'required' => true,
                 'default' => 30,
-                'force_list' => true,
+                'force_list' => false,
                 'use' => 'lged'
             ),
 
@@ -149,6 +156,26 @@ class GlmDataMembers extends GlmDataAbstract {
                 'use' => 'a'
             ),
 
+            // Member Type Display only short version
+            'member_type_short' => array (
+                'field' => 'member_type',
+                'as' => 'member_type_short',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_type',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
+                'force_list' => false,
+                'use' => 'lged'
+            ),
+
+            // Date created
+            'created' => array (
+                'field' => 'created',
+                'type' => 'date',
+                'required' => true,
+                'use' => 'a'
+            ),
+
             // Member Name
             'name' => array (
                 'field' => 'name',
@@ -165,14 +192,134 @@ class GlmDataMembers extends GlmDataAbstract {
                 'use' => 'gle'
             ),
 
-            // Date created
-            'created' => array (
-                'field' => 'created',
-                'type' => 'date',
-                'required' => true,
+            // Address Line 1
+            'addr1' => array (
+                'field' => 'addr1',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Address Line 2
+            'addr2' => array (
+                'field' => 'addr2',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // City
+            'city' => array (
+                'field' => 'city',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
+                'use' => 'a'
+            ),
+
+            // State
+            'state' => array (
+                'field' => 'state',
+                'type' => 'list',
+                'list' => $this->config['states'],
+                'default' => 'MI',
+                'use' => 'a'
+            ),
+
+            // ZIP / Postal Code
+            'zip' => array (
+                'field' => 'zip',
+                'type' => 'text',
                 'use' => 'a'
             ),
 
+            // Country
+            'country' => array (
+                'field' => 'country',
+                'type' => 'list',
+                'list' => $this->config['countries'],
+                'default' => 'US',
+                'use' => 'a'
+            ),
+
+            // Latitude
+            'lat' => array(
+                'field'    => 'lat',
+                'type'     => 'float',
+                'default'  => $this->config['settings']['maps_default_lat'],
+                'use'      => 'a'
+            ),
+
+            // Longitude
+            'lon' => array(
+                'field'    => 'lon',
+                'type'     => 'float',
+                'default'  => $this->config['settings']['maps_default_lon'],
+                'use'      => 'a'
+            ),
+
+            // Region
+            'region' => array (
+                'field' => 'region',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
+                    'p_blank' => true,
+                //  'force_list' => true,
+                'use' => 'a'
+            ),
+
+            // Phone
+            'phone' => array(
+                'field'    => 'phone',
+                'type'     => 'phone',
+                'use'      => 'a'
+            ),
+
+            // Toll Free
+            'toll_free' => array(
+                'field'    => 'toll_free',
+                'type'     => 'phone',
+                'use'      => 'a'
+            ),
+
+            // E-Mail Address
+            'email' => array(
+                'field'    => 'email',
+                'type'     => 'email',
+                'use'      => 'a'
+            ),
+
+            // URL
+            'url' => array(
+                'field'    => 'url',
+                'type'     => 'text',
+                'use'      => 'a'
+            ),
+
+            // Logo
+            'logo' => array(
+                    'field'    => 'logo',
+                    'type'     => 'image',
+                    'use'      => 'a'
+            ),
+
+            // Credit Cards Accepted - multi-pick
+            'cc_type' => array(
+                    'field'    => 'cc_type',
+                    'type'     => 'bitmap',
+                    'bitmap'    => $this->config['credit_card'],
+                    'default'  => 0, // no cards selected
+                    'use'      => 'a'
+            ),
+
+            // Notes
+            'notes' => array (
+                    'field' => 'notes',
+                    'type' => 'text',
+                    'use' => 'a'
+            ),
+
             // Active Version
             'active_id' => array (
                 'field' => 'id',
@@ -218,6 +365,48 @@ class GlmDataMembers extends GlmDataAbstract {
 
     }
 
+    /*
+     * Entry Post Processing Call-Back Method
+     *
+     * Perform post-processing for all result entries.
+     *
+     * In this case we're using it to append an array of category
+     * data to each member result and also sort by member name.
+     *
+     * @param array $r Array of field result data for a single entry
+     * @param string $a Action being performed (l, i, g, ...)
+     *
+     * @return object Class object
+     *
+     */
+    public function entryPostProcessing($r, $a)
+    {
+
+        // Only run these tests for 'l' (getList), 'g' (getEntry), 'e' (editEntry)
+        if (!$this->doPostProcessing || ($a != 'l' && $a != 'g' && $a != 'e')) {
+            return $r;
+        }
+
+        // Get Member Category data for this entry
+        $sql = "
+            SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr,
+                   COALESCE (
+                        (
+                        SELECT name
+                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories
+                         WHERE id = C.parent
+                        ), ''
+                   ) AS parent_name
+              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C,
+                   ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI
+             WHERE C.id = CMI.category
+               AND CMI.member_info = ".$r['id']."
+        ;";
+        $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
+
+        return $r;
+    }
+
     /*
      * Update member slug - should be called after a member record is added or updated
      *
@@ -247,23 +436,30 @@ class GlmDataMembers extends GlmDataAbstract {
 
     }
 
+
     /*
      * Get a simple members list - Name and ID only
      *
      * @return array Array of Name and ID for all members
      * @access public
      */
-    public function getSimpleMembersList()
+    public function getSimpleMembersList($where = '')
     {
 
         // Save the current fields array and make a copy
         $fSave = $this->fields;
-        $f = $fSave;
 
-        // Remove what we don't want form the copy and get the list
-        unset($f['access'], $f['member_type'], $f['created']);
-        $this->fields = $f;
-        $memberList = $this->getList();
+        // Remove what we don't want from the copy and get the list
+        $this->fields = array(
+            'id' => $fSave['id'],
+            'name' => $fSave['name'],
+            'created' => $fSave['created'],
+            'access_short' => $fSave['access_short'],
+            'member_type_short' => $fSave['member_type_short'],
+            'active_id' => $fSave['active_id']
+        );
+
+        $memberList = $this->getList($where);
 
         // Restore the fields list
         $this->fields = $fSave;
index 0e69c3e..a6c22d5 100644 (file)
@@ -105,6 +105,13 @@ class glmMembersAdmin extends GlmPluginSupport
      * @access public
      */
     public $config;
+    /**
+     * Current Git Branch
+     *
+     * @var $gitBranch
+     * @access public
+     */
+    public $gitBranch;
 
     /**
      * Admin Controller Constructor
@@ -183,6 +190,12 @@ class glmMembersAdmin extends GlmPluginSupport
             )
         );
 
+        // Check the current Git branch and if it's not 'master' then display admin warning
+        $this->getGitBranch();
+        if (count($this->gitBranch) > 0) {
+            add_action('admin_notices', array($this, 'glmMembersGitNotice'));
+        }
+
         // Create hook for add-ons to create menus
         do_action('glm-member-db-add-menu');
 
@@ -211,6 +224,77 @@ class glmMembersAdmin extends GlmPluginSupport
 
     }
 
+
+    /**
+     * Get Git Branch
+     *
+     * @return void
+     * @access public
+     */
+    public function getGitBranch()
+    {
+        $gitBranch = array();
+
+        foreach ($this->config['addOns'] as $a) {
+
+            // Git branch should be stored in .git/HEAD file
+            $gitFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/.git/HEAD';
+
+            // Check if the file exists
+            if (file_exists($gitFile)) {
+
+                // Read in the file
+                $gitString = file_get_contents($gitFile);
+
+                // Parse the branch string by '/'
+                $gitParts = explode('/', $gitString);
+
+                if (trim($gitParts[2]) != 'master') {
+
+                    $gitBranch[$a['slug']]['slug'] = $a['slug'];
+
+                    // [2] should be branch name or type
+                    if (isset($gitParts[2])) {
+                        $gitBranch[$a['slug']]['branch'] = $gitParts[2];
+                    }
+
+                    // [3] should be name of feature
+                    if (isset($gitParts[3])) {
+                        $gitBranch[$a['slug']]['feature'] = $gitParts[3];
+                    }
+
+                }
+
+            }
+
+        }
+
+        $this->gitBranch = $gitBranch;
+        return;
+
+    }
+
+    /**
+     * Display Git Branch as an admin warning
+     *
+     * @return void
+     * @access public
+     */
+    function glmMembersGitNotice() {
+
+        echo '<div class="error"><h3 class="glm-error">Plugin Git Branch Warning:</h3><table>';
+        foreach ($this->gitBranch as $b) {
+
+            echo '<tr><th align="left">'.$b['slug'].'</th><td>'.$b['branch'];
+            if (isset($b['feature'])) {
+                echo '/'.$b['feature'];
+            }
+            echo '</td></tr>';
+
+        }
+        echo "</table></div>";
+    }
+
     /**
      * Admin Ajax Target
      *
@@ -612,7 +696,7 @@ class glmMembersAdmin extends GlmPluginSupport
             if (!isset($this->config['validActions']['adminActions'][$menuItem])) {
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                    $this->addNotice('<b>Error in Admin Controller:</b> Menu Item not specified!', 'Alert');
+                    $this->addNotice('<b>Error in Admin Controller:</b> Menu Item not included in validActions.php!', 'Alert');
                 }
 
                 $modelRedirect = true;
index d6c690f..80e0f3e 100644 (file)
@@ -41,6 +41,9 @@
 .glm-clear {
     clear: both;
 }
+.glm-hidden {
+    display: none !important;    
+}
 .glm-button {
     margin-left: 4px !important;
     margin-right: 4px !important;   
@@ -74,6 +77,9 @@
 }
 
 /* Admin Forms */
+.glm-bad-input-area {
+    background: #FFaBa9;   
+}
 .glm-form-bad-input {
     background: #FFaBa9;
     padding: .2em;
@@ -91,7 +97,7 @@
     width: 50em;
 }
 .glm-form-textarea {
-    width: 90%;
+    width: 100%;
 }
 
 /* Admin table additions */
 .glm-admin-table-active {
     background: #99FFFF;
 }
+.glm-admin-table-large-bold-text {
+    font-size: 1.4em;
+    font-weight: bold;
+    margin: 0px;
+}
 .glm-admin-table-medium-text {
     font-size: 0.9em;
     margin: 0px;
index c2d6cb7..8b7dcd7 100644 (file)
@@ -4,10 +4,10 @@
 
 */
 .glm-right {
-    float: right;    
+    float: right;
 }
 .glm-left {
-    float: left;    
+    float: left;
 }
 .glm-hidden {
     display: none;
index 50fd72a..1ba06e9 100644 (file)
@@ -25,9 +25,6 @@
 /*
  *  Plugin and Database Versions
  *
- *  Note that the database version matches the version of the last
- *  plugin version where there was a change in the database.
- *
  *  Database updates for the main plugin and add-ons must also be
  *  listed in the /setup/databaseScripts/dbVersions.php file of
  *  the corresponding plugin/add-on. The table in that file
@@ -42,7 +39,7 @@
  */
 
 define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.57');
-define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.0.43');
+define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.0');
 
 // Check if plugin version is not current in WordPress option and if needed updated it
 if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) {
index 1463c91..60896c1 100755 (executable)
@@ -587,7 +587,8 @@ abstract class GlmDataAbstract
         $pSum = (isset($f['p_sum']) && $f['p_sum']);
         if (($this->optionIncludeSelectListData || $alwaysList || $forEdit || $pSum) && !$pStatic ) {
 
-            $p_value = $d;
+            // Get pointer value, ensure it's an integer
+            $p_value = ($d - 0);
 
             // Check for ORDER BY option
             $order_by = $f['p_field'];
@@ -685,11 +686,14 @@ abstract class GlmDataAbstract
         // Not doing list so get value only
         } else {
 
+            // Get pointer value, ensure that's it's an integer
+            $p_value = ($d - 0);
+
             $sql = "
                 SELECT ".$f['p_field']."
                   FROM ".$f['p_table']."
                         $where
-                   AND $p_id = $d
+                   AND $p_id = $p_value
             ";
             $res = $this->wpdb->get_row($sql, ARRAY_A);
 
@@ -2675,7 +2679,7 @@ abstract class GlmDataAbstract
         while (list($k, $v) = each($this->fields )) {
 
             // If this field is selected for the current operation
-            if (strstr($v['use'], $op) || strstr($v['use'], 'a')) {
+            if (isset($v['use']) && (strstr($v['use'], $op) || strstr($v['use'], 'a'))) {
 
                 $type = $v['type'];
 
@@ -2756,7 +2760,7 @@ abstract class GlmDataAbstract
         while (list($k, $v) = each($this->fields )) {
 
             // If this field is selected for the current operation
-            if (strstr($v['use'], $op) || strstr($v['use'], 'a')) {
+            if (isset($v['use']) && (strstr($v['use'], $op) || strstr($v['use'], 'a'))) {
 
                 // Is there a separate output type?
                 $type = $v['type'];
@@ -2840,7 +2844,7 @@ abstract class GlmDataAbstract
             $this->inputFieldStatus = true;
 
             // If this field is selected for the current operation
-            if (strstr($v['use'], $op) || strstr($v['use'], 'a')) {
+            if (isset($v['use']) && (strstr($v['use'], $op) || strstr($v['use'], 'a'))) {
 
                 // Check for good field type
                 if (!in_array($v['type'], $this->knownFieldTypes)) {
diff --git a/models/admin/configure/accommodationTypes.php b/models/admin/configure/accommodationTypes.php
deleted file mode 100644 (file)
index 0eb9ddf..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Accommodation Types List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @version  0.1
- */
-
-// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php');
-
-/*
- * This class performs the work for the default action of the "Members" menu
- * option, which is to display the members dashboard.
- *
- */
-class GlmMembersAdmin_configure_accommodationTypes extends GlmDataAccommodationTypes
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-
-    /*
-     * Constructor
-     *
-     * This contructor 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;
-
-        // Run constructor for members data class
-        parent::__construct(false, false);
-
-    }
-
-    /*
-     * Perform Model Action
-     *
-     * This method does the work for this model and returns any resulting data
-     *
-     * @return array Status and data array
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'menuItemRedirect'
-     *
-     * If not false, provides a menu item the controller should
-     * execute after this one. Normally if this is used, there would also be a
-     * modelRedirect value supplied as well.
-     *
-     * 'modelRedirect'
-     *
-     * If not false, provides an action the controller should execute after
-     * this one.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     */
-    public function modelAction ($actionData = false)
-    {
-
-        $success = true;
-        $haveAccommodationTypes = false;
-        $accommodationTypes = false;
-        $error = false;
-
-        // Check for accommodation type id
-        $id = 0;
-        if (isset($_REQUEST['id'])) {
-            $id = $_REQUEST['id']-0;
-        }
-
-        // If there's an action option
-        if (isset($_REQUEST['option'])) {
-
-            switch($_REQUEST['option']) {
-
-                case 'addNew':
-                    $this->insertEntry();
-                    break;
-
-                case 'update':
-                    if ($id > 0) {
-                        $this->updateEntry($id);
-                    }
-                    break;
-
-                case 'delete':
-                    if ($id > 0) {
-                        $this->deleteEntry($id, true);
-                    }
-                    break;
-
-            }
-
-        }
-
-        // Get a current list of accommodation types
-        $accommodationTypes = $this->getList();
-
-        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice($accommodationTypes, 'DataBlock', 'Accommodation Type Data');
-        }
-
-        // If we have list entries - even if it's an empty list
-        $success = true;
-        $haveAccommodationTypes = false;
-        if ($accommodationTypes !== false) {
-
-            $success = true;
-
-            // If we have any entries
-            if (count($accommodationTypes) > 0) {
-                $haveAccommodationTypes = true;
-            }
-        }
-
-        // If we had a fatal error, redirect to the error page
-        if ($error) {
-            return array(
-                    'status' => $success,
-                    'menuItemRedirect' => 'error',
-                    'modelRedirect' => 'index',
-                    'view' => 'admin/error/index.html',
-                    'data' => false
-            );
-        }
-
-        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice($accommodationTypes, 'DataBlock', 'Accommodation Types Data');
-        }
-
-        // Compile template data
-        $templateData = array(
-            'haveAccommodationTypes' => $haveAccommodationTypes,
-            'accommodationTypes' => $accommodationTypes
-        );
-
-        // Return status, suggested view, and data to controller
-        return array(
-            'status' => $success,
-            'menuItemRedirect' => false,
-            'modelRedirect' => false,
-            'view' => 'admin/configure/accommodationTypes.html',
-            'data' => $templateData
-        );
-
-    }
-
-
-}
-
-?>
\ No newline at end of file
index 38290d5..f80e318 100644 (file)
@@ -119,12 +119,6 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers
         $categoriesStats = $Categories->getStats();
         $haveCategories = ($categoriesStats > 0);
 
-        // Check for required Accommodation Types
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php');
-        $AccommodationTypes = new GlmDataAccommodationTypes($this->wpdb, $this->config);
-        $accommodationTypesStats = $AccommodationTypes->getStats();
-        $haveAccommodationTypes = ($accommodationTypesStats > 0);
-
         // Check for required Amenities
         require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php');
         $Amenities = new GlmDataAmenities($this->wpdb, $this->config);
@@ -148,9 +142,9 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers
         $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
         $membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']);
 
-        // Get member information records with bad or no lat/lon
-        $hideArchived = " T.status != ".$this->config['status_numb']['Archived'];
-        $badLatLonList = $MemberInfo->getSimpleMemberInfoList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
+        // Get member records with bad or no lat/lon
+        $hideArchived = " T.access != ".$this->config['access_numb']['Archived'];
+        $badLatLonList = $this->getSimpleMembersList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
         $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0);
 
         // If there's members with pending information, list them
@@ -168,7 +162,6 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers
             'badLatLonList' => $badLatLonList,
             'haveMemberTypes' => $haveMemberTypes,
             'haveCategories' => $haveCategories,
-            'haveAccommodationTypes' => $haveAccommodationTypes,
             'haveAmenities' => $haveAmenities,
             'haveRegions' => $haveRegions,
             'haveCities' => $haveCities,
index 09e36f2..878d8f0 100644 (file)
@@ -168,6 +168,7 @@ class GlmMembersAdmin_management_index extends GlmDataSettingsGeneral
 
         // Compile template data
         $templateData = array(
+            'gitBranch' => $gitBranch,
             'reason' => '',
             'genSettings' => $generalSettings,
             'timezones' =>  DateTimeZone::listIdentifiers(),
diff --git a/models/admin/member/memberEdit.php b/models/admin/member/memberEdit.php
new file mode 100644 (file)
index 0000000..76c5699
--- /dev/null
@@ -0,0 +1,471 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Member Management - Edit base member data
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Members data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Memeber ID
+     *
+     * @var $memberID
+     * @access public
+     */
+    public $memberID;
+
+    /*
+     * Constructor
+     *
+     * This contructor 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;
+
+        // Run constructor for members data class
+        parent::__construct(false, false);
+
+    }
+
+    /*
+     * Perform Model Action
+     *
+     * This method does the work for this model and returns any resulting data
+     *
+     * @return array Status and data array
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'menuItemRedirect'
+     *
+     * If not false, provides a menu item the controller should
+     * execute after this one. Normally if this is used, there would also be a
+     * modelRedirect value supplied as well.
+     *
+     * 'modelRedirect'
+     *
+     * If not false, provides an action the controller should execute after
+     * this one.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     */
+    public function modelAction ($actionData = false)
+    {
+
+        $success = true;
+        $option = false;
+        $haveMemberTypes = false;
+        $categories = false;
+        $this->memberID = false;
+        $memberUpdated = false;
+        $memberData = false;
+        $haveMember = false;
+        $addingMember = false;
+        $memberUpdated = false;
+
+        /*
+         * Get some data we're going to need
+         */
+
+        // Check for required Member Types
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php');
+        $MemberTypes = new GlmDataMemberTypes($this->wpdb, $this->config);
+        $memberTypesStats = $MemberTypes->getStats();
+        $haveMemberTypes = ($memberTypesStats > 0);
+
+        /*
+         * Get a sorted list of categories to use for picklists.
+         * These will be sorted so sub-categories fall under their
+         * respective category.
+         */
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+        $Categories = new GlmDataCategories($this->wpdb, $this->config);
+        $categories = $Categories->getListSortedParentChild();
+
+        // Check for action option - Should be one of the values in the "switch" statement below
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+
+        /*
+         * Determine member ID to use
+         */
+
+        // Check if there's a logged in user who is locked to their own entity
+        $lockedToMember = apply_filters('glm_members_locked_to_member_id', false);
+        if ($lockedToMember) {
+            $this->memberID = $lockedToMember;
+
+        // Otherwise Check for other member selection options
+        } else {
+
+            if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'add') {
+
+               delete_option('glmMembersDatabaseMemberID');
+               $this->memberID = 0;
+
+            // Check if a redirecting model supplied the member ID
+            } elseif (isset($actionData['memberID'])) {
+
+                $this->memberID = $actionData['memberID'];
+
+            // Otherwise check if one was supplied by the user or passed from somewhere else
+            } elseif (isset($_REQUEST['member'])) {
+
+                // Make sure it's a number
+                $this->memberID = $_REQUEST['member']-0;
+
+            } else {
+
+                $this->memberID = get_option('glmMembersDatabaseMemberID');
+
+            }
+        }
+
+        // If member ID not supplied and we're not adding a new member - we shouldn't be here, so redirect to an error page
+        if ($this->memberID <= 0 && $option != 'add' && $option != 'addNew') {
+
+            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID expected but no ID was supplied.", 'Alert');
+            }
+
+            return array(
+                    'status' => true,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect' => 'index',
+                    'view' => 'admin/error/index.html',
+                    'data' => false
+            );
+
+        }
+
+        /*
+         * Perform requested action
+         */
+        switch ($option) {
+
+            // Add new member
+            case 'add':
+
+                $memberData = $this->newEntry();
+
+                $addingMember = true;
+
+                break;
+
+            // Submit a member update
+            case 'submit':
+
+                // Check for new cities being submitted
+                $this->checkNewCities();
+
+                // Update submitted categories
+                $this->updateCategories();
+
+                $memberData = $this->updateEntry($this->memberID);
+
+                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                    glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member Update:</b> $this->memberID", 'Process');
+                }
+
+                // If update was successful then use editEntry() to setup for the edit again.
+                if ($memberData['status']) {
+
+                    $slug = $this->updateSlug($this->memberID);
+
+                    $memberData = $this->editEntry($this->memberID);
+                    $memberUpdated = true;
+
+                    // Also update all member info records with any possible name change
+                    $sql = "
+                        UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+                           SET member_name = '".addslashes($memberData['fieldData']['name'])."'
+                         WHERE member = $this->memberID
+                    ;";
+                    $this->wpdb->query($sql);
+
+                    $memberName = $memberData['fieldData']['name'];
+
+                }
+
+                $haveMember = true;
+
+                break;
+
+            // Add the new member
+            case 'addNew':
+
+                    // Check for new cities being submitted
+                    $this->checkNewCities();
+
+                    // Update submitted categories
+                    $this->updateCategories();
+echo "------------------------------------asd+";
+                    $memberData = $this->insertEntry();
+
+                    // If update was successful then use editEntry() to setup for the edit again.
+                    if ($memberData['status']) {
+
+                        $slug = $this->updateSlug($this->memberID);
+
+                        $memberData = $this->editEntry($this->memberID);
+                        $memberUpdated = true;
+
+                        // Also update all member info records with any possible name change
+                        $sql = "
+                            UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+                               SET member_name = '".addslashes($memberData['fieldData']['name'])."'
+                             WHERE member = $this->memberID
+                        ;";
+                        $this->wpdb->query($sql);
+
+                        $memberName = $memberData['fieldData']['name'];
+
+                    }
+
+                break;
+
+                // Delete this member
+            case 'delete':
+
+                break;
+
+            // Default is to edit the member
+            case 'edit':
+            default:
+
+                // Try to get existing member data
+                $memberData = $this->editEntry($this->memberID);
+                if ($memberData) {
+                    $haveMember = true;
+                    $memberName = $memberData['fieldData']['name'];
+                } else {
+                    $success = false;
+                }
+
+                break;
+
+        }
+
+        // Compile template data
+        $templateData = array(
+            'success' => $success,
+            'haveMemberTypes' => $haveMemberTypes,
+            'availableCategories' => $categories,
+            'memberID' => $this->memberID,
+            'haveMember' => $haveMember,
+            'member' => $memberData,
+            'memberName' => $memberName,
+            'addingMember' => $addingMember,
+            'memberUpdated' => $memberUpdated
+
+/*
+            'addingMember' => $addingMember,
+            'member' => $memberData,
+            'memberName' => $memberName,
+            'haveInfoRecords' => $haveInfoRecords,
+            'memberInfoRecords' => $memberInfoRecords,
+            'noActive' => $noActive,
+            'showArchived' => $showArchived,
+            'haveMemberInfo' => $haveMemberInfo,
+            'memberUpdated' => $memberUpdated,
+            'statusTypeNumbers' => $this->config['status_numb'],
+            'statusPending' => $this->config['status_numb']['Pending']
+*/
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/member/memberEdit.html',
+            'data' => $templateData
+        );
+
+    }
+
+    /*
+     * Check for new Cities being submitted
+     *
+     * @return void
+     */
+    public function checkNewCities()
+    {
+
+        // If we have a member ID and this was a submission with a new city (id < 0)
+        if ($this->memberID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') {
+
+            // Clean up city name
+            $cName = trim(filter_var($_REQUEST['newCityName']));
+
+            // Try to add the city
+            require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
+            $Cities = new GlmDataCities($this->wpdb, $this->config);
+            $cID = $Cities->addCity($cName);
+
+            // If we got a city id back
+            if (is_int($cID) && $cID > 0) {
+
+                // Update the city selected for this member record
+                $sql = "
+                        UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member
+                            SET city = $cID
+                            WHERE id = ".$this->memberID."
+                            ;";
+                $this->wpdb->query($sql);
+
+                // Update submitted city value to use the new ID
+                $_REQUEST['city'] = $cID;
+
+            }
+        }
+    }
+
+    /*
+     * Update categories for the current submission
+     *
+     * @return void
+     */
+    public function updateCategories()
+    {
+
+        // Instatiate the dataCategories class
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+        $Categories = new GlmDataCategories($this->wpdb, $this->config);
+
+        // Instatiate categoryMemberInfo class
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php');
+        $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config);
+
+        // Get any selected categories
+        $selectedCategories = array();
+        $newCategory = false;
+        if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) {
+
+            /*
+             *  For each selected category
+             *
+             *  Note that categories are submitted with either a positive key, which indicates
+             *  that it represents an existing category, or a negative key, which indicates
+             *  that the user is trying to add it to the list of categories.
+             *
+             */
+            foreach ($_REQUEST['category'] as $key) {
+
+                // Make sure key is an integer
+                $key = intval($key -0);
+
+                // If negative, this is a new category that needs to be added to the category table
+                if ($key < 0) {
+
+                    $newCategory = true;
+
+                    // Check if a parent is specified
+                    $parent = 0;
+                    if ($_REQUEST['newCatParent'][$key] != '') {
+                        $parent = $_REQUEST['newCatParent'][$key] -0;
+                    } elseif ($_REQUEST['newCatParentName'][$key]) {
+                        $parent = $_REQUEST['newCatParentName'][$key];
+                    }
+
+                    // Clean up the category name
+                    $category = filter_var($_REQUEST['newCategory'][$key]);
+
+                    // Add it to the category table and get the new category ID
+                    $categoryID = $Categories->addCategory($category, $parent);
+
+                    // If we got a new category ID, add it to the array of currently selected categoryMember records
+                    if ($categoryID) {
+                        $selectedCategories[$categoryID] = $categoryID;
+                    }
+
+                    // Otherwise if it's positive, the category is an existing one
+                } else if ($key > 0) {
+
+                    $selectedCategories[$key] = $key;
+
+                }
+
+                // If there's selected categories
+                if (count($selectedCategories) > 0) {
+
+                    // Update the selected categories for this member information record, returns new list
+                    $CategoryMemberInfo->setMemberInfoCategories($this->memberID, $selectedCategories);
+
+                }
+
+                // If there's been a new category
+                if ($newCategory) {
+
+                    // Get the full category list again
+                    $this->categories = $Categories->getListSortedParentChild();
+
+                }
+
+            } // For each category being submitted
+
+            // Otherwise if this is a submission and there's no categories submitted, so make sure there's none stored
+        } elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+            $CategoryMemberInfo->clearMemberInfoCategories($this->memberID);
+        }
+
+    }
+
+}
+
+?>
\ No newline at end of file
index c760002..70037d6 100644 (file)
@@ -87,27 +87,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
      * @access public
      */
     public $isActive = false;
-    /**
-     * Category data for current member info record
-     *
-     * @var $categoryMemberInfo
-     * @access public
-     */
-    public $categoryMemberInfo = false;
-    /**
-     * Full list of categories
-     *
-     * @var $categories
-     * @access public
-     */
-    public $categories = false;
-    /**
-     * Have categories?
-     *
-     * @var $haveCategories
-     * @access public
-     */
-    public $haveCategories = false;
     /**
      * Have image gallery contents
      *
@@ -301,23 +280,9 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
             // Process submission of a member information record update
             case 'submit':
 
-                // Check for new cities being submitted
-                $this->checkNewCities();
-
-                // Update submitted categories
-                $this->updateCategories();
-
                 // Update submitted amenities
                 $this->updateAmenities();
 
-                // Load Image data class
-                require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php');
-                $Images = new GlmDataImages($this->wpdb, $this->config);
-
-                // Update image gallery titles, descriptions, and image positions then return current image gallery
-                $this->imageGallery = $Images->galleryImageDataUpdate($this->config['ref_type_numb']['MemberInfo'], $this->memberInfoID, 'galleryPositionOrder');
-                $this->haveImageGallery = ($this->imageGallery != false);
-
                 if ($this->haveMemberInfo) {
 
                     // Update the member Info data
@@ -349,12 +314,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
                     $this->memberInfoID = $this->memberInfo['fieldData']['id'];
                     $this->haveMemberInfo = true;
 
-                    // Check for new cities being submitted
-                    $this->checkNewCities();
-
-                    // Update submitted categories
-                    $this->updateCategories();
-
                     // Update submitted amenities
                     $this->updateAmenities();
 
@@ -406,15 +365,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
             );
         }
 
-        /*
-         * Get a sorted list of categories to use for picklists.
-         * These will be sorted so sub-categories fall under their
-         * respective category.
-         */
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
-        $Categories = new GlmDataCategories($this->wpdb, $this->config);
-        $this->categories = $Categories->getListSortedParentChild();
-
         // Get list of Available Member Amenities to use for picklists
         require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php');
         $Amenities = new GlmDataAmenities($this->wpdb, $this->config);
@@ -464,7 +414,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
         } else {
 
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Specified Member Information Record ID is invalid:</b> $this->memberInfoID", 'Alert');
+                glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID is invalid or Status not success:</b> Member ID = $this->memberInfoID", 'Alert');
             }
 
             $this->error = true;
@@ -486,7 +436,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
             'memberInfoID' => $this->memberInfoID,
             'memberInfo' => $this->memberInfo,
             'memberUpdated' => $memberUpdated,
-            'availableCategories' => $this->categories,
             'availableAmenities' => $this->amenities,
             'haveImageGallery' => $this->haveImageGallery,
             'imageGallery' => $this->imageGallery,
@@ -506,42 +455,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
     }
 
 
-    /*
-     * Check for new Cities being submitted
-     *
-     * @return void
-     */
-    public function checkNewCities()
-    {
-
-        // If we have a member ID and this was a submission with a new city (id < 0)
-        if ($this->memberInfoID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') {
-
-            // Clean up city name
-            $cName = trim(filter_var($_REQUEST['newCityName']));
-
-            // Try to add the city
-            require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
-            $Cities = new GlmDataCities($this->wpdb, $this->config);
-            $cID = $Cities->addCity($cName);
-
-            // If we got a city id back
-            if (is_int($cID) && $cID > 0) {
-
-                // Update the city selected for this memberInfo record
-                $sql = "
-                        UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
-                            SET city = $cID
-                            WHERE id = ".$this->memberInfoID."
-                            ;";
-                $this->wpdb->query($sql);
-
-                // Update submitted city value to use the new ID
-                $_REQUEST['city'] = $cID;
-
-            }
-        }
-    }
 
     /*
      * Check it there's no active information record
@@ -603,98 +516,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
 
     }
 
-
-    /*
-     * Update categories for the current submission
-     *
-     * @return void
-     */
-    public function updateCategories()
-    {
-
-        // Instatiate the dataCategories class
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
-        $Categories = new GlmDataCategories($this->wpdb, $this->config);
-
-        // Instatiate categoryMemberInfo class
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php');
-        $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config);
-
-        // Get any selected categories
-        $selectedCategories = array();
-        $newCategory = false;
-        if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) {
-
-            /*
-             *  For each selected category
-             *
-             *  Note that categories are submitted with either a positive key, which indicates
-             *  that it represents an existing category, or a negative key, which indicates
-             *  that the user is trying to add it to the list of categories.
-             *
-             */
-            foreach ($_REQUEST['category'] as $key) {
-
-                // Make sure key is an integer
-                $key = intval($key -0);
-
-                // If negative, this is a new category that needs to be added to the category table
-                if ($key < 0) {
-
-                    $newCategory = true;
-
-                    // Check if a parent is specified
-                    $parent = 0;
-                    if ($_REQUEST['newCatParent'][$key] != '') {
-                        $parent = $_REQUEST['newCatParent'][$key] -0;
-                    } elseif ($_REQUEST['newCatParentName'][$key]) {
-                        $parent = $_REQUEST['newCatParentName'][$key];
-                    }
-
-                    // Clean up the category name
-                    $category = filter_var($_REQUEST['newCategory'][$key]);
-
-                    // Add it to the category table and get the new category ID
-                    $categoryID = $Categories->addCategory($category, $parent);
-
-                    // If we got a new category ID, add it to the array of currently selected categoryMemberInfo records
-                    if ($categoryID) {
-                        $selectedCategories[$categoryID] = $categoryID;
-                    }
-
-                    // Otherwise if it's positive, the category is an existing one
-                } else if ($key > 0) {
-
-                    $selectedCategories[$key] = $key;
-
-                }
-
-                // If there's selected categories
-                if (count($selectedCategories) > 0) {
-
-                    // Update the selected categories for this member information record, returns new list
-                    $CategoryMemberInfo->setMemberInfoCategories($this->memberInfoID, $selectedCategories);
-
-                }
-
-                // If there's been a new category
-                if ($newCategory) {
-
-                    // Get the full category list again
-                    $this->categories = $Categories->getListSortedParentChild();
-
-                }
-
-            } // For each category being submitted
-
-            // Otherwise if this is a submission and there's no categories submitted, so make sure there's none stored
-        } elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
-            $CategoryMemberInfo->clearMemberInfoCategories($this->memberInfoID);
-        }
-
-    }
-
-
     /*
      * Update amenities for the current submission
      *
index 4510f9b..3d82ee3 100644 (file)
@@ -118,12 +118,6 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
         $categoriesStats = $Categories->getStats();
         $haveCategories = ($categoriesStats > 0);
 
-        // Check for required Accommodation Types
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php');
-        $AccommodationTypes = new GlmDataAccommodationTypes($this->wpdb, $this->config);
-        $accommodationTypesStats = $AccommodationTypes->getStats();
-        $haveAccommodationTypes = ($accommodationTypesStats > 0);
-
         // Check for required Amenities
         require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php');
         $Amenities = new GlmDataAmenities($this->wpdb, $this->config);
@@ -142,16 +136,16 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
         $regionsStats = $Regions->getStats();
         $haveRegions = ($regionsStats > 0);
 
+        // Get member records with bad or no lat/lon
+        $hideArchived = " T.access != ".$this->config['access_numb']['Archived'];
+        $badLatLonList = $this->getSimpleMembersList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
+        $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0);
+
         // Get number of member information records with pending updates
         require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
         $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
         $membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']);
 
-        // Get member information records with bad or no lat/lon
-        $hideArchived = " T.status != ".$this->config['status_numb']['Archived'];
-        $badLatLonList = $MemberInfo->getSimpleMemberInfoList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
-        $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0);
-
         // If there's members with pending information, list them
         $pendingList = false;
         if ($membersPending > 0) {
@@ -168,7 +162,6 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
             'badLatLonList' => $badLatLonList,
             'haveMemberTypes' => $haveMemberTypes,
             'haveCategories' => $haveCategories,
-            'haveAccommodationTypes' => $haveAccommodationTypes,
             'haveAmenities' => $haveAmenities,
             'haveRegions' => $haveRegions,
             'haveCities' => $haveCities,
index 3a154f9..cc81f7c 100644 (file)
@@ -143,7 +143,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
 
 
         // Get a current list of members
-        $list = $this->getList($where);
+        $list = $this->getSimpleMembersList($where);
 
         /*
          * Check for list filters
diff --git a/setup/databaseScripts/create_database_V1.0.43.sql b/setup/databaseScripts/create_database_V1.0.43.sql
deleted file mode 100644 (file)
index 3091728..0000000
+++ /dev/null
@@ -1,795 +0,0 @@
--- Gaslight Media Members Database 
--- File Created: 12/09/14 15:27:15
--- Database Version: 1.0.43
--- Database Creation Script
--- 
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
-
--- Accommodation Types 
-CREATE TABLE {prefix}accommodation_types (
-  id INT NOT NULL AUTO_INCREMENT,
-  facility_type INT NULL,                   -- See "Facility Types" in config/plugin.ini
-  name TINYTEXT NULL,                       -- Name of accommodation type
-  descr TEXT NULL,                          -- Description of accommodation type
-  short_descr TINYTEXT NULL,                -- Short description of accommodation type
-  PRIMARY KEY (id),                         
-  INDEX(facility_type),
-  INDEX(name(20))
-);
-
-----
-
--- Accommodations
-CREATE TABLE {prefix}accommodations (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Accommodation record is active flag
-  name TINYTEXT NULL,                       -- Name of the accommodation record
-  accommodation_type INT NULL,              -- Pointer to Accommodation type in accommodation_types table
-  descr TEXT NULL,                          -- Description of accommodation
-  short_descr TINYTEXT NULL,                -- Short description of accommodation
-  url TINYTEXT NULL,                        -- URL for info regarding this accommodation
-  notes TEXT NULL,                          -- Notes regarding this accommodation - Not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Date/time this accommondation was created
-  modify_time TIMESTAMP NULL,               -- Date/time this accommodation was last updated
-  quant INT NULL,                           -- Quantity of this accommodation
-  reservation_url TINYTEXT NULL,            -- URL to use for making reservaionn
-  reservation_id TINYTEXT NULL,             -- ID to use as a reference to this accommodation when making reservations
-  year_round TINYINT(1) NULL,               -- Accommodation is available year-round
-  ref_type INT NULL,                        -- Type of entity this accommodation is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this accommodation is associated with
-  PRIMARY KEY (id),
-  INDEX(accommodation_type),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Accounts
-CREATE TABLE {prefix}accounts (
-  id INT NOT NULL AUTO_INCREMENT,
-  member INT NULL,
-  payment_type INT NULL,
-  invoice_delivery INT NULL,
-  PRIMARY KEY (id),
-  INDEX(member)
-);
-
-----
-
--- Activities
-CREATE TABLE {prefix}activities (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Activity is active flag
-  activity_type INT NULL,                   -- ***** NEED TO ADD ACTIVITY_TYPES TABLE AND SUPPORT FOR THAT ***** 
-  name TINYTEXT NULL,                       -- Activity name
-  descr TEXT NULL,                          -- Description of activity
-  short_descr TINYTEXT NULL,                -- Shot description of activity
-  phone TINYTEXT NULL,                      -- Phone number to contact someone regarding this activity
-  url TINYTEXT NULL,                        -- URL for info regarding this activity
-  notes TEXT NULL,                          -- Notes regarding this activity - Not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Date/time this activity was created
-  modify_time TIMESTAMP NULL,               -- Date/time this activity was last updated
-  ref_type INT NULL,                        -- Type of entity this activity is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of type ref_type
-  PRIMARY KEY (id),
-  INDEX(activity_type),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Amenities
-CREATE TABLE {prefix}amenities (
-  id INT NOT NULL AUTO_INCREMENT,
-  active TINYINT(1) NULL,                   -- Amenity is active flag
-  name TINYTEXT NULL,                       -- Name of amenity
-  descr TEXT NULL,                          -- Description of amenity
-  short_descr TINYTEXT NULL,                -- Short description of amenity
-  ref_type INT NULL,                        -- Type of entity these amenitites are associated with - see plugin.ini ref_type tables
-  uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
-  PRIMARY KEY (id),
-  INDEX(name(20))
-);
-
-----
-
--- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
-CREATE TABLE {prefix}amenity_ref (
-  id INT NOT NULL AUTO_INCREMENT,
-  amenity INT NULL,                         -- Pointer to amenity in amenities table
-  ref_type INT NULL,                        -- Copy of ref_type from matching ameities table entry - to simplify searches
-  ref_dest INT NULL,                        -- Pointer to the specific entity of type ref_type
-  amenity_value TINYTEXT NULL,              -- Quanity if amenity uses values
-  PRIMARY KEY (id),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Member Cateogries - used with member information records
-CREATE TABLE {prefix}categories (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of this category
-  descr TEXT NULL,                          -- Description of this category
-  short_descr TINYTEXT NULL,                -- Short description of this category 
-  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
-  PRIMARY KEY (id)
-);
-
-----
-
--- Mapping of categories to speific member information records
-CREATE TABLE {prefix}category_member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  category INT NULL,                        -- Pointer to category in categories table
-  member_info INT NULL,                     -- Pointer to member infomation record
-  PRIMARY KEY (id),
-  CONSTRAINT {prefix}categories_fk_1
-    FOREIGN KEY (category)
-    REFERENCES {prefix}categories (id)
-    ON DELETE CASCADE,
-  INDEX(category),
-  INDEX(member_info)
-);
-
-----
-
--- Cities
-CREATE TABLE {prefix}cities (
-  id INT NOT NULL AUTO_INCREMENT,           
-  name TINYTEXT NULL,                       -- Name of city
-  PRIMARY KEY (id)
-);
-
-----
-
--- Contacts - used by various entities
-CREATE TABLE {prefix}contacts (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Contact is active flag
-  access INT NULL,                          -- Access type - See access table in plugin.ini
-  fname TINYTEXT NULL,                      -- First name of contact
-  lname TINYTEXT NULL,                      -- Last name of contact
-  contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
-  contact_role INT NULL,                    -- Contact WordPress user Role
-  org TINYTEXT NULL,                        -- Organization name
-  title TINYTEXT NULL,                      -- Title/Position
-  descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
-  image TINYTEXT NULL,                      -- Image
-  addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
-  addr2 TINYTEXT NULL,                      -- Address line 2 
-  city INT NULL,                            -- Pointer to city in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries 
-  zip TINYTEXT NULL,                        -- ZIP/Postal Code     
-  lat FLOAT NULL,                           -- Latitude of contact location
-  lon FLOAT NULL,                           -- Longitude of contact location
-  url TINYTEXT NULL,                        -- URL to information regarding this contact
-  office_phone TINYTEXT NULL,               -- Office phone number
-  home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
-  mobile_phone TINYTEXT NULL,               -- Mobile phone number
-  alt_phone TINYTEXT NULL,                  -- An alternate phone number
-  fax TINYTEXT NULL,                        -- FAX number (do people still use these?) 
-  email TINYTEXT NULL,                      -- E-Mail address
-  alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in 
-  username TINYTEXT NULL,                   -- Optional username to use for login
-  password TINYTEXT NULL,                   -- Encrypted password
-  notes TEXT NULL,                          -- Notes - Not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last modified date/time
-  ref_type INT NULL,                        -- Type of entity this contact is associated with                        
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
-  PRIMARY KEY (id),
-  INDEX(fname(20)),
-  INDEX(lname(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(email(20))
-);
-
-----
-
--- Facilities - Facilities are separate functional units of a member, either physically or operationally
--- For example, separate facilities could be individual properties (hotels, motels) or could be operationally 
--- separate hotel and restaurant at the same location. A facility is an entity under a member "location".
-CREATE TABLE {prefix}facilities (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Facility is active flag
-  facility_type INT NULL,                   -- Facility type - see plugin.ini facility type
-  location INT NULL,                        -- Pointer to one of the member's locations - see locations table
-  name TINYTEXT NULL,                       -- Name of this facility
-  descr TEXT NULL,                          -- Description
-  short_descr TINYTEXT NULL,                -- Short description
-  addr1 TINYTEXT NULL,                      -- Address line 1 
-  addr2 TINYTEXT NULL,                      -- Address line 2
-  city INT NULL,                            -- Pointer to city in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries 
-  zip TINYTEXT NULL,                        -- ZIP/Postal code
-  lat FLOAT NULL,                           -- Latitude of facility
-  lon FLOAT NULL,                           -- Longitude of facility
-  phone TINYTEXT NULL,                      -- Primary phone number
-  toll_free TINYTEXT NULL,                  -- Toll Free phone number
-  url TINYTEXT NULL,                        -- URL for information specifically regarding this facility
-  logo TINYTEXT NULL,                       -- Logo 
-  notes TEXT NULL,                          -- Notes - Not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last modified date/time
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon)
-);
-
-----
-
--- Donwloadable Files - files are stored under /wp-content/uploads/glm-member-db/files/
-CREATE TABLE {prefix}files (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of this file
-  file_name TINYTEXT NULL,                  -- Physical file name for this file
-  descr TEXT NULL,                          -- Description
-  short_descr TINYTEXT NULL,                -- Short descroption
-  size INT NULL,                            -- Download size of this file
-  pending BOOLEAN NULL,                     -- File is pending review flag
-  create_date DATE NULL,                    -- Date file was uploaded
-  ref_type INT NULL,                        -- Type of entity this file is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this file is associated with
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Detail on golf courses
-CREATE TABLE {prefix}golf (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- This golf course is active flag
-  name TINYTEXT NULL,                       -- Name of Golf course
-  descr TEXT NULL,                          -- Description
-  short_descr TINYTEXT NULL,                -- Short Description
-  rating TINYTEXT NULL,                     -- Rating
-  par TINYTEXT NULL,                        -- Par
-  yardage TINYTEXT NULL,                    -- Total yardage
-  slope TINYTEXT NULL,                      -- Slope rating
-  walking TINYINT(1) NULL,                  -- Walking course
-  holes INT NULL,                           -- Number of holes
-  reservation_url TINYTEXT NULL,            -- URL for making reservations for this course
-  ref_type INT NULL,                        -- Type of entity this golf course is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this golf course is associated with
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Images - Images are stored under /wp-content/uploads/glm-member-db/images/{size}/
-CREATE TABLE {prefix}images (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Original name of the image - might be URL if copied via HTTP
-  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
-  selected BOOLEAN NULL,                    -- A single special image in the current gallery for this entity
-  featured BOOLEAN null,                    -- Image is a member of a group of featured images
-  file_name TINYTEXT NULL,                  -- Stored file name for the image
-  descr TEXT NULL,                          -- Description 
-  caption TINYTEXT NULL,                    -- Caption for the image
-  position INT NULL,                        -- Numeric position for sequence of display
-  ref_type INT NULL,                        -- Type of entity this image is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Member locations - Locations are physically separate campuses where facilities exist
-CREATE TABLE {prefix}locations (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- This location is active flag
-  member INT NULL,                          -- Pointer to main member record
-  member_info INT NULL,                     -- Pointer to associated member info record
-  name TINYTEXT NULL,                       -- Name of location 
-  descr TEXT NULL,                          -- Description
-  short_descr TINYTEXT NULL,                -- Short Description
-  addr1 TINYTEXT NULL,                      -- Address line 1 - Main address for this location
-  addr2 TINYTEXT NULL,                      -- Address line 2
-  city INT NULL,                            -- Pointer to city in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries 
-  zip TINYTEXT NULL,                        -- ZIP/Postal code
-  lat FLOAT NULL,                           -- Latitude of location
-  lon FLOAT NULL,                           -- Longitude of location
-  region INT NULL,                          -- Pointer to region where location exists
-  phone TINYTEXT NULL,                      -- Primary phone number
-  toll_free TINYTEXT NULL,                  -- Toll Free phone number
-  url TINYTEXT NULL,                        -- URL for information regarding this location
-  logo TINYTEXT NULL,                       -- Logo
-  notes TEXT NULL,                          -- Notes - not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last Update date/time
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(region)
-);
-
-----
-
--- Meals offered by a restaurant
-CREATE TABLE {prefix}meals (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Meal is active flag
-  name TINYTEXT NULL,                       -- Name of this meal (typically Breakfast, Lunch, Dinner, Brunch, ...)
-  descr TEXT NULL,                          -- Description of the meal
-  short_descr TINYTEXT NULL,                -- Short description
-  menu TEXT NULL,                           -- Text menu for this meal
-  menu_file TINYTEXT NULL,                  -- File name of downloadable menu file (PDF, etc.)
-  daily BOOLEAN NULL,                       -- Flag indicating if meal is available daily
-  daily_start_time TIME NULL,               -- Daily meal - Time of day this meal starts
-  daily_end_time TIME NULL,                 -- Daily meal - Time of day this meal ends
-  daily_res_req BOOLEAN NULL,               -- Daily meal - Reservations requested
-  sunday BOOLEAN NULL,                      -- Flag indicating if meal is available Sunday
-  sun_menu TEXT NULL,                       -- Optional menu text for Sunday
-  sun_start_time TIME NULL,                 -- Sunday - Time of day this meal starts
-  sun_end_time TIME NULL,                   -- Sunday - Time of day this meal ends
-  sun_res_req BOOLEAN NULL,                 -- Sunday - Reservations requested
-  monday BOOLEAN NULL,                      -- Flag indicating if meal is available Monday
-  mon_menu TEXT NULL,                       -- Optional menu text for Monday
-  mon_start_time TIME NULL,                 -- Monday - Time of day this meal starts
-  mon_end_time TIME NULL,                   -- Monday - Time of day this meal ends
-  mon_res_req BOOLEAN NULL,                 -- Monday - Reservations requested
-  tuesday BOOLEAN NULL,                     -- Flag indicating if meal is available Tuesday
-  tue_menu TEXT NULL,                       -- Optional menu text for Tuesday
-  tue_start_time TIME NULL,                 -- Tuesday - Time of day this meal starts
-  tue_end_time TIME NULL,                   -- Tuesday - Time of day this meal ends
-  tue_res_req BOOLEAN NULL,                 -- Tuesday - Reservations requested
-  wednesday BOOLEAN NULL,                   -- Flag indicating if meal is available Wednesday
-  wed_menu TEXT NULL,                       -- Optional menu text for Wednesday
-  wed_start_time TIME NULL,                 -- Wednesday - Time of day this meal starts
-  wed_end_time TIME NULL,                   -- Wednesday - Time of day this meal ends
-  wed_res_req BOOLEAN NULL,                 -- Wednesday - Reservations requested
-  thursday BOOLEAN NULL,                    -- Flag indicating if meal is available Thursday
-  thu_menu TEXT NULL,                       -- Optional menu text for Thursday
-  thu_start_time TIME NULL,                 -- Thursday - Time of day this meal starts
-  thu_end_time TIME NULL,                   -- Thursday - Time of day this meal ends
-  thu_res_req BOOLEAN NULL,                 -- Thursday - Reservations requested
-  friday BOOLEAN NULL,                      -- Flag indicating if meal is available Friday
-  fri_menu TEXT NULL,                       -- Optional menu text for Friday
-  fri_start_time TIME NULL,                 -- Friday - Time of day this meal starts
-  fri_end_time TIME NULL,                   -- Friday - Time of day this meal ends
-  fri_res_req BOOLEAN NULL,                 -- Friday - Reservations requested
-  saturday BOOLEAN NULL,                    -- Flag indicating if meal is available Saturday
-  sat_menu TEXT NULL,                       -- Optional menu text for Saturday
-  sat_start_time TIME NULL,                 -- Saturday - Time of day this meal starts
-  sat_end_time TIME NULL,                   -- Saturday - Time of day this meal ends
-  sat_res_req BOOLEAN NULL,                 -- Saturday - Reservations requested
-  restaurant INT NULL,                      -- Pointer to restaurant that has this meal
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(restaurant)
-);
-
-----
-
--- Primary member records - One for each member
-CREATE TABLE {prefix}members (
-  id INT NOT NULL AUTO_INCREMENT,
-  access INT NULL,                          -- Access type - See access table in plugin.ini
-  member_type INT NULL,                     -- Pointer to member type in member_type table
-  created DATE NULL,                        -- Date member record was created
-  name TINYTEXT NULL,                       -- Member name
-  member_slug TINYTEXT NULL,                -- Member name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(member_slug(20)),
-  INDEX(created)
-);
-
-----
-
--- Member information version record - May be multiples per member - Only one with stauts "Active" for a distinct date range
-CREATE TABLE {prefix}member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  member INT NULL,                          -- Pointer to member record in table members
-  member_name TINYTEXT NULL,                -- Copy of member name from members table entry for fast reference
-  status INT NULL,                          -- Status of this member information record - See plugin.ini status table
-  reference_name TINYTEXT NULL,             -- Refernce name for this member information record - Not displayed on front-end
-  descr TEXT NULL,                          -- Description
-  short_descr TEXT NULL,                    -- Short description
-  addr1 TINYTEXT NULL,                      -- Address line 1 - Main member address (main location) or 
-  addr2 TINYTEXT NULL,                      -- Address line 2
-  city INT NULL,                            -- Pointer to City in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
-  zip TINYTEXT NULL,                        -- ZIP/Postal code
-  lat FLOAT NULL,                           -- Latitude of member's location
-  lon FLOAT NULL,                           -- Longitude of member's location
-  region INT NULL,                          -- Pointer to entry in regions table
-  phone TINYTEXT NULL,                      -- Primary phone number
-  toll_free TINYTEXT NULL,                  -- Toll Free phone number
-  url TINYTEXT NULL,                        -- URL with information about this member
-  email TINYTEXT NULL,                      -- Main E-Mail address for this member
-  logo TINYTEXT NULL,                       -- Member logo
-  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
-  notes TEXT NULL,                          -- General notes - Not displayed in front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last update date/time
-  PRIMARY KEY (id),
-  INDEX(status),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(region)
-);
-
-----
-
--- Member type - Can be used to assign members to different "classes" of membership (i.e. Full, Associate, Premium)
--- Mostly for internal use by the member organization, but could be displayed - Consider a short_description if they are. 
-CREATE TABLE {prefix}member_type (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of member type
-  descr TINYTEXT NULL,                      -- Description of member type
-  PRIMARY KEY (id)
-);
-
-----
-
--- Regions - Used to segment members into various geographical regions - can be cities, counties, or other logical regions
-CREATE TABLE {prefix}regions (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of region
-  descr TEXT NULL,                          -- Descrption of region
-  short_descr TINYTEXT NULL,                -- Short descroption of region
-  PRIMARY KEY (id)
-);
-
-----
-
--- Resturaunt Types - Various general types of restaurants (i.e. Fast Food, Ethnic, Fine food, ...)
-CREATE TABLE {prefix}restaurant_types (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of restaurant type
-  descr TEXT NULL,                          -- Description
-  short_descr TINYTEXT NULL,                -- Short Description
-  PRIMARY KEY (id),
-  INDEX(name(20))
-);
-
-----
-
--- Restaurants
-CREATE TABLE {prefix}restaurants (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- This restaurant is active flag
-  name TINYTEXT NULL,                       -- Name of restaurant
-  restaurant_type INT NULL,                 -- Pointer to restaurant_types table entry
-  descr TEXT NULL,                          -- Description
-  short_descr TINYTEXT NULL,                -- Short Description
-  url TINYTEXT NULL,                        -- URL of Web page about this restaurant
-  reservation_url TINYTEXT NULL,            -- Reservations URL 
-  phone TINYTEXT NULL,                      -- Phone number / reservations number
-  hours_descr TINYTEXT NULL,                -- Description of restaurant hours
-  alcohol BOOLEAN NULL,                     -- Flag indicating whether restaurant serves alcohol 
-  non_smoking BOOLEAN NULL,                 -- Flag indicating whether restaurant is non-smoking only
-  notes TEXT NULL,                          -- General notes
-  ref_type INT NULL,                        -- Type of entity this restaurant is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this restaurant is associated with
-  PRIMARY KEY (id),
-  INDEX(restaurant_type),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- General settings available on Management page in admin - Only 1 entry in this table
--- Items in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_general (
-  id INT NOT NULL AUTO_INCREMENT,
-  admin_debug BOOLEAN DEFAULT '1',
-  admin_debug_verbose BOOLEAN DEFAULT '0',
-  front_debug BOOLEAN DEFAULT '0',
-  front_debug_verbose BOOLEAN DEFAULT '0',
-  google_maps_api_key TINYTEXT DEFAULT '',
-  maps_default_lat FLOAT DEFAULT '45.3749',
-  maps_default_lon FLOAT DEFAULT '-84.9592',
-  maps_default_zoom INTEGER DEFAULT '10',
-  time_zone TINYTEXT DEFAULT NULL,
-  canonical_member_page TINYTEXT DEFAULT NULL,
-  list_show_map BOOLEAN DEFAULT '1',
-  list_show_list BOOLEAN DEFAULT '1',
-  list_show_search BOOLEAN DEFAULT '1',
-  list_show_search_text BOOLEAN DEFAULT '1',
-  list_show_search_category BOOLEAN DEFAULT '1',
-  list_show_search_amenities BOOLEAN DEFAULT '1',
-  list_show_search_alpha BOOLEAN DEFAULT '1',
-  list_show_detail_link BOOLEAN DEFAULT '1',
-  list_show_logo BOOLEAN DEFAULT '1',
-  list_logo_size TINYTEXT NULL,
-  list_show_address BOOLEAN DEFAULT '1',
-  list_show_street BOOLEAN DEFAULT '1',
-  list_show_citystatezip BOOLEAN DEFAULT '1',
-  list_show_country BOOLEAN DEFAULT '1',
-  list_show_region BOOLEAN DEFAULT '1',
-  list_show_descr BOOLEAN DEFAULT '0',
-  list_show_short_descr BOOLEAN DEFAULT '1',
-  list_show_phone BOOLEAN DEFAULT '1',
-  list_show_tollfree BOOLEAN DEFAULT '1',
-  list_show_url BOOLEAN DEFAULT '1',
-  list_show_url_newtarget BOOLEAN DEFAULT '1',
-  list_show_email BOOLEAN DEFAULT '1',
-  list_show_categories BOOLEAN DEFAULT '0',
-  list_show_creditcards BOOLEAN DEFAULT '0',
-  list_show_amenities BOOLEAN DEFAULT '0',
-  list_map_show_detaillink BOOLEAN DEFAULT '1',
-  list_map_show_logo BOOLEAN DEFAULT '0',
-  list_map_logo_size TINYTEXT NULL,
-  list_map_show_descr BOOLEAN DEFAULT '0',
-  list_map_show_short_descr BOOLEAN DEFAULT '1',
-  list_map_show_address BOOLEAN DEFAULT '1',
-  list_map_show_street BOOLEAN DEFAULT '1',
-  list_map_show_citystatezip BOOLEAN DEFAULT '1',
-  list_map_show_country BOOLEAN DEFAULT '1',
-  list_map_show_region BOOLEAN DEFAULT '1',
-  list_map_show_phone BOOLEAN DEFAULT '1',
-  list_map_show_tollfree BOOLEAN DEFAULT '1',
-  list_map_show_url BOOLEAN DEFAULT '1',
-  list_map_show_url_newtarget BOOLEAN DEFAULT '1',
-  list_map_show_email BOOLEAN DEFAULT '1',
-  list_map_show_categories BOOLEAN DEFAULT '0',
-  list_map_show_creditcards BOOLEAN DEFAULT '0',
-  list_map_show_amenities BOOLEAN DEFAULT '0',
-  detail_show_map BOOLEAN DEFAULT '1',
-  detail_show_directions BOOLEAN DEFAULT '1',
-  detail_show_logo BOOLEAN DEFAULT '1',
-  detail_logo_size TINYTEXT NULL,
-  detail_show_descr BOOLEAN DEFAULT '1',
-  detail_show_short_descr BOOLEAN DEFAULT '0',
-  detail_show_address BOOLEAN DEFAULT '1',
-  detail_show_street BOOLEAN DEFAULT '1',
-  detail_show_citystatezip BOOLEAN DEFAULT '1',
-  detail_show_country BOOLEAN DEFAULT '1',
-  detail_show_region BOOLEAN DEFAULT '1',
-  detail_show_phone BOOLEAN DEFAULT '1',
-  detail_show_tollfree BOOLEAN DEFAULT '1',
-  detail_show_url BOOLEAN DEFAULT '1',
-  detail_show_url_newtarget BOOLEAN DEFAULT '1',
-  detail_show_email BOOLEAN DEFAULT '1',
-  detail_show_categories BOOLEAN DEFAULT '0',
-  detail_show_creditcards BOOLEAN DEFAULT '0',
-  detail_show_amenities BOOLEAN DEFAULT '1',
-  detail_show_imagegallery BOOLEAN DEFAULT '1',
-  detail_show_coupons BOOLEAN DEFAULT '0',
-  detail_show_packages BOOLEAN DEFAULT '0',
-  detail_map_show_logo BOOLEAN DEFAULT '0',
-  detail_map_logo_size TINYTEXT NULL,
-  detail_map_show_descr BOOLEAN DEFAULT '0',
-  detail_map_show_short_descr BOOLEAN DEFAULT '1',
-  detail_map_show_address BOOLEAN DEFAULT '1',
-  detail_map_show_street BOOLEAN DEFAULT '1',
-  detail_map_show_citystatezip BOOLEAN DEFAULT '1',
-  detail_map_show_country BOOLEAN DEFAULT '1',
-  detail_map_show_region BOOLEAN DEFAULT '1',
-  detail_map_show_phone BOOLEAN DEFAULT '1',
-  detail_map_show_tollfree BOOLEAN DEFAULT '1',
-  detail_map_show_url BOOLEAN DEFAULT '1',
-  detail_map_show_url_newtarget BOOLEAN DEFAULT '1',
-  detail_map_show_email BOOLEAN DEFAULT '1',
-  detail_map_show_categories BOOLEAN DEFAULT '0',
-  detail_map_show_creditcards BOOLEAN DEFAULT '0',
-  detail_map_show_amenities BOOLEAN DEFAULT '0',
-  PRIMARY KEY (id)
-);
-
-----
-
--- Set default entry
-INSERT INTO {prefix}settings_general
-    ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size )
-   VALUES
-    ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb' )
-;
-
-----
-
--- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
--- Tems in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_terms (
-  id INT NOT NULL AUTO_INCREMENT,
-  term_admin_menu_members TINYTEXT NULL,
-  term_admin_menu_member_list TINYTEXT NULL,
-  term_admin_menu_member TINYTEXT NULL,
-  term_admin_menu_configure TINYTEXT NULL,
-  term_admin_menu_settings TINYTEXT NULL,
-  term_admin_menu_shortcodes TINYTEXT NULL,
-  term_admin_menu_members_dashboard TINYTEXT NULL,
-  term_admin_menu_members_list TINYTEXT NULL,
-  term_admin_menu_members_reports TINYTEXT NULL,
-  term_admin_menu_member_dashboard TINYTEXT NULL,
-  term_admin_menu_member_info TINYTEXT NULL,
-  term_admin_menu_member_locations TINYTEXT NULL,
-  term_admin_menu_member_facilities TINYTEXT NULL,
-  term_admin_menu_member_attractions TINYTEXT NULL,
-  term_admin_menu_member_contacts TINYTEXT NULL,
-  term_admin_menu_configure_member_types TINYTEXT NULL,
-  term_admin_menu_configure_member_cats TINYTEXT NULL,
-  term_admin_menu_configure_accom_types TINYTEXT NULL,
-  term_admin_menu_configure_amenities TINYTEXT NULL,
-  term_admin_menu_configure_cities TINYTEXT NULL,
-  term_admin_menu_configure_regions TINYTEXT NULL,
-  term_admin_menu_settings_general TINYTEXT NULL,
-  term_admin_menu_settings_terms TINYTEXT NULL,
-  term_admin_menu_settings_development TINYTEXT NULL,
-  term_member TINYTEXT NULL,
-  term_member_cap TINYTEXT NULL,
-  term_member_plur TINYTEXT NULL,
-  term_member_plur_cap TINYTEXT NULL,
-  term_location TINYTEXT NULL,
-  term_location_cap TINYTEXT NULL,
-  term_location_plur TINYTEXT NULL,
-  term_location_plur_cap TINYTEXT NULL,
-  term_facility TINYTEXT NULL,
-  term_facility_cap TINYTEXT NULL,
-  term_facility_plur TINYTEXT NULL,
-  term_facility_plur_cap TINYTEXT NULL,
-  term_attraction TINYTEXT NULL,
-  term_attraction_cap TINYTEXT NULL,
-  term_attraction_plur TINYTEXT NULL,
-  term_attraction_plur_cap TINYTEXT NULL,
-  term_contact TINYTEXT NULL,
-  term_contact_cap TINYTEXT NULL,
-  term_contact_plur TINYTEXT NULL,
-  term_contact_plur_cap TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
--- Default terms entry
-INSERT INTO {prefix}settings_terms
-    (
-    id,
-    term_admin_menu_members,                        
-    term_admin_menu_member_list,                    
-    term_admin_menu_member,                     
-    term_admin_menu_configure,                      
-    term_admin_menu_settings,                       
-    term_admin_menu_shortcodes,                     
-    term_admin_menu_members_dashboard,         
-    term_admin_menu_members_list,                   
-    term_admin_menu_members_reports,                
-    term_admin_menu_member_dashboard,
-    term_admin_menu_member_info,
-    term_admin_menu_member_locations,               
-    term_admin_menu_member_facilities,              
-    term_admin_menu_member_attractions,             
-    term_admin_menu_member_contacts,                
-    term_admin_menu_configure_member_types,         
-    term_admin_menu_configure_member_cats,          
-    term_admin_menu_configure_accom_types,          
-    term_admin_menu_configure_amenities,     
-    term_admin_menu_configure_cities,               
-    term_admin_menu_configure_regions,              
-    term_admin_menu_settings_general,               
-    term_admin_menu_settings_terms,                 
-    term_admin_menu_settings_development,           
-    term_member,                                    
-    term_member_cap,                                
-    term_member_plur,                               
-    term_member_plur_cap,                           
-    term_location,                                  
-    term_location_cap,                              
-    term_location_plur,                             
-    term_location_plur_cap,                         
-    term_facility,                                  
-    term_facility_cap,                              
-    term_facility_plur,                             
-    term_facility_plur_cap,                         
-    term_attraction,                                
-    term_attraction_cap,                            
-    term_attraction_plur,                           
-    term_attraction_plur_cap,                       
-    term_contact,                                   
-    term_contact_cap,                               
-    term_contact_plur,                              
-    term_contact_plur_cap                           
-    )
-   VALUES
-    (
-    1,
-    'Members',            
-    'Member',             
-    'Member',         
-    'Configure',          
-    'Management',           
-    'Shortcodes',         
-    'Dashboard',          
-    'Member List',        
-    'Reports',            
-    'Member Dashboard',
-    'Member Info',        
-    'Locations',          
-    'Facilities',         
-    'Attractions',        
-    'Contacts',           
-    'Member Types',       
-    'Member Categories',  
-    'Accommodation Types',
-    'Amenities',          
-    'Cities',             
-    'Regions',            
-    'General Settings',   
-    'Terms & Phrases',    
-    'Development',        
-    'member',             
-    'Member',             
-    'members',            
-    'Members',            
-    'location',           
-    'Location',           
-    'locations',          
-    'Locations',          
-    'facility',           
-    'Facility',           
-    'facilities',         
-    'Facilities',         
-    'attraction',         
-    'Attraction',         
-    'attractions',        
-    'Attractions',        
-    'contact',            
-    'Contact',            
-    'contacts',           
-    'Contacts'
-    )
-;
-
-----
-
--- Social Media types (i.e. Facebook, Twitter, ...)
-CREATE TABLE {prefix}social_media (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                                   -- Name of this social media service
-  descr TEXT NULL,                                      -- Description
-  short_descr TINYTEXT NULL,                            -- Short Description
-  PRIMARY KEY (id)
-);
-
-----
-
--- Social media to entity cross-reference table
-CREATE TABLE {prefix}social_media_ref (
-  id INT NOT NULL AUTO_INCREMENT,
-  ref_type INT NULL,                                    -- Type of entity this entry is associated with
-  ref_dest INT NULL,                                    -- Pointer to the specific entity of ref_type
-  social_media INT NULL,                                -- Pointer to entry in social_media table
-  url TINYTEXT NULL,                                    -- URL to this social media service
-  PRIMARY KEY (id),
-  INDEX(ref_type),
-  INDEX(ref_dest),
-  INDEX(social_media)
-);
diff --git a/setup/databaseScripts/create_database_V1.1.0.sql b/setup/databaseScripts/create_database_V1.1.0.sql
new file mode 100644 (file)
index 0000000..a14a337
--- /dev/null
@@ -0,0 +1,482 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.0.43
+-- Database Creation Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Amenities
+CREATE TABLE {prefix}amenities (
+  id INT NOT NULL AUTO_INCREMENT,
+  active TINYINT(1) NULL,                   -- Amenity is active flag
+  name TINYTEXT NULL,                       -- Name of amenity
+  descr TEXT NULL,                          -- Description of amenity
+  short_descr TINYTEXT NULL,                -- Short description of amenity
+  ref_type INT NULL,                        -- Type of entity these amenitites are associated with - see plugin.ini ref_type tables
+  uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
+  PRIMARY KEY (id),
+  INDEX(name(20))
+);
+
+----
+
+-- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
+CREATE TABLE {prefix}amenity_ref (
+  id INT NOT NULL AUTO_INCREMENT,
+  amenity INT NULL,                         -- Pointer to amenity in amenities table
+  ref_type INT NULL,                        -- Copy of ref_type from matching ameities table entry - to simplify searches
+  ref_dest INT NULL,                        -- Pointer to the specific entity of type ref_type
+  amenity_value TINYTEXT NULL,              -- Quanity if amenity uses values
+  PRIMARY KEY (id),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Member Cateogries - used with member information records
+CREATE TABLE {prefix}categories (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of this category
+  descr TEXT NULL,                          -- Description of this category
+  short_descr TINYTEXT NULL,                -- Short description of this category 
+  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Mapping of categories to speific member information records
+CREATE TABLE {prefix}category_member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  category INT NULL,                        -- Pointer to category in categories table
+  member_info INT NULL,                     -- Pointer to member infomation record
+  PRIMARY KEY (id),
+  CONSTRAINT {prefix}categories_fk_1
+    FOREIGN KEY (category)
+    REFERENCES {prefix}categories (id)
+    ON DELETE CASCADE,
+  INDEX(category),
+  INDEX(member_info)
+);
+
+----
+
+-- Cities
+CREATE TABLE {prefix}cities (
+  id INT NOT NULL AUTO_INCREMENT,           
+  name TINYTEXT NULL,                       -- Name of city
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Contacts - used by various entities
+CREATE TABLE {prefix}contacts (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,                      -- Contact is active flag
+  access INT NULL,                          -- Access type - See access table in plugin.ini
+  fname TINYTEXT NULL,                      -- First name of contact
+  lname TINYTEXT NULL,                      -- Last name of contact
+  contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
+  contact_role INT NULL,                    -- Contact WordPress user Role
+  org TINYTEXT NULL,                        -- Organization name
+  title TINYTEXT NULL,                      -- Title/Position
+  descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
+  image TINYTEXT NULL,                      -- Image
+  addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
+  addr2 TINYTEXT NULL,                      -- Address line 2 
+  city INT NULL,                            -- Pointer to city in cities table
+  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
+  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries 
+  zip TINYTEXT NULL,                        -- ZIP/Postal Code     
+  lat FLOAT NULL,                           -- Latitude of contact location
+  lon FLOAT NULL,                           -- Longitude of contact location
+  url TINYTEXT NULL,                        -- URL to information regarding this contact
+  office_phone TINYTEXT NULL,               -- Office phone number
+  home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
+  mobile_phone TINYTEXT NULL,               -- Mobile phone number
+  alt_phone TINYTEXT NULL,                  -- An alternate phone number
+  fax TINYTEXT NULL,                        -- FAX number (do people still use these?) 
+  email TINYTEXT NULL,                      -- E-Mail address
+  alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in 
+  username TINYTEXT NULL,                   -- Optional username to use for login
+  password TINYTEXT NULL,                   -- Encrypted password
+  notes TEXT NULL,                          -- Notes - Not displayed on front-end
+  create_time TIMESTAMP NULL,               -- Create date/time
+  modify_time TIMESTAMP NULL,               -- Last modified date/time
+  ref_type INT NULL,                        -- Type of entity this contact is associated with                        
+  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
+  PRIMARY KEY (id),
+  INDEX(fname(20)),
+  INDEX(lname(20)),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon),
+  INDEX(email(20))
+);
+
+----
+
+-- Images - Images are stored under /wp-content/uploads/glm-member-db/images/{size}/
+CREATE TABLE {prefix}images (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Original name of the image - might be URL if copied via HTTP
+  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
+  selected BOOLEAN NULL,                    -- A single special image in the current gallery for this entity
+  featured BOOLEAN null,                    -- Image is a member of a group of featured images
+  file_name TINYTEXT NULL,                  -- Stored file name for the image
+  descr TEXT NULL,                          -- Description 
+  caption TINYTEXT NULL,                    -- Caption for the image
+  position INT NULL,                        -- Numeric position for sequence of display
+  ref_type INT NULL,                        -- Type of entity this image is associated with
+  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Primary member records - One for each member
+CREATE TABLE {prefix}members (
+  id INT NOT NULL AUTO_INCREMENT,
+  access INT NULL,                          -- Access type - See access table in plugin.ini
+  member_type INT NULL,                     -- Pointer to member type in member_type table
+  created DATE NULL,                        -- Date member record was created
+  name TINYTEXT NULL,                       -- Member name
+  member_slug TINYTEXT NULL,                -- Member name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
+  addr1 TINYTEXT NULL,                      -- Main member location address line 1
+  addr2 TINYTEXT NULL,                      -- Address line 2
+  city INT NULL,                            -- Pointer to City in cities table
+  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
+  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
+  zip TINYTEXT NULL,                        -- ZIP/Postal code
+  lat FLOAT NULL,                           -- Latitude of member's location
+  lon FLOAT NULL,                           -- Longitude of member's location
+  region INT NULL,                          -- Pointer to entry in regions table
+  phone TINYTEXT NULL,                      -- Primary phone number
+  toll_free TINYTEXT NULL,                  -- Toll Free phone number
+  url TINYTEXT NULL,                        -- URL with information about this member
+  email TINYTEXT NULL,                      -- Main E-Mail address for this member
+  logo TINYTEXT NULL,                       -- Member logo
+  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
+  notes TEXT NULL,                          -- General notes - Not displayed in front-end
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(member_slug(20)),
+  INDEX(created)
+);
+
+----
+
+-- Member information version record - May be multiples per member - Only one with stauts "Active" for a distinct date range
+CREATE TABLE {prefix}member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  member INT NULL,                          -- Pointer to member record in table members
+  member_name TINYTEXT NULL,                -- Copy of member name from members table entry for fast reference
+  status INT NULL,                          -- Status of this member information record - See plugin.ini status table
+  reference_name TINYTEXT NULL,             -- Refernce name for this member information record - Not displayed on front-end
+  descr TEXT NULL,                          -- Description
+  short_descr TEXT NULL,                    -- Short description
+  notes TEXT NULL,                          -- General notes - Not displayed in front-end
+  create_time TIMESTAMP NULL,               -- Create date/time
+  modify_time TIMESTAMP NULL,               -- Last update date/time
+  PRIMARY KEY (id),
+  INDEX(status),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon),
+  INDEX(region)
+);
+
+----
+
+-- Member type - Can be used to assign members to different "classes" of membership (i.e. Full, Associate, Premium)
+-- Mostly for internal use by the member organization, but could be displayed - Consider a short_description if they are. 
+CREATE TABLE {prefix}member_type (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of member type
+  descr TINYTEXT NULL,                      -- Description of member type
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Regions - Used to segment members into various geographical regions - can be cities, counties, or other logical regions
+CREATE TABLE {prefix}regions (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of region
+  descr TEXT NULL,                          -- Descrption of region
+  short_descr TINYTEXT NULL,                -- Short descroption of region
+  PRIMARY KEY (id)
+);
+
+----
+
+-- General settings available on Management page in admin - Only 1 entry in this table
+-- Items in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_general (
+  id INT NOT NULL AUTO_INCREMENT,
+  admin_debug BOOLEAN DEFAULT '1',
+  admin_debug_verbose BOOLEAN DEFAULT '0',
+  front_debug BOOLEAN DEFAULT '0',
+  front_debug_verbose BOOLEAN DEFAULT '0',
+  google_maps_api_key TINYTEXT DEFAULT '',
+  maps_default_lat FLOAT DEFAULT '45.3749',
+  maps_default_lon FLOAT DEFAULT '-84.9592',
+  maps_default_zoom INTEGER DEFAULT '10',
+  time_zone TINYTEXT DEFAULT NULL,
+  canonical_member_page TINYTEXT DEFAULT NULL,
+  list_show_map BOOLEAN DEFAULT '1',
+  list_show_list BOOLEAN DEFAULT '1',
+  list_show_search BOOLEAN DEFAULT '1',
+  list_show_search_text BOOLEAN DEFAULT '1',
+  list_show_search_category BOOLEAN DEFAULT '1',
+  list_show_search_amenities BOOLEAN DEFAULT '1',
+  list_show_search_alpha BOOLEAN DEFAULT '1',
+  list_show_detail_link BOOLEAN DEFAULT '1',
+  list_show_logo BOOLEAN DEFAULT '1',
+  list_logo_size TINYTEXT NULL,
+  list_show_address BOOLEAN DEFAULT '1',
+  list_show_street BOOLEAN DEFAULT '1',
+  list_show_citystatezip BOOLEAN DEFAULT '1',
+  list_show_country BOOLEAN DEFAULT '1',
+  list_show_region BOOLEAN DEFAULT '1',
+  list_show_descr BOOLEAN DEFAULT '0',
+  list_show_short_descr BOOLEAN DEFAULT '1',
+  list_show_phone BOOLEAN DEFAULT '1',
+  list_show_tollfree BOOLEAN DEFAULT '1',
+  list_show_url BOOLEAN DEFAULT '1',
+  list_show_url_newtarget BOOLEAN DEFAULT '1',
+  list_show_email BOOLEAN DEFAULT '1',
+  list_show_categories BOOLEAN DEFAULT '0',
+  list_show_creditcards BOOLEAN DEFAULT '0',
+  list_show_amenities BOOLEAN DEFAULT '0',
+  list_map_show_detaillink BOOLEAN DEFAULT '1',
+  list_map_show_logo BOOLEAN DEFAULT '0',
+  list_map_logo_size TINYTEXT NULL,
+  list_map_show_descr BOOLEAN DEFAULT '0',
+  list_map_show_short_descr BOOLEAN DEFAULT '1',
+  list_map_show_address BOOLEAN DEFAULT '1',
+  list_map_show_street BOOLEAN DEFAULT '1',
+  list_map_show_citystatezip BOOLEAN DEFAULT '1',
+  list_map_show_country BOOLEAN DEFAULT '1',
+  list_map_show_region BOOLEAN DEFAULT '1',
+  list_map_show_phone BOOLEAN DEFAULT '1',
+  list_map_show_tollfree BOOLEAN DEFAULT '1',
+  list_map_show_url BOOLEAN DEFAULT '1',
+  list_map_show_url_newtarget BOOLEAN DEFAULT '1',
+  list_map_show_email BOOLEAN DEFAULT '1',
+  list_map_show_categories BOOLEAN DEFAULT '0',
+  list_map_show_creditcards BOOLEAN DEFAULT '0',
+  list_map_show_amenities BOOLEAN DEFAULT '0',
+  detail_show_map BOOLEAN DEFAULT '1',
+  detail_show_directions BOOLEAN DEFAULT '1',
+  detail_show_logo BOOLEAN DEFAULT '1',
+  detail_logo_size TINYTEXT NULL,
+  detail_show_descr BOOLEAN DEFAULT '1',
+  detail_show_short_descr BOOLEAN DEFAULT '0',
+  detail_show_address BOOLEAN DEFAULT '1',
+  detail_show_street BOOLEAN DEFAULT '1',
+  detail_show_citystatezip BOOLEAN DEFAULT '1',
+  detail_show_country BOOLEAN DEFAULT '1',
+  detail_show_region BOOLEAN DEFAULT '1',
+  detail_show_phone BOOLEAN DEFAULT '1',
+  detail_show_tollfree BOOLEAN DEFAULT '1',
+  detail_show_url BOOLEAN DEFAULT '1',
+  detail_show_url_newtarget BOOLEAN DEFAULT '1',
+  detail_show_email BOOLEAN DEFAULT '1',
+  detail_show_categories BOOLEAN DEFAULT '0',
+  detail_show_creditcards BOOLEAN DEFAULT '0',
+  detail_show_amenities BOOLEAN DEFAULT '1',
+  detail_show_imagegallery BOOLEAN DEFAULT '1',
+  detail_show_coupons BOOLEAN DEFAULT '0',
+  detail_show_packages BOOLEAN DEFAULT '0',
+  detail_map_show_logo BOOLEAN DEFAULT '0',
+  detail_map_logo_size TINYTEXT NULL,
+  detail_map_show_descr BOOLEAN DEFAULT '0',
+  detail_map_show_short_descr BOOLEAN DEFAULT '1',
+  detail_map_show_address BOOLEAN DEFAULT '1',
+  detail_map_show_street BOOLEAN DEFAULT '1',
+  detail_map_show_citystatezip BOOLEAN DEFAULT '1',
+  detail_map_show_country BOOLEAN DEFAULT '1',
+  detail_map_show_region BOOLEAN DEFAULT '1',
+  detail_map_show_phone BOOLEAN DEFAULT '1',
+  detail_map_show_tollfree BOOLEAN DEFAULT '1',
+  detail_map_show_url BOOLEAN DEFAULT '1',
+  detail_map_show_url_newtarget BOOLEAN DEFAULT '1',
+  detail_map_show_email BOOLEAN DEFAULT '1',
+  detail_map_show_categories BOOLEAN DEFAULT '0',
+  detail_map_show_creditcards BOOLEAN DEFAULT '0',
+  detail_map_show_amenities BOOLEAN DEFAULT '0',
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Set default entry
+INSERT INTO {prefix}settings_general
+    ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size )
+   VALUES
+    ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb' )
+;
+
+----
+
+-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
+-- Tems in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_terms (
+  id INT NOT NULL AUTO_INCREMENT,
+  term_admin_menu_members TINYTEXT NULL,
+  term_admin_menu_member_list TINYTEXT NULL,
+  term_admin_menu_member TINYTEXT NULL,
+  term_admin_menu_configure TINYTEXT NULL,
+  term_admin_menu_settings TINYTEXT NULL,
+  term_admin_menu_shortcodes TINYTEXT NULL,
+  term_admin_menu_members_dashboard TINYTEXT NULL,
+  term_admin_menu_members_list TINYTEXT NULL,
+  term_admin_menu_members_reports TINYTEXT NULL,
+  term_admin_menu_member_dashboard TINYTEXT NULL,
+  term_admin_menu_member_info TINYTEXT NULL,
+  term_admin_menu_member_locations TINYTEXT NULL,
+  term_admin_menu_member_facilities TINYTEXT NULL,
+  term_admin_menu_member_attractions TINYTEXT NULL,
+  term_admin_menu_member_contacts TINYTEXT NULL,
+  term_admin_menu_configure_member_types TINYTEXT NULL,
+  term_admin_menu_configure_member_cats TINYTEXT NULL,
+  term_admin_menu_configure_accom_types TINYTEXT NULL,
+  term_admin_menu_configure_amenities TINYTEXT NULL,
+  term_admin_menu_configure_cities TINYTEXT NULL,
+  term_admin_menu_configure_regions TINYTEXT NULL,
+  term_admin_menu_settings_general TINYTEXT NULL,
+  term_admin_menu_settings_terms TINYTEXT NULL,
+  term_admin_menu_settings_development TINYTEXT NULL,
+  term_member TINYTEXT NULL,
+  term_member_cap TINYTEXT NULL,
+  term_member_plur TINYTEXT NULL,
+  term_member_plur_cap TINYTEXT NULL,
+  term_location TINYTEXT NULL,
+  term_location_cap TINYTEXT NULL,
+  term_location_plur TINYTEXT NULL,
+  term_location_plur_cap TINYTEXT NULL,
+  term_facility TINYTEXT NULL,
+  term_facility_cap TINYTEXT NULL,
+  term_facility_plur TINYTEXT NULL,
+  term_facility_plur_cap TINYTEXT NULL,
+  term_attraction TINYTEXT NULL,
+  term_attraction_cap TINYTEXT NULL,
+  term_attraction_plur TINYTEXT NULL,
+  term_attraction_plur_cap TINYTEXT NULL,
+  term_contact TINYTEXT NULL,
+  term_contact_cap TINYTEXT NULL,
+  term_contact_plur TINYTEXT NULL,
+  term_contact_plur_cap TINYTEXT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Default terms entry
+INSERT INTO {prefix}settings_terms
+    (
+    id,
+    term_admin_menu_members,                        
+    term_admin_menu_member_list,                    
+    term_admin_menu_member,                     
+    term_admin_menu_configure,                      
+    term_admin_menu_settings,                       
+    term_admin_menu_shortcodes,                     
+    term_admin_menu_members_dashboard,         
+    term_admin_menu_members_list,                   
+    term_admin_menu_members_reports,                
+    term_admin_menu_member_dashboard,
+    term_admin_menu_member_info,
+    term_admin_menu_member_locations,               
+    term_admin_menu_member_facilities,              
+    term_admin_menu_member_attractions,             
+    term_admin_menu_member_contacts,                
+    term_admin_menu_configure_member_types,         
+    term_admin_menu_configure_member_cats,          
+    term_admin_menu_configure_accom_types,          
+    term_admin_menu_configure_amenities,     
+    term_admin_menu_configure_cities,               
+    term_admin_menu_configure_regions,              
+    term_admin_menu_settings_general,               
+    term_admin_menu_settings_terms,                 
+    term_admin_menu_settings_development,           
+    term_member,                                    
+    term_member_cap,                                
+    term_member_plur,                               
+    term_member_plur_cap,                           
+    term_location,                                  
+    term_location_cap,                              
+    term_location_plur,                             
+    term_location_plur_cap,                         
+    term_facility,                                  
+    term_facility_cap,                              
+    term_facility_plur,                             
+    term_facility_plur_cap,                         
+    term_attraction,                                
+    term_attraction_cap,                            
+    term_attraction_plur,                           
+    term_attraction_plur_cap,                       
+    term_contact,                                   
+    term_contact_cap,                               
+    term_contact_plur,                              
+    term_contact_plur_cap                           
+    )
+   VALUES
+    (
+    1,
+    'Members',            
+    'Member',             
+    'Member',         
+    'Configure',          
+    'Management',           
+    'Shortcodes',         
+    'Dashboard',          
+    'Member List',        
+    'Reports',            
+    'Member Dashboard',
+    'Member Info',        
+    'Locations',          
+    'Facilities',         
+    'Attractions',        
+    'Contacts',           
+    'Member Types',       
+    'Member Categories',  
+    'Accommodation Types',
+    'Amenities',          
+    'Cities',             
+    'Regions',            
+    'General Settings',   
+    'Terms & Phrases',    
+    'Development',        
+    'member',             
+    'Member',             
+    'members',            
+    'Members',            
+    'location',           
+    'Location',           
+    'locations',          
+    'Locations',          
+    'facility',           
+    'Facility',           
+    'facilities',         
+    'Facilities',         
+    'attraction',         
+    'Attraction',         
+    'attractions',        
+    'Attractions',        
+    'contact',            
+    'Contact',            
+    'contacts',           
+    'Contacts'
+    )
+;
index 2819fd8..81b6197 100644 (file)
@@ -27,7 +27,8 @@ $glmMembersDbVersions = array(
     '0.1' => array('version' => '0.1', 'tables' => 26),
     '1.0.28' => array('version' => '1.0.28', 'tables' => 26),
     '1.0.30' => array('version' => '1.0.30', 'tables' => 26),
-    '1.0.43' => array('version' => '1.0.43', 'tables' => 26)
+    '1.0.43' => array('version' => '1.0.43', 'tables' => 26),
+    '1.1.0' => array('version' => '1.1.0', 'tables' => 13)
 );
 
 
diff --git a/setup/databaseScripts/update_database_V1.1.0.sql b/setup/databaseScripts/update_database_V1.1.0.sql
new file mode 100644 (file)
index 0000000..e6519d8
--- /dev/null
@@ -0,0 +1,203 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.0.28
+-- Database Update From Previous Version Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+DROP TABLE IF EXISTS
+    {prefix}accommodation_types,
+    {prefix}accommodations,
+    {prefix}accounts,
+    {prefix}activities,
+    {prefix}facilities,
+    {prefix}files,
+    {prefix}golf,
+    {prefix}locations,
+    {prefix}meals,
+    {prefix}restaurant_types,
+    {prefix}restaurants,
+    {prefix}social_media,
+    {prefix}social_media_ref
+;
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN addr1 TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET addr1 = (SELECT addr1 FROM {prefix}member_info WHERE member = M.id  AND addr1 > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN addr2 TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET addr2 = (SELECT addr2 FROM {prefix}member_info WHERE member = M.id  AND addr2 > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN city INT;
+
+----
+
+UPDATE {prefix}members M SET city = (SELECT city FROM {prefix}member_info WHERE member = M.id  AND city > 0 AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN state TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET state = (SELECT state FROM {prefix}member_info WHERE member = M.id  AND state > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN zip TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET zip = (SELECT zip FROM {prefix}member_info WHERE member = M.id  AND zip > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN country TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET country = (SELECT country FROM {prefix}member_info WHERE member = M.id  AND country > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN lat FLOAT;
+
+----
+
+UPDATE {prefix}members M SET lat = (SELECT lat FROM {prefix}member_info WHERE member = M.id  AND lat != 0 AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN lon FLOAT;
+
+----
+
+UPDATE {prefix}members M SET lon = (SELECT lon FROM {prefix}member_info WHERE member = M.id  AND lon != 0 AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN region INT;
+
+----
+
+UPDATE {prefix}members M SET region = (SELECT region FROM {prefix}member_info WHERE member = M.id  AND region > 0 AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN phone TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET phone = (SELECT phone FROM {prefix}member_info WHERE member = M.id  AND phone > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN toll_free TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET toll_free = (SELECT toll_free FROM {prefix}member_info WHERE member = M.id  AND toll_free > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN email TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET email = (SELECT email FROM {prefix}member_info WHERE member = M.id  AND email > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN url TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET url = (SELECT url FROM {prefix}member_info WHERE member = M.id  AND url > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN logo TINYTEXT;
+
+----
+
+UPDATE {prefix}members M SET logo = (SELECT logo FROM {prefix}member_info WHERE member = M.id  AND logo > '' AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN cc_type INT;
+
+----
+
+UPDATE {prefix}members M SET cc_type = (SELECT cc_type FROM {prefix}member_info WHERE member = M.id  AND cc_type > 0 AND status in (30, 20, 10) LIMIT 1);
+
+----
+
+ALTER TABLE {prefix}members ADD COLUMN notes TEXT;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN addr1;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN addr2;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN city;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN state;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN zip;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN country;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN lat;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN lon;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN region;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN phone;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN toll_free;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN url;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN logo;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN cc_type;
index 3b493b9..9d45927 100644 (file)
@@ -47,10 +47,8 @@ $glmMembersValidActions = array(
         'member' => array(
                 'index' => 'glm-member-db',            // Member Dashboard
                 'memberInfo' => 'glm-member-db',
-                'locations' => 'glm-member-db',
-                'facilities' => 'glm-member-db',
-                'activities' => 'glm-member-db',
-                'accommodations' => 'glm-member-db'
+                'memberEdit' => 'glm-member-db',
+                'locations' => 'glm-member-db'
         )
         ,
         'configure' => array(
@@ -58,7 +56,6 @@ $glmMembersValidActions = array(
                 'categories' => 'glm-member-db',
                 'cities' => 'glm-member-db',
                 'regions' => 'glm-member-db',
-                'accommodationTypes' => 'glm-member-db',
                 'amenities' => 'glm-member-db'
         ),
         'management' => array(
diff --git a/views/admin/configure/accommodationTypes.html b/views/admin/configure/accommodationTypes.html
deleted file mode 100644 (file)
index a57c7e6..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-{include file='admin/configure/header.html'}
-
-    <!-- Add Accommodation Type Button and Dialog Box -->
-    <div id="newAccommodationTypeButton" class="button button-primary glm-right">Add a Accommodation Type</div>
-    <div id="newAccommodationTypeDialog" class="glm-dialog-box" title="Enter a New Accommodation Type">
-        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
-            <input type="hidden" name="glm_action" value="accommodationTypes">
-            <input type="hidden" name="option" value="addNew">
-            <table class="glm-admin-table">
-                <tr>
-                    <th class="glm-required">Accommodation Type Name:</th>
-                    <td>
-                        <input type="text" name="name" class="glm-form-text-input">
-                    </td>
-                </tr>
-                <tr>
-                    <th>Description:</th>
-                    <td>
-                        <textarea name="descr" class="glm-form-textarea"></textarea>
-                    </td>
-                </tr>
-                <tr>
-                    <th>Description:</th>
-                    <td>
-                        <input type="text" name="short_descr" class="glm-form-text-input">
-                    </td>
-                </tr>
-            </table>
-            <p><span class="glm-required">*</span> Required</p>
-            <a id="newAccommodationTypeCancel" class="button button-primary glm-right">Cancel</a>
-            <input type="submit" value="Add new Accommodation Type" class="button button-primary">
-        </form>
-    </div>
-
-    <!-- Delete Accommodation Type Button -->
-    <div id="deleteAccommodationTypeDialog" class="glm-dialog-box" title="Delete Accommodation Type">
-        <center>
-            <p>Are you sure you want to delete this accommodation type?</p>
-            <p><div id="deleteAccommodationTypeConfirm" class="button button-primary">Yes, delete this accommodation type</div></p>
-            <p><div id="deleteAccommodationTypeCancel" class="button button-primary">Cancel</div></p>
-        </center>
-    </div>
-
-    <!--  Edit Accommodation Type Dialog Box -->                    
-    <div id="editAccommodationTypeDialog" class="glm-dialog-box" title="Enter a New Accommodation Type">
-        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
-            <input type="hidden" name="glm_action" value="accommodationTypes">
-            <input type="hidden" name="option" value="update">
-            <input id="editAccommodationTypeID" type="hidden" name="id" value="">
-            <table class="glm-admin-table">
-                <tr>
-                    <th class="glm-required">Accommodation Type Name:</th>
-                    <td>
-                        <input id="editAccommodationTypeName" type="text" name="name" class="glm-form-text-input">
-                    </td>
-                </tr>
-                <tr>
-                    <th>Description:</th>
-                    <td>
-                        <textarea id="editAccommodationTypeDescr" name="descr" class="glm-form-textarea"></textarea>
-                    </td>
-                </tr>
-                <tr>
-                    <th>Short Description:</th>
-                    <td>
-                        <input id="editAccommodationTypeShortDescr" type="text" name="short_descr" class="glm-form-text-input">
-                    </td>
-                </tr>
-            </table>
-            <p><span class="glm-required">*</span> Required</p>
-            <a id="editAccommodationTypeCancel" class="button button-primary glm-right">Cancel</a>
-            <input type="submit" value="Update this Accommodation Type">
-        </form>
-    </div>
-    
-    <h2>Accommodation Types</h2>
-
-    <table class="wp-list-table widefat fixed posts glm-admin-table"">
-        <thead>
-            <tr>
-                <th>Accommodation Type</th>
-                <th>Description</th>
-                <th>Short Description</th>
-                <th>&nbsp;</th>
-            </tr>
-        </thead>
-        <tbody>
-{if $haveAccommodationTypes}
-    {assign var="i" value="0"}
-    {foreach $accommodationTypes as $t}
-        {if $i++ is odd by 1} 
-            <tr>
-        {else}
-            <tr class="alternate">
-        {/if}
-                <td>
-                    <a class="editAccommodationType" data-accommodationTypeID="{$t.id}">{$t.name}</a>
-                </td>
-                <td id="editAccommodationTypeDescr_{$t.id}">
-                    {$t.descr}
-                </td>
-                <td id="editAccommodationTypeShortDescr_{$t.id}">
-                    {$t.short_descr}
-                </td>
-                <td>
-                    <div class="deleteAccommodationTypeButton button button-secondary glm-button-small glm-right" data-accommodationTypeID="{$t.id}">Delete</div>
-                </td>
-            </tr>
-    {/foreach}
-{else}
-            <tr class="alternate"><td colspan="2">(no accommodationTypes listed)</td></tr>
-{/if}
-        </tbody>
-    </table>
-
-    <script type="text/javascript">
-        jQuery(document).ready(function($) {
-               
-            $("#newAccommodationTypeDialog").dialog({
-               autoOpen: false,
-               minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-            $("#editAccommodationTypeDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-            $("#deleteAccommodationTypeDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-
-            $('#newAccommodationTypeButton').click( function() {
-                $("#newAccommodationTypeDialog").dialog("open");
-            });
-            $('.editAccommodationType').click( function() {
-                var accommodationTypeID = $(this).attr('data-accommodationTypeID');
-                var accommodationTypeName = $(this).text();
-                var accommodationTypeDescr = $('#editAccommodationTypeDescr_' + accommodationTypeID).html();
-                var accommodationTypeShortDescr = $('#editAccommodationTypeShortDescr_' + accommodationTypeID).html();
-                $('#editAccommodationTypeID').val(accommodationTypeID);
-                $('#editAccommodationTypeName').val(accommodationTypeName.trim());
-                $('#editAccommodationTypeDescr').val(accommodationTypeDescr.trim());
-                $('#editAccommodationTypeShortDescr').val(accommodationTypeShortDescr.trim());
-                $("#editAccommodationTypeDialog").dialog("open");
-            });
-            $('#editAccommodationTypeCancel').click( function() {
-                $("#editAccommodationTypeDialog").dialog("close");
-            });
-            $('#newAccommodationTypeCancel').click( function() {
-                $("#newAccommodationTypeDialog").dialog("close");
-            });
-
-            var id = false;
-            $('.deleteAccommodationTypeButton').click( function() {
-                id = $(this).attr('data-accommodationTypeID');
-                $("#deleteAccommodationTypeDialog").dialog("open");
-            });
-            $('#deleteAccommodationTypeConfirm').click( function() {
-                $("#deleteAccommodationTypeDialog").dialog("close");
-                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=accommodationTypes&option=delete&id=" + id;
-            });
-            $('#deleteAccommodationTypeCancel').click( function() {
-                $("#deleteAccommodationTypeDialog").dialog("close");
-            });
-
-        });
-    </script>
-            
-{include file='admin/footer.html'}
index 7115bef..eab6747 100644 (file)
@@ -51,8 +51,8 @@
     <!-- Delete Amenities Button -->
     <div id="deleteAmenityDialog" class="glm-dialog-box" title="Delete Amenity">
         <center>
-            <p>Are you sure you want to delete this accommodation type?</p>
-            <p><div id="deleteAmenityConfirm" class="button button-primary">Yes, delete this accommodation type</div></p>
+            <p>Are you sure you want to delete this amenity?</p>
+            <p><div id="deleteAmenityConfirm" class="button button-primary">Yes, delete this amenity</div></p>
             <p><div id="deleteAmenityCancel" class="button button-primary">Cancel</div></p>
         </center>
     </div>
index cb224ee..f57fdb9 100644 (file)
@@ -5,7 +5,6 @@
     <h2 class="nav-tab-wrapper">
         <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Member Types</a>
         <a href="{$thisURL}?page={$thisPage}&glm_action=categories" class="nav-tab{if $thisAction==categories} nav-tab-active{/if}">Member Categories</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=accommodationTypes" class="nav-tab{if $thisAction==accommodationTypes} nav-tab-active{/if}">Accommodation Types</a>
         <a href="{$thisURL}?page={$thisPage}&glm_action=amenities" class="nav-tab{if $thisAction==amenities} nav-tab-active{/if}">Amenities</a>
         <a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==cities} nav-tab-active{/if}">Cities</a>
         <a href="{$thisURL}?page={$thisPage}&glm_action=regions" class="nav-tab{if $thisAction==regions} nav-tab-active{/if}">Regions</a>
index dffd6dd..3d8d7a8 100644 (file)
             <td><a href="{$adminURL}?page=glm-members-admin-menu-configure&glm_action=categories" class="glm-right">Add</a></td>
         </tr>
   {/if}                
-  {if !$haveAccommodationTypes}
-        <tr>
-            <th><span class="glm-error">No Accommodation Types</span></th>
-            <td><a href="{$adminURL}?page=glm-members-admin-menu-configure&glm_action=accommodationTypes" class="glm-right">Add</a></td>
-        </tr>
-  {/if}                
   {if !$haveAmenities}
         <tr>
             <th><span class="glm-error">No Amenities</span></th>
             <tr class="alternate">
         {/if}
                 <td>
-                    <a href="{$adminURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&memberInfo={$p.id}">{$p.member}</a>
+                    <a href="{$adminURL}?page=glm-members-admin-menu-member&glm_action=member&member={$p.id}">{$p.name}</a>
                 </td>
             </tr>
     {/foreach}
index b539c74..8abe751 100644 (file)
@@ -2,6 +2,10 @@
 
     <h2>{$glmPluginName} Configuration</h2>
        
+{if $gitBranch != 'master'}
+    <h3><span class="glm-error">Current git branch: </span>{$gitBranch}</h3>
+{/if}
+       
     <h2 class="nav-tab-wrapper">
         <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">General Settings</a>
         <a href="{$thisURL}?page={$thisPage}&glm_action=terms" class="nav-tab{if $thisAction==terms} nav-tab-active{/if}">Terms and Phrases</a>
index 86e938b..2d1e334 100644 (file)
     </h2>
 
     <h2 class="nav-tab-wrapper">
-        <a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&id={$memberInfoID}" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Member Dashboard</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&id={$memberInfoID}" class="nav-tab{if $thisAction==index || $thisAction==memberEdit || $thisAction==memberInfo} nav-tab-active{/if}">Member Dashboard</a>
 {if $memberID}
-  {if $memberInfoID}
-        <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&memberInfo={$memberInfoID}" class="nav-tab{if $thisAction==memberInfo} nav-tab-active{/if} {if !$memberID || !$memberInfoID}disabled{/if}">Member Info</a>
-  {/if}
   {foreach $addOnTabs as $a}
         <a href="{$thisURL}?page={$thisPage}&glm_action={$a.action}&member={$memberID}" class="nav-tab{if $thisAction==$a.action} nav-tab-active{/if}">{$a.text}</a>
   {/foreach}        
 {/if}
 
-{* Not needed yet 
-        <a href="{$thisURL}?page={$thisPage}&glm_action=locations&member={$memberID}" class="nav-tab{if $thisAction==locations} nav-tab-active{/if} {if !$memberID || !$memberInfo}disabled{/if}">Locations</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=facilities&member={$memberID}" class="nav-tab{if $thisAction==facilities} nav-tab-active{/if} {if !$memberID || !$memberInfo}disabled{/if}">Facilities</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=attractions&member={$memberID}" class="nav-tab{if $thisAction==attractions} nav-tab-active{/if} {if !$memberID || !$memberInfo}disabled{/if}">Attractions</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=contacts&member={$memberID}" class="nav-tab{if $thisAction==contacts} nav-tab-active{/if} {if !$memberID || !$memberInfo}disabled{/if}">Contacts</a>
-*}
-        
     </h2>
     <div id="glm-admin-content-container">
     
index e6a8b71..70f07bd 100644 (file)
  {if $haveMemberTypes}
 
 
-    <h2>
-  {if $addingMember}
-        Add New Member
-  {else}
-        General Member Information
-  {/if}
-    </h2>
-
   {if $memberUpdated}
     <h2 class="glm-notice glm-flash-updated">Member Updated</h2>
   {/if}
-  
-  {if apply_filters('glm_members_permit_admin_member_index_edit_member', true)}
-    <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
-        <input type="hidden" name="glm_action" value="index">
-      {if $addingMember}
-        <input type="hidden" name="option" value="addNew">
-        <input type="hidden" name="created" value="today">
-      {else}
-        <input type="hidden" name="option" value="submit">
-        <input type="hidden" name="member" value="{$member.fieldData.id}">
-        <input type="hidden" name="created" value="{$member.fieldData.created.date}">
-      {/if}
-        
-        <table class="glm-admin-table">
-            <tr>
-                <th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
-                <td {if $member.fieldFail.name}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="name" value="{$member.fieldData.name}" class="glm-form-text-input">
-                    {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
-                </td>
-            </tr>
-            
-      {if !$addingMember}
-            <tr>
-                <th>Name for URLs:</th>
-                <td>
-                    {$member.fieldData.member_slug}
-                </td>
-            </tr>
-      {/if}
-            
-            <tr>
-                <th {if $member.fieldRequired.access}class="glm-required"{/if}>Member Display & Access:</th>
-                <td {if $member.fieldFail.access}class="glm-form-bad-input"{/if}>
-                    <select name="access">
-        {foreach from=$member.fieldData.access.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
-        {/foreach}
-                    </select>
-                    {if $member.fieldFail.access}<p>{$member.fieldFail.access}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.member_type}class="glm-required"{/if}>Member Type:</th>
-                <td {if $member.fieldFail.member_type}class="glm-form-bad-input"{/if}>
-                    <select name="member_type">
-        {foreach from=$member.fieldData.member_type.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
-        {/foreach}
-                    </select>
-                    {if $member.fieldFail.member_type}<p>{$member.fieldFail.member_type}</p>{/if}
-                </td>
-            </tr>            
-        {if !$addingMember}
-            <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>
-        {/if}
-            
-        </table>
-        <p><span class="glm-required">*</span> Required</p>
-    {if $addingMember}
-        <input type="submit" value="Add new member">
-    {else}
-        <input type="submit" value="Update member">
-    {/if}
-    </form>
+
+  {if $haveMember}
+    <table class="glm-admin-table">
+        <tr>
+            <td>
+                <span class="glm-admin-table-large-bold-text">{$member.fieldData.name}</span><br>
+                {if $member.fieldData.addr1}{$member.fieldData.addr1}<br>{/if}
+                {if $member.fieldData.addr2}{$member.fieldData.addr2}<br>{/if}
+                {if $member.fieldData.city.name}{$member.fieldData.city.name}{if $member.fieldData.state.name}, {/if}{/if}
+                {if $member.fieldData.state.name}{$member.fieldData.state.name}{/if}
+                {if $member.fieldData.zip}{$member.fieldData.zip}{/if}
+                {if $member.fieldData.country.name}{$member.fieldData.country.name}{/if}
+                <br>
+                {if $member.fieldData.phone}Phone: {$member.fieldData.phone}<br>{/if}
+                {if $member.fieldData.toll_free}Toll Free: {$member.fieldData.toll_free}<br>{/if}
+                {if $member.fieldData.email}E-Mail Address: {$member.fieldData.email}<br>{/if}
+                {if $member.fieldData.url}<a href="{$member.fieldData.url}" target="_blank">{$member.fieldData.url}</a><br>{/if}
+                
+                
+            </td>
+            <td>      
+                <table class="glm-admin-table">
+                    <tr>
+                        <th>Member Slug:</th>
+                        <td class="glm-nowrap">{$member.fieldData.member_slug}</td>
+                    </tr>
+                    <tr>
+                        <th>Member Display & Access:</th>
+                        <td class="glm-nowrap">{$member.fieldData.access.name}</td>
+                    </tr>
+                    <tr>
+                        <th>Member Type:</th>
+                        <td>{$member.fieldData.member_type.name}</td>
+                    </tr>            
+                    <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>
+                </table>
+            </td>
+            <td class="glm-right">
+                <span class="glm-right"><a href="{$thisURL}?page={$thisPage}&glm_action=memberEdit&member={$memberID}" class="button button-primary glm-button glm-right">Edit Base Member Information</a></span>
+            </td>
+        </tr>            
+    </table>
   {else}
-    {if $haveMember}
-        <table class="glm-admin-table">
-            <tr>
-                <th>Member Name:</th>
-                <td>{$member.fieldData.name}</td>
-            </tr>
-            <tr>
-                <th>Name for URLs:</th>
-                <td>{$member.fieldData.member_slug}</td>
-            </tr>
-            <tr>
-                <th>Member Display & Access:</th>
-                <td>{$member.fieldData.access.name}</td>
-            </tr>
-            <tr>
-                <th>Member Type:</th>
-                <td>{$member.fieldData.member_type.name}</td>
-            </tr>            
-            <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>            
-        </table>
-    {else}
         <h3>No member information available.</h3>
-    {/if}
   {/if}
     
   <p>&nbsp;</p>
 
   {if apply_filters('glm_members_permit_admin_member_index_view_member_info_version', true)}
     {if apply_filters('glm_members_permit_admin_member_index_add_member_info_version', true)}
-    <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}" class="button button-primary glm-button glm-right">Add New Member Information Version</a>
     {/if}   
     <br clear="all">
     <p>
-        <h3 class="glm-left">Member Information Versions</h3>
+        <h3 class="glm-left">Member Profile Versions</h3>
         <span class="glm-right">
             <p>
                 <input type="checkbox" id="showArchived"{if $showArchived} checked="checked"{/if}> Show archived information&nbsp;&nbsp;
+                <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}" class="button button-primary glm-button glm-right">Add New Member Information Version</a>
             </p>
         </span>
     </p> 
     <table class="wp-list-table striped glm-admin-table">
         <thead>
             <tr>
-                <th>Access</th>
+                <th>Status</th>
                 <th>Reference Name</th>
                 <th>Created</th>
                 <th>Last Update</th>
     <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
  {/if}
 {else}
-    <h3 class="glm-error">No current member.</h3>
+    <h3 class="glm-error">No member currently selected.</h3>
 {/if}
 
 
diff --git a/views/admin/member/memberEdit.html b/views/admin/member/memberEdit.html
new file mode 100644 (file)
index 0000000..c212a6a
--- /dev/null
@@ -0,0 +1,733 @@
+{include file='admin/member/header.html'}
+
+    <script src="http://maps.googleapis.com/maps/api/js?&key={$settings.google_maps_api_key}"></script>
+    <script type="text/javascript">var enableDraggable = true;</script>
+
+    <!--[if lt IE 9]>
+      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+
+{if $haveMember || $addingMember}
+ {if $haveMemberTypes}
+
+
+    <h2>
+  {if $addingMember}
+        Add New Member
+  {else}
+        Edit Member Information
+  {/if}
+    </h2>
+
+  {if $memberUpdated}
+    <h2 class="glm-notice glm-flash-updated">Member Updated</h2>
+  {/if}
+  
+  {if apply_filters('glm_members_permit_admin_member_index_edit_member', true)}
+    <form id="member-edit-form" action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+        <input type="hidden" name="glm_action" value="memberEdit">
+      {if $addingMember}
+        <input type="hidden" name="option" value="addNew">
+        <input type="hidden" name="created" value="today">
+      {else}
+        <input type="hidden" name="option" value="submit">
+        <input type="hidden" name="member" value="{$member.fieldData.id}">
+        <input type="hidden" name="created" value="{$member.fieldData.created.date}">
+      {/if}
+        
+        <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+            <a id="glm-member-general" data-show-table="glm-table-general" class="glm-member-tab nav-tab nav-tab-active">General Settings</a>
+            <a id="glm-member-address" data-show-table="glm-table-address" class="glm-member-tab nav-tab">Address and Location</a>
+            <a id="glm-member-other" data-show-table="glm-table-other" class="glm-member-tab nav-tab">Other Information</a>
+            <span class="glm-right"><input type="submit" value="{if $memberID && $member}Update member{else}Add new member{/if}"></span>
+        </h2>
+        
+        <!-- **** General Settings **** -->
+                
+        <table id="glm-table-general" class="glm-admin-table glm-member-table">
+            <tr>
+                <th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
+                <td {if $member.fieldFail.name}class="glm-form-bad-input"{/if}>
+                    <input type="text" name="name" value="{$member.fieldData.name}" class="glm-form-text-input">
+                    {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
+                </td>
+            </tr>
+
+      {if !$addingMember}
+            <tr>
+                <th>Name for URLs:</th>
+                <td>
+                    {$member.fieldData.member_slug}
+                </td>
+            </tr>
+      {/if}
+            
+            <tr>
+                <th {if $member.fieldRequired.access}class="glm-required"{/if}>Member Display & Access:</th>
+                <td {if $member.fieldFail.access}class="glm-form-bad-input"{/if}>
+                    <select name="access">
+        {foreach from=$member.fieldData.access.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
+        {/foreach}
+                    </select>
+                    {if $member.fieldFail.access}<p>{$member.fieldFail.access}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.member_type}class="glm-required"{/if}>Member Type:</th>
+                <td {if $member.fieldFail.member_type}class="glm-form-bad-input"{/if}>
+                    <select name="member_type">
+        {foreach from=$member.fieldData.member_type.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
+        {/foreach}
+                    </select>
+                    {if $member.fieldFail.member_type}<p>{$member.fieldFail.member_type}</p>{/if}
+                </td>
+            </tr>            
+        {if !$addingMember}
+            <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>
+        {/if}
+            <tr>
+                <th {if $member.fieldRequired.notes}class="glm-required"{/if}>Notes:</th>
+                <td {if $member.fieldFail.notes}class="glm-form-bad-input"{/if}>
+                    <textarea name="notes" class="glm-form-textarea">{$member.fieldData.notes}</textarea>
+                    {if $member.fieldFail.notes}<p>{$member.fieldFail.notes}</p>{/if}<br>
+                    This "Notes" field is not displayed anywhere else. It is strictly for making and keeping
+                    notes related to this member profile. 
+                </td>
+            </tr>
+        </table>
+        
+        <!-- **** Address and Location **** -->
+        
+        <table id="glm-table-address" class="glm-admin-table glm-hidden glm-member-table">
+            <tr>
+                <th {if $member.fieldRequired.addr1}class="glm-required"{/if}>Address Line 1:</th>
+                <td {if $member.fieldFail.addr1}class="glm-form-bad-input"{/if}>
+                    <input type="text" id="addr1" name="addr1" value="{$member.fieldData.addr1}" class="glm-form-text-input">
+                    {if $member.fieldFail.addr1}<p>{$member.fieldFail.addr1}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.addr2}class="glm-required"{/if}>Address Line 2:</th>
+                <td {if $member.fieldFail.addr2}class="glm-form-bad-input"{/if}>
+                    <input id="addr2" type="text" name="addr2" value="{$member.fieldData.addr2}" class="glm-form-text-input">
+                    {if $member.fieldFail.addr2}<p>{$member.fieldFail.addr2}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th>City</th>
+                <td class="glm-item-container">
+                    <!--  Add new city dialog -->
+                    <div id="newCityButton" class="button button-secondary glm-right">Add a new City</div>
+                    <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
+                        <table class="glm-admin-table">
+                            <tr>
+                                <th class="glm-required">City Name:</th>
+                                <td id="newCityNameTD">
+                                    <input id="newCityName" type="text" name="newCityName" class="glm-form-text-input">
+                                    <div id="newCityNameRequired"></div>
+                                </td>
+                            </tr>
+                        </table>
+                        <p><span class="glm-required">*</span> Required</p>
+                        <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
+                        <input id="newCitySubmit" type="submit" value="Add new City">
+                    </div>
+                    <!-- City Selection -->
+                    <input id="cityName" type="hidden" name="newCityName" value=""><!-- this field is only used if adding a new city to pass the new name -->
+                    <select name="city" id="city">
+                        <option value="0"></option>
+        {foreach from=$member.fieldData.city.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                            {$v.name}
+                        </option>
+        {/foreach}
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.state}class="glm-required"{/if}>State:</th>
+                <td {if $member.fieldFail.state}class="glm-form-bad-input"{/if}>
+                    <select id="state" name="state">
+        {foreach from=$member.fieldData.state.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                            {$v.name}
+                        </option>
+        {/foreach}
+                    </select>
+                    {if $member.fieldFail.state}<p>{$member.fieldFail.state}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.zip}class="glm-required"{/if}>ZIP / Postal Code:</th>
+                <td {if $member.fieldFail.zip}class="glm-form-bad-input"{/if}>
+                    <input id="zip" type="text" name="zip" value="{$member.fieldData.zip}" class="glm-form-text-input-short">
+                    {if $member.fieldFail.zip}<p>{$member.fieldFail.zip}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.country}class="glm-required"{/if}>Country:</th>
+                <td {if $member.fieldFail.country}class="glm-form-bad-input"{/if}>
+                    <select id="country" name="country">
+        {foreach from=$member.fieldData.country.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                            {$v.name} {$v.value}
+                        </option>
+        {/foreach}
+                    </select>
+                    {if $member.fieldFail.country}<p>{$member.fieldFail.country}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                {if $member.fieldRequired.lat}<th class="emRequiredInputField">{else}<th>{/if}Location:</th>
+                <td>
+                    <input id="glmLat" name="lat" type="hidden" value="{$member.fieldData.lat}">
+                    <input id="glmLng" name="lon" type="hidden" value="{$member.fieldData.lon}">
+                    <div id="glm-estimate-location" class="button button-secondary">Map Location Using Above Address</div>
+                    <p>
+                        MAP USE: Drag the pointer to the desired location for this member.
+                        Use + and - buttons or the mouse wheel to zoom in or out.
+                        Click and drag anywhere else on the map to move to another area.
+                    </p>
+                    <div id="locationMap" class="glm-map-edit">(map loads here)</div>
+                    Selected Position: <span id="mapPosition">Lat {$member.fieldData.lat}, Lon {$member.fieldData.lon}</span>
+                </td>
+            </tr>
+        </table>
+        
+        <!-- **** Other Information **** -->
+        
+        <table id="glm-table-other" class="glm-admin-table glm-hidden glm-member-table">
+            <tr>
+                <th>Categories</th>
+                <td class="glm-item-container">
+                    <!--  Add new category dialog -->
+                    <div id="newCategoryButton" class="button button-secondary glm-right">Add a new Category</div>
+                    <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
+                            <table class="glm-admin-table">
+                                <tr>
+                                    <th class="glm-required">Category Name:</th>
+                                    <td id="newCatNameTD">
+                                        <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
+                                        <div id="newCatNameRequired"></div>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>Parent Category:</th>
+                                    <td>
+                                        <select id="newCatParent" name="newCatParent">
+                            {if $availableCategories}
+                                            <option value=""></option>
+                                {foreach $availableCategories as $t}
+                                    {if !$t.parent.value} <!-- don't show child categories -->
+                                            <option value="{$t.id}" data-parent="{$t.name}">{$t.name}</option>
+                                    {/if}
+                                {/foreach}
+                            {/if}
+                                        </select>
+                                        <br>OR<br>
+                                        <input id="newCatParentName" type="text" name="newCatParentName" placeholder="Enter a new parent name."> 
+                                    </td>
+                                </tr>
+                            </table>
+                            <p><span class="glm-required">*</span> Required</p>
+                            <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
+                            <input id="newCategorySubmit" type="submit" value="Add new Category">
+                    </div>
+                    <!-- Category Selection -->
+                    <select name="categorySelect" id="categorySelect">
+        {if $availableCategories}
+                        <option id="categoryNone" value=""></option>
+            {foreach from=$availableCategories item=v}
+                        <option value="{$v.id}" data-parent="{$v.parent.name}">
+                            {if $v.parent.value}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
+                        </option>
+            {/foreach}
+        {else}
+                        <option id="" value="">(No Categories Listed - Select "Add a new Category" to the right. )</option>  
+        {/if}
+                    </select>&nbsp;&nbsp; Select a category to add to box below.<br>
+                    <div id="activeCategories" class="glm-dynSelect-box">
+                    
+        {if isset($member.fieldData.categories) && $member.fieldData.categories}
+            {foreach from=$member.fieldData.categories item=c}
+                        <div data-id="{$c.id}" class="glm-dynSelect-item glm-members-catgegory"> 
+                            {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} 
+                            <span data-id="{$c.id}" class="glm-dynSelect-delete catDelete">X</span>
+                            <input type="hidden" name="category[{$c.id}]" value="{$c.id}">
+                       </div>                    
+            {/foreach}
+        {/if}                    
+                    </div>
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.region}class="glm-required"{/if}>Region:</th>
+                <td {if $member.fieldFail.region}class="glm-form-bad-input"{/if}>
+                    <select name="region">
+        {foreach from=$member.fieldData.region.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
+        {/foreach}
+                    </select>
+                    {if $member.fieldFail.region}<p>{$member.fieldFail.region}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.phone}class="glm-required"{/if}>Phone #:</th>
+                <td {if $member.fieldFail.phone}class="glm-form-bad-input"{/if}>
+                    <input type="text" name="phone" value="{$member.fieldData.phone}" class="glm-form-text-input-short" placeholder="ex: 123-456-7890 ext 123">
+                    {if $member.fieldFail.phone}<p>{$member.fieldFail.phone}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.toll_free}class="glm-required"{/if}>Toll Free #:</th>
+                <td {if $member.fieldFail.toll_free}class="glm-form-bad-input"{/if}>
+                    <input type="text" name="toll_free" value="{$member.fieldData.toll_free}" class="glm-form-text-input-short" placeholder="ex: 800-123-4567">
+                    {if $member.fieldFail.toll_free}<p>{$member.fieldFail.toll_free}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
+                <td {if $member.fieldFail.url}class="glm-form-bad-input"{/if}>
+        {if $member.fieldData.url}
+                    <a class="button button-secondary glm-right" href="{$member.fieldData.url}" target="urlTarget">Test Link</a>
+        {/if}
+                    <input type="text" name="url" value="{$member.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
+                    {if $member.fieldFail.url}<p>{$member.fieldFail.url}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.cc_type}class="glm-required"{/if}>Credit Cards Accepted:</th>
+                <td {if $member.fieldFail.cc_type}class="glm-form-bad-input"{/if}>
+        {foreach from=$member.fieldData.cc_type.bitmap item=v}
+                    <input type="checkbox" name="cc_type[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+        {/foreach}                    
+                    {if $member.fieldFail.cc_type}<p>{$member.fieldFail.cc_type}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $member.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
+                <td {if $member.fieldFail.logo}class="glm-form-bad-input"{/if}>
+                    <table class="glm-admin-image-edit-table">
+        {if $member.fieldData.logo}
+                        <tr>
+                            <td>
+                                <div class="glm-galleryImage" data-id="logo">
+                                    <img src="{$glmPluginMediaURL}/images/small/{$member.fieldData.logo}">
+                                </div>
+                            </td>
+                            <td>
+                                <input type="checkbox" name="logo_delete"> Delete Image<br>
+                                {$member.fieldData.logo}<br>
+                            </td>
+                        </tr>
+        {/if}
+                        <tr><td colspan="2"><b>New image:</b> <input type="file" name="logo_new"></td></tr>
+                    </table>
+                    <div id="glm-galleryImageLarger_logo" class="glm-imageDialog"><img src="{$glmPluginMediaURL}/images/large/{$member.fieldData.logo}"></div>
+                    {if $member.fieldFail.logo}<p>{$member.fieldFail.logo}</p>{/if}
+                </td>
+            </tr>
+        </table>
+        <p><span class="glm-required">*</span> Required</p>
+    {if $addingMember}
+        <input type="submit" value="Add new member">
+    {else}
+        <input type="submit" value="Update member">
+    {/if}
+    </form>
+  {else}
+    {if $haveMember}
+        <table class="glm-admin-table">
+            <tr>
+                <th>Member Name:</th>
+                <td>{$member.fieldData.name}</td>
+            </tr>
+            <tr>
+                <th>Name for URLs:</th>
+                <td>{$member.fieldData.member_slug}</td>
+            </tr>
+            <tr>
+                <th>Member Display & Access:</th>
+                <td>{$member.fieldData.access.name}</td>
+            </tr>
+            <tr>
+                <th>Member Type:</th>
+                <td>{$member.fieldData.member_type.name}</td>
+            </tr>            
+            <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>            
+        </table>
+    {else}
+        <h3>No member information available.</h3>
+    {/if}
+  {/if}
+
+ {else}        
+    <h3 class="glm-error">You do not have any Member Types setup.</h3>
+    <p>You must have at least one Member Type to add a new member.</p>
+    <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
+ {/if}
+{else}
+    <h3 class="glm-error">No member currently selected.</h3>
+{/if}
+
+
+    <script type="text/javascript">
+        jQuery(document).ready(function($) {
+            
+            /*
+             * Edit area tabs
+             */
+            $('.glm-member-tab').click( function() {
+
+                // Clear tabl highlights and hide all tables
+                $('.glm-member-tab').removeClass('nav-tab-active');
+                $('.glm-member-table').addClass('glm-hidden');
+                
+                // Highlight selected tab
+                $(this).addClass('nav-tab-active');
+                
+                // Show selected table
+                var table = $(this).attr('data-show-table');
+                $('#' + table).removeClass('glm-hidden');
+                
+                if (table == 'glm-table-address') {
+                    initMap();
+                }
+                
+            });
+            
+            /*
+             * Category Selection
+             */
+             
+            // Action to select a category
+            $('#categorySelect').change( function() {
+                
+                // Get the ID, name, and parent of the category
+                var catValue = $('#categorySelect').val();       
+                var catName = $('#categorySelect').find(':selected').text();
+                var catParent = $('#categorySelect').find(':selected').attr('data-parent');
+                
+                // Check if the category has already been added
+                var found = false;              
+                $(".glm-members-catgegory").each( function() {
+                    var id = $(this).attr('data-id');
+                    if (id == catValue) {
+                        found = true;
+                    }
+                });
+  
+                // Check if there's a parent
+                parentName = '';
+                if (catParent != '') {
+                    parentName = catParent + ': ';
+                }
+                
+                // If not found, Add the category
+                if (!found) {
+                    $('#activeCategories').append('<div data-id="' + catValue 
+                            + '" class="glm-dynSelect-item glm-members-catgegory">' 
+                            + parentName + catName.trim() + ' <span class="glm-dynSelect-delete catDelete">X</span>'
+                            + '<input type="hidden" name="category[' + catValue + ']" value="' + catValue + '"></div>');
+                }
+
+                // Reset picklist
+                $('#categorySelect').val('');
+
+            });
+
+            // Action to de-select a category
+            $('.catDelete').live('click', function() {
+                $(this).parent().remove();
+            });
+
+            /*
+             * New Category Dialog
+             */
+             
+            var newCat = 0;    // Used for new category numbering (new cats are negative numbers)
+            
+            // Setup dialog box for adding a new category
+            $("#newCategoryDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+
+            // Ad a new category button action - pop-up dialog
+            $('#newCategoryButton').click( function() {
+                $("#newCategoryDialog").dialog("open");
+            });
+
+            // Submit new category
+             $('#newCategorySubmit').click( function() {
+                
+                // Assign new cat number
+                newCat--;
+                
+                // Get new category information
+                var newCatName = $('#newCatName').val();
+                var newCatParent = $('#newCatParent').val();
+                var catParent = $('#newCatParent').find(':selected').attr('data-parent');
+                var newCatParentName = $('#newCatParentName').val();
+                
+                // If there's no name, tell the user we need one.
+                if (newCatName == '') {
+                    $('#newCatNameTD').addClass('glm-form-bad-input');
+                    $('#newCatNameRequired').text('A catogory name is required!');
+                    return false;
+                }
+                
+                // Check if there's a parent, get the name - new parent name overrides selected parent
+                parentName = '';
+                if (newCatParentName && newCatParentName != '') {
+                    parentName = newCatParentName + ': ';
+                } else if (catParent && catParent != '') {
+                    parentName = catParent + ': ';
+                }
+                
+                // Add the new category to the active categories list
+                $('#activeCategories').append('<div data-id="' + newCat 
+                        + '" class="glm-dynSelect-item glm-members-catgegory">' 
+                        + parentName + newCatName.trim() + ' <span data-id="' + newCat + '" class="glm-dynSelect-delete catDelete">X</span>'
+                        + '<input type="hidden" name="category[' + newCat + ']" value="' + newCat + '">'
+                        + '<input type="hidden" name="newCategory[' + newCat + ']" value="' + newCatName + '">'
+                        + '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
+                        + '<input type="hidden" name="newCatParentName[' + newCat + ']" value="' + newCatParentName + '">'
+                        + '</div>');
+
+                // Clear the dialog input fields
+                $('#newCatName').val('');
+                $('#newCatParent').val('');  
+                $('#newCatParentName').val('');  
+
+                $("#newCategoryDialog").dialog("close");
+
+            });
+            $('#newCategoryCancel').click( function() {
+                $("#newCategoryDialog").dialog("close");
+            });
+
+            // Setup dialog box for adding a new category
+            $("#newCategoryDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+            
+            /*
+             * New City Dialog
+             */
+
+            // Setup dialog box for adding a new city
+            $("#newCityDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+            $('#newCityCancel').click( function() {
+                $("#newCityDialog").dialog("close");
+            });
+             
+            // Ad a new city button action - pop-up dialog
+            $('#newCityButton').click( function() {
+                $("#newCityDialog").dialog("open");
+            });
+
+            // Submit new city
+            var newCityAdded = false;
+            $('#newCitySubmit').click( function() {
+                
+                // Get new city name
+                var newCityName = $('#newCityName').val();
+
+                // If no name is supplied, notify used it's required
+                if (newCityName == '') {
+                    $('#newCityNameTD').addClass('glm-form-bad-input');
+                    $('#newCityNameRequired').text('A city name is required!');
+                    return false;
+                }
+
+                // Add new city name to the hidden field that will pass the new name to PHP.
+                $('#cityName').val(newCityName);
+                
+                // Add new city name to picklist and for storing - Only one permitted per submission
+                if (newCityAdded) {
+                    
+                    // New city already added, so just update the name and select that one
+                    $('#city').val(-1);
+                    $('#city option:selected').text(newCityName);
+                    
+                } else {
+                    
+                    // Add the new city name to the city picklist
+                    $('#city').append('<option value="-1">' + newCityName + '</option>');
+                    $('#city').val(-1);
+                    $('#newCityNameTD').append('<input type="hidden" name="newCity" value="' + newCityName + '">');
+                    newCityAdded = true;
+
+                }
+      
+                // Clear new city name from form
+                $('#newCityName').val('');
+                
+                $("#newCityDialog").dialog("close");
+
+                glmGeocode();   
+
+            });
+            
+            /*
+             * Map operations
+             */
+  
+           //show error if location can't be found
+           function showError() {
+               alert("Location can't be found");
+           }
+  
+            /*
+             * Google Maps
+             *  API reference: https://developers.google.com/maps/documentation/javascript/reference
+             */
+
+            // Set default - Need to make this configurable
+            var startLat = $('#glmLat').val();
+            var startLon = $('#glmLng').val();
+            var location = new google.maps.LatLng(startLat, startLon);
+            var map;
+            var geocoder;
+            var marker;
+            
+            function initMap() {
+                var map = new google.maps.Map(document.getElementById('locationMap'), {  
+                    zoom: 15,  
+                    disableDefaultUI: false,   
+                    mapTypeId: google.maps.MapTypeId.MAP,  
+                });  
+                var geocoder = new google.maps.Geocoder();
+                var marker = new google.maps.Marker({  
+                    map: map,  
+                    position: location,  
+                    draggable: enableDraggable,
+                    animation: google.maps.Animation.DROP,  
+                    title: "This is your location"  
+                });  
+                map.setCenter(location);
+
+                // Listen for an end of drag event for the map marker            
+                google.maps.event.addListener(marker,'dragend',function(event) {
+                    
+                    // Get the end postion
+                    glmLat = this.position.lat();
+                    glmLng = this.position.lng();
+                    
+                    // Assign it to the hidden fields for submission
+                    $('#glmLat').val(glmLat);
+                    $('#glmLng').val(glmLng);
+                    
+                    // Also display it to the user
+                    $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
+                });
+                
+                // When estimate location button is clicked, geocode using address
+                $('#glm-estimate-location').on('click', function() {
+
+                    // Get all address parts
+                    var geoAddr1 = $('#addr1').val().trim();
+                    var geoAddr2 = $('#addr2').val().trim();
+                    var geoCity = $('#city').find('option:selected').text().trim();
+                    var geoState = $('#state').find('option:selected').text().trim();
+                    var geoZIP = $('#zip').val().trim();
+                    var geoCountry = $('#country').find('option:selected').text().trim();
+                    
+                    // Assemble address string for 
+                    var geoAddress = geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
+                    
+                    // Send to Google Geocoder
+                    geocoder.geocode( { 'address': geoAddress }, function(results, status) {
+
+                        // If we have a geocode solution
+                        if (status == google.maps.GeocoderStatus.OK) {
+
+                            // Center the map and locate the marger to the new location
+                            map.setCenter(results[0].geometry.location);
+                            marker.setPosition( results[0].geometry.location );
+                            
+                            // Assign the new position to the hidden fields for submission
+                            glmLat = results[0].geometry.location.lat();
+                            glmLng = results[0].geometry.location.lng();
+                            $('#glmLat').val(glmLat);
+                            $('#glmLng').val(glmLng);
+
+                            // Also display it to the user
+                            $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
+
+                            // Otherwise tell the user. 
+                        } else {                        
+                            alert('Not able to estimate position from the current address.');
+                        }
+                    });
+
+                });
+
+            }
+
+            // Resubmit geocoding when map location button is clicked
+            function glmGeocode() {
+                
+                // Get all address parts
+                var geoAddr1 = $('#addr1').val().trim();
+                var geoAddr2 = $('#addr2').val().trim();
+                var geoCity = $('#city').find('option:selected').text().trim();
+                var geoState = $('#state').find('option:selected').text().trim();
+                var geoZIP = $('#zip').val().trim();
+                var geoCountry = $('#country').find('option:selected').text().trim();
+                
+                // Assemble address string for 
+                var geoAddress = geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
+                
+                // Send to Google Geocoder
+                geocoder.geocode( { 'address': geoAddress }, function(results, status) {
+
+                    // If we have a geocode solution
+                    if (status == google.maps.GeocoderStatus.OK) {
+
+                        // Center the map and locate the marger to the new location
+                        map.setCenter(results[0].geometry.location);
+                        marker.setPosition( results[0].geometry.location );
+                        
+                        // Assign the new position to the hidden fields for submission
+                        glmLat = results[0].geometry.location.lat();
+                        glmLng = results[0].geometry.location.lng();
+                        $('#glmLat').val(glmLat);
+                        $('#glmLng').val(glmLng);
+
+                        // Also display it to the user
+                        $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
+
+                        // Otherwise tell the user. 
+                    } else {                        
+                        alert('Not able to estimate position from the current address.');
+                    }
+                });
+            }
+
+               $('#showArchived').click( function() {
+                       checked = 'false';
+                       if ($(this).attr('checked') == 'checked') {
+                           checked = 'true';   
+                       }
+                window.location.replace("{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&showArchived=" + checked);                
+               });
+               
+            // Flash certain elements for a short time after display      
+            $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+
+        });
+    </script>
+
+    
+{include file='admin/footer.html'}
index 436c1ad..b656934 100644 (file)
@@ -1,9 +1,6 @@
 {include file='admin/member/header.html'}
 
-    <script src="http://maps.googleapis.com/maps/api/js?sensor=true&key={$settings.google_maps_api_key}"></script>
-    <script type="text/javascript">var enableDraggable = true;</script>
-
-    {if $memberUpdated}<h2 class="glm-notice glm-flash-updated">Member Information Updated</h2>{/if}
+    {if $memberUpdated}<h2 class="glm-notice glm-flash-updated">Member Profile Updated</h2>{/if}
     
     <!--[if lt IE 9]>
       <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
 {if apply_filters('glm_members_permit_admin_member_info_edit', true)}
     
     {if $memberInfoID && $memberInfo}
-        <!--  Delete Member Information dialog -->
-        <div id="deleteMemberInfoButton" class="button button-primary glm-right">Delete this Member Information Version</div>
-        <div id="deleteMemberInfoDialog" class="glm-dialog-box" title="Delete Member Information">
+        <!--  Delete Member Profile dialog -->
+        <div id="deleteMemberInfoButton" class="button button-primary glm-right">Delete this Member Profile Version</div>
+        <div id="deleteMemberInfoDialog" class="glm-dialog-box" title="Delete Member Profile">
       {if $memberInfo.fieldData.status.value == 10}
             <p><center><a id="deleteMemberInfoCancel" class="button button-primary">Cancel</a></center></p>
             <p>
-                <span class="glm-notice">NOTE:</span> This member information is the <b>currently active</b> version! You may not delete an active version. 
-                To delete this version, please select another version to be active or change the "Member Info Status" on this page to something
+                <span class="glm-notice">NOTE:</span> This member profile is the <b>currently active</b> version! You may not delete an active profile version. 
+                To delete this version, please select another version to be active or change the "Profile Status" on this page to something
                 other than "Active".
             </p>
             <p>
                 If you change this version to something other than "Active" without selecting another version as active, there will be no active 
-                information for this member. Members without an active information version will not be displayed on the front-end of this Web site.
+                profile for this member. Members without an active profile will not be displayed on the front-end of this Web site.
             </p>
             <p>
-                Click the "Member Dashboard" tab above to see all information versions for this member and optionally to select another version to
+                Click the "Member Dashboard" tab above to see all profile versions for this member and optionally to select another version to
                 be active.
             </p>
       {else}
             <center>
                 <p><a id="deleteMemberInfoCancel" class="button button-primary">Cancel</a></p>
-                <p><input id="deleteMemberInfoSubmit" type="submit" value="Delete this Member Information Version"></p>
+                <p><input id="deleteMemberInfoSubmit" type="submit" value="Delete this Member Profile Version"></p>
             </center>
             <div class="glm-item-container">
                 <p><center><span class="glm-error">WARNING:</span></center></p>
                 <p>
-                    <span class="glm-warning">Clicking the "Delete this Member Information Version" button above will 
-                    delete all of the data and images displayed on this page and any other information in the tabs that may show to the right of the "Member Info"
+                    <span class="glm-warning">Clicking the "Delete this Member Profile Version" button above will 
+                    delete all of the data and images displayed on this page and any other information in the tabs that may show to the right of the "Member Profile"
                     tab above.</span>
                 </p>
                 <p>
                 </p>
             </div>
             <p>
-                This member may also have other member information records. Click the "Member Dashboard" Tab above to view a list of all information 
+                This member may also have other member profile records. Click the "Member Dashboard" Tab above to view a list of all profile version
                 records for this member. 
             </p>
             <p>
-                Only this member information version will be deleted. Other member information versions listed under the "Member Dashboard" tab 
+                Only this member profile version will be deleted. Other member profile versions listed under the "Member Dashboard" tab 
                 above will not be deleted. 
             </p>
             <p>
                 There may also be "Archived" versions that will not normally show up in the "Member Dashboard". Click the 
-                "Show Archiived Versions" checkbox at the top right of the versions list on that page to include archived versions.
+                "Show Archiived Profile Versions" checkbox at the top right of the versions list on that page to include archived versions.
             </p>
 
       {/if} <!-- status == 10 -->
         </div>
 
-        <h2>Edit Member Information</h2>
+        <h2>Edit Member Profile</h2>
     {else}
-        <h2>Add New Member Information</h2>
+        <h2>Add New Member Profile</h2>
     {/if} <!-- memberInfoID && memberInfo -->
 
     <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
                 <th>Member Name:</th>
                 <td>{$member.name}</td>
             </tr>
-            <tr>
-                <th>Member Type:</th>
-                <td>{$member.member_type.name}</td>
-            </tr>            
       {if $memberInfoID && $memberInfo}
             <tr>
                 <th>Access:</th>
                 <td>{$member.access.name}</td>
             </tr>                        
       {/if}            
-      {if $noActive}
-            <tr><td colspan="2"><h3 class="glm-error">You do not have any active information for this member.</h3></td></tr>
-      {/if}
-      {if $memberInfoID && $memberInfo}
-            <tr>
-                <th>Created:</th>
-                <td>{$memberInfo.fieldData.create_time.datetime}</td>
-            </tr>            
+        </table>
+            
+    <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+        <a id="glm-member-info-general" data-show-table="glm-table-general" class="glm-member-info-tab nav-tab nav-tab-active">General Information</a>
+        <a id="glm-member-info-gallery" data-show-table="glm-table-gallery" class="glm-member-info-tab nav-tab">Image Gallery</a>
+        <span class="glm-right"><input id="updateMemberProfile" type="submit" value="{if $memberInfoID && $memberInfo}Update member profile{else}Add new member profile{/if}"></span>
+    </h2>
+            
+        <table id="glm-table-general" class="glm-admin-table glm-member-info-table">
             <tr>
-                <th>Last Updated:</th>
-                <td>{$memberInfo.fieldData.modify_time.datetime}</td>
+                <th {if $memberInfo.fieldRequired.reference_name}class="glm-required"{/if}>Profile Name:</th>
+                <td {if $memberInfo.fieldFail.reference_name}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
+                    <input type="text" name="reference_name" value="{$memberInfo.fieldData.reference_name}" class="glm-form-text-input" placeholder="Name of this member profile record for reference only. Not displayed to user.">
+                    {if $memberInfo.fieldFail.reference_name}<p>{$memberInfo.fieldFail.reference_name}</p>{/if}<br>
+                    The "Profile Name" field is used to help identify this particular member profile. Members may have multiple profiles,
+                    only one of which can be active at a time. Multiple profiles make it easy to manage separate sets of information that may be 
+                    used at different times, for example seasons of the year or for special events (i.e. "Winter Profile").  
+                </td>
             </tr>
-      {/if}
-            
-            <th>Member Info Status:</th>
+            <tr>
+                <th>Profile Status:</th>
                 <td>
                     <select name="status">
         {foreach from=$memberInfo.fieldData.status.list item=v}
                     {if $memberInfo.fieldFail.status}<p>{$memberInfo.fieldFail.status}</p>{/if}
                 </td>
             </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.reference_name}class="glm-required"{/if}>Reference Name:</th>
-                <td {if $memberInfo.fieldFail.reference_name}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="reference_name" value="{$memberInfo.fieldData.reference_name}" class="glm-form-text-input" placeholder="Name of this member information record for reference only. Not displayed to user.">
-                    {if $memberInfo.fieldFail.reference_name}<p>{$memberInfo.fieldFail.reference_name}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <td>&nbsp;</td>
-                <td>
-                    <h3>Descriptions</h3>
-                </td>
-            </tr>
             <tr>
                 <th {if $memberInfo.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
-                <td {if $memberInfo.fieldFail.descr}class="glm-form-bad-input"{/if}>
+                <td {if $memberInfo.fieldFail.descr}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
                     {php} 
                         wp_editor('{$memberInfo.fieldData.descr|escape:quotes}', 'glm_descr', array(
                             // 'media_buttons' => true,
             </tr>
             <tr>
                 <th {if $memberInfo.fieldRequired.short_descr}class="glm-required"{/if}>Short Description:</th>
-                <td {if $memberInfo.fieldFail.short_descr}class="glm-form-bad-input"{/if}>
+                <td {if $memberInfo.fieldFail.short_descr}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
                     <input type="text" name="short_descr" value="{$memberInfo.fieldData.short_descr}" class="glm-form-text-input" placeholder="A short, one line, description of the member.">
                     {if $memberInfo.fieldFail.short_descr}<p>{$memberInfo.fieldFail.short_descr}</p>{/if}
                 </td>
             </tr>
-            <tr>
-                <td>&nbsp;</td>
-                <td>
-                    <h3>Member Address</h3>
-                    <p>The map below will display the likely location as you enter or edit the address.</p> 
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.addr1}class="glm-required"{/if}>Address Line 1:</th>
-                <td {if $memberInfo.fieldFail.addr1}class="glm-form-bad-input"{/if}>
-                    <input type="text" id="addr1" name="addr1" value="{$memberInfo.fieldData.addr1}" class="glm-form-text-input glm-geocodeAction">
-                    {if $memberInfo.fieldFail.addr1}<p>{$memberInfo.fieldFail.addr1}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.addr2}class="glm-required"{/if}>Address Line 2:</th>
-                <td {if $memberInfo.fieldFail.addr2}class="glm-form-bad-input"{/if}>
-                    <input id="addr2" type="text" name="addr2" value="{$memberInfo.fieldData.addr2}" class="glm-form-text-input glm-geocodeAction">
-                    {if $memberInfo.fieldFail.addr2}<p>{$memberInfo.fieldFail.addr2}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th>City</th>
-                <td class="glm-item-container">
-                    <!--  Add new city dialog -->
-                    <div id="newCityButton" class="button button-secondary glm-right">Add a new City</div>
-                    <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
-                        <table class="glm-admin-table">
-                            <tr>
-                                <th class="glm-required">City Name:</th>
-                                <td id="newCityNameTD">
-                                    <input id="newCityName" type="text" name="newCityName" class="glm-form-text-input">
-                                    <div id="newCityNameRequired"></div>
-                                </td>
-                            </tr>
-                        </table>
-                        <p><span class="glm-required">*</span> Required</p>
-                        <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
-                        <input id="newCitySubmit" type="submit" value="Add new City">
-                    </div>
-                    <!-- City Selection -->
-                    <input id="cityName" type="hidden" name="newCityName" value=""><!-- this field is only used if adding a new city to pass the new name -->
-                    <select name="city" id="city" class="glm-geocodeAction">
-                        <option value="0"></option>
-        {foreach from=$memberInfo.fieldData.city.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
-                            {$v.name}
-                        </option>
-        {/foreach}
-                    </select>
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.state}class="glm-required"{/if}>State:</th>
-                <td {if $memberInfo.fieldFail.state}class="glm-form-bad-input"{/if}>
-                    <select id="state" name="state" class="glm-geocodeAction">
-        {foreach from=$memberInfo.fieldData.state.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
-                            {$v.name}
-                        </option>
-        {/foreach}
-                    </select>
-                    {if $memberInfo.fieldFail.state}<p>{$memberInfo.fieldFail.state}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.zip}class="glm-required"{/if}>ZIP / Postal Code:</th>
-                <td {if $memberInfo.fieldFail.zip}class="glm-form-bad-input"{/if}>
-                    <input id="zip" type="text" name="zip" value="{$memberInfo.fieldData.zip}" class="glm-form-text-input-short glm-geocodeAction">
-                    {if $memberInfo.fieldFail.zip}<p>{$memberInfo.fieldFail.zip}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.country}class="glm-required"{/if}>Country:</th>
-                <td {if $memberInfo.fieldFail.country}class="glm-form-bad-input"{/if}>
-                    <select id="country" name="country" class="glm-geocodeAction">
-        {foreach from=$memberInfo.fieldData.country.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
-                            {$v.name} {$v.value}
-                        </option>
-        {/foreach}
-                    </select>
-                    {if $memberInfo.fieldFail.country}<p>{$memberInfo.fieldFail.country}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                {if $memberInfo.fieldRequired.lat}<th class="emRequiredInputField">{else}<th>{/if}Location:</th>
-                <td>
-                    <input id="glmLat" name="lat" type="hidden" value="{$memberInfo.fieldData.lat}">
-                    <input id="glmLng" name="lon" type="hidden" value="{$memberInfo.fieldData.lon}">
-                    <p>
-                        MAP USE: Drag the pointer to the desired location for this member.
-                        Use + and - buttons or the mouse wheel to zoom in or out.
-                        Click and drag anywhere else on the map to move to another area.
-                    </p>
-                    <div id="locationMap" class="glm-map-edit">(map loads here)</div>
-                    Selected Position: <span id="mapPosition">Lat {$memberInfo.fieldData.lat}, Lon {$memberInfo.fieldData.lon}</span>
-                </td>
-            </tr>
-            <tr>
-                <td>&nbsp;</td>
-                <td>
-                    <h3>Other Information</h3>
-                </td>
-            </tr>
-            <tr>
-                <th>Categories</th>
-                <td class="glm-item-container">
-                    <!--  Add new category dialog -->
-                    <div id="newCategoryButton" class="button button-secondary glm-right">Add a new Category</div>
-                    <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
-                            <table class="glm-admin-table">
-                                <tr>
-                                    <th class="glm-required">Category Name:</th>
-                                    <td id="newCatNameTD">
-                                        <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
-                                        <div id="newCatNameRequired"></div>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>Parent Category:</th>
-                                    <td>
-                                        <select id="newCatParent" name="newCatParent">
-                            {if $availableCategories}
-                                            <option value=""></option>
-                                {foreach $availableCategories as $t}
-                                    {if !$t.parent.value} <!-- don't show child categories -->
-                                            <option value="{$t.id}" data-parent="{$t.name}">{$t.name}</option>
-                                    {/if}
-                                {/foreach}
-                            {/if}
-                                        </select>
-                                        <br>OR<br>
-                                        <input id="newCatParentName" type="text" name="newCatParentName" placeholder="Enter a new parent name."> 
-                                    </td>
-                                </tr>
-                            </table>
-                            <p><span class="glm-required">*</span> Required</p>
-                            <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
-                            <input id="newCategorySubmit" type="submit" value="Add new Category">
-                    </div>
-                    <!-- Category Selection -->
-                    <select name="categorySelect" id="categorySelect">
-        {if $availableCategories}
-                        <option id="categoryNone" value=""></option>
-            {foreach from=$availableCategories item=v}
-                        <option value="{$v.id}" data-parent="{$v.parent.name}">
-                            {if $v.parent.value}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
-                        </option>
-            {/foreach}
-        {else}
-                        <option id="" value="">(No Categories Listed - Select "Add a new Category" to the right. )</option>  
-        {/if}
-                    </select>&nbsp;&nbsp; Select a category to add to box below.<br>
-                    <div id="activeCategories" class="glm-dynSelect-box">
-                    
-        {if isset($memberInfo.fieldData.categories) && $memberInfo.fieldData.categories}
-            {foreach from=$memberInfo.fieldData.categories item=c}
-                        <div data-id="{$c.id}" class="glm-dynSelect-item glm-members-catgegory"> 
-                            {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} 
-                            <span data-id="{$c.id}" class="glm-dynSelect-delete catDelete">X</span>
-                            <input type="hidden" name="category[{$c.id}]" value="{$c.id}">
-                       </div>                    
-            {/foreach}
-        {/if}                    
-                    </div>
-                </td>
-            </tr>
             <tr>
                 <th>Amenities</th>
                 <td class="glm-item-container">
                     </div>
                 </td>
             </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.region}class="glm-required"{/if}>Region:</th>
-                <td {if $memberInfo.fieldFail.region}class="glm-form-bad-input"{/if}>
-                    <select name="region">
-        {foreach from=$memberInfo.fieldData.region.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
-        {/foreach}
-                    </select>
-                    {if $memberInfo.fieldFail.region}<p>{$memberInfo.fieldFail.region}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.phone}class="glm-required"{/if}>Phone #:</th>
-                <td {if $memberInfo.fieldFail.phone}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="phone" value="{$memberInfo.fieldData.phone}" class="glm-form-text-input-short" placeholder="ex: 123-456-7890 ext 123">
-                    {if $memberInfo.fieldFail.phone}<p>{$memberInfo.fieldFail.phone}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.toll_free}class="glm-required"{/if}>Toll Free #:</th>
-                <td {if $memberInfo.fieldFail.toll_free}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="toll_free" value="{$memberInfo.fieldData.toll_free}" class="glm-form-text-input-short" placeholder="ex: 800-123-4567">
-                    {if $memberInfo.fieldFail.toll_free}<p>{$memberInfo.fieldFail.toll_free}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
-                <td {if $memberInfo.fieldFail.url}class="glm-form-bad-input"{/if}>
-        {if $memberInfo.fieldData.url}
-                    <a class="button button-secondary glm-right" href="{$memberInfo.fieldData.url}" target="urlTarget">Test Link</a>
-        {/if}
-                    <input type="text" name="url" value="{$memberInfo.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
-                    {if $memberInfo.fieldFail.url}<p>{$memberInfo.fieldFail.url}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.email}class="glm-required"{/if}>E-Mail Address:</th>
-                <td {if $memberInfo.fieldFail.email}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="email" value="{$memberInfo.fieldData.email}" class="glm-form-text-input-short" placeholder="ex: name@domain.com">
-                    {if $memberInfo.fieldFail.email}<p>{$memberInfo.fieldFail.email}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
-                <td {if $memberInfo.fieldFail.logo}class="glm-form-bad-input"{/if}>
-                    <table class="glm-admin-image-edit-table">
-        {if $memberInfo.fieldData.logo}
-                        <tr>
-                            <td>
-                                <div class="glm-galleryImage" data-id="logo">
-                                    <img src="{$glmPluginMediaURL}/images/small/{$memberInfo.fieldData.logo}">
-                                </div>
-                            </td>
-                            <td>
-                                <input type="checkbox" name="logo_delete"> Delete Image<br>
-                                {$memberInfo.fieldData.logo}<br>
-                            </td>
-                        </tr>
-        {/if}
-                        <tr><td colspan="2"><b>New image:</b> <input type="file" name="logo_new"></td></tr>
-                    </table>
-                    <div id="glm-galleryImageLarger_logo" class="glm-imageDialog"><img src="{$glmPluginMediaURL}/images/large/{$memberInfo.fieldData.logo}"></div>
-                    {if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.cc_type}class="glm-required"{/if}>Credit Cards Accepted:</th>
-                <td {if $memberInfo.fieldFail.cc_type}class="glm-form-bad-input"{/if}>
-        {foreach from=$memberInfo.fieldData.cc_type.bitmap item=v}
-                    <input type="checkbox" name="cc_type[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
-        {/foreach}                    
-                    {if $memberInfo.fieldFail.cc_type}<p>{$memberInfo.fieldFail.cc_type}</p>{/if}
-                </td>
-            </tr>
             <tr>
                 <th {if $memberInfo.fieldRequired.notes}class="glm-required"{/if}>Notes:</th>
-                <td {if $memberInfo.fieldFail.notes}class="glm-form-bad-input"{/if}>
-                    {php}
-                        wp_editor('{$memberInfo.fieldData.notes}', 'glm_notes', array(
-                            'quicktags' => false,
-                            'media_buttons' => false,
-                            'wpautop' => false,
-                            'textarea_name' => 'notes',
-                            'editor_height' => 100,     // Height in px, overrides editor_rows
-                                // 'textarea_rows' => 4,
-                        ));
-                    {/php}
-                    {if $memberInfo.fieldFail.notes}<p>{$memberInfo.fieldFail.notes}</p>{/if}
+                <td {if $memberInfo.fieldFail.notes}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
+                    <textarea name="notes" class="glm-form-textarea">{$memberInfo.fieldData.notes}</textarea>
+                    {if $memberInfo.fieldFail.notes}<p>{$memberInfo.fieldFail.notes}</p>{/if}<br>
+                    This "Notes" field is not displayed anywhere else. It is strictly for making and keeping
+                    notes related to this member profile. 
                 </td>
             </tr>
+        </table>
+        <table id="glm-table-gallery" class="glm-admin-table glm-hidden glm-member-info-table">
             <tr>
                 <th>Image Gallery</th>
                 <td class="glm-item-container glm-imageGalleryContainer">
         {/if}
                     </ul>
     {else}
-                    <b>Note:</b> Images may only be added to member information records that have been created.
+                    <b>Note:</b> Images may only be added to member profile records that have been created.
                     You are editing information to create a new record.
                     <br>After you click "Add new member" below, you may come back here to add images to the gallery.
     {/if}          
             </tr>
         </table>
         <p><span class="glm-required">*</span> Required</p>
-        <input type="submit" value="{if $memberInfoID && $memberInfo}Update member information{else}Add new member information{/if}">
+        <input type="submit" value="{if $memberInfoID && $memberInfo}Update member profile{else}Add new member profile{/if}">
 
     </form>
     
             <tr><th>Short Description:</th><td>{$memberInfo.fieldData.short_descr}</td></tr>
             <tr>
                 <td>&nbsp;</td>
-                <td>
+                <td> 
                     <h3>Member Address</h3>
                     <p>The map below will display the likely location as you enter or edit the address.</p> 
                 </td>
     <script type="text/javascript">
         jQuery(document).ready(function($) {
 
-               /*
-                * Category Selection
-                */
-                
-               // Action to select a category
-            $('#categorySelect').change( function() {
-               
-               // Get the ID, name, and parent of the category
-               var catValue = $('#categorySelect').val();       
-               var catName = $('#categorySelect').find(':selected').text();
-               var catParent = $('#categorySelect').find(':selected').attr('data-parent');
-               
-               // Check if the category has already been added
-               var found = false;              
-               $(".glm-members-catgegory").each( function() {
-                       var id = $(this).attr('data-id');
-                       if (id == catValue) {
-                               found = true;
-                       }
-               });
-  
-               // Check if there's a parent
-               parentName = '';
-               if (catParent != '') {
-                       parentName = catParent + ': ';
-               }
-               
-               // If not found, Add the category
-                if (!found) {
-                       $('#activeCategories').append('<div data-id="' + catValue 
-                                       + '" class="glm-dynSelect-item glm-members-catgegory">' 
-                                       + parentName + catName.trim() + ' <span class="glm-dynSelect-delete catDelete">X</span>'
-                                       + '<input type="hidden" name="category[' + catValue + ']" value="' + catValue + '"></div>');
-                }
-
-               // Reset picklist
-                $('#categorySelect').val('');
-
-            });
-
-            // Action to de-select a category
-            $('.catDelete').live('click', function() {
-               $(this).parent().remove();
-            });
-
-               /*
-                * New Category Dialog
-                */
-                
-               var newCat = 0;    // Used for new category numbering (new cats are negative numbers)
-               
-               // Setup dialog box for adding a new category
-            $("#newCategoryDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-
-               // Ad a new category button action - pop-up dialog
-            $('#newCategoryButton').click( function() {
-                $("#newCategoryDialog").dialog("open");
-            });
+            /*
+             * Edit area tabs
+             */
+            $('.glm-member-info-tab').click( function() {
 
-               // Submit new category
-             $('#newCategorySubmit').click( function() {
-                
-                // Assign new cat number
-                newCat--;
-                
-                // Get new category information
-                var newCatName = $('#newCatName').val();
-                var newCatParent = $('#newCatParent').val();
-                var catParent = $('#newCatParent').find(':selected').attr('data-parent');
-                var newCatParentName = $('#newCatParentName').val();
+                // Clear tabl highlights and hide all tables
+                $('.glm-member-info-tab').removeClass('nav-tab-active');
+                $('.glm-member-info-table').addClass('glm-hidden');
                 
-                // If there's no name, tell the user we need one.
-                if (newCatName == '') {
-                       $('#newCatNameTD').addClass('glm-form-bad-input');
-                       $('#newCatNameRequired').text('A catogory name is required!');
-                       return false;
-                }
+                // Highlight selected tab
+                $(this).addClass('nav-tab-active');
                 
-                // Check if there's a parent, get the name - new parent name overrides selected parent
-                parentName = '';
-                if (newCatParentName && newCatParentName != '') {
-                       parentName = newCatParentName + ': ';
-                } else if (catParent && catParent != '') {
-                    parentName = catParent + ': ';
-                }
+                // Show selected table
+                var table = $(this).attr('data-show-table');
+                $('#' + table).removeClass('glm-hidden');
                 
-                // Add the new category to the active categories list
-                $('#activeCategories').append('<div data-id="' + newCat 
-                        + '" class="glm-dynSelect-item glm-members-catgegory">' 
-                        + parentName + newCatName.trim() + ' <span data-id="' + newCat + '" class="glm-dynSelect-delete catDelete">X</span>'
-                        + '<input type="hidden" name="category[' + newCat + ']" value="' + newCat + '">'
-                        + '<input type="hidden" name="newCategory[' + newCat + ']" value="' + newCatName + '">'
-                        + '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
-                        + '<input type="hidden" name="newCatParentName[' + newCat + ']" value="' + newCatParentName + '">'
-                        + '</div>');
-
-                // Clear the dialog input fields
-                $('#newCatName').val('');
-                $('#newCatParent').val('');  
-                $('#newCatParentName').val('');  
-
-                $("#newCategoryDialog").dialog("close");
-
-            });
-            $('#newCategoryCancel').click( function() {
-                $("#newCategoryDialog").dialog("close");
-            });
-
-            // Setup dialog box for adding a new category
-            $("#newCategoryDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
             });
             
             /*
                     }
                 });
                 
-                // If not found, Add the category
+                // If not found, Add the amenity
                 if (!found) {
                     $('#activeAmenities').append('<div data-id="' + amenValue 
                             + '" class="glm-dynSelect-item glm-members-amenity">' + amenName
                 $(this).parent().remove();
             });
 
-            /*
-             * New City Dialog
-             */
-
-            // Setup dialog box for adding a new city
-            $("#newCityDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-            $('#newCityCancel').click( function() {
-                $("#newCityDialog").dialog("close");
-            });
-             
-            // Ad a new city button action - pop-up dialog
-            $('#newCityButton').click( function() {
-                $("#newCityDialog").dialog("open");
-            });
-
-            // Submit new city
-            var newCityAdded = false;
-            $('#newCitySubmit').click( function() {
-               
-               // Get new city name
-                var newCityName = $('#newCityName').val();
-
-               // If no name is supplied, notify used it's required
-               if (newCityName == '') {
-                    $('#newCityNameTD').addClass('glm-form-bad-input');
-                    $('#newCityNameRequired').text('A city name is required!');
-                    return false;
-               }
-
-               // Add new city name to the hidden field that will pass the new name to PHP.
-               $('#cityName').val(newCityName);
-               
-               // Add new city name to picklist and for storing - Only one permitted per submission
-               if (newCityAdded) {
-                       
-                       // New city already added, so just update the name and select that one
-                       $('#city').val(-1);
-                       $('#city option:selected').text(newCityName);
-                       
-               } else {
-                       
-                       // Add the new city name to the city picklist
-                       $('#city').append('<option value="-1">' + newCityName + '</option>');
-                       $('#city').val(-1);
-                       $('#newCityNameTD').append('<input type="hidden" name="newCity" value="' + newCityName + '">');
-                    newCityAdded = true;
-
-                }
-      
-               // Clear new city name from form
-               $('#newCityName').val('');
-               
-               $("#newCityDialog").dialog("close");
-
-                glmGeocode();   
-
-            });
-            
-            /*
-             * Large Logo Dialog
-             */
-
-            // Setup dialog box for showing enlarged logo image
-            x = $("#largeLogoDialog").dialog({
-                autoOpen: false,
-                resizable: false,
-                dialogClass: "glm-dialog-no-close"
-            });
-            $('#largeLogoCancel').click( function() {
-                $("#largeLogoDialog").dialog("close");
-            });
-
-            // Show large logo image - pop-up dialog - resize at time of pop-up
-            $('#largeLogoButton').click( function() {
-                $("#largeLogoDialog").dialog("open");
-                $( "#largeLogoDialog" ).dialog( "option", "position", { my: "center", at: "center", of: window } );
-                var newWidth = $(window).width() * .8;
-                $( "#largeLogoDialog" ).dialog( "option", "width", newWidth );
-            });
-
-            // Resize whenever window size changes
-            $(window).resize(function(){
-                $( "#largeLogoDialog" ).dialog( "option", "position", { my: "center", at: "center", of: window } );
-                var newWidth = $(window).width() * .8;
-                $( "#largeLogoDialog" ).dialog( "option", "width", newWidth );
-            });
-
     {if $memberInfoID && $memberInfo}            
             // Delete Member Info dialog
             $("#deleteMemberInfoDialog").dialog({
             });
     {/if}        
             
+            // Flash certain elements for a short time after display      
+            $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+           
             /*
-             * New Image Dialog
+             * Check for bad input or input changes
              */
-    
-            // Setup dialog box for adding a new image
-            $("#newImageDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-            $('#newImageCancel').click( function() {
-                $("#newImageDialog").dialog("close");
-            });
              
-            // Ad a new image button action - pop-up dialog
-            $('#newImageButton').click( function() {
-                $("#newImageDialog").dialog("open");
-            });
-    
-            /*
-             * Map operations
-             */
-  
-           //show error if location can't be found
-           function showError() {
-               alert("Location can't be found");
-           }
-  
-            /*
-             * Google Maps
-             *  API reference: https://developers.google.com/maps/documentation/javascript/reference
-             */
-
-            // Set default - Need to make this configurable
-            var startLat = $('#glmLat').val();
-            var startLon = $('#glmLng').val();
-            var location = new google.maps.LatLng(startLat, startLon);
-               var map = new google.maps.Map(document.getElementById('locationMap'), {  
-                zoom: 15,  
-                disableDefaultUI: false,   
-                mapTypeId: google.maps.MapTypeId.MAP,  
-            });  
-            var geocoder = new google.maps.Geocoder();
-            var marker = new google.maps.Marker({  
-                map: map,  
-                position: location,  
-                draggable: enableDraggable,
-                animation: google.maps.Animation.DROP,  
-                title: "This is your location"  
-            });  
-            map.setCenter(location);  
-
-            // Listen for an end of drag event for the map marker            
-            google.maps.event.addListener(marker,'dragend',function(event) {
-               
-               // Get the end postion
-                glmLat = this.position.lat();
-                glmLng = this.position.lng();
-                
-                // Assign it to the hidden fields for submission
-                $('#glmLat').val(glmLat);
-                $('#glmLng').val(glmLng);
-                
-                // Also display it to the user
-                $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
-            });
+            // Check for any field errors and if found change related tab to error color.
+            if ($('.glm-form-bad-input-general').length) {
+                $('#glm-member-info-general').addClass('glm-bad-input-area');
+            }
             
-            // Resubmit geocoding when address changes
-            function glmGeocode() {
-               
-               // Get all address parts
-                var geoAddr1 = $('#addr1').val().trim();
-               var geoAddr2 = $('#addr2').val().trim();
-               var geoCity = $('#city').find('option:selected').text().trim();
-               var geoState = $('#state').find('option:selected').text().trim();
-               var geoZIP = $('#zip').val().trim();
-               var geoCountry = $('#country').find('option:selected').text().trim();
-               
-               // Assemble address string for 
-                var geoAddress = geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
-                
-               // Send to Google Geocoder
-               geocoder.geocode( { 'address': geoAddress }, function(results, status) {
-
-                       // If we have a geocode solution
-                       if (status == google.maps.GeocoderStatus.OK) {
-
-                               // Center the map and locate the marger to the new location
-                               map.setCenter(results[0].geometry.location);
-                           marker.setPosition( results[0].geometry.location );
-                           
-                           // Assign the new position to the hidden fields for submission
-                        $('#glmLat').val(results[0].geometry.location.lat());
-                        $('#glmLng').val(results[0].geometry.location.lng());
-
-                       // Otherwise tell the user. 
-                   } else {                            
-                       $('#mapPosition').html('<span class="glm-notice">Not able to estimate position from the above address.</span>');
-                   }
-               });
+            // Check for most input changes
+            $('input, textarea, select').on( 'change', function() {
+                updateRequired();
+            }); 
+            
+            // Flag submit button when updates are required.
+            function updateRequired() {
+                $('#updateMemberProfile').addClass('glm-bad-input-area');
             }
-
-            $('.glm-geocodeAction').change( function() {
-                glmGeocode();  
-            });
-
-            // Flash certain elements for a short time after display      
-            $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-
+            
         });
     </script>
             
index 065e96d..eaf7dd5 100644 (file)
@@ -1,7 +1,7 @@
 {include file='admin/members/header.html'}
     
 {if apply_filters('glm_members_permit_admin_members_index_add_member', true)}
-    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&option=add" class="button button-primary glm-button glm-right">Add A New Member</a>
+    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberEdit&option=add" class="button button-primary glm-button glm-right">Add A New Member</a>
 {/if}
     <h2 class="glm-left">Main Dashboard</h2>
     
             <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=categories">Click here to add Member Categories.</a></td>
         </tr>
   {/if}                
-  {if !$haveAccommodationTypes}
-        <tr>
-            <th><span class="glm-error">You do not have any Accommodation Types setup.</span></th>
-            <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=accommodationTypes">Click here to add Accommodation Types.</a></td>
-        </tr>
-  {/if}                
   {if !$haveAmenities}
         <tr>
             <th><span class="glm-error">You do not have any Amenities setup.</span></th>
@@ -56,7 +50,7 @@
         <tr><td colspan="2">&nbsp;</td></tr>
         <tr>
            <th> <span class="glm-error">You do not have any members listed.</span></th>
-            <td><a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&option=add">Click here to create your first member.</a></td>
+            <td><a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberEdit&option=add">Click here to create your first member.</a></td>
         </tr>
 {/if}                
     </table>
     </table>
 
 {if $haveBadLatLon}
-    <h3>Member Information with Bad Map Location Information</h3>
+    <h3 class="glm-error">&nbsp;<br>Member Profile with Bad Map Location Information</h3>
     
     <table class="wp-list-table widefat fixed posts glm-admin-table">
         <thead>
             <tr>
                 <th>Member Name</th>
-                <th>Last Updated</th>
-                <th>Reference Name</th>
-                <th>&nbsp;</th>
+                <th>Created</th>
             </tr>
         </thead>
         <tbody>
             <tr class="alternate">
         {/if}
                 <td>
-                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&id={$p.id}}">{$p.member}</a>
-                </td>
-                <td>
-                    {$p.modify_time.datetime}
-                </td>
-                <td>
-                    {$p.reference_name}
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberEdit&memberID={$p.id}">{$p.name}</a>
                 </td>
                 <td>
-                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&id={$p.id}}" class="button button-secondary glm-button-small glm-right">Manage</a>
+                    {$p.created.date}
                 </td>
             </tr>
     {/foreach}
 {/if}
 
 {if $membersPending}
-    <h3>Pending Member Information</h3>
+    <h3 class="glm-error">&nbsp;<br>Pending Member Profile</h3>
     
     <table class="wp-list-table widefat fixed posts glm-admin-table"">
         <thead>
             <tr class="alternate">
         {/if}
                 <td>
-                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&memberInfo={$p.id}}">{$p.member}</a>
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&memberInfo={$p.id}">{$p.member}</a>
                 </td>
                 <td>
                     {$p.modify_time.datetime}
index bfa4ced..fbecd96 100644 (file)
@@ -27,8 +27,6 @@
                 <th>Access</th>
                 <th>Member Type</th>
                 <th>Date Created</th>
-                <th>Pending</th>
-                <th>&nbsp;</th>
             </tr>
         </thead>
         <tbody>
@@ -42,6 +40,7 @@
         {/if}
                 <td>
                     {$m.id}
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$m.id}&memberInfo={$m.active_id}" class="button button-secondary glm-button-small" style="margin: 0 .2em 0 .2em;">Active Profile</a>
                 </td>
                 <td class="glm-nowrap">
                     <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}">{$m.name}</a>
                     {$m.access_short.name}
                 </td>
                 <td>
-                    {$m.member_type.name}
+                    {$m.member_type_short}
                 </td>
                 <td>
                     {$m.created.date}
                 </td>
-                <td>
-                    {if $m.pending > 0}<span class="glm-notice">{$m.pending} Pending</span>{/if}
-                </td>
-                <td>
-                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$m.id}&memberInfo={$m.active_id}" class="button button-secondary glm-button-small glm-right" style="margin: 0 .2em 0 .2em;">Active Info</a>
-                </td>
             </tr>
     {/foreach}
 {else}