See logs for all the stuff that's been done.
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 11 Nov 2015 18:22:51 +0000 (13:22 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 11 Nov 2015 18:22:51 +0000 (13:22 -0500)
33 files changed:
classes/data/dataAccommodationTypes.php
classes/data/dataAmenities.php
classes/data/dataCategories.php
classes/data/dataCategoryMemberInfo.php
classes/data/dataCities.php
classes/data/dataImages.php
classes/data/dataMemberInfo.php
classes/data/dataMemberTypes.php
classes/data/dataMembers.php
classes/data/dataRegions.php
classes/glmPluginSupport.php
config/plugin.ini
controllers/admin.php
controllers/front.php
css/admin.css
defines.php
glm-member-db.php
js/admin.js
js/imageUpload/imageUpload.js
lib/EasyPassword/EasyPassword.php
lib/EasyPassword/EasyPassword.words
lib/GlmDataAbstract/DataAbstract.php
misc/databaseScripts/create_database_V1.0.43.sql
misc/databaseScripts/drop_database_V1.0.43.sql
misc/databaseScripts/update_database_V1.0.43.sql
models/admin/member/index.php
models/admin/member/memberInfo.php
models/admin/members/list.php
views/admin/member/header.html
views/admin/member/index.html
views/admin/member/memberInfo.html
views/admin/members/header.html
views/admin/members/list.html

index ef803e5..230fde5 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataAccommodationTypes extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
index a8b2054..8dd8165 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataAmenities extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
index 2fe5422..8eef456 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataCategories extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
@@ -136,7 +136,7 @@ class GlmDataCategories extends GlmDataAbstract
                         'required' => false,
                         'use' => 'a'
                 ),
-
+/*
                 // Parent ID
                 'parent_id' => array(
                         'field' => 'parent',
@@ -144,7 +144,7 @@ class GlmDataCategories extends GlmDataAbstract
                         'type' => 'integer',
                         'use' => 'a'
                 ),
-
+*/
                 // Description
                 'descr' => array(
                         'field' => 'descr',
@@ -267,7 +267,7 @@ class GlmDataCategories extends GlmDataAbstract
         // Check if the new category name/parent already exists
         $sql = "
             SELECT id
-              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cateogry
+              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
              WHERE name = '$name'
                AND parent = $parentID
         ;";
index 5cfeb56..68ef0b8 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataCategoryMemberInfo extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
index 8b4156c..591aeee 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataCities extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
index e40e06e..36a7180 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataImages extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
@@ -375,14 +375,23 @@ class GlmDataImages extends GlmDataAbstract
                                     glmMembersAdmin::addNotice("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Deleting size $k.", 'Process');
                                 }
 
-                                // Delete each image size
-                                unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$imgData['file_name']);
+                                // Check if the image actually exists - May not if we're doing development
+                                if (is_file(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$imgData['file_name'])) {
+
+                                    // Delete each image size
+                                    unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$imgData['file_name']);
+
+                                }
 
                             }
 
-                            // Also delete the original
-                            unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/original/'.$imgData['file_name']);
+                            // Check if the image actually exists - May not if we're doing development
+                            if (is_file(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/original/'.$imgData['file_name'])) {
 
+                                // Also delete the original
+                                unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/original/'.$imgData['file_name']);
+
+                            }
                         }
                     }
                 }
@@ -441,9 +450,13 @@ class GlmDataImages extends GlmDataAbstract
                 reset($sizes);
                 while (list($k, $v) = each($sizes)) {
 
-                    // Copy src file to dst file for this size
-                    copy(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$srcName, GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$dstName);
+                    // Check if the source image exists
+                    if (is_file(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$srcName)) {
 
+                        // Copy src file to dst file for this size
+                        copy(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$srcName, GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$dstName);
+
+                    }
                 }
 
                 // Add this image to the images table
index 23e1d60..f58a524 100644 (file)
@@ -42,296 +42,296 @@ class GlmDataMemberInfo extends GlmDataAbstract
      */
     public $config;
     /**
-        * Field definitions
-        *
-        * @var $ini
-        * @access public
-        */
-       public $table;
+     * 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;
+    /**
+     * 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 . 'member_info';
-
-               /*
-                * Table Data Fields
-                */
-               $this->fields = array (
-
-                               'id' => array (
-                                               'field' => 'id',
-                                               'type' => 'integer',
-                                               'view_only' => true,
-                                               'use' => 'a'
-                               ),
-
-                       // Member Pointer
-                       'member' => array (
-                               'field' => 'member',
-                               'type' => 'pointer',
-                            'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
-                            'p_field' => 'name',
-                                   'p_static' => true,
-                               'required' => true,
-                               'use' => 'a'
-                       ),
-
-                       // Member Name (stored by member updates) for sorting
-                       'member_name' => array(
-                        'field' => 'member_name',
-                               'type' => 'text',
-                               'use' => 'lg'
-                       ),
-
-                       // Member Slug
-                       'member_slug' => array (
-                               'field' => 'member',
-                               'as' => 'member_slug',
-                               'type' => 'pointer',
-                            'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
-                            'p_field' => 'member_slug',
-                                   'p_static' => true,
-                               'required' => true,
-                               'use' => 'gle'
-                       ),
-
-                       // Member Pointer index
-                       'member_pointer' => array (
-                               'field' => 'member',
-                               'as' => 'member_pointer',
-                               'type' => 'integer',
-                               'required' => true,
-                               'use' => 'gle'
-                       ),
-
-                       // Reference Name - Not displayed to user
-                       'reference_name' => array (
-                                       'field' => 'reference_name',
-                                       'type' => 'text',
-                                       'use' => 'a'
-                       ),
-
-                       // Status
-                               'status' => array (
-                                               'field' => 'status',
-                                       'type' => 'list',
-                                       'list' => $this->config['status'],
-                                       'required' => true,
-                                       'default' => $this->config['status_numb']['Pending'],
-                                       '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',
-                               'type' => 'text',
-                               'use' => 'a'
-                       ),
-
-                       // Short description
-                       'short_descr' => array (
-                                       'field' => 'short_descr',
-                                       'type' => 'text',
-                               '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',
-                                   'p_blank' => true,
-                               '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'
-                       )
-
-               );
-
-               if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-                   glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
-               }
+    /**
+     * 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 . 'member_info';
+
+        /*
+         * Table Data Fields
+         */
+        $this->fields = array (
+
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Member Pointer
+            'member' => array (
+                'field' => 'member',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
+                    'p_field' => 'name',
+                    'p_static' => true,
+                'required' => true,
+                'use' => 'a'
+            ),
+
+            // Member Name (stored by member updates) for sorting
+            'member_name' => array(
+                'field' => 'member_name',
+                'type' => 'text',
+                'use' => 'lg'
+            ),
+
+            // Member Slug
+            'member_slug' => array (
+                'field' => 'member',
+                'as' => 'member_slug',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
+                    'p_field' => 'member_slug',
+                    'p_static' => true,
+                'required' => true,
+                'use' => 'gle'
+            ),
+
+            // Member Pointer index
+            'member_pointer' => array (
+                'field' => 'member',
+                'as' => 'member_pointer',
+                'type' => 'integer',
+                'required' => true,
+                'use' => 'gle'
+            ),
+
+            // Reference Name - Not displayed to user
+            'reference_name' => array (
+                'field' => 'reference_name',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Status
+            'status' => array (
+                'field' => 'status',
+                'type' => 'list',
+                'list' => $this->config['status'],
+                'required' => true,
+                'default' => $this->config['status_numb']['Pending'],
+                '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',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Short description
+            'short_descr' => array (
+                'field' => 'short_descr',
+                'type' => 'text',
+                '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',
+                    'p_blank' => true,
+                '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'
+            )
+
+        );
+
+        if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+        }
 
        }
 
@@ -362,32 +362,32 @@ class GlmDataMemberInfo extends GlmDataAbstract
 
         return false;
 
-       }
+    }
 
-       /*
-        * 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)
-       {
+    /*
+     * 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 ($a != 'l' && $a != 'g' && $a != 'e') {
-               return $r;
-           }
+        // Only run these tests for 'l' (getList), 'g' (getEntry), 'e' (editEntry)
+        if ($a != 'l' && $a != 'g' && $a != 'e') {
+            return $r;
+        }
 
-           // Get Member Category data for this entry
-           $sql = "
+        // 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 (
                         (
@@ -401,92 +401,92 @@ class GlmDataMemberInfo extends GlmDataAbstract
              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.*
-                FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "amenities AS A,
-                     ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "amenity_ref AS R
-               WHERE R.ref_type = ".$this->config['ref_type_numb']['MemberInfo']."
-                 AND R.ref_dest = ".$r['id']."
-                 AND A.id = R.amenity
+        $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
+
+        // Get Amenity Data for this entry
+        $sql = "
+           SELECT A.*
+             FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "amenities AS A,
+                  ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "amenity_ref AS R
+            WHERE R.ref_type = ".$this->config['ref_type_numb']['MemberInfo']."
+              AND R.ref_dest = ".$r['id']."
+              AND A.id = R.amenity
         ;";
-           $r['amenities'] = $this->wpdb->get_results($sql, ARRAY_A);
+        $r['amenities'] = $this->wpdb->get_results($sql, ARRAY_A);
 
-           return $r;
-       }
+        return $r;
+    }
 
-       /*
-        * Get Apha list of first characters in member name
-        * for those members that have active info.
-        *
-        * @param string $where Where clause
-        *     Note the table refernces M and I.
-        * @param string $selected Optional selected alpha character
-        *
-        * @return object Class object
-        *
-        */
-       public function getAlphaList($where = '', $selected = '')
-       {
-
-           $sql = "
-              SELECT DISTINCT LEFT(M.name, 1) AS alpha
-                FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "members M,
-                     ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "member_info T
-               WHERE T.status = ".$this->config['status_numb']['Active']."
-                 AND M.id = T.member
-                     $where
-               ORDER BY alpha
-           ;";
-           $alphaData = $this->wpdb->get_results($sql, ARRAY_A);
+    /*
+     * Get Apha list of first characters in member name
+     * for those members that have active info.
+     *
+     * @param string $where Where clause
+     *     Note the table refernces M and I.
+     * @param string $selected Optional selected alpha character
+     *
+     * @return object Class object
+     *
+     */
+    public function getAlphaList($where = '', $selected = '')
+    {
 
-           // Set selected
-           foreach ($alphaData as $k=>$v) {
-               $alphaData[$k]['default'] = ($v['alpha'] == $selected);
-           }
+        $sql = "
+           SELECT DISTINCT LEFT(M.name, 1) AS alpha
+             FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "members M,
+                  ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "member_info T
+            WHERE T.status = ".$this->config['status_numb']['Active']."
+              AND M.id = T.member
+                  $where
+            ORDER BY alpha
+        ;";
+        $alphaData = $this->wpdb->get_results($sql, ARRAY_A);
 
-           return $alphaData;
+        // Set selected
+        foreach ($alphaData as $k=>$v) {
+            $alphaData[$k]['default'] = ($v['alpha'] == $selected);
+        }
 
-       }
+        return $alphaData;
 
-       /*
-        * Get simplified list of member info records.
-        *
-        * @param string $where Where clause
-        *     Note the table refernces M and I.
-        *
-        * @return object Class object
-        *
-        */
-       public function getSimpleMemberInfoList($where = '')
-       {
-
-           // Save current list of fields
-           $f = $this->fields;
-
-           // Replace fields list with limited list
-           $this->fields = array(
-                       'id' => $f['id'],
-               'member' => $f['member'],
-               'member_name' => $f['member_name'],
-               'member_slug' => $f['member_slug'],
-               'member_pointer' => $f['member_pointer'],
-               'reference_name' => $f['reference_name'],
-                       'status' => $f['status'],
-               'create_time' => $f['create_time'],
+    }
+
+    /*
+     * Get simplified list of member info records.
+     *
+     * @param string $where Where clause
+     *     Note the table refernces M and I.
+     *
+     * @return object Class object
+     *
+     */
+    public function getSimpleMemberInfoList($where = '')
+    {
+
+        // Save current list of fields
+        $f = $this->fields;
+
+        // Replace fields list with limited list
+        $this->fields = array(
+            'id' => $f['id'],
+            'member' => $f['member'],
+            'member_name' => $f['member_name'],
+            'member_slug' => $f['member_slug'],
+            'member_pointer' => $f['member_pointer'],
+            'reference_name' => $f['reference_name'],
+            'status' => $f['status'],
+            'create_time' => $f['create_time'],
             'modify_time' => $f['modify_time']
-           );
+        );
 
-           // Get the simplified list
-           $list = $this->getList($where);
+        // Get the simplified list
+        $list = $this->getList($where);
 
-           // Restore full fields list
-           $this->fields = $f;
+        // Restore full fields list
+        $this->fields = $f;
 
-           return $list;
-       }
+        return $list;
+    }
 
 
 }
index 887f3bb..935605b 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataMemberTypes extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
@@ -108,28 +108,28 @@ class GlmDataMemberTypes extends GlmDataAbstract
          */
         $this->fields = array(
 
-                'id' => array(
-                        'field' => 'id',
-                        'type' => 'integer',
-                        'view_only' => true,
-                        'use' => 'a'
-                ),
-
-                // Member Type Name
-                'name' => array(
-                        'field' => 'name',
-                        'type' => 'text',
-                        'required' => true,
-                        'unique' => true,
-                        'use' => 'a'
-                ),
-
-                // Description
-                'descr' => array(
-                        'field' => 'descr',
-                        'type' => 'text',
-                        'use' => 'a'
-                )
+            'id' => array(
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Member Type Name
+            'name' => array(
+                'field' => 'name',
+                'type' => 'text',
+                'required' => true,
+                'unique' => true,
+                'use' => 'a'
+            ),
+
+            // Description
+            'descr' => array(
+                'field' => 'descr',
+                'type' => 'text',
+                'use' => 'a'
+            )
 
 
         );
index d1e7739..296a0bd 100644 (file)
@@ -41,195 +41,195 @@ class GlmDataMembers extends GlmDataAbstract {
      */
     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)
-       {
+     * 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 . 'members';
-
-               /*
-                * Table Data Fields
-                */
-               $this->fields = array (
-
-                               'id' => array (
-                                               'field' => 'id',
-                                               'type' => 'integer',
-                                               'view_only' => true,
-                                               'use' => 'a'
-                               ),
-
-                               // Status
-                               'access' => array (
-                                               'field' => 'access',
-                                       'type' => 'list',
-                                       'list' => $this->config['memb_access'],
-                                           'l_blank' => true,
-                                       'required' => true,
-                                       'default' => 30,
-                                       'force_list' => true,
-                                       'use' => 'a'
-                               ),
-
-                               // Member Type
-                               'member_type' => array (
-                                               'field' => 'member_type',
-                                               'type' => 'pointer',
-                                           'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_type',
-                                           'p_field' => 'name',
-                                           'p_orderby' => 'name',
-                                           'p_blank' => true,
-                                               'required' => true,
-                                       'force_list' => true,
-                                               'use' => 'a'
-                               ),
-
-                       // Member Name
-                               'name' => array (
-                                               'field' => 'name',
-                                               'type' => 'text',
-                                               'required' => true,
-                                       'unique' => true,
-                                               'use' => 'a'
-                               ),
-
-                       // Member Name (stored by member updates) for sorting
-                       'member_slug' => array(
-                               'field' => 'member_slug',
-                               'type' => 'text',
-                               'required' => true,
-                               'use' => 'a'
-                       ),
-
-                       // Date created
-                       'created' => array (
-                               'field' => 'created',
-                               'type' => 'date',
-                               'required' => true,
-                               'use' => 'a'
-                       ),
-
-                       // Active Version
-                       'active_id' => array (
-                               'field' => 'id',
-                        'as' => 'active_id',
-                               'type' => 'pointer',
-                                 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_info',
-                                 'p_field' => 'id',
-                                 'p_id' => 'member',
-                                 'p_where' => 'status = '.$this->config['status_numb']['Active'],
-                               'p_static' => true,
-                               'use' => 'gl'
-                       ),
-
-                       /*
-                        *  Has pending information
-                        *
-                        *  This is returning the sum of the ID field for all matching entries in the other table
-                        *  where the ID of the member entry is equal to the 'member' column in the member_info
-                        *  table and only for those entries where the status column is set to Pending.
-                        *
-                        *  If this returns a value of 0, there are no pending informaation records for this member.
-                        *  If it returns a positive value, there are. The actual positive number returned is
-                        *  of course not anything useable, only that it's positive.
-                        *
-                        */
-                       'pending' => array (
-                               'field' => 'id',
-                        'as' => 'pending',
-                               'type' => 'pointer',
-                                 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_info',
-                                 'p_field' => 'member',
-                                 'p_id' => 'member',
-                                 'p_where' => 'status = '.$this->config['status_numb']['Pending'],
-                                 'p_sum' => true,
-                               'use' => 'gl'
-                       )
-
-               );
-
-               if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-                   glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
-               }
-
-       }
-
-       /*
-        * Get a simple members list - Name and ID only
-        *
-        * @return array Array of Name and ID for all members
-        * @access public
-        */
-       public function getSimpleMembersList()
-       {
-
-           // 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();
-
-           // Restore the fields list
-           $this->fields = $fSave;
-
-           return $memberList;
-       }
+        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 . 'members';
+
+        /*
+         * Table Data Fields
+         */
+        $this->fields = array (
+
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Status
+            'access' => array (
+                'field' => 'access',
+                'type' => 'list',
+                'list' => $this->config['memb_access'],
+                    'l_blank' => true,
+                'required' => true,
+                'default' => 30,
+                'force_list' => true,
+                'use' => 'a'
+            ),
+
+            // Member Type
+            'member_type' => array (
+                'field' => 'member_type',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_type',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
+                    'p_blank' => true,
+                'required' => true,
+                'force_list' => true,
+                'use' => 'a'
+            ),
+
+            // Member Name
+            'name' => array (
+                'field' => 'name',
+                'type' => 'text',
+                'required' => true,
+                'unique' => true,
+                'use' => 'a'
+            ),
+
+            // Member Name (stored by member updates) for sorting
+            'member_slug' => array(
+                'field' => 'member_slug',
+                'type' => 'text',
+                'required' => true,
+                'use' => 'a'
+            ),
+
+            // Date created
+            'created' => array (
+                'field' => 'created',
+                'type' => 'date',
+                'required' => true,
+                'use' => 'a'
+            ),
+
+            // Active Version
+            'active_id' => array (
+                'field' => 'id',
+                'as' => 'active_id',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_info',
+                    'p_field' => 'id',
+                    'p_id' => 'member',
+                    'p_where' => 'status = '.$this->config['status_numb']['Active'],
+                'p_static' => true,
+                'use' => 'gl'
+            ),
+
+            /*
+             *  Has pending information
+             *
+             *  This is returning the sum of the ID field for all matching entries in the other table
+             *  where the ID of the member entry is equal to the 'member' column in the member_info
+             *  table and only for those entries where the status column is set to Pending.
+             *
+             *  If this returns a value of 0, there are no pending informaation records for this member.
+             *  If it returns a positive value, there are. The actual positive number returned is
+             *  of course not anything useable, only that it's positive.
+             *
+             */
+            'pending' => array (
+                    'field' => 'id',
+                    'as' => 'pending',
+                    'type' => 'pointer',
+                      'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_info',
+                      'p_field' => 'member',
+                      'p_id' => 'member',
+                      'p_where' => 'status = '.$this->config['status_numb']['Pending'],
+                      'p_sum' => true,
+                    'use' => 'gl'
+            )
+
+        );
+
+        if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+        }
+
+    }
+
+    /*
+     * Get a simple members list - Name and ID only
+     *
+     * @return array Array of Name and ID for all members
+     * @access public
+     */
+    public function getSimpleMembersList()
+    {
+
+        // 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();
+
+        // Restore the fields list
+        $this->fields = $fSave;
+
+        return $memberList;
+    }
 
 }
 
index 09ccaef..7d79840 100644 (file)
@@ -88,15 +88,15 @@ class GlmDataRegions extends GlmDataAbstract
     {
 
         // If this class is not being extended along with existing $wpdb and $config
-           if (!$this->wpdb) {
+        if (!$this->wpdb) {
 
-           // Save WordPress Database object
-           $this->wpdb = $wpdb;
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
 
-           // Save plugin configuration object
-           $this->config = $config;
+            // Save plugin configuration object
+            $this->config = $config;
 
-           }
+        }
 
         /*
          * Table Name
@@ -108,35 +108,35 @@ class GlmDataRegions extends GlmDataAbstract
          */
         $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'
-                )
+            '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'
+            )
 
 
         );
index 93b18a6..8d6ca55 100644 (file)
@@ -38,7 +38,7 @@ class GlmPluginSupport
             '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' => 27)
+            '1.0.43' => array('version' => '1.0.43', 'tables' => 26)
     );
 
     /*
index 15c6d2d..0b18102 100644 (file)
@@ -113,28 +113,6 @@ facility_type_numb['BedAndBreakfast'] = 20
 facility_type_numb['Restaurant'] = 30
 facility_type_numb['Golf'] = 40
 
-;
-; Contact Type
-;
-contact_type[0] = 'None'
-contact_type[10] = 'Personal'
-contact_type[20] = 'Role'
-
-contact_type_numb['None'] = 0
-contact_type_numb['Personal'] = 10
-contact_type_numb['Role'] = 20
-
-;
-; Contact Permissions
-;
-permission_type[0] = 'None'
-permission_type[50] = 'Member All'
-permission_type[99] = 'All'
-
-permission_type_numb['None'] = 0
-permission_type_numb['MemberAll'] = 50
-permission_type_numb['All'] = 99
-
 ;
 ; Invoice Delivery
 ;
index eefa6eb..3eb77fb 100644 (file)
  * @link     http://dev.gaslightmedia.com/
  */
 
-/**
- * Array of valid menu items and actions.
- *
- *
- * The higher level elements are valid menu items. These correlate to
- * actual menu or sub menu items that are hooks back to this controller
- * class.
- *
- * The lower level items below each menu item are actions that may be specified
- * by a "glmMembersAction" form field.
- */
-$GLOBALS['glmMembersAdminValidActions'] = array(
-
-        'ajax' => array(
-                'imageUpload'
-        ),
-        'dashboardWidget' => array(
-                'index'
-        ),
-        'members' => array(
-                'index',            // member list
-                'list',
-                'reports',
-                'other'
-        ),
-        'member' => array(
-                'index',            // Member Dashboard
-                'memberInfo',
-                'locations',
-                'facilities',
-                'activities',
-                'accommodations'
-        )
-        ,
-        'configure' => array(
-                'index',            // Member Types
-                'categories',
-                'cities',
-                'regions',
-                'accommodationTypes',
-                'amenities'
-        ),
-        'management' => array(
-                'index',            // General Options
-                'terms',
-                'development',
-                'import',
-                'addons',
-                'hooks'
-        ),
-        'shortcodes' => array(
-                'index'
-        ),
-        'error' => array(
-                'index',
-                'badAction'
-        )
-);
-
 // Load glmPluginSupport class
 require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
 
@@ -207,27 +148,30 @@ class glmMembersAdmin extends GlmPluginSupport
             exit();
         }
 
-        // Add hooks to WordPress
+        // Add admin menus
         add_action('admin_menu',
-                array(
-                        $this,
-                        'configureMenus'
-                ));
+            array(
+                $this,
+                'configureMenus'
+            )
+        );
 
         // Add admin scripts and css
         add_action('admin_enqueue_scripts',
-                array(
-                        $this,
-                        'glmMembersAdminScripts'
-                ));
+            array(
+                $this,
+                'glmMembersAdminScripts'
+            )
+        );
 
         // Add dashboard widget
         add_action( 'wp_dashboard_setup',
-                array(
-                        $this,
-                        'glmMembersAdminDashboardWidget'
+            array(
+                $this,
+                'glmMembersAdminDashboardWidget'
 
-                ));
+            )
+        );
 
         // Add AJAX image upload action
         add_action( 'wp_ajax_glm_members_admin_ajax',
@@ -273,10 +217,10 @@ class glmMembersAdmin extends GlmPluginSupport
         }
 
         // Check for a valid action
-        if (!in_array($glmAction, $GLOBALS['glmMembersAdminValidActions']['ajax'], true)) {
+        if (!isset($GLOBALS['glmMembersValidActions']['adminActions']['ajax'][$glmAction])) {
 
             // Menu item/Action not in valid actions array
-            trigger_error ( 'ERROR: The specified action is not valid.', E_USER_ERROR);
+            trigger_error ( 'ERROR: The specified action is not valid - '.$glmAction, E_USER_ERROR);
         }
 
         // Build model and path and class names
@@ -380,77 +324,74 @@ class glmMembersAdmin extends GlmPluginSupport
     {
 
         // Add a new main menu item for management and display of Members
-        add_menu_page('Members', 'Member DB', 'glm_members_edit',
-                'glm-members-admin-menu-members',
-                array(
-                        $this,
-                        'glmMembersAdminMenuMembers'
-                ), false, '91.123');
-
-        /*
-         *  Add a submenu for the "Members" section
-         *  Note that this uses the main menu item's slug for both the parent and menu slug
-         *  to create a sub-menu with a title different from the main menu title
-         */
-
-        add_submenu_page('glm-members-admin-menu-members', 'Members',
-                'Members', 'glm_members_edit', 'glm-members-admin-menu-members',
-                array(
-                        $this,
-                        'glmMembersAdminMenuMembers'
-                ));
+        add_menu_page(
+            'Members',
+            'Member DB',
+            'glm_members_edit',
+            'glm-members-admin-menu-members',
+            function() {$this->controller('members');},
+            false,
+            '91.123'
+        );
 
         // Add a submenu for Member List
-        add_submenu_page('glm-members-admin-menu-members', 'Member List',
-                '&nbsp;&nbsp;Member List', 'glm_members_edit', 'glm-members-admin-menu-members-list',
-                array(
-                        $this,
-                        'glmMembersAdminMenuMembersList'
-                ));
+        add_submenu_page(
+            'glm-members-admin-menu-members',
+            'Member List',
+            '&nbsp;&nbsp;Member List',
+            'glm_members_edit',
+            'glm-members-admin-menu-members-list',
+            function() {$this->controller('members', 'list');}
+        );
 
         // Add a submenu for the "Member" section
-        add_submenu_page('glm-members-admin-menu-members', 'Member Information',
-                'Add Member', 'glm_members_edit', 'glm-members-admin-menu-member',
-                array(
-                        $this,
-                        'glmMembersAdminMenuMember'
-                ));
+        add_submenu_page(
+            'glm-members-admin-menu-members',
+            'Member Information',
+            'Add Member',
+            'glm_members_edit',
+            'glm-members-admin-menu-member',
+            function() {$this->controller('member');}
+        );
 
         // Add a submenu for the "Configure" section
-        add_submenu_page('glm-members-admin-menu-members',
-                'Configure Members Database', 'Configure',
-                'glm_members_configure', 'glm-members-admin-menu-configure',
-                array(
-                        $this,
-                        'glmMembersAdminMenuConfigure'
-                ));
+        add_submenu_page(
+            'glm-members-admin-menu-members',
+            'Configure Members Database',
+            'Configure',
+            'glm_members_configure',
+            'glm-members-admin-menu-configure',
+            function() {$this->controller('configure');}
+        );
 
         // Add a submenu for the "Management" section
-        add_submenu_page('glm-members-admin-menu-members',
-                'Member DB Management', 'Management',
-                'glm_members_management', 'glm-members-admin-menu-management',
-                array(
-                        $this,
-                        'glmMembersAdminMenuManagement'
-                ));
+        add_submenu_page(
+            'glm-members-admin-menu-members',
+            'Member DB Management',
+            'Management',
+            'glm_members_management',
+            'glm-members-admin-menu-management',
+            function() {$this->controller('management');}
+        );
 
         // Add a submenu for the "Shortcode Reference" section
-        add_submenu_page('glm-members-admin-menu-members',
-                'Shortcode Reference', 'Shortcodes',
-                'glm_members_info', 'glm-members-admin-menu-shortcodes',
-                array(
-                        $this,
-                        'glmMembersAdminMenuShortcodes'
-                ));
-
-
+        add_submenu_page(
+            'glm-members-admin-menu-members',
+            'Shortcode Reference',
+            'Shortcodes',
+            'glm_members_info',
+            'glm-members-admin-menu-shortcodes',
+            function() {$this->controller('shortcodes');}
+        );
 
+        // For each add-on, read in their menu additions
+        foreach ($this->config['addOns'] as $a) {
+            require_once(GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/setup/adminMenus.php');
+            require_once(GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/setup/adminTabs.php');
+        }
 
     }
 
-
-
-
     /**
      * Add Admin Dashboard Widget
      *
@@ -467,12 +408,9 @@ class glmMembersAdmin extends GlmPluginSupport
         if ( current_user_can( 'glm_members_info' ) ) {
 
             wp_add_dashboard_widget(
-                    'glm_members_admin_dashboard_widget',
-                    'Member DB Summary',
-                    array(
-                            $this,
-                            'glmMembersAdminDashboardContent'
-                    )
+                'glm_members_admin_dashboard_widget',
+                'Member DB Summary',
+                function() {$this->controller('dashboardWidget'); }
             );
 
             // Set widget default position to right column
@@ -484,68 +422,6 @@ class glmMembersAdmin extends GlmPluginSupport
         }
     }
 
-    /**
-     * Admin dashboard widget content
-     *
-     * (no prameters)
-     *
-     * @return void
-     * @access public
-     */
-
-
-    /*
-     * Menu item specific "Callback" methods
-     *
-     * These methods are called by WordPress when specific menu items are
-     * selected by the
-     * user or a form action is submitted associated with the menu item.
-     *
-     * These methods call the controller and pass it the menu item that was
-     * called
-     * but perform no other work.
-     *
-     */
-
-    // Dashboard Widget
-    public function glmMembersAdminDashboardContent ()
-    {
-        $this->controller('dashboardWidget');
-    }
-
-    // Main Plugin Menu Item
-    public function glmMembersAdminMenuMembers ()
-    {
-        $this->controller('members');
-    }
-
-    // A test third-level admin menu
-    public function glmMembersAdminMenuMembersList()
-    {
-        $this->controller('members', 'list');
-    }
-
-    // Add Sub Menu Items
-    public function glmMembersAdminMenuMember ()
-    {
-        $this->controller('member');
-    }
-
-    public function glmMembersAdminMenuConfigure ()
-    {
-        $this->controller('configure');
-    }
-
-    public function glmMembersAdminMenuManagement ()
-    {
-        $this->controller('management');
-    }
-
-    public function glmMembersAdminMenuShortcodes ()
-    {
-        $this->controller('shortcodes');
-    }
-
     /**
      * Admin controller
      *
@@ -598,6 +474,7 @@ class glmMembersAdmin extends GlmPluginSupport
      */
     public function controller ($menuItem, $action = false)
     {
+
         $errorMsg = '';
 
         /*
@@ -669,7 +546,7 @@ class glmMembersAdmin extends GlmPluginSupport
             $modelRedirect = false;
 
             // Verify that we have the requested menu item in the valid actions
-            if (!isset($GLOBALS['glmMembersAdminValidActions'][$menuItem])) {
+            if (!isset($GLOBALS['glmMembersValidActions']['adminActions'][$menuItem])) {
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
                     $this->addNotice('<b>Error in Admin Controller:</b> Menu Item not specified!', 'Alert');
@@ -678,13 +555,13 @@ class glmMembersAdmin extends GlmPluginSupport
                 $modelRedirect = true;
                 $menuItem = 'error';
                 $action = 'index';
-                $errorMsg .= "<b>Model doesn't exist:</b> ".$modelName;
+                $errorMsg .= "<b>Menu not in valid list:</b> ".$menuItem;
 
             }
 
             // Verify Menu item and action using array at top of this file
-            if (! isset($GLOBALS['glmMembersAdminValidActions'][$menuItem]) ||
-                     ! in_array($action, $GLOBALS['glmMembersAdminValidActions'][$menuItem])) {
+            if (! isset($GLOBALS['glmMembersValidActions']['adminActions'][$menuItem]) ||
+                     ! isset($GLOBALS['glmMembersValidActions']['adminActions'][$menuItem][$action])) {
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
                     $this->addNotice('<b>Error in Admin Controller:</b> Requested Menu Item is invalid! - '.$menuItem, 'Alert');
@@ -698,13 +575,16 @@ class glmMembersAdmin extends GlmPluginSupport
              * Execute the selected model
              */
 
+            // Get name of plugin where model and view are located
+            $plugIn = $GLOBALS['glmMembersValidActions']['adminActions'][$menuItem][$action];
+
             // Build model and path and class names
-            $modelName = GLM_MEMBERS_PLUGIN_PATH . '/models/admin/' . $menuItem .
-                     '/' . $action . '.php';
+            $modelName = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "$plugIn/models/admin/$menuItem/$action.php";
             $className = 'GlmMembersAdmin_' . $menuItem . '_' . $action;
 
             // Create hook to add page tabs by add-on plugins
             $addOnTabs = array();
+
             $addOnTabs = apply_filters(
                 'glm-member-db-add-tab-for-'.$menuItem,
                 $addOnTabs
@@ -777,7 +657,9 @@ class glmMembersAdmin extends GlmPluginSupport
                     }
 
                     // Check for invalid or missing view file
-                    if (!$view || !is_file(GLM_MEMBERS_PLUGIN_PATH . '/views/'.$view)) {
+                    $viewFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "$plugIn/views/$view";
+
+                    if (!$view || !is_file($viewFile)) {
 
                         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
                             $this->addNotice("<b>Error in Admin Controller:</b> Requested View file doesn't exist - ".$view, 'Alert');
@@ -831,6 +713,8 @@ class glmMembersAdmin extends GlmPluginSupport
         // Load Smarty Template support
         $smarty = new smartyTemplateSupport();
 
+        $smarty->template->addTemplateDir(GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "$plugIn/views");
+
         // Add standard template parameters
         $smarty->templateAssign ( 'addOnTabs', $addOnTabs);
         $smarty->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
@@ -854,7 +738,6 @@ class glmMembersAdmin extends GlmPluginSupport
 
         $smarty->templateAssign ( 'thisAction', $action);
 
-
         // If there's an error message, add that also
         if ($errorMsg != '') {
             $smarty->templateAssign('errorMsg', $errorMsg);
@@ -877,7 +760,6 @@ class glmMembersAdmin extends GlmPluginSupport
         }
 
         // Generate output from model data and view
-
         $smarty->template->display($view);
 
         // Restore timezone that was set before our code was called
index 3bab226..f8cea96 100644 (file)
  * @link     http://dev.gaslightmedia.com/
  */
 
-/**
- * Array of valid menu items and actions.
- *
- *
- * The higher level elements are valid menu items. These correlate to
- * actual menu or sub menu items that are hooks back to this controller
- * class.
- *
- * The lower level items below each menu item are actions that may be specified
- * by a "glmMembersAction" form field.
- */
-$GLOBALS['glmMembersFrontValidActions'] = array(
-
-        'members' => array(
-                'list',
-                'detail'
-        ),
-        'error' => array(
-                'index',
-                'badAction'
-        )
-
-);
-
 // Load glmPluginSupport class
 require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
 
@@ -81,39 +57,45 @@ class glmMembersFront extends GlmPluginSupport
 
         // Setup rewrite for member detail pages
         add_filter( 'rewrite_rules_array',
-                array(
-                        $this,
-                        'glm_members_insert_rewrite_rules'
-                ));
+            array(
+                $this,
+                'glm_members_insert_rewrite_rules'
+            )
+        );
         add_filter('query_vars',
-                array(
-                        $this,
-                        'glm_members_RewriteQueryVars'
-                ));
+            array(
+                $this,
+                'glm_members_RewriteQueryVars'
+            )
+        );
         add_filter( 'init',
-                array(
-                        $this,
-                        'glm_members_flush_rules'
-                ));
+            array(
+                $this,
+                'glm_members_flush_rules'
+            )
+        );
 
         // Add front-end scripts and css
         add_action('wp_enqueue_scripts',
-                array(
-                        $this,
-                        'glmMembersFrontScripts'
-                ));
+            array(
+                $this,
+                'glmMembersFrontScripts'
+            )
+        );
 
         add_shortcode('glm-members-list',
-                array(
-                        $this,
-                        'controller'
-                ));
+            array(
+                $this,
+                'controller'
+            )
+        );
 
         add_shortcode('glm-member-detail',
-                array(
-                        $this,
-                        'controller'
-                ));
+            array(
+                $this,
+                'controller'
+            )
+        );
 
     }
 
@@ -167,7 +149,8 @@ class glmMembersFront extends GlmPluginSupport
             GLM_MEMBERS_PLUGIN_URL . 'js/front.js',
             array(
                 'jquery'
-            ));
+            )
+        );
         wp_enqueue_script('glm-members-front-js');
 
         // A simple set of styles for things I haven't found as a WordPress
index 08fc3bf..69a5ad0 100644 (file)
@@ -13,7 +13,7 @@
     font-weight: bold;
 }
 .glm-notice {
-    color: blue;
+    color: #0073AA;
     font-weight: bold;
 }
 .glm-required {
index 714cd30..01e8d32 100644 (file)
@@ -7,8 +7,9 @@
 
 // NOTE: Plugin & Database versions are defined in "/glm-member-db.php".
 
-define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Members Database');
-define('GLM_MEMBERS_PLUGIN_DIR', 'glm-member-db');
+define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Member Database');
+define('GLM_MEMBERS_PLUGIN_SHORT_NAME', 'GLM Member DB');
+define('GLM_MEMBERS_PLUGIN_SLUG', 'glm-member-db');
 
 // Determine which system we're running on - If not provided, assume PRODUCTION
 $host = getenv('GLM_HOST_ID');
@@ -34,19 +35,22 @@ $WPUploadDir = wp_upload_dir();
 define('GLM_MEMBERS_SITE_BASE_URL', home_url('/') );
 define('GLM_MEMBERS_PLUGIN_URL', plugin_dir_url(__FILE__));
 define('GLM_MEMBERS_PLUGIN_ADMIN_URL', admin_url('admin.php'));
-define('GLM_MEMBERS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_PLUGIN_DIR);
+define('GLM_MEMBERS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_PLUGIN_SLUG);
 define('GLM_MEMBERS_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]);
-define('GLM_MEMBERS_PLUGIN_MEDIA_URL', $WPUploadDir['baseurl'].'/'.GLM_MEMBERS_PLUGIN_DIR);
+define('GLM_MEMBERS_PLUGIN_MEDIA_URL', $WPUploadDir['baseurl'].'/'.GLM_MEMBERS_PLUGIN_SLUG);
 
 // Directories
 define('GLM_MEMBERS_PLUGIN_PATH', dirname(__FILE__));
 define('GLM_MEMBERS_PLUGIN_DB_SCRIPTS', dirname(__FILE__).'/misc/databaseScripts');
 define('GLM_MEMBERS_PLUGIN_CLASS_PATH', GLM_MEMBERS_PLUGIN_PATH.'/classes');
 define('GLM_MEMBERS_PLUGIN_LIB_PATH', GLM_MEMBERS_PLUGIN_PATH.'/lib');
-define('GLM_MEMBERS_PLUGIN_MEDIA_PATH', $WPUploadDir['basedir'].'/'.GLM_MEMBERS_PLUGIN_DIR);
+define('GLM_MEMBERS_PLUGIN_MEDIA_PATH', $WPUploadDir['basedir'].'/'.GLM_MEMBERS_PLUGIN_SLUG);
 define('GLM_MEMBERS_PLUGIN_IMAGES_PATH', GLM_MEMBERS_PLUGIN_MEDIA_PATH.'/images');
 define('GLM_MEMBERS_PLUGIN_CONFIG_PATH', GLM_MEMBERS_PLUGIN_PATH.'/config');
 
+$pluginsPath = str_replace(GLM_MEMBERS_PLUGIN_SLUG, '', GLM_MEMBERS_PLUGIN_PATH);
+define('GLM_MEMBERS_WORDPRESS_PLUGIN_PATH', $pluginsPath);
+
 // Database table prefixes
 global $wpdb;
 define('GLM_MEMBERS_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_members_');
index 6387bb5..20755e3 100644 (file)
 define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.43');
 define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.0.43');
 
+/**
+ * Array of valid menu items and actions.
+ *
+ * The higher level elements are valid menu items. These correlate to
+ * actual menu or sub menu items that are hooks back to this controller
+ * class.
+ *
+ * The lower level items below each menu item are actions that may be specified
+ * by a "glmMembersAction" form field.
+ *
+ * The string after the action is the slug of the plugin where the model/view
+ * is to perform that action.
+ *
+ * This array is extended to include valid menus and actions from any add-on
+ * plugins.
+ */
+$GLOBALS['glmMembersValidActions'] = array(
+    'adminActions' => array(
+        'ajax' => array(
+                'imageUpload' => 'glm-member-db'
+        ),
+        'dashboardWidget' => array(
+                'index' => 'glm-member-db'
+        ),
+        'members' => array(
+                'index' => 'glm-member-db',            // member list
+                'list' => 'glm-member-db',
+                'reports' => 'glm-member-db',
+                'other' => 'glm-member-db'
+        ),
+        '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'
+        )
+        ,
+        'configure' => array(
+                'index' => 'glm-member-db',            // Member Types
+                'categories' => 'glm-member-db',
+                'cities' => 'glm-member-db',
+                'regions' => 'glm-member-db',
+                'accommodationTypes' => 'glm-member-db',
+                'amenities' => 'glm-member-db'
+        ),
+        'management' => array(
+                'index' => 'glm-member-db',            // General Options
+                'terms' => 'glm-member-db',
+                'development' => 'glm-member-db',
+                'import' => 'glm-member-db',
+                'addons' => 'glm-member-db',
+                'hooks' => 'glm-member-db'
+        ),
+        'shortcodes' => array(
+                'index' => 'glm-member-db'
+        ),
+        'error' => array(
+                'index' => 'glm-member-db',
+                'badAction' => 'glm-member-db'
+        )
+    ),
+    'frontActions' => array(
+        'members' => array(
+            'list' => 'glm-member-db',
+            'detail' => 'glm-member-db'
+        ),
+        'error' => array(
+            'index' => 'glm-member-db',
+            'badAction' => 'glm-member-db'
+        )
+    )
+);
+
 /*
  * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
  *
@@ -187,7 +262,9 @@ if (!defined('ABSPATH')) {
 }
 
 /*
+ *
  * Some initial setup and tests
+ *
  */
 
 $startupNotices = '';
@@ -201,10 +278,39 @@ require_once('config.php');
 // Try to set the DB version option to false (new plugin) - If it's already set this won't do anything.
 add_option('glmMembersDatabaseDbVersion', false);
 
+/*
+ *
+ * Hook in add-ons and integrate their actions
+ *
+ */
+
 // Create hook for registering add-on plugins and their features
 $config['addOns'] = array();
 $config['addOns'] = apply_filters('glm-member-db-register-addon', $config['addOns']);
 
+// If any add-ons have registered, integrate their actions and drop the actions array from the $config object as they're not needed there
+if (count($config['addOns']) > 0) {
+    foreach ($config['addOns'] as $a) {
+
+        // Add valid actions from add-on
+        if (isset($a['actions'])) {
+            $GLOBALS['glmMembersValidActions'] = array_merge_recursive($GLOBALS['glmMembersValidActions'], $a['actions']);
+        }
+
+        // Check for add-on config file
+        $iniFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/config/plugin.ini';
+        if (isset($iniFile)) {
+
+            // Parse the add-on's configuration file
+            $addOnIni = parse_ini_file($iniFile);
+
+            // Replace parameters that are in the theme ini file
+            $config = array_replace($config, $addOnIni);
+
+        }
+    }
+}
+
 /*
  *
  * Activate and Deactivate hooks
index 564f1eb..17d8de5 100644 (file)
@@ -3,16 +3,16 @@
 
 jQuery(document).ready(function($){
 
-       /* 
-        * Use media uploaded for all file/image uploads
-        */
+    /*
+     * Use media uploaded for all file/image uploads
+     */
 
     var custom_uploader;
+
     $('.glm-protp-upload-button').click(function(e) {
+
         e.preventDefault();
-        
+
         var id = $(this).attr('data-id');
 
         //If the uploader object has already been created, reopen the dialog
@@ -20,7 +20,7 @@ jQuery(document).ready(function($){
             custom_uploader.open();
             return;
         }
+
         //Extend the wp.media object
         var custom_uploader = wp.media.frames.file_frame = wp.media({
             title: 'Choose the desired image below or select "Upload Files" to select a new image.',
@@ -32,13 +32,13 @@ jQuery(document).ready(function($){
 
         //When a file is selected, grab the URL and set it as the text field's value
         custom_uploader.on('select', function() {
-            attachment = custom_uploader.state().get('selection').first().toJSON();            
+            attachment = custom_uploader.state().get('selection').first().toJSON();
             $('#' + id).val(attachment.url);
         });
+
         //Open the uploader dialog
         custom_uploader.open();
+
     });
+
 });
\ No newline at end of file
index 9fdf5f5..0234c2c 100644 (file)
 /*
  * Gaslight Media HTML5 Image Upload Support for glm-member-db plugin.
- * 
+ *
  * Author: Chuck Scott <cscott@gaslightmedia.com>
- * 
- * Developed from information in 
+ *
+ * Developed from information in
  *     http://www.sitepoint.com/html5-file-drag-and-drop/
  *  http://hayageek.com/drag-and-drop-file-upload-jquery/
- *  
+ *
  * See also the following methods in classes/data/dataImages.php in this plugin.
  *     galleryPositionOrder()
  *  galleryImageDataUpdate()
- *  
+ *
  */
 
 jQuery(document).ready(function($) {
 
-       
-       var drop;
-       var recordID;
-       var refType;
-       var recordID;
-       var maxFileSize;
-       var allowedTypes;
-       var files;
-       var uploadStatusTemplate;
-       var imageDataTemplate;
-       var galleryImages;
-       var newImageAdded = false;
-
-       // Setup Drag and Drop when Add and
-       if (window.File && window.FileList && window.FileReader) {
-       
-               // is XHR2 available?
-               var xhr = new XMLHttpRequest();
-               if (xhr.upload) {
-
-                       // Change from Drag/Drop not supported to drop here text
-                       $('.glm-imageBrowseButton').addClass('glm-imageItemHidden');
-                       $('.glm-imageDropText').removeClass('glm-imageItemHidden');
-                       $('.glm-imageDrop').removeClass('glm-imageItemHidden');
-
-                       // Prevent dropping on the document
-                       $(document).on('dragenter', function (e) {
-                           e.stopPropagation();
-                           e.preventDefault();
-                       });
-                       $(document).on('dragover', function (e) {
-                         e.stopPropagation();
-                         e.preventDefault();
-                       });
-                       $(document).on('drop', function (e) {
-                           e.preventDefault();
-                       });
-                       
-                       // For each image drop area on the page
-                       $('.glm-imageDrop').each(function() {
-                               drop = $(this);
-                               initDrop();                             
-                       });
-
-               } else {
-                       alert('Your Web browser does not support "Drag & Drop" image uploads using "XHR2".\nThat capability is required to upload images for the image gallery on this page.\nConsider upgrading your browser.');
-               }
-
-       }
-       
-       // Setup an image drop area
-       function initDrop() {
-
-               // Get information from the field on where this image file is going
-               refType = drop.attr("data-refType");
-               recordID = drop.attr("data-recordID");
-               maxFileSize = drop.attr("data-maxFileSizeKB") * 1000;
-               allowedTypes = drop.attr("data-allowedTypes");
-               
-               uploadStatusTemplate = drop.children('.glm-imageUploadStatusTemplate').html();
-               imageDataTemplate = drop.children('.glm-galleryImageDataTemplate').html();
-               galleryImages = drop.parent().parent().children('.glm-galleryImages');
-
-               // Change drop destination appearance only when dragging over a file.
-               drop.on('dragenter', function(e){
-                       e.stopPropagation();
-                       e.preventDefault();
-                       drop.parent().addClass('glm-imageDropDragOver');
-               });
-               drop.on('dragover', function(e){
-                       e.stopPropagation();
-                       e.preventDefault();
-               });
-               drop.on('dragleave', function(e){
-                       e.stopPropagation();
-                       e.preventDefault();
-                       drop.parent().removeClass('glm-imageDropDragOver');
-               });
-               
-               // File drop action
-               $('.glm-imageDrop').on('drop', function (e) { 
-                       e.preventDefault();
-                       files = e.originalEvent.dataTransfer.files;
-                       handleFileDrop();
-                       drop.parent().removeClass('glm-imageDropDragOver');
-               });
-
-       }
-       
-       /*
-        * This function sets up AJAX processing of the list of files. It then fires
-        * off the processFile() function to do the first file. When the AJAX call
-        * in sendFileToServer() completes, the complete: function will call
-        * processFile() again to do the next file, if one exists.
-        */
-       var thisFile = 0;
-       var numbFiles = 0;
-
-       function handleFileDrop() {
-               
-               // Reset file pointer and set number of last file
-               thisFile = 0;
-               numbFiles = files.length;
-
-               // Start with the first file
-               processFile();
-               
-       }
-       
-       /*
-        * Process the current file - AJAX complete: will call back to this function
-        * for the next file
-        */ 
-       function processFile() {
-
-               // If we still have files to process
-               if (thisFile < numbFiles) {
-                       
-                       file = files[thisFile];
-                       
-                       // Setup field pairs for sending in request
-                       var fd = new FormData();
-                       
-                       // Add file upload information
-                   fd.append('file', file);
-                   
-                       /*
-                        * Add "action" post parameter specifying where WordPress should
-                        * route the request. In this case we are routing this AJAX request
-                        * to the admin controller glmMembersAdminAjax() method which will
-                        * route the request to the proper file in the models/admin/ajax
-                        * directory of this plugin.
-                        * 
-                        * see "add_action( 'wp_ajax_glm_members_admin_ajax',..." in admin
-                        * controller.
-                        */
-                       fd.append( 'action', 'glm_members_admin_ajax' );
-
-                       // Tell admin controller where to route AJAX call
-                       // (models/admin/ajax/imageUpload.php)
-                       fd.append('glm_action', 'imageUpload');
-
-                       // Tell image upload AJAX processor who the image is for
-                       fd.append('glm_refType', refType);
-                       fd.append('glm_refDest', recordID);
-
-               // Setup status display area
-                       var status = new createStatusbar(file, thisFile, numbFiles);
-
-               statusArea.fadeIn( function() {
-               
-                       // Check image size and alert the user if it's too big
-                       if (file.size > maxFileSize) {
-                               
-                               alert("This image file is too large to process.\nTo use this image, consider resizing it before uploading.\n\nMaximum image size is " + (maxFileSize/1000) + "KB.");
-                               statusArea.fadeOut();
-                               processFile();
-
-                       // Check the image mime type and alert the user if it's not
-                               // permitted
-                       } else if (allowedTypes.indexOf(file.type) < 0) {
-
-                               alert("The file is not an accepted image type.\nTo use this image, consider resaving it as a differnt image type.\n");
-                               statusArea.fadeOut();
-                               processFile();
-                               
-                       } else {
-                               // When status has faded in, Send the files
-                               sendFileToServer(fd, status);
-                       }
-                       
-               });
-
-               thisFile++;
-                       
-               } else {
-
-                       // Reset expanded image and sortable events
-                       setupExpandedImageEvents();
-                       
-               }
-
-       }       
-       
-       function createStatusbar(file, thisFile, numbFiles)
-       {
-               var statusDone = false;
-               
-               /*
-                * We need to redefine these values inside this function so the
-                * reader.onload function can see them.
-                */
-               var curFile = thisFile + 1;
-               var lastFile = numbFiles;
-               
-               // Get status area for this drop area
-               statusArea = drop.siblings('.glm-imageUploadStatus');
-
-               // Make status area visible (overlay) and clear contents
-               statusArea.html('');
-
-               // If file is an image
+
+    var drop;
+    var recordID;
+    var refType;
+    var recordID;
+    var maxFileSize;
+    var allowedTypes;
+    var files;
+    var uploadStatusTemplate;
+    var imageDataTemplate;
+    var galleryImages;
+    var newImageAdded = false;
+
+    // Setup Drag and Drop when Add and
+    if (window.File && window.FileList && window.FileReader) {
+
+        // is XHR2 available?
+        var xhr = new XMLHttpRequest();
+        if (xhr.upload) {
+
+            // Change from Drag/Drop not supported to drop here text
+            $('.glm-imageBrowseButton').addClass('glm-imageItemHidden');
+            $('.glm-imageDropText').removeClass('glm-imageItemHidden');
+            $('.glm-imageDrop').removeClass('glm-imageItemHidden');
+
+            // Prevent dropping on the document
+            $(document).on('dragenter', function (e) {
+                e.stopPropagation();
+                e.preventDefault();
+            });
+            $(document).on('dragover', function (e) {
+              e.stopPropagation();
+              e.preventDefault();
+            });
+            $(document).on('drop', function (e) {
+                e.preventDefault();
+            });
+
+            // For each image drop area on the page
+            $('.glm-imageDrop').each(function() {
+                drop = $(this);
+                initDrop();
+            });
+
+        } else {
+            alert('Your Web browser does not support "Drag & Drop" image uploads using "XHR2".\nThat capability is required to upload images for the image gallery on this page.\nConsider upgrading your browser.');
+        }
+
+    }
+
+    // Setup an image drop area
+    function initDrop() {
+
+        // Get information from the field on where this image file is going
+        refType = drop.attr("data-refType");
+        recordID = drop.attr("data-recordID");
+        maxFileSize = drop.attr("data-maxFileSizeKB") * 1000;
+        allowedTypes = drop.attr("data-allowedTypes");
+
+        uploadStatusTemplate = drop.children('.glm-imageUploadStatusTemplate').html();
+        imageDataTemplate = drop.children('.glm-galleryImageDataTemplate').html();
+        galleryImages = drop.parent().parent().children('.glm-galleryImages');
+
+        // Change drop destination appearance only when dragging over a file.
+        drop.on('dragenter', function(e){
+               e.stopPropagation();
+               e.preventDefault();
+               drop.parent().addClass('glm-imageDropDragOver');
+        });
+        drop.on('dragover', function(e){
+               e.stopPropagation();
+               e.preventDefault();
+        });
+        drop.on('dragleave', function(e){
+               e.stopPropagation();
+               e.preventDefault();
+               drop.parent().removeClass('glm-imageDropDragOver');
+        });
+
+        // File drop action
+        $('.glm-imageDrop').on('drop', function (e) {
+            e.preventDefault();
+            files = e.originalEvent.dataTransfer.files;
+            handleFileDrop();
+            drop.parent().removeClass('glm-imageDropDragOver');
+        });
+
+    }
+
+    /*
+     * This function sets up AJAX processing of the list of files. It then fires
+     * off the processFile() function to do the first file. When the AJAX call
+     * in sendFileToServer() completes, the complete: function will call
+     * processFile() again to do the next file, if one exists.
+     */
+    var thisFile = 0;
+    var numbFiles = 0;
+
+    function handleFileDrop() {
+
+       // Reset file pointer and set number of last file
+       thisFile = 0;
+       numbFiles = files.length;
+
+       // Start with the first file
+       processFile();
+
+    }
+
+    /*
+     * Process the current file - AJAX complete: will call back to this function
+     * for the next file
+     */
+    function processFile() {
+
+        // If we still have files to process
+        if (thisFile < numbFiles) {
+
+            file = files[thisFile];
+
+            // Setup field pairs for sending in request
+            var fd = new FormData();
+
+            // Add file upload information
+            fd.append('file', file);
+
+            /*
+             * Add "action" post parameter specifying where WordPress should
+             * route the request. In this case we are routing this AJAX request
+             * to the admin controller glmMembersAdminAjax() method which will
+             * route the request to the proper file in the models/admin/ajax
+             * directory of this plugin.
+             *
+             * see "add_action( 'wp_ajax_glm_members_admin_ajax',..." in admin
+             * controller.
+             */
+            fd.append( 'action', 'glm_members_admin_ajax' );
+
+            // Tell admin controller where to route AJAX call
+            // (models/admin/ajax/imageUpload.php)
+            fd.append('glm_action', 'imageUpload');
+
+            // Tell image upload AJAX processor who the image is for
+            fd.append('glm_refType', refType);
+            fd.append('glm_refDest', recordID);
+
+            // Setup status display area
+            var status = new createStatusbar(file, thisFile, numbFiles);
+
+            statusArea.fadeIn( function() {
+
+                // Check image size and alert the user if it's too big
+                if (file.size > maxFileSize) {
+
+                    alert("This image file is too large to process.\nTo use this image, consider resizing it before uploading.\n\nMaximum image size is " + (maxFileSize/1000) + "KB.");
+                    statusArea.fadeOut();
+                    processFile();
+
+                // Check the image mime type and alert the user if it's not
+                // permitted
+                } else if (allowedTypes.indexOf(file.type) < 0) {
+
+                    alert("The file is not an accepted image type.\nTo use this image, consider resaving it as a differnt image type.\n");
+                    statusArea.fadeOut();
+                    processFile();
+
+                } else {
+                    // When status has faded in, Send the files
+                    sendFileToServer(fd, status);
+                }
+
+            });
+
+            thisFile++;
+
+        } else {
+
+            // Reset expanded image and sortable events
+            setupExpandedImageEvents();
+
+        }
+
+    }
+
+    function createStatusbar(file, thisFile, numbFiles)
+    {
+        var statusDone = false;
+
+        /*
+         * We need to redefine these values inside this function so the
+         * reader.onload function can see them.
+         */
+        var curFile = thisFile + 1;
+        var lastFile = numbFiles;
+
+        // Get status area for this drop area
+        statusArea = drop.siblings('.glm-imageUploadStatus');
+
+        // Make status area visible (overlay) and clear contents
+        statusArea.html('');
+
+        // If file is an image
 // var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.jpg|.jpeg|.gif|.png|.bmp)$/;
 
 // if (regex.test(file.name.toLowerCase())) {
 
-               // Create HTML5 file reader and load image
-               var reader = new FileReader();
-               reader.onload = function (e) {
-               
-                       // Using a copy of the supplied template, add file information
-                               // to statusbar
-                       statusbar = uploadStatusTemplate;
-                       statusbar = statusbar.replace('{ thisFile }', curFile);
-                       statusbar = statusbar.replace('{ numbFiles }', lastFile);
-                       statusbar = statusbar.replace('{ fileImage }', e.target.result);
-                       statusbar = statusbar.replace('{ fileName }', file.name);
-                       statusbar = statusbar.replace('{ fileType }', file.type);
-
-                       // Fix up file size string and replace that
-                       var sizeStr="";
-                var sizeKB = file.size/1024;
-                if(parseInt(sizeKB) > 1024)
-                {
-                    var sizeMB = sizeKB/1024;
-                    sizeStr = sizeMB.toFixed(2)+" MB";
-                }
-                else
-                {
-                    sizeStr = sizeKB.toFixed(2)+" KB";
-                }
-                       
-                       // If a large file, notify user it will take time.
-                       if (file.size > 100000 && file.type == 'image/png') {
-                               sizeStr += ' -- NOTE: Processing for this image may be slow!';
-                       }
-
-                       statusbar = statusbar.replace('{ fileSize }', sizeStr);
-                       
-                       // Assign the HTML to the status area
-                       statusArea.html(statusbar);
-
-               }
+        // Create HTML5 file reader and load image
+        var reader = new FileReader();
+        reader.onload = function (e) {
+
+            // Using a copy of the supplied template, add file information
+            // to statusbar
+            statusbar = uploadStatusTemplate;
+            statusbar = statusbar.replace('{ thisFile }', curFile);
+            statusbar = statusbar.replace('{ numbFiles }', lastFile);
+            statusbar = statusbar.replace('{ fileImage }', e.target.result);
+            statusbar = statusbar.replace('{ fileName }', file.name);
+            statusbar = statusbar.replace('{ fileType }', file.type);
+
+            // Fix up file size string and replace that
+            var sizeStr="";
+            var sizeKB = file.size/1024;
+            if(parseInt(sizeKB) > 1024)
+            {
+                var sizeMB = sizeKB/1024;
+                sizeStr = sizeMB.toFixed(2)+" MB";
+            }
+            else
+            {
+                sizeStr = sizeKB.toFixed(2)+" KB";
+            }
+
+            // If a large file, notify user it will take time.
+            if (file.size > 100000 && file.type == 'image/png') {
+               sizeStr += ' -- NOTE: Processing for this image may be slow!';
+            }
+
+            statusbar = statusbar.replace('{ fileSize }', sizeStr);
+
+            // Assign the HTML to the status area
+            statusArea.html(statusbar);
+
+        }
             reader.readAsDataURL(file);
-               
-           this.setProgress = function(progress)
-           {
-               statusArea.find('.glm-progressBar').css('width', progress + '%');
-           }
-
-           this.setAbort = function(jqxhr)
-           {
-               var sb = this.statusbar;
-               $('#imageUploadCancel').click(function()
-               {
-                   jqxhr.abort();
-                   sb.hide();
-               });
-           }       
-       }
-       
-       /*
-        * Sends file to image plugin via AJAX submission targeting WordPress AJAX
-        * handler.
-        */
-       function sendFileToServer(fd, status)
-       {
-               // Send one (or more) images to the server. Normally only one image here for now.
-           var jqXHR=$.ajax({
-                   xhr: function() {
-                   var xhrobj = $.ajaxSettings.xhr();
-                   if (xhrobj.upload) {
-                           xhrobj.upload.addEventListener('progress', function(event) {
-
-                               // calculate progress periodically and set the progress bar 
-                               var percent = 0;
-                               var position = event.loaded || event.position;
-                               var total = event.total;
-                               if (event.lengthComputable) {
-                                   percent = Math.ceil(position / total * 100);
-                               }
-                               status.setProgress(percent);
-                           }, false);
-
-                   }
-                   return xhrobj;
-               },      
-               url: ajaxurl,
-               type: "POST",
-               contentType:false,
-               processData: false,
-               cache: false,
-               data: fd,
-               success: function(data){
-
-                               // Parse returned data
-                               fileData = JSON.parse(data);
-
-                               // Check for success
-                               if (fileData.status) {                  
-
-                               // Add image(s) to gallery display
-                               for (f of fileData.files) {
-               
-                                       // Using a copy of the supplied template, add image information
-                                       imageData = imageDataTemplate;
-                                       imageData = imageData.replace(/{ id }/g, f.id);
-                                       imageData = imageData.replace(/\{ filename \}/g, f.newFileName);
-                                       galleryImages.prepend(imageData);
-
-                                       // Enable the fields that were just added
-                                       $("#" + f.id + " input, #" + f.id + " textarea").removeAttr('disabled');
-
-                                       // Prepend image ID to position order input field
-                                       $("#galleryPositionOrder").val(f.id + ',' + $("#galleryPositionOrder").val());
-                                       
-                               }
-
-                               } else {
-                                       alert("Upload Failed\nReason: " + fileData.message);                                    
-                               }
-                       
-               },
-               complete: function() {
-                       
-                       // When status area has faded
-                       statusArea.fadeOut( function() {
-                               
-                               // Process the next file, if one exists.
-                               processFile();
-                               
-                       });
-                        
-               }
-           }); 
-           
-           return jqXHR;
-
-       }
-       
-       /* 
-        * This function is used to start handling of various things and
-        * to restart handling when an image has been added. I neede to
-        * do this because .on() didn't cover this situation.  
-        */
-       function setupExpandedImageEvents() {
-
-               // Handle expanded images on hover for image gallery
-           $('.glm-galleryImage').on("mouseenter", function(){
-                   id = $(this).attr("data-id");
-                   var imgTitle = $("#galleryImage_caption_" + id).val();                  
-                   $('#glm-galleryImageLarger_' + id).dialog({
-                       title: imgTitle,
-                       dialogClass: "no-close",
-                       autoOpen: true,
-                       resizable: false,
-                       width: 'auto',
-                       minWidth: 100,
-                       minHeight: 100,
-                       create: function() {
-
-                               $(this).dialog('option', 'maxHeight', $(window).height() * .9);        
-                               $(this).dialog('option', 'maxWidth', $(window).width() * .9);        
-                           },
-                       position: { my: "left+10 top+10", at: "right top", of: $(this), collision: "fit"  }
-                   });           
-           });
-           $('.glm-galleryImage').on("mouseleave", function(){
-               id = $(this).attr("data-id");
-               $('#glm-galleryImageLarger_' + id).dialog("close");
-           });
-           
-           // Make images sortable and store the list of IDs in a hidden input field when order has changed.
-           $('.glm-galleryImages').sortable({
-               update: function(event, ui) {
-                       var sortedIDs = $(this).sortable('toArray');
-                       $('#galleryPositionOrder').val(sortedIDs);
-               }
-           });
-
-       }
-       setupExpandedImageEvents();
+
+        this.setProgress = function(progress)
+        {
+            statusArea.find('.glm-progressBar').css('width', progress + '%');
+        }
+
+        this.setAbort = function(jqxhr)
+        {
+            var sb = this.statusbar;
+            $('#imageUploadCancel').click(function()
+            {
+                jqxhr.abort();
+                sb.hide();
+            });
+        }
+    }
+
+    /*
+     * Sends file to image plugin via AJAX submission targeting WordPress AJAX
+     * handler.
+     */
+    function sendFileToServer(fd, status)
+    {
+        // Send one (or more) images to the server. Normally only one image here for now.
+        var jqXHR=$.ajax({
+                xhr: function() {
+                var xhrobj = $.ajaxSettings.xhr();
+                if (xhrobj.upload) {
+                        xhrobj.upload.addEventListener('progress', function(event) {
+
+                            // calculate progress periodically and set the progress bar
+                            var percent = 0;
+                            var position = event.loaded || event.position;
+                            var total = event.total;
+                            if (event.lengthComputable) {
+                                percent = Math.ceil(position / total * 100);
+                            }
+                            status.setProgress(percent);
+                        }, false);
+
+                }
+                return xhrobj;
+            },
+            url: ajaxurl,
+            type: "POST",
+            contentType:false,
+            processData: false,
+            cache: false,
+            data: fd,
+            success: function(data){
+
+                // Parse returned data
+                fileData = JSON.parse(data);
+
+                // Check for success
+                if (fileData.status) {
+
+                    // Add image(s) to gallery display
+                    for (f of fileData.files) {
+
+                        // Using a copy of the supplied template, add image information
+                        imageData = imageDataTemplate;
+                        imageData = imageData.replace(/{ id }/g, f.id);
+                        imageData = imageData.replace(/\{ filename \}/g, f.newFileName);
+                        galleryImages.prepend(imageData);
+
+                        // Enable the fields that were just added
+                        $("#" + f.id + " input, #" + f.id + " textarea").removeAttr('disabled');
+
+                        // Prepend image ID to position order input field
+                        $("#galleryPositionOrder").val(f.id + ',' + $("#galleryPositionOrder").val());
+
+                    }
+
+                } else {
+                    alert("Upload Failed\nReason: " + fileData.message);
+                    }
+
+                },
+                complete: function() {
+
+                // When status area has faded
+                statusArea.fadeOut( function() {
+
+                    // Process the next file, if one exists.
+                    processFile();
+
+                });
+
+            }
+        });
+
+        return jqXHR;
+
+    }
+
+    /*
+     * This function is used to start handling of various things and
+     * to restart handling when an image has been added. I neede to
+     * do this because .on() didn't cover this situation.
+     */
+    function setupExpandedImageEvents() {
+
+        // Handle expanded images on hover for image gallery
+        $('.glm-galleryImage').on("mouseenter", function(){
+                id = $(this).attr("data-id");
+                var imgTitle = $("#galleryImage_caption_" + id).val();
+                $('#glm-galleryImageLarger_' + id).dialog({
+                    title: imgTitle,
+                    dialogClass: "no-close",
+                    autoOpen: true,
+                    resizable: false,
+                    width: 'auto',
+                    minWidth: 100,
+                    minHeight: 100,
+                    create: function() {
+
+                        $(this).dialog('option', 'maxHeight', $(window).height() * .9);
+                        $(this).dialog('option', 'maxWidth', $(window).width() * .9);
+                    },
+                    position: { my: "left+10 top+10", at: "right top", of: $(this), collision: "fit"  }
+                });
+        });
+        $('.glm-galleryImage').on("mouseleave", function(){
+            id = $(this).attr("data-id");
+            $('#glm-galleryImageLarger_' + id).dialog("close");
+        });
+
+        // Make images sortable and store the list of IDs in a hidden input field when order has changed.
+        $('.glm-galleryImages').sortable({
+            update: function(event, ui) {
+                var sortedIDs = $(this).sortable('toArray');
+                $('#galleryPositionOrder').val(sortedIDs);
+            }
+        });
+
+    }
+    setupExpandedImageEvents();
 });
index d4e19dc..2438ece 100644 (file)
@@ -8,6 +8,7 @@
 *
 * This is a highly modified version of this password generator for this application only.
 * For original code please refer to original author.
+*
 */
 
 
@@ -16,23 +17,40 @@ class EasyPassword
 
     // Get a random dictionary word from a text file
     function dictionaryWord() {
-        $path = 'EasyPassword.words';
+        $path = dirname(__FILE__).'/EasyPassword.words';
         $fileload = @file($path);
         $i = count($fileload)-1;
         $random = rtrim($fileload[rand(0,$i)]);
         return $random;
     }
 
-    // This is the function to produce the password
-    function generateEasyPassword()
-    {
-        $word1 = $this->dictionaryWord();
-        $numb = rand(1, 9);                                                  // Generate specified amount of numbers
-        $word2 = $this->dictionaryWord();
+    // Generate random capitalization - either all characters ('all')or just first and last ('firstlast')
+    function randomCaps($s, $type = 'full') {
+
+        switch ($type) {
+            case 'firstlast':
+                if (rand(0, 1)) $s[0] = strtoupper($s[0]);
+                $last = strlen($s) - 1;
+                if (rand(0, 1)) $s[$last] = strtoupper($s[$last]);
+                break;
+            case 'all':
+            default:
+                for ($i = 0 ; $i < strlen($s) ; $i++) {
+                    if (rand(0, 1)) $s[$i] = strtoupper($s[$i]);
+                }
+                break;
+            }
+        return $s;
+    }
 
-        $keys = array ($word1,$numb,$word2);                    // Place password components in an array
-        $rand_keys = array_rand($keys,3);                                        // Randomize the 3 password components
-        return $keys[$rand_keys[0]].$keys[$rand_keys[1]].$keys[$rand_keys[2]];  // Return the resulting password
+    // This is the function to produce the password - optionally provide a type for capitalization
+    function generateEasyPassword($type = 'firstlast')
+    {
+        $numbPunct = '123456789!@#$%&_-:;.?/';
+        $word1 = $this->randomCaps($this->dictionaryWord(), $type);
+        $char = $numbPunct[rand(0, strlen($numbPunct)-1)];
+        $word2 = $this->randomCaps($this->dictionaryWord(), $type);
+        return $word1.$char.$word2;
     }
 
 
index f03284c..0e07f04 100644 (file)
@@ -615,7 +615,6 @@ sense
 separate
 serious
 servant
-sex
 shade
 shake
 shame
index a7cc1f2..67fd6da 100755 (executable)
@@ -2965,7 +2965,6 @@ abstract class GlmDataAbstract
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
             glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query");
         }
-
         $list = $this->wpdb->get_results($sql, ARRAY_A);
 
         if (count($list) == 0) {
index 61fd969..d6ac3f9 100644 (file)
@@ -153,9 +153,11 @@ CREATE TABLE {prefix}cities (
 CREATE TABLE {prefix}contacts (
   id INT NOT NULL AUTO_INCREMENT,
   active BOOLEAN NULL,                      -- Contact is active flag
+  
   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
   addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
   addr2 TINYTEXT NULL,                      -- Address line 2 
@@ -190,23 +192,6 @@ CREATE TABLE {prefix}contacts (
   INDEX(email(20))
 );
 
-----
-
--- Mapping of permissions to specific contacts
-CREATE TABLE {prefix}contact_permissions (
-  id INT NOT NULL AUTO_INCREMENT,
-  permission INT NULL,                      -- Index of permission - see permissions table in plugin.ini
-  contact INT NULL,                         -- Pointer to specific contact
-  PRIMARY KEY (id),
-  CONSTRAINT {prefix}contact_fk_1
-    FOREIGN KEY (contact)
-    REFERENCES {prefix}contacts (id)
-    ON DELETE CASCADE,
-  INDEX(permission),
-  INDEX(contact)
-);
-
-
 ----
 
 -- Facilities - Facilities are separate functional units of a member, either physically or operationally
index cc75793..553101a 100644 (file)
@@ -14,7 +14,6 @@ DROP TABLE IF EXISTS
     {prefix}category_member_info,
     {prefix}categories,
     {prefix}cities,
-    {prefix}contact_permissions,
     {prefix}contacts,
     {prefix}facilities,
     {prefix}files,
index 3235219..7a07b1c 100644 (file)
@@ -195,3 +195,11 @@ ALTER TABLE {prefix}restaurants MODIFY alcohol BOOLEAN;
 
 ALTER TABLE {prefix}restaurants MODIFY non_smoking BOOLEAN;
 
+----
+
+DROP TABLE {prefix}contact_permissions IF EXISTS;
+
+----
+
+ALTER TABLE {prefix}contacts ADD COLUMN contact_role INT;
+
index 30b7c88..d88174e 100644 (file)
@@ -119,14 +119,9 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
             $memberID = $actionData['memberID'];
 
         // Otherwise check if one was supplied by the user or passed from somewhere else
-        } elseif (isset($_REQUEST['id'])) {
-
-            // Make sure it's a number
-            $memberID = $_REQUEST['id']-0;
-
-        // Not sure why I have this. Need to look for it.
         } elseif (isset($_REQUEST['member'])) {
 
+            // Make sure it's a number
             $memberID = $_REQUEST['member']-0;
 
         }
index 01a3b90..4550b20 100644 (file)
@@ -241,8 +241,8 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
             $this->memberID = $_REQUEST['member']-0;
 
             // If a member info record ID is supplied, get that and make sure it's an integer
-            if (isset($_REQUEST['id'])) {
-                $this->memberInfoID = $_REQUEST['id']-0;
+            if (isset($_REQUEST['memberInfo'])) {
+                $this->memberInfoID = $_REQUEST['memberInfo']-0;
                 $this->haveMemberInfo = true;
 
             }
index 6bd88f0..d34b478 100644 (file)
@@ -107,6 +107,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
         $filterPending = false;
         $filterArchived = false;
         $filterName = false;
+        $filterCat = false;
         $haveFilter = false;
 
         if (isset($_REQUEST['filterName'])) {
index 81d99bb..1398eac 100644 (file)
@@ -1,19 +1,31 @@
+{* Sometimes this header is called without a memberInfoID. It's easier to handle it here that to set this in all models that don't need it. *}
+{if !isset($memberInfoID)}
+  {assign var="memberInfoID" value="false"}
+{/if}
+{if !isset($memberInfo)}
+  {assign var="memberInfo" value="false"}
+{/if}
+
 <div class="wrap">
        
     <h2>Member Data</h2>
     
     <h2 class="nav-tab-wrapper">
-        <a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}" class="nav-tab{if $thisAction==index}-active{/if}">Member Dashboard</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&id={$memberInfoID}" class="nav-tab{if $thisAction==memberInfo}-active{/if} {if !$member || !$memberInfo}disabled{/if}">Member Info</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&id={$memberInfoID}" class="nav-tab{if $thisAction==index}-active{/if}">Member Dashboard</a>
+{if $memberInfoID || $thisAction == 'memberInfo'}        
+        <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&memberInfo={$memberInfoID}" class="nav-tab{if $thisAction==memberInfo}-active{/if} {if !$memberID || !$memberInfoID}disabled{/if}">Member Info</a>
+{/if}        
 {foreach $addOnTabs as $a}
-        <a href="{$thisURL}?page={$thisPage}&glm_action={$a.action}" class="nav-tab{if $thisAction==$a.action}-active{/if}">{$a.text}</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action={$a.action}&member={$memberID}&memberInfo={$memberInfoID}" class="nav-tab{if $thisAction==$a.action}-active{/if}">{$a.text}</a>
 {/foreach}        
-<!-- 
-        <a href="{$thisURL}?page={$thisPage}&glm_action=locations&member={$memberID}" class="nav-tab{if $thisAction==locations}-active{/if} {if !$member || !$memberInfo}disabled{/if}">Locations</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=facilities&member={$memberID}" class="nav-tab{if $thisAction==facilities}-active{/if} {if !$member || !$memberInfo}disabled{/if}">Facilities</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=attractions&member={$memberID}" class="nav-tab{if $thisAction==attractions}-active{/if} {if !$member || !$memberInfo}disabled{/if}">Attractions</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=contacts&member={$memberID}" class="nav-tab{if $thisAction==contacts}-active{/if} {if !$member || !$memberInfo}disabled{/if}">Contacts</a>
--->        
+
+{* Not needed yet 
+        <a href="{$thisURL}?page={$thisPage}&glm_action=locations&member={$memberID}" class="nav-tab{if $thisAction==locations}-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}-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}-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}-active{/if} {if !$memberID || !$memberInfo}disabled{/if}">Contacts</a>
+*}
+        
     </h2>
     <div id="glm-admin-content-container">
     
index acdd205..25d1748 100644 (file)
@@ -18,7 +18,7 @@
         <input type="hidden" name="glm_action" value="index">
       {if $haveMember}
         <input type="hidden" name="option" value="submit">
-        <input type="hidden" name="id" value="{$member.fieldData.id}">
+        <input type="hidden" name="member" value="{$member.fieldData.id}">
         <input type="hidden" name="created" value="{$member.fieldData.created.date}">
       {else}
         <input type="hidden" name="option" value="addNew">
@@ -93,6 +93,7 @@
         </span>
     </p> 
 
+  {if $haveMember}
     <table class="wp-list-table widefat fixed posts glm-admin-table"">
         <thead>
             <tr>
         </thead>
         <tbody>
     
-  {if $haveMember}
     {if $haveInfoRecords}
     
       {assign var="i" value="0"}
         {else}
             <tr class="alternate{if $m.status.name == 'Active'} glm-admin-table-active{/if}">
         {/if}
-                <td><a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&id={$m.id}"{if $m.status.value == $statusPending} class="glm-notice"{/if}>{$m.status.name}</a></td>
+                <td><a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&memberInfo={$m.id}"{if $m.status.value == $statusPending} class="glm-notice"{/if}>{$m.status.name}</a></td>
                 <td>{$m.reference_name}</td>
                 <td>{$m.create_time.datetime}</td>
                 <td>{$m.modify_time.datetime}</td>
                 <td>
-                    <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&id={$m.id}&option=clone" class="button-primary glm-right">Clone</a>&nbsp;
+                    <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&memberInfo={$m.id}&option=clone" class="button-primary glm-right">Clone</a>&nbsp;
                     {if $m.status.name != 'Active'}<a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&activateID={$m.id}" class="button-primary glm-button glm-right">Activate</a>{/if}
                 </td>
             </tr>
index 1f87a45..fd8529a 100644 (file)
@@ -67,7 +67,7 @@
         <input type="hidden" name="member" value="{$member.id}">
       {if $memberInfoID && $memberInfo}
         <input type="hidden" name="option" value="submit">
-        <input type="hidden" name="id" value="{$memberInfo.fieldData.id}">
+        <input type="hidden" name="memberInfo" value="{$memberInfo.fieldData.id}">
         <input type="hidden" name="modify_time" value="now">
       {else}
         <input type="hidden" name="option" value="addNew">
                                     <th>Parent Category:</th>
                                     <td>
                                         <select id="newCatParent" name="newCatParent">
-                            {if $categories}
+                            {if $availableCategories}
                                             <option value=""></option>
-                                {foreach $categories as $t}
+                                {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}
index 80c4c83..479179a 100644 (file)
@@ -3,9 +3,8 @@
     <h2 class="nav-tab-wrapper">
         <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">Main Dashboard</a>
         <a href="{$thisURL}?page={$thisPage}&glm_action=list" class="nav-tab{if $thisAction==list}-active{/if}">List of Members</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==add}-active{/if} disabled">Reports</a>
 {foreach $addOnTabs as $a}
-        <a href="{$thisURL}?page={$thisPage}&glm_action={$a.action}" class="nav-tab{if $thisAction==$a.action}-active{/if}">{$a.text}</a>
+        <a href="{$thisURL}?page=glm-members-admin-menu-{$a.menu}&glm_action={$a.action}" class="nav-tab{if $thisAction==$a.action}-active{/if}">{$a.text}</a>
 {/foreach}        
     </h2>
     <div id="glm-admin-content-container">
index e102e9f..7fbf489 100644 (file)
@@ -7,8 +7,8 @@
         <select id="filterCategories" class="listFilter">
             <option id="categoryNone" value=""></option>
     {foreach from=$categories item=v}
-            <option value="{$v.id}" data-parent="{$v.parent.name}"{if $v.id == $filterCat} selected{/if}>
-                {if $v.parent.value}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
+            <option value="{$v.id}" data-parent="{$v.parent}"{if $v.id == $filterCat} selected{/if}>
+                {if $v.parent_id}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
             </option>
     {/foreach}
         </select>
                     {$m.created.date}
                 </td>
                 <td>
-                    {if $m.pending > 0}<span class="glm-notice">Pending</span>{/if}
+                    {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}&id={$m.active_id}" class="button-primary glm-right" style="margin: 0 .2em 0 .2em;">Active Info</a>
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$m.id}&memberInfo={$m.active_id}" class="button-primary glm-right" style="margin: 0 .2em 0 .2em;">Active Info</a>
                 </td>
             </tr>
     {/foreach}